[Moto Z2 Play  Guides, News, & Discussion] leodexe:
Updating guide

I followed @JulioCeesarC's guide to update my XT1710-06 to Stock Pie which previously had Stock Oreo and I could never make the USB and MTP connection to ever work. Besides, without the OEM commands the installation becomes heavier, installing lots of bloatware that worsen the overall system performance.

With @HTCDevil's guide, I managed to fix the USB issue, the main difference is that Julio's Guide lacks these three commands, while HTCDevil's has them included:

fastboot getvar max-sparse-size
fastboot oem fb_mode_set
fastboot oem fb_mode_clear

Then I found another problem too, it seems that none of the guys who makes these guides were aware that the modem file from the updated Stock Pie causes several audio issues during calls with Custom ROMs. At first I thought it was my loudspeaker, but it wasn't as soon as I went back to Stock ROM the audio during calls worked once again. After lots of testing and searching on the forums I found more people with the same audio issue during calls, only affecting Custom ROM users with Stock Pie's faulty modem. Flashing the modem file from Stock Oreo fixes the issue, so Custom ROMs can be used with proper audio after updating from Stock Pie.

In other words, when upgrading from Stock Oreo to Stock Pie this line MUST be entirely skipped:

fastboot flash modem NON-HLOS.bin

After flashing with the two missing OEM commands, the USB connection will work once again (if it didn't before) and you get a debloated installation for free.. Then you can flash TWRP through fastboot. 64-bit Treble TWRP is recommended for everything.

After flashing TWRP you need to reboot recovery, format data, I repeat, FORMAT, data, because if the partition is encrypted TWRP will be unable to wipe it, you need to format two to three times so the format goes right without errors, then reboot to TWRP once more and flash Magisk, Since it is Stock 9.0 Pie you don't need to issue the KEEPVERITY and KEEPFORCEENCRYPT commands since these are only needed when you are flashing Stock Oreo, not Pie. If for whatever reason the phone boots to the Motorola logo instead of the TWRP recovery during the format processes you have to force shutdown and reboot recovery again, just in case that happens do the wipes again, also you need to do this to keep the custom recovery because if you boot normally without installing Magisk the system will replace it with its stock recovery regardless of how many times you reflash TWRP through fastboot and regardless of whether you skip flashing the stock recovery, YOU NEED TO INSTALL MAGISK TO KEEP YOUR TWRP RECOVERY. Also remember to do a backup always, specially backup EFS just in case something goes wrong and you lose IMEI, this way you can restore your IMEI. If you don't backup and this happens (this has never happened to me but it may happen to someone), chances are that if you don't have your IMEI backed up or annotated or don't have your phone's box with its IMEI, you won't be able to recover it again ever.

I forgot to mention, the first thing you are supposed to do is install Universal ADB Drivers, then afterwards install Motorola Device Manager provided below. Then you can follow the rest of the guide.

After unlocking your bootloader, whenever you turn on your phone you will notice that the Stock Moto Z boot logo is gone and instead it shows some ugly text telling what is already obvious, so in order to get rid of that and replace the Void Warranty text you can flash this Stock Moto Z logo with this command:

fastboot flash logo logoz.bin

It worked for me, so it should work for you too.

---MAGISK NOT WORKING PROPERLY--- HOW TO FIX IT

Sometimes when installing Magisk your phone may get stuck in bootloop forever, so here is one workaround to fix it, you can also flash uninstaller and try again with other version.

LINKS/RESOURCES

Universal ADB Drivers for Windows http://download.clockworkmod.com/test/UniversalAdbDriverSetup.msi

Motorola USB Drivers for Windows http://www.mediafire.com/file/akiha24e4z3sine/MotorolaDeviceManager_2.5.4.7z/file

latest adb platform tools: https://www.mediafire.com/file/pgmkw9vj1qut4ba/platform-tools_r30.0.3-windows(adb).7z/file

RETAIL Pie 9.0 Update: https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

64-bit Treble TWRP (needed to flash Custom ROMs and GSI) https://androidfilehost.com/?fid=1322778262904007189

Stock Oreo Modem http://www.mediafire.com/file/q8nbpybxc8mjyew/NON-HLOS-Z2P-STOCK-8-OREO.7z/file

Magisk 20.4: https://www.mediafire.com/file/yh9jtc9rdqzmjeo/Magisk-v20.4.zip/file

Stock Moto Z logo http://www.mediafire.com/file/lpcmsgtm2vs603r/logoz.bin/file

Take a look at my updated guide if you have any questions: https://xdaforums.com/showpost.php?p=82886049&postcount=2