[Xiaomi Mi A2 / 6X Guides, News, & Discussion] minnuss:
This guide worked for every OREO version, and also is working for PIE ! :good:

You will enable camera2 on your phone, and keep it stock afterwards so it can receive future OTA updates. :victory:

1 - Unlocking bootloader

Unlocking bootloader, this command will delete/reset your phone, so do backup of files as needed.

First of all, enable the Developer Option.

To do this go to your Settings -> About -> Software Information -> More -> Now Tap on the Build Number 7-8 Times until you see a toast message “Developer option enabled”.

Now go back to settings -> Enable the OEM Unlock by going to Settings -> Developer Option and Enable OEM Unlock and USB Debugging.

Now connect the phone with your USB cable, use USB port 2.0 on your computer.

It should appear on your phone screen an asking for access privileges of your PC (device, maybe Linux), allow it.

Download ADB if you don't have it.

https://drive.google.com/file/d/1yCdMyAAOD46T4B8haFuZVF57E4-WK8l2/view?usp=sharing

In ADB folder, double click "Open CMD here.bat".

AND FROM THIS TIME, YOU DON'T CLOSE THIS CMD AT ALL, UNTILL YOU FINISH THE WHOLE GUIDE

adb devices

Your device should appear with some random numbers like this

https://www.howtogeek.com/wp-content/uploads/2012/10/image34.png

If it does, go to next stage, if it's not, you are not installed usb drivers corectly or did not enabled usb debugging.

Link for USB Drivers for Mi A2.

http://dl.adbdriver.com/upload/adbdriver.zip

adb reboot bootloader

Unlocking bootloader, this command will delete/reset your phone, so do backup of files as needed.

fastboot oem unlock

Phone will reboot, go to check developer options > usb debugging ON once again.

adb reboot bootloader

Again in fastboot we are unlocking critical partitions, and once again it will erase verything from the phone, so be sure to do the backup as needed.

fastboot flashing unlock_critical

Again when the phone reboot, check developer options > usb debugging ON.

2. Rooting the phone (temporarily)

Download stock boot and patched boot of android version you have, if you need versions for OREO, find somewhere in forum, here it is link for PIE.

10.0.9.0 https://drive.google.com/drive/folders/1ZP5jelFGT5z9EJvHRokzLJwAikKtWI8p?usp=sharing

10.0.8.0 https://drive.google.com/drive/folders/1XNE_veO_FvOLQ46oorUBa2g7TKA1PHRv?usp=sharing

10.0.7.0 https://drive.google.com/drive/folders/1kHLYXhaWFpjh58F79xnOkN3kjkuyEdHV?usp=sharing

10.0.5.0 https://drive.google.com/drive/folders/1qCIsk1MVVq_X-mR8BBWa2NeVLB_-4q5y?usp=sharing

10.0.4.0 https://drive.google.com/drive/folders/1piLD_9mQv0XgahyIZdxRqfdwaDbfx2_0?usp=sharing

10.0.3.0 https://drive.google.com/open?id=1uO3yfxHdTr4gv4DmCaLu-naIIt8mprBT

"It seems like 10.0.3.0 OTA is withdrawn by Xiaomi due to numerous bootloops in stock phones."

My recommendation is to skip flashing this version, until next stable comes up !

10.0.2.0 https://drive.google.com/drive/folders/1_cIM0ltKD_PU1mIiWwUE-nMba964NyvN?usp=sharing

10.0.1.0 https://drive.google.com/drive/folders/18tcBVaKwH9cy_RVczf-GSc_tAkFYvn15?usp=sharing

9.6.17.0 https://drive.google.com/drive/folders/1D9RlDZRupdriCyJM4p0ixvntPE2QPP9w?usp=sharing

Put the files in adb folder, both the stock boot.img and patched_boot.img.

NOW !

There are two methods, so you can choose between those two:

1. Faster and easier one with only booting patched boot

2. Slower with flashing, but this one will teach you how to flash and root your phone

1. ENABLING WITH BOOTING PATCHED_BOOT.IMG

In CMD type

adb reboot bootloader

fastboot boot patched_boot.img

When the phone starts, wait for magisk to appear in apps, or if it's not there, find it in apkmirror site, magisk manager, download, install from phone it is easier.

https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=magisk+manager

Then when you start magisk, it will ask you to download full zip, just skip it, your phone will now be rooted.

3. Enabling Camera2 api (lvl3)

In CMD type

adb shell

su

(this time look at the phone screen, allow root access ONCE)

setprop persist.camera.HAL3.enabled 1

For PIE and for using v6 Gcam ports three more commands, for OREO it is not needed.

setprop persist.vendor.camera.HAL3.enabled 1

setprop persist.camera.stats.test 5

setprop persist.vendor.camera.stats.test 5

Press ctrl+c to exit adb shell (windows) or just type "exit" and again "exit"

4. Unrooting the phone

Start magisk again, go to UNINSTALL, choose full uninstall, magisk will reboot the phone in process of uninstalling, and the phone should start normaly without Magisk installed, and with camera2 enabled, because nothing was flashed, you are DONE !

2. ENABLING WITH FLASHING PATCHED_BOOT.IMG

In CMD type

adb reboot bootloader

fastboot getvar current-slot

Then when you see your active partition, flash the patched image.

fastboot flash boot_a patched_boot.img

OR if it was b partition active

fastboot flash boot_b patched_boot.img

fastboot reboot

When the phone starts, wait for magisk to appear in apps, or if it's not there, find it in apkmirror site, magisk manager, download, install from phone it is easier.

https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=magisk+manager

Then when you start magisk, it will ask you to download full zip, just skip it, your phone will now be rooted.

3. Enabling Camera2 api (lvl3)

In CMD type

adb shell

su

(this time look at the phone screen, allow root access ONCE)

setprop persist.camera.HAL3.enabled 1

For PIE and for using v6 Gcam ports three more commands, for OREO it is not needed.

setprop persist.vendor.camera.HAL3.enabled 1

setprop persist.camera.stats.test 5

setprop persist.vendor.camera.stats.test 5

Press ctrl+c to exit adb shell (windows) or just type "exit" and again "exit"

4. Unrooting the phone

Start magisk again, go to UNINSTALL, choose full uninstall, magisk will reboot the phone in process of uninstalling, prepare and hold down the volume button when phone restarts, your phone will go into fastboot.

Type the command for active partition

fastboot getvar current-slot

fastboot flash boot_a boot.img

Or

fastboot flash boot_b boot.img

fastboot reboot

This is it guys, you have enabled lvl3 (camera2), and unrooted phone, ready for next OTA updates.

Install camera2 probe from gplay to confirm.

https://play.google.com/store/apps/details?id=de.weis.camera2probe&hl=en

Phone needs to stay with unlocked bootloader, because if you lock the phone, you will lose camera2, but do not worry, the future OTA updates will work.

If this guide helped you, please click the thanks button, that's all, cheers. :highfive: