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

Search This thread

kundifon

Member
Apr 16, 2019
24
22
I knew it, that won't be that easy. Wow, you are amazing! I appreciate your quick reliable support!
Sure I'm interested, becase this phone probably be at least the famly backup phone, and mother uses another P9 eva (stock rom).

If I compare google account (settings/accounts) on this microG rom to my other GApps phone, here is missing contacts and docs, spreedshets.
I will try with contact sync adapter. Calendar works fine already and gdrive seemt to sync properly.


About location service. I compared app Sygic side by side this and another phone. It cleary shows deviation of about ~60 m to accurete position on the map. May be this device related?


-- Edit --

For now GoogleContactsSyncAdapter is working. In the first attempt it didn't, don't know the reason. Then I do the factory reset (EMUI recovery) to achive working state. (Factory reset didn't remove /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk)

At the moment google maps is working and navigate, but complain that will stop working due outdated google play services.
Ok, I found very good alternative for my oppinion, Here WeGo navigation and would recomend it with this rom. But this app uses text-to-speech for voice guidance. Here we encounter a problem.
Together whith this custom rom come eSpeak preinstalled. Honestly, it's unusable TTS synthesizes speech mechanism. You cannot understand ENG, DEU language at all!! @MSe1969 I recommend you improvement, please replace eSpeak with RHVoice. So we get working ENG speech TTS synthesizer.
Location deviance still persist on my device an have influence by navigation. Any advice from somebody?
 
Last edited:
  • Like
Reactions: MSe1969
At the moment google maps is working and navigate, but complain that will stop working due outdated google play services.
Next ROM release comes with updated (fake) play services version in microG - maybe it helps?

Ok, I found very good alternative for my oppinion, Here WeGo navigation and would recomend it with this rom. But this app uses text-to-speech for voice guidance. Here we encounter a problem.
Together whith this custom rom come eSpeak preinstalled. Honestly, it's unusable TTS synthesizes speech mechanism. You cannot understand ENG, DEU language at all!! @MSe1969 I recommend you improvement, please replace eSpeak with RHVoice. So we get working ENG speech TTS synthesizer.
Thanks for the hint with RHVoice - I'll have a look at it soon.

For the time being, I also have another 'dirty trick', which works quite well, but you need to follow below instructions step-by-step:
- Launch Aurora Store and search "Speech Services by Google"
- Do not simply install it, because we need an older version
- Manually download and install, via "choose version", the version 210354702
- Add the app afterwards to Aurora's block list to make sure, it does never get updated
- Activate it in Settings and download the speech files of your preferred language(s)
- Afterwards, block the network traffic for this app to force 100% offline mode
 
  • Like
Reactions: kundifon

lzyshiki

New member
Oct 2, 2022
3
1
Huawei Nexus 6P
Huawei P9
Great ROM,My P9 got a second life
But a tiny problem here, I swiched off root access in dev.settings, but some apps(like bank apps) still waring my device is rooted,how to hide or how to completly turn off root?
 
  • Like
Reactions: MSe1969
Great ROM,My P9 got a second life
But a tiny problem here, I swiched off root access in dev.settings, but some apps(like bank apps) still waring my device is rooted,how to hide or how to completly turn off root?
Well, the "root detection methods" of the apps vary, and "root" is not necessarily bound to the existence of the 'su' binary, but can also look for other kinds of "device tampering" (e.g. if the Google Safety API is used).
Banking apps are especially bad (if you ask me for my personal opinion, this seems mostly to make the work of security researchers more difficult, as finding loopholes isn't good for the public image - however, spending the efforts to secure the code rather than improving the root detection would be better invested...)

Depending on the specific bank app, there are usually three ways, how a bank app reacts on root detection:
a. A popup is shown at start to warn about root, you click "OK, proceed anyway" and you can fully use the app
b. The app is still usable in display-mode, but you cannot initiate any transfers/payments
c. The app refuses to launch and ends, once you confirm the "root" popup

So this determines the severity of your issue. Coming now to the technical side of your root detection issue:
You could try to flash Magisk (look for an older version, which still ships "Magisk hide"). You could also try the "unroot" / "securize" option in the "Phh Treble app" (I've never tried that, so be prepared to flash the system.img again...).

This ROM in particular, since it's a "treble" build, still uses the Huawei Stock Kernel, so the LineageOS patches to hide the 'su' binary, when root id disabled, aren't present. It further contains some specific hardening features, which for sure will trigger the "SafetyNet" API (in case your app makes use of it).

So if the above options don't help, the only remaining option, I am afraid, is considering e.g. to use the mobile browser to access your bank account or use an alternative 'generic' banking app (if possible), which could at least provide you display-access.
 
  • Like
Reactions: Tecalote
New build with backported November '22 ASB patches available

Hi all,
a new build is available for download (update instructions, see OP):
  • Custom build release 2022-11-01
  • Bromite Webview 106.0.5249.163
  • microG 0.2.25.223616-10
  • F-Droid 1.15.3
  • Timezone data updated to 2022f
Happy flashing!
Regards, M.
 
Last edited:
Corrected Build

Hi all,
I had to push a new build, the download link has been adapted in the OP and the previous post.

In the build provided before, by accident, the "basic" F-Droid version, instead of the full version, had been shipped - this has lead to some issues. (When building F-Droid from source, two APKs are built and I accidentically took the wrong one) Sorry for the inconvenience.
 
Hi,when i need fake gps to work on root mode, it is warning like "disable the selinux",It is possible to force disable it on this rom? thanks
As this is a treble build, your phone still uses the Huawei Stock kernel. If I remember right, the kernel does not allow to switch off SELinux. Nevertheless, you could try a root shell (e.g. via adb) and enter the command setenforce 0.
 

P9_User

Member
Oct 27, 2020
35
5
hi. for my new job I need oultlook calendar app on my P9. bevor I install, can you recommend any slim and safe app? preinstalled calendar does not offer to sync with oultlook, only google.

thnaks in advance.
 
hi. for my new job I need oultlook calendar app on my P9. bevor I install, can you recommend any slim and safe app? preinstalled calendar does not offer to sync with oultlook, only google.

thnaks in advance.
Unfortunately, Microsoft isn't really keen on adhering to any standards, they usually try to force people to exclusively use their proprietary cr*p. Next to searching for info using the search engine of your choice, you could also try the exchange app: Create an e-mail connection with the shipped e-mail app of the type "Exchange". Once that is established, you have an Exchange account with sync options, maybe that will then allow to to calendar syncs too?

Edit: I mean the shipped Exchange APP, which is part of LineageOS...
 
Last edited:
Thanks! The install worked perfectly. However I could not find playstore.
I tried to replace the fakestore.apk with the real one, though it gave me errors even when done with adb su permissions.
Since I still prefer traditional Gapps, so I as usual downloaded the smallest package of OpenGapps and tried to flash it after doing facory reset. While it did uninstall MicroG, it was too big for the system partition.
I tried to partition my system, but Parted on Android was too weird for me to use and I eventually bricked my phone.
Can anyone please release a version with additional system partition space without MicroG?
Or can anyone give repartitioning tips?
Or perhaps I overdid this procedure and could just find an older (which is) smaller package of the smallest gapps to flash and then update? Android 9 is not that old (4 years is not that much to me) though, so the smallest package would not be that small.
Or am I usig the wrong Gapps and should use another gapps package?
Thanks in advance for your help.
 
Thanks! The install worked perfectly. However I could not find playstore.
The ROM comes with AuroraStore, which is a front-end to anonymously access the G* play store

I tried to replace the fakestore.apk with the real one, though it gave me errors even when done with adb su permissions.
It is said to work with microG, but I haven't tested since more than 3 years, so maybe not any more. Make sure to place it under /system/priv-app/phonesky/phonesky.apk and set the permissions and SELinux context properly.

Since I still prefer traditional Gapps, so I as usual downloaded the smallest package of OpenGapps and tried to flash it after doing facory reset. While it did uninstall MicroG, it was too big for the system partition.
If you scroll up a little, there was a similar discussion already - I can't really help here. However, what you *could* try having a look at the last Openkirin build, mount the IMG file (there are instructions online how to do that) and have a look, which G* stuff is part of the build (compare with the contents of the opengapps pico zip - not trivial, but if you understand what the contents of the file are and how flashing works, you should get an idea) - however, this ROM with its hardening measures was never intended to work with Gapps, so you are on your own.

I tried to partition my system, but Parted on Android was too weird for me to use and I eventually bricked my phone.
Good luck with un-bricking.

Can anyone please release a version with additional system partition space without MicroG?
Or can anyone give repartitioning tips?
I leave that question to others - I however do not recommend to mess with the system partition. The Openkirin folks did ship a truly minimal Gapps build, and also you could have a look to the phhusson repo on Github, who deals with GSI builds and is THE expert on that... - There is also a flavor to build a GSI with minimalistic Gapps

Or perhaps I overdid this procedure and could just find an older (which is) smaller package of the smallest gapps to flash and then update? Android 9 is not that old (4 years is not that much to me) though, so the smallest package would not be that small.
Even the opengapps pico flavor is bloated, nevertheless if you take Opengapps, you must use Android 9, arm64 and the flavor of your choice - so only pico, and if that is even too much - see above...
 
The ROM comes with AuroraStore, which is a front-end to anonymously access the G* play store


It is said to work with microG, but I haven't tested since more than 3 years, so maybe not any more. Make sure to place it under /system/priv-app/phonesky/phonesky.apk and set the permissions and SELinux context properly.


If you scroll up a little, there was a similar discussion already - I can't really help here. However, what you *could* try having a look at the last Openkirin build, mount the IMG file (there are instructions online how to do that) and have a look, which G* stuff is part of the build (compare with the contents of the opengapps pico zip - not trivial, but if you understand what the contents of the file are and how flashing works, you should get an idea) - however, this ROM with its hardening measures was never intended to work with Gapps, so you are on your own.


Good luck with un-bricking.


I leave that question to others - I however do not recommend to mess with the system partition. The Openkirin folks did ship a truly minimal Gapps build, and also you could have a look to the phhusson repo on Github, who deals with GSI builds and is THE expert on that... - There is also a flavor to build a GSI with minimalistic Gapps


Even the opengapps pico flavor is bloated, nevertheless if you take Opengapps, you must use Android 9, arm64 and the flavor of your choice - so only pico, and if that is even too much - see above...
Thanks for your help. It is always nice to see people like you who are still working on this phone and giving it the love even though Huawei abandoned it. It really is a shame that they abandoned the European models and even decided to stop providing bootloader unlock codes...
 
Thanks for your help. It is always nice to see people like you who are still working on this phone and giving it the love even though Huawei abandoned it. It really is a shame that they abandoned the European models and even decided to stop providing bootloader unlock codes...
Yes, indeed. And that has happened way before Huawei got targeted by (questionable) US sanctions...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    New build with back-ported January '23 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):
    • Custom build release 2023-01-01
    • microG 0.2.26.223616-16
    Happy flashing!
    Regards, M.
    4
    If someone manage to get working "genue" gapps, please report.

    Yeah bitgapps is fully working folks:giggle::cool:
    3
    I did systematic tryouts and I tried one more. So last attempt was steps following:
    1. I did factory reset with emui recovery
    2. Then I boot into the fastboot (vol down + plug usb cable). Flashed the latest (january) build of this rom. I flashed twrp in same session.
    3. Next I booted in to recovery (power + vol up). So I was in TWRP recovery, perform the steps to clean up microG files.
    4. From TWRP I instaled nikGapps core version via Instal -> select zips. (as many times bevor on others phones). Clean dalvik cache at end.
    I assume this have to lead to same result as manualy copy files as MSe1969 suggest. For me is installer much convinient and faster way as manualy. As I figured out Instal packages up to aprox. 100 mb are small enough, otherwise you are temporarily out of space due unpacking and manually copy could be the only way.
    5. Followed another boot to fastboot (volume down + plug usb cable). I flashed stock emui recovery back to phone.
    6. Next I boot to stock emui recovery (power + vol up). I did all steps for factory reset. Chosed the option "wipe data/factory reset" and then "wipe cache partition".
    7. Finaly boot to the system for first time.

    This was another fail attempt. Play store icon was present but didn't work. It repets notification that play store cannot work without play services. Add a google account in the settings/Accounts was not possible, there wasn't on the list.


    Gapps should be installed immediately after installing LineageOS. Thats well known. https://wiki.lineageos.org/gapps

    If someone manage to get working "genue" gapps, please report.
    Manually copy files would be tricky for me. Set ownership and permissions is beyond my knowledge. I assume that's nothing wrong to instal with installer. It's only easiest way are my guesses.


    Or is this rom just not suitable for gapps in the current state. May I kindly ask member with really deep related knowlage to read this my post. @Tecalote , @zgfg thanks!
    I have three P9-eva phones in family...
    How ever, many thanks to @MSe1969 to providing this rom (in current stage) to make old phone usable again. Yes, you provided great support even though you are not interested in gapps.



    Some related things I figured out.
    If you flash twrp recovery on working rom and then format that you remove encrption. This leads you in ugly boot loop. You get working rom back, but you have to flash stock emui recovery back. Then do factory reset. You can boot to system, phone encrypts again.
    Hi ..

    I was able to install Play Store manually following the explanation post ..

    But you need to understand that after you have installed google services, you have another problem, your phone it's rooted and some apps like , Whatsapp, Edge Broser .. and others .. can not be installed, because system is rooted ... So you need to install other app like Magisk to hide rooted phone, but to rme it's impossible to hide all .. so at the end i prefer to use the MicroG distro as normal, and install the apps from Auroa App ...

    If you need you can install manually, Google contacts/calendar Sync ... ( easy process) but you need to connect phone to computer, install drivers, etc ( and copy 2 folfers in /system/app) .. i do not know if is possible to make it with twrp ..
    Now my contacts are synchronized from my account without problems .. Whatsapp, Edge etc .. are installed from Aurora and working perfectly .. Now i am happy with my Huawei P9 ... ;).

    That's why I think it's best to keep the distribution as it is without installing Google services.
    3
    Do you maybe have an Idea, how to keep working GoogleContactsSyncAdapter.apk without factory resset ??
    Some remarks and observations are here https://forum.xda-developers.com/t/...0-for-huawei-p9.4078383/page-32#post-87954803
    Just for understanding: What drives the necessity for the factory reset?
    The fact that you want to temporarily flash TWRP? Or any other reason?

    Because if we only talk about the Calendar and Contact sync apk files to be added, this could also be achieved by the following command sequence, when you have booted up LineageOS (assuming you have enabled adb and root in dev. options and phone is connected to your PC and the two apk files are in the directory on your PC, from which you initiate the adb connection and 'adb devices' returns that your device is connected):
    Code:
    adb root
    adb remount
    adb shell mkdir -p /system/app/GoogleCalendarSyncAdapter/
    adb shell mkdir -p /system/app/GoogleContactsSyncAdapter/
    adb push GoogleCalendarSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter/
    adb push GoogleContactsSyncAdapter.apk /system/app/GoogleContactsSyncAdapter/
    adb reboot

    I haven't tried myself due to obvious reasons, but the above would avoid the necessity to temporarily flash TWRP.
    3
    @MSe1969 thank you so much, what a great rom! Brought P9 back to live!

    All is working for me, DAVx5 is great! The one last thing I would like is to have Whasapp backup working (google drive). Any tips on how to make that happened (if at all feasible)?

    Standalone application Google drive works. That you cannot backup What's up things to gdrive seems to be microG related fault. (See my post above yours) For instance I use Noteblock and cannot backup to gdrive either.

    I assume you are using DAVx5 for contact sync with gmail/google. How is it?
    I tryed GoogleContactsSyncAdapter. Works reliable. But every time you install it, factory reset is neccessery to work. Then every time you flash new buid of this rom, you have to reinstal the GoogleContactsSyncAdapter (and do neccessery factory reset).


    Yes, I totaly agree that this custom rom provided by @MSe1969 is really great rom, finetuned and fast. It's very triky to find all app alternatives and do workarounds due lacking genue google services. Sometimes isn't possible on the way we are used to. Or you just have to come to terms with the fact that this is simply not possible!
  • 23
    This thread is dedicated to provide Lineage-OS 16.0 builds with microG included for the HUAWEI P9 with current security patches.

    It is a treble build, therefore it could also work on other devices, but I haven't tested. And yes, the camera works!
    (Although it is based on the work of phhusson's GSI builds, some specific adaptations have been made, so I guess, it is worth a try for further Huawei devices based on EMUI 8, but that's it...)

    Features of this ROM
    Download here
    • Pre-installed microG and F-Droid like the LineageOS for microG project (own fork)
    • Pre-installed AuroraStore
    • Root included (switch on in dev. settings)
    • eSpeakTTS (FOSS TTS engine)
    • Backported Audio balance (accessibility settings) from Android 10
    • Additional security hardening features listed below
    • Access to /proc/net blocked for user apps
    • Bundled netmonitor app to allow network monitoring
    • Enhanced Privacy Guard: Switches for motion sensors and other sensors
    • Cloudflare as default DNS (instead of Google)
    • Privacy-preferred default settings
    • Optional blocking of Facebook- and Google-Tracking
    • Optional disabling of captive portal detection
    • Firewall UI
    • No submission of IMSI/phone number to Google/Sony when GPS is in use
    • Default hosts file with many blocked ad/tracking sites
    • Privacy-enhanced Bromite SystemWebView
    • Additional restrictions for secondary users
    • Increased password length
    • Hardened bionic lib and constified JNI method tables
    • Huawei Stock Camera

    Current release levels
    Custom build release 2023-01-01
    Security string: 2022-01-01
    AOSP tag: 9.0.0_r46
    Bromite System Webview: M108


    Source-code and build instructions
    Device config.: https://github.com/lin16-microg/device_phh_treble/tree/lin-16.0-eva-p9
    Build manifest: https://github.com/lin16-microg/local_manifests/tree/lin-16.0-treble


    Installation Instructions

    YOU ARE RESPONSIBLE SOLELY YOURSELF FOR ANY ACTIONS YOU DO WITH YOUR DEVICE !!!

    Please note - I won't explain any single aspect (e.g. how to install 'fastboot' on your PC or troubleshoot USB connectivity issues under Windows). Search the net and consult the search engine of your choice or look here in XDA, there is plenty of information available.

    Pre-Requisites
    • Have fastboot and adb installed on your PC and make sure, you can connect via USB to your device in fastboot mode and via adb
    • Know the key combinations to get your phone into fastboot mode and recovery mode
    • An unlocked bootloader
    • EMUI 8.0 firmware
    • Have the Huawei Stock recovery installed (not TWRP)

    ONLY, If the above pre-requisites are met, download and unpack the linked ZIP file, and flash the .img file via fastboot (EMUI 8.0 is the tricky pre-requisite - see further below).
    • Get your device into fastboot mode and connect to your PC via USB - the screen should look like below, indicating "PHONE Unlocked"
      P9_fastboot.png
    • Flash the ROM with the command fastboot flash system <name of the rom img file>.img
      fastboot-flash.png
    • Afterwards, enter the command fastboot reboot
    • Hold Power+Vol.Up to get into the Stock recovery:
      p9_stockRecovery.png
    • Choose the option "wipe data/factory reset"
      Don't 'panic' if the operation stops at a percentage significantly lower than 100% and you see a red exclamation mark, all is fine
    • Next, choose "wipe cache partition"
    • Finally choose "reboot system now"

    Some hints:
    • If you come from an EMUI 8.0 stock ROM or a different treble build (which means, you are already on EMUI 8.0), don't forget the factory reset as described.
    • If you update one of my builds from this thread, you don't need to wipe anything, so you can skip everything after the 'fastboot reboot' step!
    • On some (but not all) PCs, you may have to run fastboot as Admin (Windows) or root/sudo (Linux)

    If the above pre-requisites are NOT met, you will have some extra-rounds to perform, until you get there:
    Unlocked Bootloader
    Huawei has stopped providing unlock keys, so if you haven't got one, this thread, this link and/or of course the search-engine of your choice may be helpful. I was lucky enough to obtain an official unlock key on the last day of HUAWEI's unlock page, so I have no experience with the unofficial unlock methods - good luck!

    EMUI 8.0 firmware
    Get back to Stock ROM, if you use a Custom ROM. On Stock, if not yet done, apply all updates offered to you by the Stock ROM updater, until you are on the latest officially offered Android 7 (Nougat) EMUI 5.x release.
    Huawei has shut down however their update servers for older devices and older software releases, so this may become difficult, if you are e.g. still on Android 6 - I don't have a good advice for you in this case.
    Once you are on Android 7 (aka Nougat), please visit this thread, which really explains step-by-step, what needs to be done. Really carefully read everything and follow ALL the steps, especially, don't forget at the very end to flash the Stock EMUI recovery!
    IMPORTANT UPDATE:
    The linked thread, as well as the Openkirin documentation point - via a Russian firmware site - to the domain 'hicloud.com' for the firmware download, which seems to be down. As suggested by @zgfg you can try either
    his Mega link or e.g. https://androidhost.ru/search.html
    Update: See this post to obtain the firmware!
    Update 2: See also here

    You need your unlock key handy: During this process, the bootloader will be automatically locked several times, so you need the key a couple of times to unlock again!
    A hint for Linux users: The HWOTA tool is in fact a windows wrapper around Linux shell scripts, so there is no real need to use Windows, if you have a working Linux installation (however, make sure to replace the 'mkdir' commands in hwota_eng.sh with 'mkdir -p').


    Android 10, 11, 12 or 13 builds?

    Simple answer: There won't be any coming from my end (my aim is to provide daily-driver capable builds and not to boot an experimental GSI with lots of issues and a non-working camera) - so stop wasting everybody's time by repeatedly asking!


    Bug reports:
    If you have a problem, please create a post with these informations:
    Build Date:
    And try to get log as described here
    Please note that I can't and won't support issues with builds using a different kernel or Xposed.
    In regards to microG, I will try my best to help when it is related to this ROM (I use it myself), but any questions of the type "the YXZ-app can't do <some sort of fancy xyz Google functionality> properly" are better asked in the respective microG forums.

    Credits
    AOSP project
    LineageOS project
    openkirin.net
    phhusson
    AndyYan
    Tecalote
    microG project
    Graphene OS project
    csagan5 (Bromite)
    WhyOrean (Aurora)
    zgfg (for very helpful contributions in this thread)


    XDA:DevDB Information
    [ROM][Treble][microG]LineageOS 16.0 for HUAWEI P9, ROM for the Huawei P9

    Contributors
    MSe1969
    Source Code: https://github.com/lin16-microg/device_phh_treble/tree/lin-16.0-eva-p9

    ROM OS Version: 9.x Pie
    ROM Kernel: Linux 4.x
    ROM Firmware Required: EMUI 8 firmware
    Based On: LineageOS

    Version Information
    Status:
    Stable
    Stable Release Date: 2023-01-07

    Created 2020-04-06
    Last Updated 2023-01-07
    8
    New build with backported July '22 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):
    • Custom build release 2022-07-01
    Happy flashing!
    Regards, M.
    6
    New build with back-ported January '23 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):
    • Custom build release 2023-01-01
    • microG 0.2.26.223616-16
    Happy flashing!
    Regards, M.
    5
    New build with May 2020 ASB

    Hi all, a new build is available for download:
    https://sourceforge.net/projects/li..._a_lineage16_20200508_system.img.zip/download

    To install, download, unzip and follow instructions as outlined in OP.
    The build has the following features:
    • Sec. string 2020-05-01
    • Bromite Webview on 81.0.4044.127
    • AuroraStore updated to 3.2.8
    • Fix of bundled 'netmonitor' app not starting

    Regards, M.
    5
    New build with backported September '22 ASB patches available

    Hi all,
    a new build is available for download (update instructions, see OP):

    • Custom build release 2022-09-01
    • Bromite Webview 104.0.5112.91
    • microG 0.2.24.214816-30
    • Contacts app slightly 'de-Googled'
    Happy flashing!
    Regards, M.