[Huawei Mate 9 Guides, News, & Discussion] Deytron:
So I was tired of EMUI, the UI design isn't really that bad but it really clashed with Android's Material Design, so since our Mate 9 is Treble compatible, I decided to try a few Treble ROMs. After many fails and factory resets, I finally settled on Havoc-OS. Here I made a guide on how to switch to a Treble Rom.

So a few things to note :

There's no (fully) compatible TWRP recovery for Kirin devices. Either they work but cannot flash OpenGApps or they simply don't work with Treble ROMs.

Huawei's eRecovery seems to work. For me at least, it didn't work before. So as usual, BACKUP ALL OF YOUR DATA(Titanium Backup or HiSuite for apps if needed). You can also use TWRP with stock EMUI if you want to backup your partitions in case something goes really bad.

Make sure you're using stock kernel, ramdisk and recovery_ramdisk before starting anything.

A Micro SD card is optional but useful for restoring things or if you don't want to transfer all of your backup data to your PC

USB Debugging isn't really needed.

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

Requirements

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

- Your phone, obviously. Has to be a Mate 9 (Pro) updated to Android 8.0 Oreo.

- An unlocked bootloader (Since Huawei stopped giving unlock codes, I can't help you on that one. Sorry boys)

- A PC and a USB Type-C cable.

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

A. First things first

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

Enable OEM Unlocking

An easy thing to do, otherwise you won't be able to flash anything on your phone (FRP will be "Lock" on bootloader screen). You may think that this is kind of a mandatory thing to do since you've unlocked your bootloader, but you can get it back to disabled and greyed out anytime, so here's a reminder.

1. Enable developer options by going to Settings > System > About Phone and taping multiple times on Build Number

2. Once that's done, go to Developer Options and enable OEM Unlocking.

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

B. Downloads

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

1. Download and install Minimal ADB

Click here to download Minimal ADB

2. Download your ROM, right now there are two fully compatible ROMs :

- OpenKirin Builds : https://openkirin.net/download/

- Havoc-OS : https://xdaforums.com/mate-9/development/rom-havoc-os-t3826470

You'll get an img file that you must put inside where you installed Minimal ADB.

3a. For later : Download Huawei Firmware Finder and Huawei Update Extractor

- Huawei Firmware Finder

- Huawei Update Extractor > If you're not running Windows (Mac, Linux) (Thanks to irony_delerium)

- Also download Magisk Manager (This is an APK)

--- OR ---

3b. Download this patched Ramdisk with Magisk included so that you don't have to download all of the above. CREATED WITH BUILD NUMBER MHA-L29 8.0.0.370(C432). USE AT YOUR OWN RISK IF IT DOESN'T EXACTLY MATCH YOUR PHONE BUILD.

Here (name is patched_boot.img)

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

C. Installation

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

Now that you've got your Rom img and Minimal ADB, we can start installing it.

1. Turn off your phone.

2. Plug your phone into your PC AND hold down the volume down button until you get a (terrible) white screen saying you're in fastboot&rescue mode.

3a. Open a command prompt (with admin rights if possible) on your PC and get to your Minimal ADB directory. By default, it should look like this :

cd C:\Program Files (x86)\Minimal ADB and Fastboot

3b. If you installed Minimal ADB on a different drive, then type this :

cd /d {DRIVELETTER}:/{MINIMAL ADB DIRECTORY/}

4. Make sure your phone is detected by typing :

fastboot devices

This should show up.

5. Now you can start flashing your ROM by typing :

fastboot flash system {IMGFILE}.img

Your ROM should start flashing with the message 'target reported max download size of 494927872 bytes'

It should take a minute.

Once you see 'finished. total time: times', that means your ROM has been flashed.

Don't reboot just yet. Things won't work

6. Reboot to recovery by turning off your phone (hold down power button for ~5 seconds) and holding volume up.

7. Now that you are in EMUI recovery, do the following :

- Wipe cache

- Wipe data/factory reset

You MUSTdo this otherwise you will have multiple issues.

8. You're done for the installation. Now reboot to system and start your phone first config (again).

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

D. Root

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

Your Treble Rom isn't rooted by default. But the Treble Rom itself triggers the SafetyNet flag, which means even if your phone is super clean, it is not certified. So it is obviously completely optional, by it is extremely recommended to install Magisk.

If you downloaded the patched_boot.img file in the attachment

The install process will be extremely easy. It will install Magisk 16.7 (only Beta works with Treble right now). So all you have to do is :

Get to fastboot mode by turning off your phone, plugging it to your PC while holding volume down button. Then, type the following command in the same command prompt window :

fastboot flash recovery_ramdisk patched_boot.img

It should take around 5 seconds. Now you can reboot and download Magisk Manager. But Safetynet will still trigger (if it doesn't, tell me). You'll have to follow E. SAFETYNET.

If you're not using the attachment

1. Check your phone Android version and build number. It is in Settings > About phone. Write it down, you'll need it.

2. (Install and) Open Huawei Firmware Finder. Get in the 'Common Base' tab and type in your phone build number.

3. Find the matching build number in the list. Make sure its type is 'FullOTA-MF' and its size is 2Go+. Then click on the blue link in the 'Filelist' column. Copy paste the first (ending with 'update.zip') in your browser to download the zip file. It should take some time.

4. Once it's downloaded, open it with 7Zip/WinRar and extract the file named 'UPDATE.APP'.

5. Open Huawei Update Extractor, go to the Settings tab and untick everything.

6. Now, go to the Extract tab and click on the dots on the right and select your extracted 'UPDATE.APP'. A ton of files should appear.

7. Right click on 'RAMDISK', and 'Extract selected'. Put it somewhere on your PC, you'll need it.

8. Plug your phone on your computer and put your RAMDISK.IMG in a folder on your phone.

9. On your phone, download and install Magisk Manager. If it prompts you to do so, do not install it. Then go to Settings tab and change 'Update Channel' to 'Beta'.

10. Now go back and tap 'Install', then choose 'Patch Boot Image File' and select your RAMDISK.IMG that you transferred to your phone. Then let Magisk do its thing.

11. Once it's done, on your PC, go to Your Phone/Internal Store/MagiskManager, and transfer the file 'patched_boot.img' to your Minimal ADB folder.

12. Turn off your phone and get to fastboot mode. You know how to do it now, don't you ?

13. In the same command prompt on your PC, type :

fastboot flash recovery_ramdisk patched_boot.img

It should take around 5 seconds. Now you can reboot and BAM, you're rooted. But Safetynet will still trigger (if it doesn't, tell me). You'll have to follow E. SAFETYNET.

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

E. SafetyNet

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

Magisk may be installed, but with a Treble Rom, SafetyNet should trigger anyway. So you'll have to do a few things.

1. In Magisk Manager, go to the Downloads tab and search for 'MagiskHide Props Config'. Install it, then reboot your phone.

2a. Once your phone is rebooted, download Terminal Emulator on the Play Store

--- OR ---

2b. Go to developer options and enable 'Local Terminal'.

3. Open your terminal, then type :

su

(Accept root request)

props

Things should appear. Woah.

4. Type 1 (Edit device fingerprint), then f, then choose a vendor and a model by typing the right number, then press y. Don't reboot yet (press n)

5. Type 6 (Script settings), then 1, then y. Now you can reboot (press y). Once it's done, make sure that 'boot stage' is 'currently post-fs-data'. Otherwise SafetyNet will still trigger.

THERE YOU GO ! Your phone should pass SafetyNet. You can check this by trying to search for the Netflix app on the Play Store or going into the Play Store settings and making sure your device is Certified'.

If you have any question/bug, do ask/report all of dem to me.