[Xiaomi Mi A2 / 6X Questions & Answers] KevMetal:
my suggestion is using the recovery image(,twrp) i provided and not any other

reason: because it will allow you to flash an image directly to persist..

furthermore the correct or best procedure is to download a fastboot stock rom of whatever version STOCK not custom is on your phone but that matches exactly ..then unzip with 7zip and take the persist.img file ..put it on your pc or internal storage and flash with the recovery i provided by choosing

install ..select image option ..browse to image ...select persist partition

failing this (error message) the ACTUAL and best solution that works ?% but is not easy is to take a fastboot stock rom and then using fastboot put your phone into edl mode :

fastboot oem edl

then flash the whole stock rom using Xiaomi miflash ..in fastboot mode miflash doesn't have the required permissions to flash secure partitions ..in oem edl mode ( Qualcomm) it is deep flash .. NOW the bigger problem and difficult part is that xiaomi themselves modified the flash xml ( that tells miflash what to flash NOT to flash persist EVEN if there is a persist.img in the folder ) so you need to manually modify certain lines in the xml so miflash flashes the persist img files

**although the flashable persist restorer zip works occasionally it has failed in others or worked only temporarily and if you went from pie to Q the chances of failure are even higher

and by the way if the persist restore is done successfully it does fix gps issues

as a workaround ...if gps works but not well ..use magisk gps module to replace global gps file ..

if gps shows 0 action you need to do the miflash option ..there is always also the possibility that you damaged hardware while replacing screen or that you disconnected something and failed to reconnect it properly ..

---------- Post added at 02:17 PM ---------- Previous post was at 02:02 PM ----------

so 100% fix ... following on my previous post do this using a pie fastboot stock rom for your device together with my miflash

Download XiaomiADBFastbootTools.jar https://github.com/Saki-EU/XiaomiADBFastbootTools/releases/tag/3.0.2 Credits: Saki-EU

Java run-time environment is required https://java.com/en/download/

Now extract the fastboot rom and locate rawprogram0.xml inside images folder. Edit it with Notepad++ and search for persist. You will see it among line 57 with filename="" . Add persist.img inside quotation marks. So final will be like filename="persist.img"

Now save it.

Now power on the phone while pressing volume down button in order to get into fastboot menu.

While in fastboot menu, connect your phone to pc and run XiaomiADBFastbootTools.jar

Click on menu--> Check for device , when device is found click menu-->Reboot device to edl

Now run XiaoMiFlash.exe and press refresh. device will be detected as com(n) , where n is the port number. If device is not detected, click on driver menu on miflash and reinstall driver.

Now select the extracted fastboot rom folder. click clean all and click flash.

It takes some time to flash and when flashing is done reboot device by long pressing power button for 10-20 Seconds.

---------- Post added at 02:21 PM ---------- Previous post was at 02:17 PM ----------

***keep in mind that the phone only starts working correctly after 4-5 reboots and a 1 day or 2 after restoring persist and so random sensor stuff is usual ...give it a day or so and be patient with random behaviour for a day ..like reboots and wifi or gps trouble ...this is regardless of the root you took