[Xiaomi Mi A1 Guides, News, & Discussion] YayJohn:
DISCLAMER: DOING THIS MIGHT RESET YOUR PHONE SO PLEASE BACKUP YOUR FILES BEFORE DOING THIS

now lets get started

download this tool (even if you already have adb and fastboot)*

https://xdaforums.com/showthread.php?t=2317790

and go to your phone's settings then System > about phone and press on build number until it tells you: "you have developer options"

now go to System > developer options and enable android debugging and OEM Unlocking

now plug your phone into the pc and open the file: "cmd-here.exe" from the tool you downloaded

now type adb devices and it will probably tell you unauthorized, if it does then open your phone and click on accept

if you dont see any thing other than "list of devices attached" then download this

open it and input in, N and then Y so you dont install adb but you do install the phone's drivers

now type adb devices and you should see random numbers, if it says unauthorized just go back to when I said how to fix it

so now that everything is working type in the command prompt: adb reboot bootloader

now you should see a russian cat fixing a android machine with blue text: "FASTBOOT"

now type "fastboot oem unlock" and it should unlock your phone

now type "fastboot reboot"

--------------------------------------------------------

good, Now you have the bootloader unlocked

--------------------------------------------------------

If you are now put in the setup screen don't do it, just shut down your phone and then when it's shutdown hold on the power button and volume down buttons until you enter fastboot again

now go to this page: https://github.com/CosmicDan-Android/android_device_xiaomi_tissot/releases and download the latest boot only and regular versions

put them both in the adb (tool) folder and type in the command prompt: "fastboot boot boot-recovery.img"

if your phone doesnt do anything (doesn't do anything in the 30s after you input the command) then restart it and get it back in fastboot and type fastboot --set-active=b

and then type the previous command again, if that doesnt work then restart your phone back to fastboot again

and then type fastboot --set-active=a and the command "fastboot boot boot-recovery.img" and it should work

so now you will be in twrp, good!

type "adb push (regular twrp zip name, remember to put .zip at the end!) /sdcard/"

example:"adb push TWRP-Installer-3.2.1-with-Tissot-Manager-2.5.zip /sdcard/"

and then in your phone go to install and you should already be in /sdcard if not then go there and then tap on the zip and swipe on the thing

after it finishes installing go to reboot and then tap on recovery

--------------------------------------------

good now you have TWRP installed!

-------------------------------------------

Now its up to you, do you want to install only root or rom and root? its up to you

Root Only:

Download Magisk (you can also use SuperSU but I strongly recommend magisk)

put it in your adb (tool) folder and type "adb push (magisk's zip name, remember to put .zip at the end!) /sdcard/"

example:"adb push Magisk-v17.1.zip /sdcard/"

go to install, press on the zip file and swipe on the thing and click on restart system at the end

and congrats! you have root on your phone!

Rom:

If were talking about a treble rom then you should follow this guide: https://xdaforums.com/mi-a1/how-to/treble-stock-to-treble-everything-to-t3793734 but if not you can continue using this one

download your favorite rom and download magisk (you can also use SuperSU but I strongly recommend magisk)

also go to opengapps.org choose arm64 and the android version your rom is and I recommend the nano variant

now in twrp tap on Wipe and Advanced Wipe and choose everything there (you dont have to choose micro SDcard tho) and swipe THIS WILL RESET YOUR PHONE AGAIN BUT YOU PROBABLY DONT CARE ABOUT THAT RIGHT NOW

now in the command prompt type: "adb push (rom zip name, remember to put .zip at the end!) /sdcard/"

example:"adb push RR-O-v6.1.0-20180709-Official /sdcard/"

and install it, some roms include gapps and other things in their installation for example: pixel experience. but most roms don't have that

so if you check the xda page and they say nothing about including opengapps in the rom then you should be able to fully follow the next steps.

type "adb push (magisk zip name, remember to put .zip at the end!) /sdcard/" and install it

then type "adb push (opengapps zip name, remember to put .zip at the end!) /sdcard/" and install it

now tap on reboot system and congrats! you just rooted and custom rom-ed your phone!

* "even if you already have adb and fastboot" the reason for this is because that link uses the newest version (or new enough) that is surprisingly not common in other places I downloaded adb and fastboot. the new version adds a new command that is used in the guide if you are experiencing a certain problem

I hope I helped you, if you have any questions or problems post them in the comments :)