This is the method I followed for my Xiaomi Mi 10T Pro to get from my previously installed AOSP ROM to a stock based ROM (I’ll change to a modified stock ROM later). It includes Root so a bunch of useful things can be installed. I had a nice AOSP ROM previous to this, but the camera was a stumbling block – the Xiaomi stock camera is so much better.
Remember: This is a 2021 summary, and more for my needs in case I want to go back and repeat the process. It is likely to be out of date pretty quickly with MIUI updates etc.
- the phone has already got an unlocked bootloader. This is a few step process, and you need to wait (15?) days until the phone unlocks (A Xiaomi security limit). You can’t do any of this without it.
- backups are done… (I use the Google Play backups, Titanium, SMS backup/restore, Nova backup for my launcher and a few others)
- you have access to the Mi account and the phone is registered to you in this. You need this for the Unlock tool anyway.
- Some settings may need to be changed in the developer mode settings. I’m not sure if you need USB debugging on, and USB install of apps on… I didn’t seem to need to for any of this. Also, turning off MIUI compatibility (at the bottom of the Developer settings) may be needed for some things.
- Download Stock ROM for phone
- Use windows version of Mi Flash Tool to Flash Stock Rom
- Ensure all adb and xiaomi drivers are installed (the tool can do this if needed)
- Reboot phone to fastboot with power and volume down.
- Apply fixes to flash script (I had errors so had to REM a couple of lines)
- Ensure (down the bottom of the app) you choose the flash_all script, and “clean all”. Don’t choose lock.
- If you have chosen lock… you will need to use the Mi Unlock (windows) software to Unlock the bootloader again
- Reboot and setup the phone. All your google play apps should start to be reinstalled if you were using the play backup service (you could also use the Mi one, but I don’t know anything about it). I also will use Titanium backup later to restore anything missing, or with missing data.
- This is a good time to choose the launcher you were using (I use Nova), get LastPass or your password manager running again and maybe a few other things. If you don’t need root, then no more to do.
To get root with safetynet fixes
- Reboot to fastboot again, plug the phone into your computer and install TWRP. I did this on a linux machine with the fastboot binary on the command line.
- Only boot to it (don’t install in recovery partition) by using
fastboot boot TWRP_3.5.2_10_By_Master.img
- Once installed it will boot to TWRP (don’t reboot…otherwise you’ll have to do it again)
- Download magisk
- rename the apk you just downloaded to .zip (ie. from Magisk-v23.0.apk to Magisk-v23.0.zip)
- transfer the zip to your phone using the TWRP file manager
- install the file using the TWRP “Install” option
- Fix the safetynet issues using magisk (this September fix was the only one that worked for me). You need to install the Magisk manager app first.
Netflix won’t even work on the xiaomi phone. no idea why, but doesn’t even appear in the play store. May be due to a Chinese government dispute or something.
- Turn “MIUI compatibility mode” off in developer settings
- Find a netflix apk to download
eg https://help.netflix.com/en/node/57688 or a newer one
- install it (it will warn you about installing items from unknown sources)
- turn the MIUI compatibility back on
Apps needing root access
Install Adaway. I get this from the fdroid store. Once installed, you need to open it and let your phone permanently accept root access. Then a reboot is needed before it can modify and maintain the hosts file. I also use the app to generate a self signed cert and install it (it will step you though this) for better compatibility if blocks are https redirected to localhost.
Titanium backup Pro. Useful for backing up and restoring everything. No special process needed (just root)
Banking apps, Google Pay and some other apps that deny root access.
As I installed this, the magisk module still contains”Magisk Hide” by default. It may not forever (but I’m sure there will be modules to install that will do the same thing) Go through and ensure these apps are selected to be hidden (I also get it to change the name of the Magisk manager app, but not sure if this is necessary). Ensure the safetynet checks are working.
– Install the vanced manager app
– Turn “MIUI compatibility mode” off in developer settings
– Use the manager app to install the latest version of Vanced (you need to accept root access temporarily)
– turn the MIUI compatibility back on (I think this is fine to have back on, I didn’t have any issues)
– Go to the Google Play store and turn off “Enable Auto-Update” for the Youtube app, otherwise it will be overwritten later.
- You may want to go to developer mode and turn off “Automatic System Updates” to avoid problems if something gets overwritten. Especially if you install a custom ROM.
- A Nandroid backup is a good idea (i.e. a full image backup). Do this by fastboot installing TWRP again, and chose the backup option. Copy your backups off the phone to somewhere safe.
- You may want to install TWRP on the bootloader. This version seems to be able to deal with decrypting the system partition (which was previously a problem. Now it will ask for your pattern unlock). I prefer to leave it off and just boot it as needed with fastboot. Some reports have said this causes bootloops and other issues on a MIUI ROM, others say it isn’t a problem. To install as permanent recovery, use (with fastboot, and your phone connected with USB)
fastboot flash recovery TWRP_3.5.2_10_By_Master.img
- Fixes for a Galaxy Watch issue that I had
https://forum.xda-developers.com/t/solution-for-miflash-crclist-sparsecrclist-error-failed-updated-in-april-4th-2021.4182963/ (comments right at the end re filenames)