[Xiaomi Mi A2 / 6X Guides, News, & Discussion] Aerobatic:
Since Official TWRP as of 2019-06-19 still does not support decryption of PIE /data partition, I decided, on behalf of developer of Unofficial TWRP 4pda version MOD EDIT: LINK REMOVED d4e8ede8f1f2 and with his approval, to present his project here.

The version being presented is a branch of Team's Win Recovery Project 3.x, based on Android One Pie kernel, and is licensed under the GPL (version 2) license agreement.

Neither developer nor OP creator (translator from Russian) are responsible for any harm to electronic devices or financial losses inflicted with improper usage of this software.

Proceed on your own risk.

Please get acquainted with Team Win Recovery terms and usage.

Sources:

OMNI TWRP repository..

TWRP Device configuration for Xiaomi Mi A2.

Developer forum (4pda, in Russian):

MOD EDIT: LINK REMOVED

Downloads (Google Drive):

TWRP 3.3.1-5 jasmine_sprout unofficial (2019-06-29)

Note 1: TWRP Image cannot be uploaded to local repository as a single archive due to xda limitations on file size, thus dev's Google Disk is used;

Note 2: This thread is somehow not thanked and thus is periodically drowning below other less-functional TWRP clones; do not hesitate to promote the product after successful usage, - it is for free.

Features :

1. Pie-based kernel with full decryption support for stock Androids 9 and 10:

- in case Mi A2 is not locked by PIN, password or graphic key, decryption and mounting of /data partition is made automatically,

- otherwise appropriate unlocking sequence is to be made by user in TWRP loaded into phone.

2. Slot (A/B) switching works.

3. MTP / ADB sideload and USB OTG read/write work.

4. All variants of MiA2 screen panels are correctly supported (no "black screen" bug).

5. In current version /system partition is mounted as "/system" (not as "/system_root") to comply with script of OpenGApps installer.

Usage Notes:

- Mi A2 must be fully unlocked to use TWRP; "Usb-debugging" must be switched on in phone; see Guides in this forum;

- ADB / fastboot must be properly installed and approved in phone; (see Platform tools, - r29.0.1 as of 2019-06-08, - and Guides in this forum);

- recommended booting sequence

adb devices -l
adb reboot bootloader
fastboot devices
fastboot boot twrp-3.3.x-x-jasmine_sprout-unofficial.img

1st command lists attached devices supporting ADB interface, and is used to check that phone is connected properly and that no other devices are connected. simultaneously, - read result in CMD. Most of ADB commands need "USB debugging" in ON state. If issued for the 1st time from this PC, will rise a prompt on phone, - need to approve.

2nd command reboots phone into bootloader, - wait till phone shows fastboot screen.

3rd command lists attached devices supporting fastboot interface., - read result in CMD and ensure it shows same signature as was displayed after 1st command in ADB.

4th command boots TWRP into phone.

Example 1 (pull camera photos directory):

1. boot into TWRP (do not forget to unlock TWRP and thus decrypt /data if phone is secured by PID or other method);

2. type "adb pull -a /sdcard/DCIM/" in CMD shell in platform-tools dir of PC - to save all photos to current dir.

Example 2 (pull current /boot image to PC ):

1. Boot into TWRP;

2. To learn which slot is active, see "Reboot" page in TWRP

(another way is to switch phone to bootloader mode and type "fastboot getvar current-slot" in CMD in platform-tools folder in PC).

3. in CMD shell in platform-tools dir of PC type:

- if active slot is A: "adb pull /dev/block/mmcblk0p62 ./boot_a.img";

- if active slot is B: "adb pull /dev/block/mmcblk0p63 ./boot_b.img";

Example 3 How to re-flash /persist partition using TWRP and ADB commands' script

How to install TWRP as permanent one:

As stock Mi A2 ROM comply to GSI A/B slots partitioning scheme, there is no /recovery partition, and thus no place for TWRP to be successfully flashed via fastboot (or MiFlash).

If you use "fastboot flash twrp-3.3.x-x-jasmine_sprout-unofficial.img" command, you will just substitute content of /boot_X partition with TWRP in current slot X, thus spoiling ROM, which is obviously not what you've intended.

If you want to embed TWRP into phone permanently instead of stock recovery:

- boot into TWRP, and then

- install "twrp-installer-3.3.1-5-jasmine_sprout-unofficial.zip" via booted TWRP;

- this installation will patch /boot image (similar to how MagiskManager patches /boot image to embed Magisk).

Custom ROMs usually have a custom recovery (mostly various TWRP builds) embedded into boot image from scratch, you may opt to substitute such with this one.

Update 2019.06.24:

Code of PBRP by @Manish4586, has been updated today to sources of TWRP fixes by MOD EDIT: DOWNLOAD LINK REMOVED

Update 2019.09.12:

I beg everybody (and 1st of all d4e8ede8f1f2) pardon for postponing update of this thread, since improved version 3.3.1-5 was available as of 2019.06.29.

Changes in 3.3.1-5:

1. new kernel v. 4.4.184 based on official MiA2 Pie kernel;

2. Merging with official TWRP code changes:

2.1. Fix compilation in android-9.0 repos.

2.2. Properly localized string instead of using English.

2.3. ext4crypt: support synthetic keys v3 on May update

Notes from d4e8ede8f1f2 on decryption in 3.3.1-5:

This version supports decryption of data partition encrypted in FBE (File-Based Encryption, introduced since Android 7) scheme only, as being used by stock MiA2 ROMs.

This {limitation} became deficiency since some custom ROMs, e.g. AEX, implemented older and stiffer FDE (Full Disk Encryption, introduced in Android 5) scheme.

One can check which encryption scheme is implemented in current ROM, for example, issuing ADB command: "adb shell getprop ro.crypto.type". Replied "file" means FBE, while "block" means FDE.