[Huawei P9 Questions & Answers] Wattsensi:
Surely, some Huawei P9 owners are flashaholics like me. I've rebranded, danced left and right with OTAs in order to install EMUI 8.0 and the B540 firmware, juggled recoveries up and down and played with numerous Treble ROMs. If you're like me, you have soft bricked your device numerous times, or you did factory resets from AOSP without erasing the fingerprints first. The issue is, when you forget to wipe your fingerprints and factory reset, they are gone from AOSP ROMs, but not from the sensor hardware, which leads to the issue of ghost fingerprints.

What are ghost fingerprints? Fingerprints that occupy a space in the fingerprint sensor's memory without being registered as existing in pure Android. This causes issues at the moment of registering a new fingerprint since the sensor won't register an already occupied fingerprint which leads to the enrollment not being completed on that fingerprint, reducing the available number of registerable fingerprints and being a security issue as the ghost fingerprints are recognized by an active sensor as valid even if they are not the fingerprint registered in Android.

But there is a (painful) solution, fortunately. Your fingerprint sensor is not crippled for life. This guide involves flashing several times so be careful when following it and investigate every step. I am not responsible for soft or hard (OOF, my wallet hurts) bricked devices. Also this guide is intended for rebranded P9s running a Project Treble compatible firmware stack.

I DO NOT support people running EMUI 5.0 B3xx pre-Treble firmwares or older on their phones. You need a modern B5xx firmware with the new bootloader and partition layout of EMUI 8.0 to follow this guide.

NOTE: This tutorial involves formatting the internal storage. There WILL be data loss.

First, you need the following:

* The update.zip file of the EXACT SAME EMUI firmware image that you are using

* A computer with ADB drivers and an ADB and Fastboot stack.

* Any keyboard APK (I'll explain later)

* The Huawei Update Extractor

* The ROM image of your AOSP Treble OS.

* A Huawei P9 with an unlocked bootloader, an EMUI 8 firmware installed, and/or running any AOSP Treble ROM.

PART 1: Preparations

1. Open your firmware's update.zip in any ZIP file manager.

2. Extract the 'update.app' file to the location of your ADB and Fastboot stack.

3. Open the Huawei Update Extractor in your computer.

4. Disable the signature verification checks.

5. Right click and extract the following images: SYSTEM.img, and if you use a custom kernel, KERNEL.img. After that you can close HUE.

4. Enable developer options, and turn on USB debugging.

PART 2: Going back to EMUI

1. If you have Magisk, uninstall Magisk and everything that depends on Magisk.

2. Open a command prompt or terminal, depending on your computer's OS.

3. Connect your device to USB, and confirm that it can interface with ADB using 'adb devices'.

4. 'adb reboot bootloader': This will reset our device into Fastboot mode.

5. Confirm that communication with Fastboot is possible by using 'fastboot devices'.

6. If you were using a custom kernel, do...

'fastboot flash kernel KERNEL.img'

This will reflash the original kernel image that came with your firmware update.

7. Verify that your device has at least 20% battery, just to make sure that it will work if your battery is old or faulty.

8. The actual procedure.

'fastboot flash system SYSTEM.img'

Have patience. We're flashing the stock ROM through Fastboot now.

9. 'fastboot reboot'

Self explanatory. You can disconnect your phone now.

10. Keep Volume Up to boot to your recovery image, whatever are you using.

11. Do a factory reset, then reboot. This is required to switch between AOSP and EMUI ROMS, and recommended when switching any ROMs in general.

PART 3: Making the ROM usable

1. Skip through the first time wizard.

2. Enable developer options.

3. Go to developer options, enable USB debugging.

4. Connect your device, enable file transfer.

5. Accept the RSA key of your computer, and do 'adb devices' to make sure you can communicate with ADB.

6. 'adb install keyboard.apk'

This will install a virtual keyboard, as our barebones EMUI 8 lacks one. This ROM is not usable in this state, so don't keep it.

PART 4: Killing the ghosts and leaving the battlefield

1. Configure your lock screen, put a short PIN, then go to the fingerprint settings. Your ghost fingerprints will be there, exposed to the light thanks to EMUI's dark magic.

2. Delete each fingerprint. You cannot leave any fingerprint.

3. 'adb reboot bootloader'

4. 'fastboot flash system my-aosp-treble-rom.img'

Be patient. We're returning to AOSP once more.

5. 'fastboot reboot'

6. Boot into recovery

7. Do a factory reset.

8. Disconnect your phone and reboot to system for the last time.

Your ghost fingerprints are gone. Now you can enjoy your clean fingerprint sensor once more.

And remember, make sure to flash responsibly the next time! :)

If I helped you, please hit thanks and comment