[GSI][13] LineageOS 20 "Light"

Search This thread

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
640px-Lineage_OS_Logo.png

LineageOS is a free, community built, aftermarket firmware distribution of Android, which is designed to increase performance and reliability over stock Android for your device.
LineageOS is based on the Android Open Source Project with extra contributions from many people within the Android community. It can be used without any need to have any Google application installed. LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.
All the source code for LineageOS is available in the LineageOS GitHub repo. And if you would like to contribute to LineageOS, please visit Gerrit Code Review.

MUST-READ BACKGROUND - Android 13 and the two approaches:
As some of you already know, due to various reasons, @phhusson , who kickstarted the GSI trend and committed to it over the years, is backing out from future development
- there won't be any AOSP 13+ builds or patches directly from him. He did most of the heavylifting for fixing bugs and implementing features, and selflessly supported more than his AOSP GSIs and more than devices he own. For the situation of GSIs today, we owe him a big thank-you.
Since PHH made up his mind, a number of existing builders incl. myself have formed the TrebleDroid organization, with PHH himself helping us in technical issues. TD will forward-port PHH's final patches (v415) onto Android 13 and attempt to fix new issues. This is still a new and ongoing process, but if done right, will have compatibility and feature-completion on par with past PHH-based GSIs.
Meanwhile, I'm aware that at least I myself am not as capable as PHH, and won't be able to look after the myriad of patches and devices, esp. legacy ones (pre-A10). Therefore, inspired by @PeterCxy , I'm taking a different approach - start over from AOSP's generic gsi_* target, add in the minimum amount of fixes needed for my own devices, shaking off much of the legacy burden in the process and making it easier for myself to follow/maintain. This is a radical, selfish approach that by definition won't work for legacy devices anymore, and won't work as well as PHH-based GSIs that you've come to love either. However, I've fixed it up to my own daily-driver standards, and I figured it should still be of use to many. For now, I call this the "light" approach.

Disclaimer:
No flashing instructions will be offered. If you're here in this forum, you should know what you're doing.
No guarantees that everything would work. This is a GSI, bugs are bound to happen.
The selfish nature of this approach means I can and will ignore certain bugs as I see fit. Deal with it or kindly go try something else.

Download:
https://sourceforge.net/projects/andyyan-gsi/files/
Scroll down for the naming rules of variants.
Compressed as .xz archives - extract first.

Stuff on GitHub (builders-only):
Most things should be self-explanatory. Not the cleanest code, but should help if you need some clues.
Thanks to:
  • The LineageOS team - helping me out even when they don't offer GSIs themselves
  • @phhusson - shaped the treble community, and even the "light" approach uses his fixes/infra extensively
  • @PeterCxy - inspired me with his personal-use GSI, and coded critical fixes such as sysbta
  • ...and more
Donate?
https://paypal.me/AndyCGYan
 
Last edited:

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
This post documents my progress on top of the native generic targets.

Already implemented/fixed:
  • Built-in root (PHH-SU)
  • Device overlays
  • Screen resolution & refresh rate - improved upon PHH's implementation
  • Alternative audio policy (Qualcomm)
  • Disable soundvolume effect (Qualcomm)
  • Alternative backlight scale (MediaTek)
  • resetprop/copyprop tool
  • In-call audio
  • BT audio
  • VoLTE on Qualcomm/MediaTek pre-S vendors
  • VoLTE on Qualcomm/MediaTek S vendors - new, backported to PHH-based
  • GAPPS - using MindTheGapps for now
  • Securized - "on-demand" reversible toggle
  • Disable A2DP offload
  • Alternative audio jack detection
  • Signature spoofing - limited to priv-app for the same security reason as in PHH/TD-based
  • Optional FP lockout (set persist.sys.fp.lockouts.disable to true to disable timeout on failed FP attempts)
  • Built-in PHH-SU app for *S variant
  • Override minimum brightness
  • Override navbar availability
  • Exfat
  • In-call audio on Snapdragon 8 Gen 2 (SM8550) and newer Qualcomm devices
To be implemented/fixed at a later time:
  • VoLTE on Motorola Qualcomm S vendors - waiting for T to re-evaluate situation
Known but will not implement/fix:
  • Compatibility with legacy (pre-A10) devices, A-only, VNDKLite
  • FOD/UDFPS (commonly known as in-display fingerprint) - not skilled enough for it and not interested either
  • MediaTek kernel BPF bug (#9)
  • VoLTE on non-Qualcomm/MediaTek vendors
  • Samsung/Huawei oddities
 
Last edited:

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
Notes:
  • I now have a rather taxing day job, and can't devote nearly as much time/effort into this as I did as a student, or even a year ago.
  • No A-only or VNDKLite builds. These are concepts that don't exist natively.
  • GAPPS builds are offered as-is without guarantees. As a Chinese I can't/won't help with GAPPS/SN issues - please help each other out.
  • ADB is intentionally insecure, even on first boot (turned on by default and no authentication needed). GSIs are more fragile compared to device-specific custom ROMs, both on first boot (no-boot issues) and on subsequent boots (after tuning certain Treble settings), and I insist that no-auth ADB is a must-have for debugging and general fail-safe.
  • Signature spoofing (MicroG) is supported, but only for priv-apps. This is a security consideration from PHH.
  • Refer to #9 for explanation/workaround of an MediaTek-specific kernel bug that causes no internet.
 
Last edited:

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
TD-based LOS20 will be offered as well, but at a later date - I've only made a first test build of it today. At its current state though, it doesn't work as well as PHH-based A12 either, so don't get your hopes up too high.
 
Last edited:
  • Like
Reactions: hacker812c

a9381

Member
Oct 1, 2021
41
14
Thank you very much for your great work. I've been waiting for this for a long time.
I ran into a very, very strange bug.
I have a Qin F21PRO (MT6761).
This model has two sub-models:
4GB RAM + 64GB storage
3GB RAM + 32GB storage.
My device is
4GB RAM + 64GB storage
But after flashing this GSI, it is shown that there is only 32GB storage.

edit: after factory reset via twrp, i getting 64GB storage
 

Attachments

Last edited:
  • Like
Reactions: hacker812c

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
There's a known kernel bug in some recent MTK devices that breaks BPF badly, resulting in broken networking features since Android 13, and no-boot since r11 (Google decided to tighten the check). I've reverted the no-boot, but the actual bug can't be fixed from platform-side.
This affects LOS in that it has Restricted Networking Mode turned on by default, and with the bug in place, apps cannot be added to the allow list, resulting in no internet in even system apps.

If you own an MTK device and notice such a thing, as a temporary workaround, you can turn the feature off manually with:
Code:
adb shell settings put global restricted_networking_mode 0
If you're on the gN variant, SetupWizard would also have no internet, so just skip the setup entirely, turn on USB Debugging once you're in the OS, run the above, then re-initiate the setup from the status bar.

As for a more persistent fix - thanks to @Rortiz2 , there's now a way to manually patch the kernel binary, however I no longer have an affected device for testing this. Feel free to try out the patcher here.

There might be other broken networking features that I'm unaware of. In the long term, the one true solution is to upgrade to a newer vendor base, hoping that the OEM has merged the kernel-side fix.
 
Last edited:

redymedan

Senior Member
TD-based LOS20 will be offered as well, but at a later date - I've only made a first test build of it today. At its current state though, it doesn't work as well as PHH-based A12 either, so don't get your hopes up too high.
There is no Navigation key or gesture options, How to do it?, I can install it on my Samsung device but without navigation, no home/back key
 
  • Like
Reactions: hacker812c

AndyYan

Recognized Contributor
Jan 30, 2012
4,684
4,189
Beijing
There is no Navigation key or gesture options, How to do it?, I can install it on my Samsung device but without navigation, no home/back key
Ugh, a Samsung oddity. I didn't implement the force overide switch - if a non-Samsung hits this as well, I might.
If you know how to, try adding "qemu.hw.mainkeys=0" to /system/build.prop. These images are EXT4 unshared blocks, so as long you have verity disabled and root, you should be able to edit/save it.
 
  • Like
Reactions: hacker812c
There is no Navigation key or gesture options, How to do it?, I can install it on my Samsung device but without navigation, no home/back key

Ugh, a Samsung oddity. I didn't implement the force overide switch - if a non-Samsung hits this as well, I might.
If you know how to, try adding "qemu.hw.mainkeys=0" to /system/build.prop. These images are EXT4 unshared blocks, so as long you have verity disabled and root, you should be able to edit/save it.
Same problem with Redmi Note 10 (mojito)
 

redymedan

Senior Member
D
Ugh, a Samsung oddity. I didn't implement the force overide switch - if a non-Samsung hits this as well, I might.
If you know how to, try adding "qemu.hw.mainkeys=0" to /system/build.prop. These images are EXT4 unshared blocks, so as long you have verity disabled and root, you should be able to edit/save it.
Done! I just added "qemu.hw.mainkeys=0" to /system/build.prop and the navigation keys enabled. also in Gesture menu "System navigation" option appeared. It works now on my Galaxy A50, Thanks :)

Other problem: Google Play Protect certified "This device isn't Play Protect certified"

Screenshot_20221024-043719_Settings[1].png
 
Last edited:
Oct 17, 2020
12
0
This is exactly what I was waiting for, it will be fun to test on my old Huawei P smart 2019 with Android 9 vendor so let's see what happens. Any result of this experiment will be shared here.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Updated all variants with May security patches. [Insert obligatory backup-and-test warning here]
    1
    @AndyYan , on my Xiaomi Note 12 4G (https://www.gsmarena.com/xiaomi_redmi_note_12_4g-12188.php) on your GSI images:

    trebledroid-based
    - audio does not work in calls

    lineageos light
    - cannot receive text messages (sending works without issues, including MMS)

    I don't have A2DP offload from phh settings mentioned in common issues here: https://github.com/phhusson/treble_...-fixes#cant-listen-to-anything-on-phone-calls

    on the xiaomi.eu version https://sourceforge.net/projects/xi...i_TOPAZ_V14.0.3.0.TMGMIXM_v14-13.zip/download everything works.

    I've been looking at https://github.com/phhusson/treble_experimentations/issues/976 as well but installing the latest IMS apk or switching to 3G doesn't help :/

    ideally I'd like to fix the LOS light image, what can I do? I'm a devops engineer so able and willing to give you any kind of log to help but I don't know the first thing about Android OS builds.

    edit: ok so my phone service provider did... "something" on their end and now text messages work. it's insane, but they've been bad so I'm not entirely surprised. disregard this then, the LOS light GSI works perfectly well.
    1
    20-20230506-UNOFFICIAL gsi_arm64_vS
    Redmi Note 11
    Perfect!
    Nice work!
    THANKS!
  • 30
    640px-Lineage_OS_Logo.png

    LineageOS is a free, community built, aftermarket firmware distribution of Android, which is designed to increase performance and reliability over stock Android for your device.
    LineageOS is based on the Android Open Source Project with extra contributions from many people within the Android community. It can be used without any need to have any Google application installed. LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.
    All the source code for LineageOS is available in the LineageOS GitHub repo. And if you would like to contribute to LineageOS, please visit Gerrit Code Review.

    MUST-READ BACKGROUND - Android 13 and the two approaches:
    As some of you already know, due to various reasons, @phhusson , who kickstarted the GSI trend and committed to it over the years, is backing out from future development
    - there won't be any AOSP 13+ builds or patches directly from him. He did most of the heavylifting for fixing bugs and implementing features, and selflessly supported more than his AOSP GSIs and more than devices he own. For the situation of GSIs today, we owe him a big thank-you.
    Since PHH made up his mind, a number of existing builders incl. myself have formed the TrebleDroid organization, with PHH himself helping us in technical issues. TD will forward-port PHH's final patches (v415) onto Android 13 and attempt to fix new issues. This is still a new and ongoing process, but if done right, will have compatibility and feature-completion on par with past PHH-based GSIs.
    Meanwhile, I'm aware that at least I myself am not as capable as PHH, and won't be able to look after the myriad of patches and devices, esp. legacy ones (pre-A10). Therefore, inspired by @PeterCxy , I'm taking a different approach - start over from AOSP's generic gsi_* target, add in the minimum amount of fixes needed for my own devices, shaking off much of the legacy burden in the process and making it easier for myself to follow/maintain. This is a radical, selfish approach that by definition won't work for legacy devices anymore, and won't work as well as PHH-based GSIs that you've come to love either. However, I've fixed it up to my own daily-driver standards, and I figured it should still be of use to many. For now, I call this the "light" approach.

    Disclaimer:
    No flashing instructions will be offered. If you're here in this forum, you should know what you're doing.
    No guarantees that everything would work. This is a GSI, bugs are bound to happen.
    The selfish nature of this approach means I can and will ignore certain bugs as I see fit. Deal with it or kindly go try something else.

    Download:
    https://sourceforge.net/projects/andyyan-gsi/files/
    Scroll down for the naming rules of variants.
    Compressed as .xz archives - extract first.

    Stuff on GitHub (builders-only):
    Most things should be self-explanatory. Not the cleanest code, but should help if you need some clues.
    Thanks to:
    • The LineageOS team - helping me out even when they don't offer GSIs themselves
    • @phhusson - shaped the treble community, and even the "light" approach uses his fixes/infra extensively
    • @PeterCxy - inspired me with his personal-use GSI, and coded critical fixes such as sysbta
    • ...and more
    Donate?
    https://paypal.me/AndyCGYan
    9
    There's a known kernel bug in some recent MTK devices that breaks BPF badly, resulting in broken networking features since Android 13, and no-boot since r11 (Google decided to tighten the check). I've reverted the no-boot, but the actual bug can't be fixed from platform-side.
    This affects LOS in that it has Restricted Networking Mode turned on by default, and with the bug in place, apps cannot be added to the allow list, resulting in no internet in even system apps.

    If you own an MTK device and notice such a thing, as a temporary workaround, you can turn the feature off manually with:
    Code:
    adb shell settings put global restricted_networking_mode 0
    If you're on the gN variant, SetupWizard would also have no internet, so just skip the setup entirely, turn on USB Debugging once you're in the OS, run the above, then re-initiate the setup from the status bar.

    As for a more persistent fix - thanks to @Rortiz2 , there's now a way to manually patch the kernel binary, however I no longer have an affected device for testing this. Feel free to try out the patcher here.

    There might be other broken networking features that I'm unaware of. In the long term, the one true solution is to upgrade to a newer vendor base, hoping that the OEM has merged the kernel-side fix.
    7
    This post documents my progress on top of the native generic targets.

    Already implemented/fixed:
    • Built-in root (PHH-SU)
    • Device overlays
    • Screen resolution & refresh rate - improved upon PHH's implementation
    • Alternative audio policy (Qualcomm)
    • Disable soundvolume effect (Qualcomm)
    • Alternative backlight scale (MediaTek)
    • resetprop/copyprop tool
    • In-call audio
    • BT audio
    • VoLTE on Qualcomm/MediaTek pre-S vendors
    • VoLTE on Qualcomm/MediaTek S vendors - new, backported to PHH-based
    • GAPPS - using MindTheGapps for now
    • Securized - "on-demand" reversible toggle
    • Disable A2DP offload
    • Alternative audio jack detection
    • Signature spoofing - limited to priv-app for the same security reason as in PHH/TD-based
    • Optional FP lockout (set persist.sys.fp.lockouts.disable to true to disable timeout on failed FP attempts)
    • Built-in PHH-SU app for *S variant
    • Override minimum brightness
    • Override navbar availability
    • Exfat
    • In-call audio on Snapdragon 8 Gen 2 (SM8550) and newer Qualcomm devices
    To be implemented/fixed at a later time:
    • VoLTE on Motorola Qualcomm S vendors - waiting for T to re-evaluate situation
    Known but will not implement/fix:
    • Compatibility with legacy (pre-A10) devices, A-only, VNDKLite
    • FOD/UDFPS (commonly known as in-display fingerprint) - not skilled enough for it and not interested either
    • MediaTek kernel BPF bug (#9)
    • VoLTE on non-Qualcomm/MediaTek vendors
    • Samsung/Huawei oddities
    7
    Updated all variants with Android 13 QPR1 and December security patches. [Insert obligatory backup-and-test warning here]

    As usual with "feature drops", things can change or break majorly.

    Newly implemented:
    • Disable A2DP offload
    • Alternative audio jack detection
    • Signature spoofing for priv-app (just like in PHH/TD-based)
    • Optional FP lockout (set persist.sys.fp.lockouts.disable to true to disable timeout on failed FP attempts)
    • Built-in PHH-SU app for *S variant

    Rejected:
    • Force headset audio (slightly harder to implement, and not proven effective outside of Huawei)
    • lptools
    7
    Updated all variants with November security patches. [Insert obligatory backup-and-test warning here]

    As teased a few days ago, here's a gN build with MindTheGapps, plus both vN and gN are now "integrally securized", for better chances (but not guaranteed) to pass SN. OP will be updated to reflect these changes.

    A "personal" build has also been uploaded to Testing.

    I'd like to once again remind you that "light" will remain a selfish approach. For other needs e.g. Samsung oddities, please wait for the TD-based batch which I'll make a thread for shortly, see if that would scratch your itch instead.