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

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
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)
Sadly we have no way to debug this currently
 

md sabuj

Senior Member
Apr 5, 2015
66
4
0
Dhaka
www.facebook.com
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
You can restore B550 firmware via Erecovery
 

md sabuj

Senior Member
Apr 5, 2015
66
4
0
Dhaka
www.facebook.com
Not in every case, I have tried that approach with my device (scroll up a little), but eRecovery wanted to restore the last Nougat version B387 (? don't remember the number exactly), so I stopped and ended up a different path...
For me Erecovery downloaded B550 firmware.
And I also downloaded the B550 firmwar via Huawei Firmware Finder.
 

md sabuj

Senior Member
Apr 5, 2015
66
4
0
Dhaka
www.facebook.com
If it worked that way, this is perfect. This is the easiest and straightforward approach - I just wanted to inform, that it did not work on my device and in that case, it can become tricky.
After restoring the B550 firmware via Erecovery I just downloaded the entire B550 firmware via Firmware Finder to extract the Ramdisk to patch it via magisk and have root access.
After patching the Ramdisk via Magisk i flashed it to Ramdisk partition and it’s worked for me.

I think other partition will work as well.
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
New build with October ASB available

Hi all,
a new build is available for download (install instructions, see OP) - this time, with a couple of improvements, besides the sec. fixes:
https://sourceforge.net/projects/li..._a_lineage16_20201007_system.img.zip/download

  • ASB Security string 2020-10-01
  • Bromite Webview on 86.0.4240.73
  • microG upgraded to 0.2.12.203315 - it includes now the "Exposure notification API" for Covid tracing apps
  • Additional hardening (hardened bionic lib and constified JNI method tables in several system apps)
  • Fixed: WiFi Hotspot is working now
  • Fixed: AuroraStore now finds all suitable apps - thanks @Wattsensi for the hint to the fix

A remark to the upgraded microG:
- If you have location providers configured, you need to re-enable them after flashing the upgrade as a one-time activity.
- The exposure notification API allows you to run Covid tracing apps, which are designed for its use (most apps are)

Happy flashing! Cheers, M.
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
@MSe1969 I managed to build LineageOS 18.0 from a customized manifest, what did you do to make the build smaller than 2.3 GB?
The Huawei P9 cannot accept system images larger than 2080 MB. I tried changing the partition size in BoardConfig.mk already down to 1.6 GB but it still churned out a 2.3 GB image which I cannot flash.
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
@MSe1969 I managed to build LineageOS 18.0 from a customized manifest, what did you do to make the build smaller than 2.3 GB?
The Huawei P9 cannot accept system images larger than 2080 MB. I tried changing the partition size in BoardConfig.mk already down to 1.6 GB but it still churned out a 2.3 GB image which I cannot flash.
I have no specific "secret" - my work is based on Phh and AndyYan. But I can simply add some thoughts, which you may find interesting or you can immediately drop, as they won't apply to your situation:
- my build is Android 9 and yours is Android 11 - newer android versions tend to become larger and larger
- do you include Gapps? If so, make sure - similar to what phh does - to ONLY include the bare minimum (that even means less than gapps pico) and not the "full Google sh*tload"
- if you dex-preopt, keep in mind that this significantly increases the needed space, so rather dex-preopt selected apps or even refrain from it (I have no clue about android 11, so maybe you would have to?)
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
I have no specific "secret" - my work is based on Phh and AndyYan. But I can simply add some thoughts, which you may find interesting or you can immediately drop, as they won't apply to your situation:
- my build is Android 9 and yours is Android 11 - newer android versions tend to become larger and larger
- do you include Gapps? If so, make sure - similar to what phh does - to ONLY include the bare minimum (that even means less than gapps pico) and not the "full Google sh*tload"
- if you dex-preopt, keep in mind that this significantly increases the needed space, so rather dex-preopt selected apps or even refrain from it (I have no clue about android 11, so maybe you would have to?)
Thanks for your answer, I have no GApps in the build, it's just a barebones arm64_avS build. I added WITH_DEXPREOPT := false to the BoardConfigGsiCommon.mk, so it may help. I also noticed that there are some .apex files in /system/apex which together are like 300 MB, just enough to bring down the size to something flashable if I also remove some MediaTek and Qualcomm files. However they also work for essential system functions so I will proceed with caution.

Unfortunately future Android versions for this phone will either have to be Android Go, require repartitioning the phone or just won't be possible. If LineageOS is already this heavy then we probably won't see newer Android versions if repartitioning is not possible.

EDIT: Not possible, will release repartitioning script instead
 
Last edited:

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
I'll try making a repartitioning ZIP in the meantime so it can fit a full build. This device has a really tight system partition not suited for ARM64 and I'll try expanding it to 3 GB just to future proof it.

However it is destructive so it must be done with care
 

Wattsensi

Senior Member
May 13, 2018
221
34
0
Talca
@MSe1969 I repartitioned my phone to have a 3 GB system image, but Fastboot still didn't let me flash. I'll use TWRP's mechanism to flash it instead or as a last resort, dd it into the system partition. Let's see if it is possible via repartitioning, of if it needs to be done other way.

EDIT: ROM doesn't boot, will try phhusson's GSI. It will be investigated, no progress for now. I will try phhusson's AOSP R preview GSI

EDIT: AOSP 11 booted. Doing some tests now. ROM needs to be rebuilt. Will release repartitioning script soon.

EDIT: My source-built GSI doesn't boot, I will have to redo the device tree from scratch, or pick another ROM...will you guys settle for modified AOSP 11 instead? Something in the phh patching stage isn't right for non-pure AOSP ROMs...or maybe it is my usage of Dakkar's script. I will try repo syncing Lineage once more and building it but no promises.
 
Last edited:

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
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')
. . .

2. booting from offline charging does not work
. . .
To #1 - don't have a router allowing me to hide SSID, so can't test - anybody else having that issue?
To #2 - works fine with my device, not able to re-produce. (Also, as mentioned, very difficult to debug this)
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
microG interim update

Hi all,

an interim update of microG GmsCore is available for download here:
https://sourceforge.net/projects/li...llaneous/GmsCore_20201017-signed.apk/download

The apk has been built from the microG source and signed with the specific key of this ROM.
(This means, it cannot be used on any other ROM, except the signed LineageOS 16.0 ROMs for the various devices provided by me)

This update contains the following fixes:
  • GCM sign-in issues
  • Mapbox issues
  • Various improvements of the exposure notification API

There is currently no official new version of microG, but due to some issues, which I have experienced myself in regards to the Covid tracing app and GCM sign-in and which were fully solved after applying the update, I wanted to offer it for those of you, who are interested. To update, simply download the linked apk and install.

Important hint:
The UI has been re-shaped internally. If you start the microG UI and what you see looks "weird" (e.g. Exposure notifications API now shown, or device registration and GCM looking "disabled"), don't panic and DON'T change any settings.
Instead, please go to Settings - apps, pick the microG GMS Core app and purge the app's cache (only the cache, and not the app data!) - Afterwards, all will be fine.

Regards, M.
 

brookie229

Senior Member
Aug 20, 2017
68
7
8
Hi - I've also just tried this ROM from a clean P9 with AL-10 (B550) as the poster above and I have NO mobile connection. WiFi, BT, all work fine (and everything else I've tested) but my SIM card will only show in Slot 2 and only with emergency use. Maybe I'm missing something?

p.s. question: I'm newby at this but can I try another ROM directly over this (ie OpenKirin for P9, or do I have to revert back to the previous EMUI first?
 
Last edited:

zgfg

Senior Member
Oct 10, 2016
4,419
1,899
233
Hi - I've also just tried this ROM from a clean P9 with AL-10 (B550) as the poster above and I have NO mobile connection. WiFi, BT, all work fine (and everything else I've tested) but my SIM card will only show in Slot 2 and only with emergency use. Maybe I'm missing something?

p.s. question: I'm newby at this but can I try another ROM directly over this (ie OpenKirin for P9, or do I have to revert back to the previous EMUI first?
IMO, when you were on b550, you had to flash Network zip patch (single or dual SIM, deprnding on your phone). It installs the patch but not to /system, and the patch should stay with the custom ROM.
That was exactly the case when installing OpenKirin custom ROMs over b535, b540, back at those tines

If you just rebranded to Chinese AL-10 with a clean b550, Network patch was not present

I don't know would it be possible to patch when you are alredy on the custom ROM
 

MSe1969

Senior Member
Dec 16, 2016
1,411
2,575
133
Frankfurt Rhine-Main metropolitan region
How could I install play store and play services. It is possible to flash open gapps va twrp?
This ROM contains some hardening features, which most probably won't work with the genuine Google play services.
If you'd like to try, it is your device, so you decide what you do with it - yes, technically, it should be possible to use TWRP to flash the Gapps.
But I can't give you any prediction for the result, I personally don't recommend it and whatever the result is, I can't help.