Development [ROM][12.1][UNOFFICIAL] LineageOS 19.1 for Xiaomi MIX 4

Search This thread

Inkypen

Senior Member
Aug 19, 2018
455
1,373
London
Samsung Galaxy Note 4
Xiaomi Mi 5s
2okPze5.png

LineageOS is a free, community built, aftermarket firmware distribution of Android 12 (S), which is designed to increase performance and reliability over stock Android for your device.

Code:
#include <std_disclaimer.h>

/*
* Your warranty is now void.
*
* We are not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at us for messing up your device, we will laugh at you.
*
*/

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. You will need to provide your own Google Applications package (gapps). LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.

Base source code is available in the LineageOS Github repo. And if you would like to contribute to the project, please visit our Gerrit Code Review.

GPL compliance:
yG18r6g.png


Working:
Almost everything

Broken:
Screen off FOD (Fingerprint On Display)

Downloads:
https://sourceforge.net/projects/xiaomi-odin/files/12/LineageOS
https://sourceforge.net/projects/xiaomi-odin/files/11/LineageOS

Installation:
Reboot to recovery
Copy LineageOS zip to internal storage
Install LineageOS zip package
Install [optional] a Google Apps package of your choice
Format data (wiping is not sufficient, formatting requires you to type "yes")
Reboot

Important notes:
GApps can only be flashed on clean installs.
Formatting data (all user data is wiped, including internal storage) is a must if MIUI was previously installed and device was encrypted.

Contributors
Inkypen
ROM OS Version: Android 12
ROM Kernel: Linux 5.4
Based On: AOSP
 
Last edited:

Inkypen

Senior Member
Aug 19, 2018
455
1,373
London
Samsung Galaxy Note 4
Xiaomi Mi 5s
Official TWRP thread:

TWRP Notes:
Currently the official TWRP has issues installing on custom ROMs. It can be permanently installed on with MIUI but any AOSP based ROM causes it to hang. Until this gets fixed the only way into TWRP is to use the fastboot boot method. Also the official TWRP currently has some bugs (sideload not working, boot slot selection not working, vibration not working) which I have fixed. I've submitted these fixes to the official channels so the next official build should have these problems fixed. My unofficial TWRP build is available here:

Extra Installation Notes:
 
Last edited:
  • Like
Reactions: er453r

WMWLT

New member
Jan 22, 2022
3
1
I've heard that the selfie cam of MIX 4 doesn't work with LineageOS on telegram.Did this bug fixed??
 

er453r

Member
Jan 1, 2012
47
6
@Inkypen I have managed to install this with OpenGapps pico and everything seems to look good - except for SIM cards :p None of the SIM slots are recognized... so uninstalling it now, since I need my phone :) BUT other than that I am super pumped - finally something other than MIUI and my beloved Lineage! Throwing you thank yous via PayPal in a moment :) Keep up the good work!
 

Inkypen

Senior Member
Aug 19, 2018
455
1,373
London
Samsung Galaxy Note 4
Xiaomi Mi 5s
@Inkypen I have managed to install this with OpenGapps pico and everything seems to look good - except for SIM cards :p None of the SIM slots are recognized... so uninstalling it now, since I need my phone :) BUT other than that I am super pumped - finally something other than MIUI and my beloved Lineage! Throwing you thank yous via PayPal in a moment :) Keep up the good work!
Flash it again. I've discovered that if you flash to slot A you won't have SIM cards or sensors working but everything works properly when flashed to slot B. I have a feeling it's related to TWRP, for example it's currently a bit broken and can't be permanently installed on AOSP based ROMs.
 

er453r

Member
Jan 1, 2012
47
6
@Inkypen just tried both B and A (in that order) and still no SIM detected. I am using your TWRP from that thread :/

Also, how to change SELinux status? Lineage Trust app complains about it.
 
Last edited:

shulfei

Member
May 10, 2010
9
0
Great work. Thank you.
Cts profile failed, selinux off. And safety tests not passing.
Any idea how fix it?
 

Inkypen

Senior Member
Aug 19, 2018
455
1,373
London
Samsung Galaxy Note 4
Xiaomi Mi 5s
@Inkypen just tried both B and A (in that order) and still no SIM detected. I am using your TWRP from that thread :/

Also, how to change SELinux status? Lineage Trust app complains about it.
Not sure what is wrong here, or if it's even the same issue I have when flashing to slot A. I'll need logs to investigate. Also you can turn off the SELinux warning in Trust settings.
Great work. Thank you.
Cts profile failed, selinux off. And safety tests not passing.
Any idea how fix it?
CTS profile and Safetynet failures are both related to SELinux. There is a hack to hide SELinux status from Google services but I forgot to add it in (although I did add in the hack for the unlocked bootloader check). It's possible to add the SELinux hack onto a running phone but it's complicated. Good news is I'm wokring on SE policy in order to get it fully enforcing.

Don't try to force enable SELinux to enforcing, your phone will quite likely stop working properly until you set it back to permissive.
 

shulfei

Member
May 10, 2010
9
0
I might be the one user, who is mostly excited with the prospect of leaving MIUI behind. :)
Buti have to ask,what kind of procedure, did you use to flash the LOS-Build? I tried it like the way described but, it did not go well. Btw, i come from MIUI 13.
Reboot phone to fastboot mode.
Boot to twrp (get Inkypen version twrp-odin.img) via command
"""
fastboot boot twrp-odin.img
"""
Wipe all data how wrote Inkypen:
"""
Formatting data (all user data is wiped, including internal storage) is a must if MIUI was previously installed and device was encrypted.
Format data (wiping is not sufficient, formatting requires you to type "yes")
"""
Install LineageOS.
Install gapps arm64.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    New test build is up. It has a new version of minimal gapps installed and it also passes safetynet from clean flash without the need of root or any additional patches or modules. OK Google detection is now working with the screen switched off. Biggest change is a much improved ANX camera experience. There are no more crashes when using certain camera modes, the only thing not working is slow motion. I'm considering making ANX the default camera for all future builds (gapps and non gapps) and I would appreciate any feedback about this change.

    Build is here: https://sourceforge.net/projects/xi...220426-UNOFFICIAL-gapps-anx-odin.zip/download
    3
    New builds are up. Firmware is now included so no need to flash it separately.

    • Erratic proximity sensor fixed
    • Kernel upstreamed to 5.4.195
    • Firmware/vendor blobs updated to MIUI 13.0.6.0

    Some people are having issues updating/sideloading via TWRP, so I made an unofficial build of OrangeFox.

    To install it simply sideload it in TWRP. Occasionally the device won't get recognised when plugged into a PC and it's simple to fix. Go to the mount page in menu options (3 horizontal lines) and toggle MTP off/on.

    Regarding updating the ROM, there seems to be some confusion on how to do it because no recovery is currently able to decrypt A12 data partitions. I mentioned it earlier but there are two ways in which to update.

    • Sideload
    This is the simplest way to update but it seems that TWRP won't sideload some A12 ROMs. If sideload doesn't work then use the OrangeFox linked above.​
    Usage:
    Connect device to a PC and activate ADB sideload mode in recovery​
    In a terminal type : adb sideload rom.zip

    • ADB
    The other method you can try is to use ADB to copy a ROM to the phone and install it directly from the device. Internal storage isn't actually mounted because of encryption, so /sdcard becomes attached to a temporary filesystem in memory.​
    Usage:
    Connect device to a PC​
    In a terminal type: adb push rom.zip /sdcard
    Install zip in directly in recovery from internal storage

    You should replace rom.zip with the filename of the zip you want to flash. Because of the virtual A/B setup on this device it appears that addon.d is no longer functional and this means anything that modifies the system will need to be flashed again once an update is completed, a prime example being Magisk (which you can sideload, no patching boot image is necessary). OrangeFox even prints a helpful message reminding you of this little fact.
    2
    @Inkypen tried it exactly as you said, but the same - network error
    Not an selinux issue then. It's working fine here on LOS and on PE. Go to app info (long press anx icon on launcher and select the "i") clear all storage and try again. If it still doesn't work then I'll need a logcat to try and troubleshoot it.
    OK, got root, problem seemd to be that I was flashed the first patched boot.img that I got from the stock MIUI ROM, I extracted the new boot.img from the latest LOS build, patched and flashed that, now I got root.

    I still have the problem with "Phone Services" constantly accessing location, and also the front camera "hole" seems to remain open all the time.
    Kinda sounds like the issue I had early in development when various things work on one boot slot but not the other. Reboot to recovery and flash MIUI 13 firmware again.

    Also, why does everyone seem to extract and patch the boot image when trying to install Magisk? Why not just sideload it in recovery?

    For future builds the relevant latest firmware will be included in the ROM zip, to avoid all these headaches about firmware version.
    2
    @Inkypen just dirty-flashed the lineage-19.1-20220511-UNOFFICIAL-gapps-odin build and everything that was working still works great :) Two issues already noted in this thread:
    1. ANX downloadable features still do not work for me (I get the "network error" massage)
    2. I have the same proximity issues @0201m reported, and probably had them before all along, just did not notice them (phone can go crazy in the pocket or during a phone call from face touches - I just blamed it on xiaomi hardware :p)
    Very strange, ANX downloadables are working here. Try this sequence to see if it works:
    Enable USB debugging and ADB Root/rooted debugging in developer options
    Connect device to a PC and use a terminal window to enter these commands
    adb root
    adb shell setenforce 0

    This temporarily disables selinux. Try to download ANX features. You can just reboot device to re-enable selinux.

    Also good news, I've managed to fix the erratic operation of the proximity sensor. Fix will be in next update.
    2
    New builds with May security patch are up. ANX camera is now default camera solution. The SE policy rules for ANX have been rewritten and now almost everything is working correctly, including the downloadable features like Panaroma and Document scanner. The only things not working are slow motion video recording and HDR video recording.

    Download links:
    @0201m Thank you for the logs concerning proximity sensor, I'll look into it. The sensor was working correctly on 11 and 12 and I haven't done any major changes to my device tree so something must have changed in 12.1 to cause this. Also I fixed the screen animations to line up with physical buttons so thanks for letting me know about that too ;)
  • 7
    2okPze5.png

    LineageOS is a free, community built, aftermarket firmware distribution of Android 12 (S), which is designed to increase performance and reliability over stock Android for your device.

    Code:
    #include <std_disclaimer.h>
    
    /*
    * Your warranty is now void.
    *
    * We are not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this ROM
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at us for messing up your device, we will laugh at you.
    *
    */

    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. You will need to provide your own Google Applications package (gapps). LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.

    Base source code is available in the LineageOS Github repo. And if you would like to contribute to the project, please visit our Gerrit Code Review.

    GPL compliance:
    yG18r6g.png


    Working:
    Almost everything

    Broken:
    Screen off FOD (Fingerprint On Display)

    Downloads:
    https://sourceforge.net/projects/xiaomi-odin/files/12/LineageOS
    https://sourceforge.net/projects/xiaomi-odin/files/11/LineageOS

    Installation:
    Reboot to recovery
    Copy LineageOS zip to internal storage
    Install LineageOS zip package
    Install [optional] a Google Apps package of your choice
    Format data (wiping is not sufficient, formatting requires you to type "yes")
    Reboot

    Important notes:
    GApps can only be flashed on clean installs.
    Formatting data (all user data is wiped, including internal storage) is a must if MIUI was previously installed and device was encrypted.

    Contributors
    Inkypen
    ROM OS Version: Android 12
    ROM Kernel: Linux 5.4
    Based On: AOSP
    5
    New test build is up. It has a new version of minimal gapps installed and it also passes safetynet from clean flash without the need of root or any additional patches or modules. OK Google detection is now working with the screen switched off. Biggest change is a much improved ANX camera experience. There are no more crashes when using certain camera modes, the only thing not working is slow motion. I'm considering making ANX the default camera for all future builds (gapps and non gapps) and I would appreciate any feedback about this change.

    Build is here: https://sourceforge.net/projects/xi...220426-UNOFFICIAL-gapps-anx-odin.zip/download
    4
    @Inkypen
    So I have been daily-driving lineage-19.1-20220321-UNOFFICIAL-odin.zip for over a week now and here are some things I have noticed:

    • Google Assistant Voice Match is not available (so no "OK Google") - this worked with Lineage 18.1
    • "OK Google" also does not work with locked/off screen (actually that also did not work 18.1... - that is something I miss from my Pixel 2)
    • I have used NikGApps and the security code loop during setup is still present
    • the same - using NikGApps with PixelLauncher loops the PixelLauncher (not a rom isssue, just giving a heads-up) - I have ended up using core apps flavor
    • camera Apps I have found working are some GCam builds, but they all have issues (not all cameras supported, no slow-mo videos, images are not properly scaled for diffirent lenses...) - we really need ANX - even if it means sacrificing some APIs and other cam apps...
    • I can confirm that safety net passes, the banking apps and NFC payments work OK
    • quick wireless charge works OK
    • 120Hz display works OK though I am not sure it is forced all the time
    • bluetooth works with all devices I could throw at it :)

    Other than that everything is nice and smooth :) Using it daily is pure pleasure. Kudos to @Inkypen
    Your first four points are not the fault of the ROM and are all related to the same thing: gapps

    OK Google detection needs Velvet which is only in Nikgapps stock edition and above, which you can't install because as you mentioned Pixel Launcher will crash. I've determined that the security code loop is due to using A12 version of setup wizard.

    Which leads me to the good news, I've found a 12.1 version of gapps that has fixed the setup wizard bug. It's meant to be part of a ROM build and is not suitable for flashing separately, so I'll start releasing gapps builds soon.

    As for ANX, you're in luck. I figured out what to change in the Lineage source code to get the Xiaomi camera stack working and I've successfully made a test build with it integrated. I just need to write selinux policy for it :)

    Screenshot_20220404-001531_Settings.png
    3
    I've been testing out LineageOS 19.0 based on Android 12. If anyone wants to try it out, it's available here:

    READ BEFORE INSTALLING
    **** EDIT ****
    I've uploaded a new build based on 12L and with fixed NFC. Still has same filename so download link is the same.
    3
    New builds are up. Firmware is now included so no need to flash it separately.

    • Erratic proximity sensor fixed
    • Kernel upstreamed to 5.4.195
    • Firmware/vendor blobs updated to MIUI 13.0.6.0

    Some people are having issues updating/sideloading via TWRP, so I made an unofficial build of OrangeFox.

    To install it simply sideload it in TWRP. Occasionally the device won't get recognised when plugged into a PC and it's simple to fix. Go to the mount page in menu options (3 horizontal lines) and toggle MTP off/on.

    Regarding updating the ROM, there seems to be some confusion on how to do it because no recovery is currently able to decrypt A12 data partitions. I mentioned it earlier but there are two ways in which to update.

    • Sideload
    This is the simplest way to update but it seems that TWRP won't sideload some A12 ROMs. If sideload doesn't work then use the OrangeFox linked above.​
    Usage:
    Connect device to a PC and activate ADB sideload mode in recovery​
    In a terminal type : adb sideload rom.zip

    • ADB
    The other method you can try is to use ADB to copy a ROM to the phone and install it directly from the device. Internal storage isn't actually mounted because of encryption, so /sdcard becomes attached to a temporary filesystem in memory.​
    Usage:
    Connect device to a PC​
    In a terminal type: adb push rom.zip /sdcard
    Install zip in directly in recovery from internal storage

    You should replace rom.zip with the filename of the zip you want to flash. Because of the virtual A/B setup on this device it appears that addon.d is no longer functional and this means anything that modifies the system will need to be flashed again once an update is completed, a prime example being Magisk (which you can sideload, no patching boot image is necessary). OrangeFox even prints a helpful message reminding you of this little fact.