[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Sandeeep Kiran:
Reverting Back to PIE, moving from Android 10+ to Android 9 -Just don't- (RIN users)

Right, so Anti-Rollback protection is not implemented for k20 pro or mi 9tp. YOU CAN REVERT IF YOU WANT TO.

This is confirmed by users who have reverted, and by Xiaomi.eu website. Which I trust regarding this.

We've done experiments regarding this and have concluded this applies to raphaelin users (Indian variant devices) only. Unsure why, and how it is not affecting the mi9tp variant. (no confirmation with RCN)

However,

When moving from an Android 10 vendor to an Android 9 vendor, your SENSORS will break!

You can fix this simply by flashing your persist img (Hope you took that backup).

You can also fix your sensors by flashing someone else's persist img. BUT YOU WILL LOSE L1 FOREVER.

You can get L1 back by replacing the motherboard which can be done via your warranty at a service center, or by playing a hefty sum of money. nearly half the cost of the phone. NO OTHER WAY. Also, they open your phone, so it isn't SPLASHPROOF as much anymore.

You can also fix sensors by simply updating back to android 10 via the OTA method, which is found in your settings remember. (Unsure if this will retain your L1 though)

BOTTOM LINE, IF YOU ARE ON ANDROID 10, don't go to ANDROID 9 back.

Stuck at Fastboot Fix

Best Recovery

So regarding Recoveries. Choose the one you like the most.

I prefer the latest OrangeFox recovery cause it looks better, has a better UI, better settings, more functionality, and so forth. https://files.orangefox.tech/OrangeFox-Stable/raphael/

You can also choose TWRP if you like. Completely your choice. You can get that from here https://xdaforums.com/k20-pro/development/recovery-unofficial-twrp-xiaomi-redmi-t3944363 and choose the most recent one, and follow the instructions given there.

If you are just comfortable with TWRP. Always use Mauronofrio's, which is recognized as OFFICIAL.

To flash either recovery, just download the zip file, and simply flash it directly in your recovery like you do for a rom (no need to wipe anything) and it will auto-reboot into your desired recovery.

All credits to those who made the recoveries and those people who helped them.

Stuck in Stock Recovery when Rebooting Fix

Full credits to @ SivSomRao (telegram handle, since no XDA)

So, when I screwed my phone trying recoveries, I got stuck in FastBoot. no matter what I did, even Power + Vol Up got me to fastboot, and I had just wiped my OS, so I had nothing to boot into.

This happens when you wipe your SYSTEM and/or VENDOR partitions and choose reboot recovery, or flash an incompatible recovery.

After a lot of stressful minutes, I was scared half out of my mind. A guy named Shivsom helped me.

Basically what he made me do was

Download his file vbmeta_dv_shivsom.img that is given below in attachments.

Then copy the twrp.img file and vbmeta_dv_shivsom.img file to my adb Folder in my WindowsOS C drive.

Now, on your PC. Copy your TWRP.img file, or your OrangeFox.img (I prefer the TWRP.img file by Mauronofrio.)

Open the Command prompt in that folder

You can do this by clicking on the address bar of File Explorer and typing > cmd > then Enter

There type dir *img to confirm the file is found properly.

Now switch off your phone again.

Press and hold the power button + volume down button.

you will soon enter fastboot mode.

Now, on the new command prompt where you typed dir *img

type fastboot devices and you will get an output like

3e2f2d356 fastboot

Type the instructions

fastboot flash vbmeta vbmeta_dv_shivsom.img

Then type, (Since my twrp image file was re-named to twrp.img, if you haven't done so, do it)

fastboot flash recovery twrp.img

Then press and hold Power and Volume Up till you feel the haptic feedback see the TWRP recovery

Now, TWRP usage.

Now press and hold the power key + volume up to enter TWRP.

Once in TWRP, unlock it.

Go to MOUNT and check if MTP is enabled..... click on the "enable MTP" button.

Now copy the ofox.zip (orange fox recovery zip file) to your phone from your PC via your PC.

Now go to INSTALL tap the ofox.zip file, then flash it!

YAY now, orangefox is your Permanent Recovery.

Now go to MENU > Manage Partitions > select only data > format data > type 'yes' (This will delete everything in your Internal Storage so Caution)

Then quickly flash the latest miui vendor,

Now go to MENU > Reboot > Recovery

I was OverJoyed when this worked.

Now you can flash your Favourite ROM (normal clean flash, tutorial is given above), and then boot the ROM.

This was a nasty disaster. Glad I got through it.

Right, so I tried LR-twrp (it's in Chinese, but I can change the language to English). PitchBlack and PitchBlack-old Both broke my phone to get stuck in fastboot mode no matter what I did.

HENCE I conclude that for all Xiaomi devices, OrangeFox [OFX] is the best recovery. TWRP is suited for Samsung.

ERROR 7 fix and how to modify UpdaterScript

WHAT IS ERROR 7? :

Error 7 is an error that says the ROM you are flashing is not meant for your device.

It does so by comparing the phone's codenames.....

k20p and mi9tp have two codenames, one is RAPHAEL and the other is RAPHAELIN (the Indian variant)

Flashing the Raphael/raphaelin ROM on either device won't cause any problems at all.

feel free to flash it.

Latest orangefox 10.8 works with Raphael (global and Chinese variant) and orangefox 10.6 works with Rapahelin (Indian variant).

Alternatively, It could also be caused because you are required to flash the latest vendor, which you may have not.

So please read the one-line error message that appears above the ERROR 7 red message for more details

SOLUTION to ERROR 7:

I'd recommend flashing the orangefox 10.6 recovery as it's a lot simpler.

Creating Backups

Creating backups is always the safest thing to do, and you can do so via your recovery (OrangeFox or TWRP)

First, make sure you have everything working, nothing is broken in the ROM.

Second, go to your recovery and tap on Backup. Then Click on Create Backup, rename the file if you want to.

Third, Select all the partitions, cause why not, and let it finish creating the Backup.

Finally copy the backup file created to your PC in a safe location, and later when and 'if' you mess up, you can copy the backup file back and restore it.

You can restore by first wiping everything and formatting. (For safety) Then using the same recovery you used to create the backup, Flash the backup file. DO NO FLASH SOMEONE ELSE'S BACKUP FILES!!!!!! ONLY YOURS!!!!!!

How to Decrypt Your Phone.

So encryption is the safest thing for devices, It uses a secret code/key that only your phone knows to read data and information. However, when in Recovery, we Custom ROM enthusiasts like to have our data DECRYPTED. Now, This is because we can access our files from the recovery, flash ROMs only when decrypted, and transfer files. (If we have MTP enabled in recovery)

Somehow you've found yourself encrypted, which means all the files in your recovery are showing random letters + alphabets. and you cant transfer files to your phone via recovery anymore!

To solve this, or decrypt yourself. You will have to format your data partition (this will delete everything in your internal storage, so I hope you have a backup of your photos, vids, gifs, contacts, and so forth)

Just a bit of quick advice, If you can boot into your OS, go there, and transfer all your internal storage to your PC or laptop before formatting to avoid losing your stuff.

If you can't boot into your ROM, then you'll have to lose all your data in internal storage. No known method is known YET to help without losing the files.

Now the SOLUTION: Go to Orangefox settings > manage partitions > select data > tap on format > type 'YES' > swipe to confirm > you lose all your internal storage data contents, and you are now successfully decrypted.

OR if you are using TWRP. Go to WIPE > (right side button) FORMAT DATA > type 'YES' > you lose all your internal storage data contents, and you are now successfully decrypted.

You can now transfer files to your phone properly.

To stay decrypted and not get encrypted again, flash the DFE (Disable_Dm-Verity_ForceEncrypt_02.02.2020.zip) from attachments below (or from the file attachment called disable_force_encrypt.zip above in the first post/comment) and then boot into your ROM, or if you are flashing a new custom ROM, follow the tutorial above(first post/comment)

If you want to stay encrypted. (I advise against this) Just don't flash the DFE file.

The newer latest updated dfe file I have attached in this comment is from https://xdaforums.com/android/software/universal-dm-verity-forceencrypt-t3817389 and all credits for the file go to him. The dfe file in the first comment/post is different and also works.

How to Recognize Which Device You Have And What Vendor Should You Use?

Global, EEA, China, Indian, Russian variant?

All credits for this list go to @joshuah1971 aka Superuser1958 on telegram.

Box Packaging

k20 pro-China: purple+black box with Chinese writing.

k20 pro-India: angled photo of the phone on top+ white box (NO NFC capability. hardware, not software), identifier: raphaelin.

mi 9t pro-Global: black box+ picture of the device on top, English text on side sticker. (model: M1903F11G)

mi 9t pro-RU: same as global but with Russian text+ orange sticker on the phone.

mi 9t pro-EEA: white box.

Software Differences

miui Global: version number will include "QFKMIXM", google dialer, and messages.

miui EEA: version number will include "QFKEUXM", google dialer, and messages.

miui China: version number will include "QFKCNXM", miui dialer, and messages.

miui India: version number will include "QFKINXM", miui dialer, and messages.

miui Russia: version number will include "QFKRUXM", miui dialer, and messages.

So check which device variant it is, and use the appropriate Vendor when flashing. (Go to ROM's Settings-> About phone-> MIUI Version [code in the brackets])

Vendor Links

So regarding Vendors. Choose the one your device needs.

Namely, The Indian Variant is called Raphaelin. So get your vendor from https://xiaomifirmwareupdater.com/vendor/raphaelin/

The Global, Europe, China, and Russian Vendors are gotten from https://xiaomifirmwareupdater.com/vendor/raphael/

What is OSS Vendor? How to switch to the F2FS file system on OSS ROMs only?

What is OSS Vendor?

So our device has 5 variants.

Xiaomi firmware website has all 5 official (firmware+vendor) zip files.

"Always flash your variants vendor."

"Xiaomi never showed us what's in them. Aka closed source"

But this is so confusing for some people. Idky.

Therefore, some devs decided to make a universal vendor that will work on all variants. Since they are making it. They can optimize it and also always know what's in it.

This universal vendor is called an OSS vendor. (Open Source Software) (It's not yet perfect though)

Some custom ROMs don't include vendor (cause OSS isn't perfect yet)

Some custom ROMs include OSS vendor (so we can observe how good it is in daily use)

It's always good to know if the rom is using OSS or if we have to flash the official.

Currently. Since OSS isn't perfect yet. If the rom doesn't include vendor (or it's a custom miui) do not flash/use OSS with it.

How to switch to F2FS File system?

• Go to the rightmost tab on orange fox recovery > manage partitions > data > change FS > tap on f2fs > change FS

• Now reboot recovery

• Now reboot recovery again

• You are now f2fs.

~FINISH

~Do Comment and Thank, it'll bump this guide to be noticed more, so others can find this guide and get help as well