[ROM][Treble][microG]LineageOS 16.0 for HUAWEI P9

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
On my P9 it doesn't work. adb devices reports no permissions for me. It is well configured, I use it everyday on other devices. It doesn't hog CPU unlike Phh-Treble AOSP 9.0 though. Perhaps it's your newer build though.
This fix, it pretty much adds some permissions, tells the framework to expose NFC and installs an APK along with some binary blobs.
https://forum.xda-developers.com/showpost.php?p=81021365&postcount=26
---------- Post added at 13:41 ---------- Previous post was at 13:35 ----------
Flash the amend patch for GSI ROMs. This takes care of that. Phhusson-based GSI ROMs all lack a necessary system file detailing Play Store app compatibility so they're all missing. You need to re-add it by flashing my amend patch on top of the ROM. It also fixes Bluetooth settings.
/system/etc/sysconfig/features_eva.xml
Credit: @lo_ol
@MSe1969 Please study this ZIP and add some changes into your ROM so offline charging, NFC and Aurora Store catalog can work out of the box
https://drive.google.com/drive/folders/1rpCeajjRfozMrTBgSvKELgtb9GwOeXfh

First of all, thanks for this - I will have a look and yes, whatever would be missing and prove useful, I'll of course add. :good:

Now, while having seen the ZIP files on the one hand side, and also reading this and some older statements from you, regarding things not working, like ADB (works perfectly on my device), Offline-Charging (works perfectly on my P9), NFC partly works (I can send files via Android Beam from other devices to my P9, but seems not from my P9 to another device...)
I have the suspicion that you may have partly messed up your device by flashing various ZIPs!
So I really recommend you going back to HUAWEI stock, maybe use that opportunity to get to the 550 firmware and afterwards really refrain from flashing things other than system.img and - once available, a new kernel.
Why do I say that?
In fact, a GSI should really only flash the system partition, whilst other partitions on the device remain untouched! The phh builds follow this philosophy and even "cheat" by e.g. mounting /product or /vendor stuff into the "nirvana" in order to r ZIPeplace them by own content through "over-mounting" (mount -o bind), which bypasses the file paths at runtime, but don't touch the original partitions.
EDIT correction:
The fist ZIP file overwrites e.g. the /product partition and the 2nd ZIP file stays in system, but brings a lot of stuff not necessarily needed, but to simply fit multiple different device setups.

Of course, I haven't seen your device (so I am "wild guessing"), nevertheless I would really recommend this activity to re-initialize your device and afterwards, only use TWRP a very last time to flash the network patch and then take the stock recovery back and only use fastboot to flash back system images, like e.g. my build ;)
If needed, I can write a separate post on how to get to the EVA-AL10 8.0.0.550(C00) firmware - (the method to simply let eRecovery do that job did not work for me, it wanted to downgrade my to device Stock Nougat ! :eek: (so I immediately stopped that)

I'll have a look at the zips provided by you and see, what I will include in my build...
Regards, M.
 
Last edited:

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
Phhusson-based GSI ROMs all lack a necessary system file detailing Play Store app compatibility so they're all missing. You need to re-add it by flashing my amend patch on top of the ROM. It also fixes Bluetooth settings.
/system/etc/sysconfig/features_eva.xml
Credit: @lo_ol
Cool! Many thanks - that one will definitely be added in my next build! It indeed fixes the AuroraStore behavior. :good:
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
Please study this ZIP and add some changes into your ROM so offline charging, NFC and Aurora Store catalog can work out of the box
Okay . . .
1. features_eva.xml will be added :good:
2. Offline charging works already
3. The hw HALs (system/bin/hw/vendor.huawei.hardware*) are present in /vendor/bin/hw (vendor partition)
4. The overlay is already part of my build
5. The NfC app, libs and the extras.jar - if I understand correct, this is from the "manual fixes for hi6250 devices" thread, right? So extracted from Huawei firmware? Or from where does this come from? I'll have a look as well into the newest AL10 8.0.0.550(C00) firmware . . .
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
Okay . . .
1. features_eva.xml will be added :good:
2. Offline charging works already
3. The hw HALs (system/bin/hw/vendor.huawei.hardware*) are present in /vendor/bin/hw (vendor partition)
4. The overlay is already part of my build
5. The NfC app, libs and the extras.jar - if I understand correct, this is from the "manual fixes for hi6250 devices" thread, right? So extracted from Huawei firmware? Or from where does this come from? I'll have a look as well into the newest AL10 8.0.0.550(C00) firmware . . .
They are from a PRA-L09 firmware so this may be the culprit because the NFC facilities are not 1:1. Indeed, I'll try going back to EMUI 8.0 and will update to B550 as a bonus too. I have no access to EMUI 8.0 firmware yet but I will try fetching the latest EVA-AL10 firmware. I will also update the amend patch to use EVA NFC libraries instead.

I do need to redo that ZIP...

Also, nevermind! USB debugging finally worked, but it only works while MTP is enabled. Is that intentional or just a bug?
 
Last edited:

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
Also, nevermind! USB debugging finally worked, but it only works while MTP is enabled. Is that intentional or just a bug?
This can be observed with many ROMS and also on some phones with Stock firmware.
For me not a show stopper - I would consider it a bug, but not worth for me to spend time on trying to fix it.
If anybody can point me to a solution, I will of course be happy to apply it to my build...
 
Last edited:

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
This can be observed with many ROMS and also on some phones with Stock firmware.
For me not a show stopper - I would consider it a bug, but not worth for me to spend time. on trying to fix it.
If anybody can point me to a solution, I will of course be happy to apply it to my build...
I will try my hand at building LineageOS 18.0 once we have a stable enough phh base and eventually work on shimming the non-treblified parts, is 300 GB of disk space, dual core CPU and 8 GB of RAM enough? I've built AOSP 8 before for ARMv7
I have 8 GB of RAM, 8 GB of Swap and a 500 GB HDD, 450 GB free of which 50 GB will be used for ccache
 
Last edited:

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
I will try my hand at building LineageOS 18.0 once we have a stable enough phh base and eventually work on shimming the non-treblified parts, is 300 GB of disk space, dual core CPU and 8 GB of RAM enough? I've built AOSP 8 before for ARMv7
I have 8 GB of RAM, 8 GB of Swap and a 500 GB HDD, 450 GB free of which 50 GB will be used for ccache
It should work, but this setup tends to the minimum requirements (I know, building android is really demanding hardware resources).
Disk space should be fine, although it will allow mainly one build tree (unless you cut the clone-depth) and one "out" dir for one build.
Memory with 8GB will make you "practice your patience and meditate", that is your bottleneck.

I also have a question to you:
Can you give me a good link to a simple HowTo for pulling odexed apks including vdex files from a firmware and converting them into deodexed apks, for the purpose of pulling a single apk for re-use in a Custom ROM?
I mean explicitly NOT doing this directly on a rooted device (because I wish to reuse the Apk finally).
What I found so far is either targeting the affected device only (I.e. do it directly on the device and re-odex) or from 2013-2015 and therefore no vdex handling.
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
It should work, but this setup tends to the minimum requirements (I know, building android is really demanding hardware resources).
Disk space should be fine, although it will allow mainly one build tree (unless you cut the clone-depth) and one "out" dir for one build.
Memory with 8GB will make you "practice your patience and meditate", that is your bottleneck.

I also have a question to you:
Can you give me a good link to a simple HowTo for pulling odexed apks including vdex files from a firmware and converting them into deodexed apks, for the purpose of pulling a single apk for re-use in a Custom ROM?
I mean explicitly NOT doing this directly on a rooted device (because I wish to reuse the Apk finally).
What I found so far is either targeting the affected device only (I.e. do it directly on the device and re-odex) or from 2013-2015 and therefore no vdex handling.
Sorry, I don't really know how odexing works on ART since Lollipop, never heard about such 'vdex'. I don't really know how to do it with new toolchains, I used to rely on ancient Windows tools to deodex and modify the smali files.

also NFC works partially out of the box, I just beamed a photo from my Galaxy S7 but I cannot beam it back. My amend patch borks it up so I'm going to update it so it doesn't patch the NFC libraries and other unneeded fixes. Turns out your ROM contains NFC patches already.
 
Last edited:

Nightwish1976

Senior Member
Aug 9, 2011
453
67
0
Alright, I found a fix for the apps missing from Aurora/Google Store. It's an XML file that has to be copied to system/etc/sysconfig. It works for me on this ROM.
Source and download link: https://forum.xda-developers.com/showpost.php?p=81021757&postcount=4

---------- Post added at 10:37 PM ---------- Previous post was at 10:33 PM ----------

PS: I can't make the fingerprint reader work on this ROM. When I want to set it up, it just doesn't read my fingerprint. It works on other ROMs, so it's not a hardware issue. Is it the same for you guys, or it's just my phone?
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
Alright, I found a fix for the apps missing from Aurora/Google Store. It's an XML file that has to be copied to system/etc/sysconfig. It works for me on this ROM.
Source and download link: https://forum.xda-developers.com/showpost.php?p=81021757&postcount=4

---------- Post added at 10:37 PM ---------- Previous post was at 10:33 PM ----------

PS: I can't make the fingerprint reader work on this ROM. When I want to set it up, it just doesn't read my fingerprint. It works on other ROMs, so it's not a hardware issue. Is it the same for you guys, or it's just my phone?
The first item will be solved in the next build, @Wattsensi brought me already to it, see our discussion.
Regarding Fingerprint, that works perfectly on my P9.
Again, as I told further above to @Wattsensi, some flashable ZIPs available here on XDA, which target originally other devices, may have unwanted side effects, especially if they even aim at messing around other partitions outside /system - in such a case, the "damage" might even persist, if you reflash the system partition... (In such cases, one would have to go back to Stock)
I don't know your device setup, but I take my device as "reference", because I don't use TWRP on it and I therefore can't and don't flash Zips.
 
Last edited:

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
The first item will be solved in the next build, @Wattsensi brought me already to it, see our discussion.
Regarding Fingerprint, that works perfectly on my P9.
Again, as I told further above to @Wattsensi, some flashable ZIPs available here on XDA, which target originally other devices, may have unwanted side effects, especially if they even aim at messing around other partitions outside /system - in such a case, the "damage" might even persist, if you reflash the system partition... (In such cases, one would have to go back to Stock)
I don't know your device setup, but I take my device as "reference", because I don't use TWRP on it and I therefore can't and don't flash Zips.
I don't see how flashing ZIPs can be harmful to your system, as flashable ZIPs usually just unzip some content into rw-mounted /system and set permissions. Others, like my latest kernel installer, do modify /vendor which makes changes permanent and only can be reverted by restoring a backup or flashing a vendor image from EMUI

The only reason users like Tecalote recommended to stay away form TWRP was because it couldn't handle Huawei's encryption and it couldn't do a proper factory reset on an encrypted device due to some proprietary bits not being present (and will never be) but an unencrypted phone works perfectly with TWRP. This gives the user flexiblity to backup, restore, patch easily and recover from soft bricks very fast thanks to excellent MTP support and the ability to flash images directly.

BTW for users, do not flash anything on top of @MSe1969's ROM. All the needed fixes are integrated and the NFC-patching ZIP was recalled due to incompatibility with EVA hardware even though it activated it in software. I advise you to reflash your system and flash the new amend. A newer phh-based ROM should have working NFC out of the box.

Also I;ve looked at some past posts and to avoid confusion when referring to Pie ROM or vendor you should call the firmware EMUI 8.0, or VNDK 26 (Treble O).
 
Last edited:

Nightwish1976

Senior Member
Aug 9, 2011
453
67
0
@MSe1969: I suspected it was a problem affecting only my phone, but I still had to ask.
Let me ask you something, have you done the decryption/installing TWRP to your phone? You said the GSI installation is similar to the one for Open Kyrin's ROMs which specifically forbid any modifications. In my case, after update to EMUI 8, I installed TWRP and decrypted. Decryption was the point when some anomalies appeared.
I mean we have similar phones, it has to be something I've done that caused a different result.
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
@MSe1969: I suspected it was a problem affecting only my phone, but I still had to ask.
Let me ask you something, have you done the decryption/installing TWRP to your phone? You said the GSI installation is similar to the one for Open Kyrin's ROMs which specifically forbid any modifications. In my case, after update to EMUI 8, I installed TWRP and decrypted. Decryption was the point when some anomalies appeared.
I mean we have similar phones, it has to be something I've done that caused a different result.
Stock ROMs are tightly integrated, you can expect incompatibilities sometimes when you install custom stuff. Can you tell me the exact problem? I have no problems with decryption on phh-based AOSP ROMs.

---------- Post added at 22:48 ---------- Previous post was at 22:15 ----------
I am going to flash clean B550 EMUI 8.0.0, it was very hard to find but I found a mirror on a Russian website
 
Last edited:

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
Stock ROMs are tightly integrated, you can expect incompatibilities sometimes when you install custom stuff. Can you tell me the exact problem? I have no problems with decryption on phh-based AOSP ROMs.

---------- Post added at 22:48 ---------- Previous post was at 22:15 ----------
I am going to flash clean B550 EMUI 8.0.0, it was very hard to find but I found a mirror on a Russian website
@Wattsensi : Yes, on the Russian website - but I ended up a really "weird", but at the end effective way to "update" my ROM (I have it encrypted with the Stock recovery):
I have first flashed the b540 system.IMG via fastboot. (There is the Huawei extractor software with an XDA thread allowing you to extract sparse images from Huawei firmware ZIP files)
It then first OTA updated a very small b540 patch and afterwards it pulled the b550 "delta" OTA (600MB). Now comes the weird part: This update failed, and the Stock recovery tried 3 times to apply, reboot, apply again. Then it booted back to the Android and automatically downloaded the full package (3 GB), and this time all worked. At the end, I had to temporarily flash TWRP for the network patch, could then flash the stock recovery again (extracted from b550) and my build. @Nightwish1976 : When I first flashed my build, I had before flashed the Stock recovery and did a factory reset and a cache wipe with it. After flashing my build (or any other, e.g. Openkirin build), encryption is automatically taking place as part of the first boot. So I do not use TWRP - it is definitely needed to get from Stock Nougat to Stock Emui 8 and finally to patch the Network/Modem/... stuff to use our SIM cards, but once that all is set up, I stick with the stock recovery.
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
I don't see how flashing ZIPs can be harmful to your system, as flashable ZIPs usually just unzip some content into rw-mounted /system and set permissions. Others, like my latest kernel installer, do modify /vendor which makes changes permanent and only can be reverted by restoring a backup or flashing a vendor image from EMUI

The only reason users like Tecalote recommended to stay away form TWRP was because it couldn't handle Huawei's encryption and it couldn't do a proper factory reset on an encrypted device due to some proprietary bits not being present (and will never be) but an unencrypted phone works perfectly with TWRP. This gives the user flexiblity to backup, restore, patch easily and recover from soft bricks very fast thanks to excellent MTP support and the ability to flash images directly.

BTW for users, do not flash anything on top of @MSe1969's ROM. All the needed fixes are integrated and the NFC-patching ZIP was recalled due to incompatibility with EVA hardware even though it activated it in software. I advise you to reflash your system and flash the new amend. A newer phh-based ROM should have working NFC out of the box.

Also I;ve looked at some past posts and to avoid confusion when referring to Pie ROM or vendor you should call the firmware EMUI 8.0, or VNDK 26 (Treble O).
Nothing bad with TWRP in general, I like it very much on my other non-treble builds. But as encryption does not work, I use stock recovery. You've explained, what I said before, in different words - so we are in agreement.
Using TWRP and flashing Zips is not "bad" as such, but as said: Dangerous if, other partitions than /system are modified, as you cannot easily revert. And, I suspect this (I mean: something flashed on top, no matter what) being the root cause of reported issues, if those reported things perfectly work on my device with my setup, and we can exclude HW issues.
 
Last edited:

Nightwish1976

Senior Member
Aug 9, 2011
453
67
0
Hi, guys. Posting to let you know that I wiped everything, went back to EMUI 8 and flashed this ROM on a clean vendor (genuine recovery and encrypted). No big surprise, but my fingerprint problem has disappeared. So it was obviously caused by vendor alterations.
 

NervReaper

Senior Member
May 19, 2015
95
38
18
Hi, guys. Posting to let you know that I wiped everything, went back to EMUI 8 and flashed this ROM on a clean vendor (genuine recovery and encrypted). No big surprise, but my fingerprint problem has disappeared. So it was obviously caused by vendor alterations.
Did you delete your fingerprints or did a factory reset before flash the rom? It's a common issue that firgerprint doesn't work on gsi if you didn't delete them on emui.
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
Hi, guys. Posting to let you know that I wiped everything, went back to EMUI 8 and flashed this ROM on a clean vendor (genuine recovery and encrypted). No big surprise, but my fingerprint problem has disappeared. So it was obviously caused by vendor alterations.
Vendor is not the problem, it's the AOSP-based ROMs being unable to fully access the fingerprint scanner's secure memory. It forgets about them after a factory reset if they aren't deleted. This allows you to accidentally fill your secure memory with ghost fingerprints.

They waste a fingerprint slot and can become a security backdoor by working even if only other fingerprints are enabled. The only way to delete ghost fingerprints is to return to EMUI and delete them from there, because only EMUI can detect those ghost fingerprints.

So, if you use AOSP GSI ROMs, delete all your fingerprints before factory resetting or you will have to flash EMUI to get rid of them ;)
 

xaweryp

Member
Aug 3, 2020
13
0
1
Hi, installed on top of 'clean' P9 AL-10 (B550). Looks like majority works fine, but found 2 minor issues as well:

1. wifi is not connecting if AP is not broadcasting it's name (aka 'hidden SSID')
Steps to reproduce:
1. setup hidden wifi on AP
2. add the wifi on P9 by name, correct encryption method and password
3. P9 does not connect to the AP (does not see it within range)

2. booting from offline charging does not work
Steps to reproduce:
1. turn off P9
2. connect charger (used standard 5v charger)
3. wait for the phone to start offline charging
4. try to turn on the phone while charging (mine got stuck at this step, need to hold power to reboot)