• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[ROM][8.1/9/10/11][Unofficial] LineageOS for Mi-4c/Mi-4s

Search This thread

lousido

Member
Jul 12, 2009
15
2
Last edited:
  • Like
Reactions: colins

lousido

Member
Jul 12, 2009
15
2
The installation process was the same as on previous occasions:
- I download ROM and Gapps (in this case Lineage- 18.1 20210602 UNOFFICIAL -libra and the NikGapps-core-arm64-11-20210124-signed)
- Reboot in OrangeFox
- I flash the ROM
- Wipes
- I access Mount and click on: System, vendor
- I access Files / System / system / fonts and delete NotoSans CJK
- I access Files / System / system / product / app and delete WebView
- I flash the Gapps
- Wipe
- Reboot
The installation works quite well. It is slow and has some reset hooks. My phone has 2GB RAM and 16GB Storage.
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
The installation process was the same as on previous occasions:
- I download ROM and Gapps (in this case Lineage- 18.1 20210602 UNOFFICIAL -libra and the NikGapps-core-arm64-11-20210124-signed)
- Reboot in OrangeFox
- I flash the ROM
- Wipes
- I access Mount and click on: System, vendor
- I access Files / System / system / fonts and delete NotoSans CJK
- I access Files / System / system / product / app and delete WebView
- I flash the Gapps
- Wipe
- Reboot
The installation works quite well. It is slow and has some reset hooks. My phone has 2GB RAM and 16GB Storage.
Could you try installing the ROM (wipe "/system" first, don't delete anything) without GAPPs?

I wonder if there is something wrong in your GAPPs package. The recovery I'm using is original TWRP, but most TWRP based recovery (like OrangeFox) should not have problem. Also, there is no real "/vendor" partition on Mi-4c, did you change the partition layout at past?
 

faldue

New member
Feb 22, 2018
3
0
I'm not to sure what i'm doing wrong but I'm unable to install the pico version of gapps because there is insufficient space. I tried to roll back to the may version of 17.1 but that doesn't work and i've deleted NotoSans CJK but couldn't find Webview and tried to resize the partition. Any tips on some other major files or things I could delete?
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
I'm not to sure what i'm doing wrong but I'm unable to install the pico version of gapps because there is insufficient space. I tried to roll back to the may version of 17.1 but that doesn't work and i've deleted NotoSans CJK but couldn't find Webview and tried to resize the partition. Any tips on some other major files or things I could delete?
The webview package is in "/system/product/app/", it's recommended to install a new one (or just reinstall itself) before deleting it. The free space left in "/system" is not enough for GAPPs in both 17.1 and 18.1, so no need to downgrade. Repartition might be a effective and permanent solution, but try to delete something first (which is much safer).
 

cstn

Member
Jul 29, 2007
23
2
I tested two functions on some ROMs on my Mi4s device.

1. USB to MIDI port support. (connect to computer as a virtual MIDI keyboard, such as 'MIDI keyboard.apk')
2. Latest Psiphon v324 app to tunnel selected installed apps. (Psiphon have 3 VPN tunnel modes, tunnel all apps, tunnel selected apps, don't tunnel selected apps.)

Some roms have no midi support, though developer options have midi option in usb setting, but it doesn't support actually.

Some unofficial roms can't support psiphon tunnel selected apps, though it seems tunneled in psiphon, but browsers appears connetion error. Tunnel all apps mode is good to use on all rom versions.


lineageos_14.1_20181026_official psiphon [YES] midi [NO]
lineageos_15.1_20190311_unofficial_EOL psiphon [YES], midi [NO]
lineageos_16.0_20200321_unofficial_EOL psiphon [NO] midi [YES]
lineageos_17.1_20210414_unofficial psiphon [NO] midi [YES]
lineageos_17.1_20210512_unofficial psiphon [NO] midi[YES]
lineageos_17.1_20220615_unofficial_EOL (touchsreen_support failed ! )
lineageos_18.1_20210623_unofficial (touchsreen_support failed ! ) (I found this 18.1 rom in androidhostfile.com)

in older roms VPN tunnel modes are OK, but midi sopport failed
in newer roms, VPN tunnel mode are imperfect, but midi is OK.

I really need the midi function support and perfect psiphon VPN tunnel modes.

I feel it's hard to ask to fix the older roms midi (though they runs smoothly and good. Is it possible to make a patch zip to fix midi function ? )
So could you please fix the VPN tunnel bug in 17.1 roms and the incoming 18.1 roms ?

by the way, the last 17.1 EOL rom touchscreen failure is a big problem for users, please fix it.
thanks for your work!
 
Last edited:

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
I tested two functions on some ROMs on my Mi4s device.

1. USB to MIDI port support. (connect to computer as a virtual MIDI keyboard, such as 'MIDI keyboard.apk')
2. Latest Psiphon v324 app to tunnel selected installed apps. (Psiphon have 3 VPN tunnel modes, tunnel all apps, tunnel selected apps, don't tunnel selected apps.)

Some roms have no midi support, though developer options have midi option in usb setting, but it doesn't support actually.

Some unofficial roms can't support psiphon tunnel selected apps, though it seems tunneled in psiphon, but browsers appears connetion error. Tunnel all apps mode is good to use on all rom versions.


lineageos_14.1_20181026_official psiphon [YES] midi [NO]
lineageos_15.1_20190311_unofficial_EOL psiphon [YES], midi [NO]
lineageos_16.0_20200321_unofficial_EOL psiphon [NO] midi [YES]
lineageos_17.1_20210414_unofficial psiphon [NO] midi [YES]
lineageos_17.1_20210512_unofficial psiphon [NO] midi[YES]
lineageos_17.1_20220615_unofficial_EOL (touchsreen_support failed ! )
lineageos_18.1_20210623_unofficial (touchsreen_support failed ! ) (I found this 18.1 rom in androidhostfile.com)

in older roms VPN tunnel modes are OK, but midi sopport failed
in newer roms, VPN tunnel mode are imperfect, but midi is OK.

I really need the midi function support and perfect psiphon VPN tunnel modes.

I feel it's hard to ask to fix the older roms midi (though they runs smoothly and good. Is it possible to make a patch zip to fix midi function ? )
So could you please fix the VPN tunnel bug in 17.1 roms and the incoming 18.1 roms ?

by the way, the last 17.1 EOL rom touchscreen failure is a big problem for users, please fix it.
thanks for your work!
There is also a similar "tunnel selected apps" function in ShadowSocks, which is not work either. I never realized that it's a ROM problem but not the bugs in Shadowsocks, thanks for telling me. I'm currently not sure why this issue happened, so it needs some time to checkout. I remember that the USB MIDI function could be enabled or disabled in kernel config, which should be enabled if it works in 20210512. There are lots of differences between 14.1 (not my ROM), 15.1 and 16.0+, so I could only fix 17.1/18.1 currently.

For the touchscreen issue, I confirm that the touchscreen works properly on my own Mi-4c. However, there is a recent change that disabled some "unused" touchscreen drivers, which might be used on Mi-4s (I don't have this device, sorry for the inconvenience). I have deleted the sources of lineage-17.1 days ago, but it's still able to build a new kernel and modify the existing boot image. I'll upload the new boot image (for both 17.1 and 18.1) to GitHub Releases soon (flash after the ROM).
 
Last edited:

cstn

Member
Jul 29, 2007
23
2
There is also a similar "tunnel selected apps" function in ShadowSocks, which is not work either. I never realized that it's a ROM problem but not the bugs in Shadowsocks, thanks for telling me. I'm currently not sure why this issue happened, so it needs some time to checkout. I remember that the USB MIDI function could be enabled or disabled in kernel config, which should be enabled if it works in 20210512. There are lots of differences between 14.1 (not my ROM), 15.1 and 16.0+, so I could only fix 17.1/18.1 currently.

For the touchscreen issue, I confirm that the touchscreen works properly on my own Mi-4c. However, there is a recent change that disabled some "unused" touchscreen drivers, which might be used on Mi-4s (I don't have this device, sorry for the inconvenience). I have deleted the sources of lineage-17.1 days ago, but it's still able to build a new kernel and modify the existing boot image. I'll upload the new boot image (for both 17.1 and 18.1) to GitHub Releases soon (flash after the ROM).
Glad to hear that and thx, I will check the new patch.

And...in fact, I am using another Mi note3 as my main phone, it runs lineageos official 17.1, the 'tunnel selected apps' mode work good. Hope you get some inspiration from it.
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
Glad to hear that and thx, I will check the new patch.

And...in fact, I am using another Mi note3 as my main phone, it runs lineageos official 17.1, the 'tunnel selected apps' mode work good. Hope you get some inspiration from it.
Different devices (especially when they have different SOCs) might be a valuable reference sometimes, but usually doesn't. The device configs and kernel used by lineage-15.1 and 16.0 on Mi-4c have little relationship (a new branch is imported after lineage-16.0, so the ones in 16.0/17.1/18.1 are similar). Therefore, it might not be a good choice to take reference to the device configs or kernel of Mi-Note-3.

After testing Psiphon for all three proxy modes (for Shadowsocks, the situation is similar), I confirm that "tunnel selected apps" didn't work as you said. However, "not tunnel selected apps" works properly, which might be a mitigation of this problem. The logs I collected during the tests gave me almost no helpful info about this problem. Without knowing which component caused this issue, it might not be fixed easily.

I have uploaded the new kernel to GitHub Releases, you could now have a try on Mi-4s to see if it works.
 
Last edited:

cstn

Member
Jul 29, 2007
23
2
Different devices (especially when they have different SOCs) might be a valuable reference sometimes, but usually doesn't. The device configs and kernel used by lineage-15.1 and 16.0 on Mi-4c have little relationship (a new branch is imported after lineage-16.0, so the ones in 16.0/17.1/18.1 are similar). Therefore, it might not be a good choice to take reference to the device configs or kernel of Mi-Note-3.

After testing Psiphon for all three proxy modes (for Shadowsocks, the situation is similar), I confirm that "tunnel selected apps" didn't work as you said. However, "not tunnel selected apps" works properly, which might be a mitigation of this problem. The logs I collected during the tests gave me almost no helpful info about this problem. Without knowing which component caused this issue, it might not be fixed easily.

I have uploaded the new kernel to GitHub Releases, you could now have a try on Mi-4s to see if it works.
I tested the "not tunnel selected apps" mode after you, and found a weird issue:

When set "not tunnel selected apps" mode, the unselected apps' net traffic go through psiphon, it's OK and work properly.
But the selected apps seems also go through psiphon. Because the selected browser tells the tunneled IP address instead of a direct IP, and slow down some website access speed.

for example, in my region,
"github.com" should be accessed with tunneled.
"baidu.com" should be accessed without tunneled and access speed should be very quick.

When use the selected browser to access github.com, it can't to be accessed. this is right.
When use the selected browser to access baidu.com, it also go through psiphon's tunnel, it can be accessed but accessing speed is very slow. this is wrong.

And I tested the new touchscreen fixed kernel on Mi-4s:

boot-20210624-0a71962.img for 18.1_20210623 works properly, touchscreen fixed.
boot-20210624-0a71962.img for 17.1_20210615_EOL will be stuck at the booting "MI" logo.

I checked the downloaded file is right. and do twice fresh install (factory wipe). it's the same and stuck at MI logo.
 
Last edited:

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
I tested the "not tunnel selected apps" mode after you, and found a weird issue:

When set "not tunnel selected apps" mode, the unselected apps' net traffic go through psiphon, it's OK and work properly.
But the selected apps seems also go through psiphon. Because the selected browser tells the tunneled IP address instead of a direct IP, and slow down some website access speed.

for example, in my region,
"github.com" should be accessed with tunneled.
"baidu.com" should be accessed without tunneled and access speed should be very quick.

When use the selected browser to access github.com, it can't to be accessed. this is right.
When use the selected browser to access baidu.com, it also go through psiphon's tunnel, it can be accessed but accessing speed is very slow. this is wrong.

And I tested the new touchscreen fixed kernel on Mi-4s:

boot-20210624-0a71962.img for 18.1_20210623 works properly, touchscreen fixed.
boot-20210624-0a71962.img for 17.1_20210615_EOL will be stuck at the booting "MI" logo.

I checked the downloaded file is right. and do twice fresh install (factory wipe). it's the same and stuck at MI logo.
The new boot image for lineage-17.1 was not rebuilt from sources, but a modified one with the kernel image from lineage-18.1 (this way works like anykernel and have succeeded before, maybe I should try using anykernel directly to make a flashable zip this time). Unfortunately, I cannot rebuild it again currently as I have deleted all files about lineage-17.1 from my computer, and they're too large to download again.

I have uploaded the new kernel to GitHub Releases page, you could flash it in recovery (for 16.0/17.1/18.1, may also boot on 14.1/15.1 after some modifications to init scripts) just like other custom kernels or ROMs (*.zip). Remember to reinstall the ROM if you want to use lineage-17.1 and have installed the boot image yesterday.
 
Last edited:

cstn

Member
Jul 29, 2007
23
2
The new boot image for lineage-17.1 was not rebuilt from sources, but a modified one with the kernel image from lineage-18.1 (this way works like anykernel and have succeeded before, maybe I should try using anykernel directly to make a flashable zip this time). Unfortunately, I cannot rebuild it again currently as I have deleted all files about lineage-17.1 from my computer, and they're too large to download again.

I have uploaded the new kernel to GitHub Releases page, you could flash it in recovery (for 16.0/17.1/18.1, may also boot on 14.1/15.1 after some modifications to init scripts) just like other custom kernels or ROMs (*.zip). Remember to reinstall the ROM if you want to use lineage-17.1 and have installed the boot image yesterday.
I read the Github Releases page. So, it means the kernel (zip) patch is generally for various rom versions. I downloaded the two files, and checked them have the same MD5sum, they are the same.
It looks like anykernel3 is a good way to adjust such two device (libra/aqua).

I tried the new aqua+libra-AnyKernel3-20210625-0a71962.zip after fresh newly install the lineageos-17.1-20210615-UNOFFICIAL-EOL.zip. It still stuck at MI logo. I tried twice, wait at least 15 mins at MI logo. I think it's stuck.
The new aqua+libra-AnyKernel3-20210625-0a71962.zip works fine with lineage_18.1_20210623.zip

Now I restored back and stay with the 18.1, it's great in my daily use.
Thank you not forgeting Mi-4s users, as an old device, mi4s is great as mi4c.
I don't know if any mi4s user still want to use this lineageos 17.1 EOL, if needed, i will keep testing new kernel patch.
And I will also keep using latest 18.1 on mi4s, if you keep developing and supporting my device.

another thing i want to says is, mi4s fingerprint finally works good in 18.1. anytime the fingerprint will active wheni want to use it to unlock screen.
before, in 16/17.1 roms, the fingerprint didn't read my finger at almost time. just extreme few times suddenly start to read my finger, i don't know in what situatuon it will active, and i can't reproduce the situation again. At least now in 18.1 it looks working fine.
 

cstn

Member
Jul 29, 2007
23
2
Does camera-HAL3-patch-10-libra.zip patch make a difference if using the camera app that comes with this ROM (17.1)? In other words, if I am not really into photography and take only casual photos, do I need this patch i.e. would it make the "auto" pictures better in any way?

Thanks!
this patch add the system camera_api2 support, i don't know if the 17.1 original camera app support camera_api2.
i use hedgecam 2 or fv-5 camera instead of the original camera. these two apps can find api2 support in their settings. if you want a better photo, maybe it worth to try. the api 1 and api 2 can exist together in your system.
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
Does camera-HAL3-patch-10-libra.zip patch make a difference if using the camera app that comes with this ROM (17.1)? In other words, if I am not really into photography and take only casual photos, do I need this patch i.e. would it make the "auto" pictures better in any way?

Thanks!
You don't need to install this patch in most conditions, especially for daily use. This patch is intended to test the Camera API2 features on Mi-4c, and provides the support for Google Camera. It will bring more camera features at the cost of stability (stock ROMs on Mi-4c doesn't enable Camera API2 by default).
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
this patch add the system camera_api2 support, i don't know if the 17.1 original camera app support camera_api2.
i use hedgecam 2 or fv-5 camera instead of the original camera. these two apps can find api2 support in their settings. if you want a better photo, maybe it worth to try. the api 1 and api 2 can exist together in your system.
The prebuilt camera (Snap) actually supports Camera API2 with a new UI. I enabled this hidden feature manually, which only works when API2 is presented (and I never told others about this feature before). However, using some third-party camera APPs is usually a better choice (eg. using some versions of Google Camera to get better image quality).
 

WJXXBSH

Senior Member
Dec 22, 2018
135
75
Xiaomi Mi 4C
Xiaomi Mi Mix 2
I read the Github Releases page. So, it means the kernel (zip) patch is generally for various rom versions. I downloaded the two files, and checked them have the same MD5sum, they are the same.
It looks like anykernel3 is a good way to adjust such two device (libra/aqua).

I tried the new aqua+libra-AnyKernel3-20210625-0a71962.zip after fresh newly install the lineageos-17.1-20210615-UNOFFICIAL-EOL.zip. It still stuck at MI logo. I tried twice, wait at least 15 mins at MI logo. I think it's stuck.
The new aqua+libra-AnyKernel3-20210625-0a71962.zip works fine with lineage_18.1_20210623.zip

Now I restored back and stay with the 18.1, it's great in my daily use.
Thank you not forgeting Mi-4s users, as an old device, mi4s is great as mi4c.
I don't know if any mi4s user still want to use this lineageos 17.1 EOL, if needed, i will keep testing new kernel patch.
And I will also keep using latest 18.1 on mi4s, if you keep developing and supporting my device.

another thing i want to says is, mi4s fingerprint finally works good in 18.1. anytime the fingerprint will active wheni want to use it to unlock screen.
before, in 16/17.1 roms, the fingerprint didn't read my finger at almost time. just extreme few times suddenly start to read my finger, i don't know in what situatuon it will active, and i can't reproduce the situation again. At least now in 18.1 it looks working fine.
Right, the two zip files on 17.1/18.1 release pages are the same, to make new users find the latest kernel easily. Maybe some recent changes broke the compatibility of Android 10 (though the possibility is low), makes it unable to boot on lineage-17.1 ROMs. AnyKernel3 is certainly a good way to install new kernel on any ROMs, many custom kernels also use this way. I'm using lineage-18.1 on my own Mi-4c (for daily use) currently, so this ROM will be kept maintaining.

It's a good news that the fingerprint sensor finally works on Mi-4s (I cannot test this device by myself). I once heard some Mi-4s users complaining about the fingerprint issues on lineage-16.0/17.1 ROMs. However, there are some new changes (1 | 2) related to fingerprint features on lineage-18.1, which may fix these problems (change #1 is also ported to lineage-17.1). Some new changes from AOSP may also fix the issues, with some ways I don't know currently.

I have uploaded a special kernel image for lineage-17.1, which doesn't include some new changes (9214c6d..0a71962) after 20210615. The only difference should be the touchscreen driver (doesn't exist in 20210615), unless I forgot something I did at past. It's also packed with AnyKernel3 (at the same page), you could test this kernel in your free time.
 
Last edited:

cstn

Member
Jul 29, 2007
23
2
The prebuilt camera (Snap) actually supports Camera API2 with a new UI. I enabled this hidden feature manually, which only works when API2 is presented (and I never told others about this feature before). However, using some third-party camera APPs is usually a better choice (eg. using some versions of Google Camera to get better image quality).
i prefer to try the new api2. thanks telling that, a surprise to the prebuilt camera.
 

cstn

Member
Jul 29, 2007
23
2
Right, the two zip files on 17.1/18.1 release pages are the same, to make new users find the latest kernel easily. Maybe some recent changes broke the compatibility of Android 10 (though the possibility is low), makes it unable to boot on lineage-17.1 ROMs. AnyKernel3 is certainly a good way to install new kernel on any ROMs, many custom kernels also use this way. I'm using lineage-18.1 on my own Mi-4c (for daily use) currently, so this ROM will be kept maintaining.

It's a good news that the fingerprint sensor finally works on Mi-4s (I cannot test this device by myself). I once heard some Mi-4s users complaining about the fingerprint issues on lineage-16.0/17.1 ROMs. However, there are some new changes (1 | 2) related to fingerprint features on lineage-18.1, which may fix these problems (change #1 is also ported to lineage-17.1). Some new changes from AOSP may also fix the issues, with some ways I don't know currently.

I'll upload a special kernel image for lineage-17.1 later, which doesn't include some new changes (9214c6d..0a71962) after 20210615. The only difference should be the touchscreen driver (doesn't exist in 20210615), unless I forgot something I did at past. It's also packed with AnyKernel3 (at the same page), you could test this kernel in your free time.
after read the two committed changes, i guess this (about biometric code) take the effect to the fingerprint sensor, or maybe something else changes from aosp like you said.

I will test the kernel for the latest 17.1.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I want to flash this rom on my Mi4C, but cant get it to flash.
    i'm not sure what i do wrong.

    1. I installed the latest official twrp from twrp.me (version 3.1.1.-1).
    2. Downloaded the .zip file lineage-18.1-20210623-UNOFFICIAL-libra from github.
    3. Did a full wipe.
    4. Tried to flash the .zip file.

    The TWRP error is:

    E3004: This package is for device: 4C,libra; this device is .
    Updater process ended with ERROR: 1
    Error installing zip file '/sdcard/rom/lineage-18.1-20210623-UNOFFICIAL-libra.zip'


    It seems like TWRP doesn't know it is a Mi4C or something.
    Can anyone help me?
    Could you try this version of TWRP recovery (3.1.1 is too old)? Also, you need to unlock your Mi-4c with official method and flash the latest firmware before using this ROM.
    1
    You are fast :) .
    I have the phone unlocked with the official method, i'll try those.

    Do I flash the firmware and do a wipe afterwards or flash the firmware and then the rom without a wipe?
    Also do I need to flash the kernel that is on Github separately (aqua+libra-AnyKernel3-20210629-8970622)?
    It's not needed to wipe any partition after flashing the firmware or recovery image. However, a factory reset is needed if you updated from a different custom ROM except my lineage-17.1 . The latest kernel image is optional, which may contain some new kernel changes after the latest ROM release.
    1
    @WJXXBSH
    Thanks for the ROM.
    Right now I'm using your 18.1 Build with mindthegapps.
    Almost everything works flawlessly.
    Only for the GPS, I need to install a third-party app to easily lock the location.
    I was using the GPS Test app to lock. The locking process also very fast using that app.
    Another question, is this build make our mi4c hotter than 17.1?
    Since I'm using this phone as a daily driver, could you help me to make it cooler? really don't need a faster phone, but just a normal phone but cooler. Is there a workaround for that?
    Thanks again for your great job to make this phone still alive.
    The GPS works well in Mainland China, no location or navigation problem happened.

    Theoretically, lineage-18.1 should not be hotter than 17.1, as nothing about performance was changed (both of them use the same kernel). If you prefer a cooler device than high performance, don't enable the "High performance mode" in Battery Settings (if it's disabled, the max frequency of little cores should be 1440MHz rather than 1632MHz). Otherwise, there might be no available way to limit the performance, unless setting the maximum CPU frequency manually with root access. The thermal control mothed used currently is to limit the number of online CPU cores, which may not be efficient enough (but has less affect to performance) like the frequency limit in stock ROMs.
    1
    @WJXXBSH
    Thanks for the ROM.
    Right now I'm using your 18.1 Build with mindthegapps.
    Almost everything works flawlessly.
    Only for the GPS, I need to install a third-party app to easily lock the location.
    I was using the GPS Test app to lock. The locking process also very fast using that app.
    Another question, is this build make our mi4c hotter than 17.1?
    Since I'm using this phone as a daily driver, could you help me to make it cooler? really don't need a faster phone, but just a normal phone but cooler. Is there a workaround for that?
    Thanks again for your great job to make this phone still alive.
    if you do not care about the performance, the "3c all-in-one toolbox" or some app like this may help you, it can toggle almost every core of cpu online or offline manually. even you can manipulate cpu min_max frequency. this can decrease the power consmption and also performence, to get device cooler. (Root access needed)
    1
    Finally got the time to move from the last xiaomi.eu v10.1.1.0 release to lineage-18.1-20210718 . woa, first impressions is smooth.

    Install was however quite annoying. I found some of the pointers in the previous pages, hinting to remove the CJK fonts to get space for GApps.

    I tried installing OpenGApps, and their pico versions won't fit when you just remove the CJK fonts, so you have to dig around trying to find stuff you won't need. I believe i ended up needing about 260mb of free space just to install the pico version.
    Removing the WebView is a bad idea, as the Google setup wizard ends up using it (as far as I can read elsewhere). I experienced a black screen, which made it impossible to finish the setup. When I tried not removing the WebView, then it worked perfectly.
    However I needed to spend way to much time trying to find other stuff to remove. I ended up removing all sorts of LineageOS apps, like the recorder, wallpaper (this obviously made the Trebuchet wallpaper change menu fail), and others - I dont entirely remember all of them anymore.

    Hints to which GApps that will fit for 18.1, and what else to remove than CJK fonts would be nice in the first post. The notes about this seems quite outdated.

    I'm not entirely sure if my battery is just old or if something else is going on. It seems to drain battery very fast, according to the old xiaomi.eu release I was running. However when it turns off, when battery is empty, and I plug it in a charger for 2 seconds, remove the charger and turn it on again, then it claims to have about 60% battery, and it will continue to work for quite some time before dying completely.

    Everything seemed to work perfectly. But, after a few days of use, a few things suddenly stopped working:
    1. The settings menu used to have a search bar at the top, as seen on the following image. However I now just have a blank space of about 1-2cm and then it starts listing the Settings menus.

    2. It seems like the settings generally is missing things. settings -> system feels somewhat empty.
      And clicking on the build number a few hundred times doesn't trigger the developer options menu.
      I believe there should be a settings -> system -> buttons menu, but I cant find it. It generally seems like the "Advanved" dropdown is missing.

    3. Task switcher / recent apps no longer comes up when pressing the recents button. I feel the haptic feedback, so its not the button that is defective.

    4. Pulling down the notification curtain, it no longer shows any notifications. It says
      "No notifications", but I can hear the notification sound when they happen.
      And I can no longer pull it further down to expand the first row of toggles (wifi, phone data, etc).

    5. The power menu (when holding the power button for a few seconds) used to show Google Home and other "smart" apps, and suggest that I add smart devices to be toggled in there.

    I'll try to see if a factory reset will do the trick.

    Update: It did. All is now back to normal. The quetion now is just what I did to **** it up.
    The problem you mentioned should be "Initial setup not finished". That's an old and common problem (exactly, a security feature) of Android. In such situations, you cannot expand quick settings, cannot open recent apps, besides have limited access to Settings. If you deleted too many basic apps from system (exactly, the LineageOS Setup Wizard), the initial setup may fail and cause the problem. For solutions, run the setup again or manually make your device provisioned using shell commands:
    Code:
    settings put secure user_setup_complete 1
    settings put global device_provisioned 1
    OpenGapps is surely a good choice, but you can still try BitGapps or other ones with less disk space requirement. Delete the prebuilt Webview package is an alternative to the font file, but only after installing a new version (or the same version) of Webview to "/data".
  • 12
    DESCRIPTION
    Unofficial LineageOS ROMs for Mi-4c (libra) and Mi-4s (aqua), with base-layer enhancements and performance optimizations.
    Version 15.1/16.0/17.1/18.1 are available for download, version 18.1 are in active development.


    FEATURE
    The following items may not be available for all versions, please use the latest build!
    • Build with user variant instead of userdebug (to reduce image size and improve performance).
    • CPU/GPU is overclocked with optimized voltage/bus-cci and 300 Hz/Jiffies kernel clock frequency. [16.0 +]
    • EAS (sched cpufreq governor from linux-3.18) CPU scheduler implemented. [16.0 +]
    • Full-weight NotoSansCJK fonts included (to display East Asian characters with more font weights).
    • High screen refresh-rate (75 Hz) support for Mi-4c with "Sharp-rsp61322 LCD" screen. [16.0 +]
    • Implement ZRAM with ZSTD crypto algorithm (KSM is used after 20210116) to improve I/O performance on devices with 2GB RAM. [16.0 +]
    • Linux kernel is built by clang-12 toolchains, with Polly + LTO + -Ofast optimization to get better performance. [17.1 +]
    • Pre-dex2oat with everything filter globally (sacrificing space and first-install time to improve efficiency).
    • Remove or disable unnecessary kernel configs and modules, also includes some other optimizations. [16.0 +]
    • Remove unnecessary apps/binaries/libraries/services from Android framework and more. [16.0 +]
    • Signature spoofing support (ready for MicroG, including Chinese translations).
    • User-friendly controller for special features in Settings app (like CPU overclock, Edge gesture and Screen refresh rate). [17.1 +]
    • ...

    STATUS
    Go to GitHub Issues for more details and give me feedback.
    • Working
      • Basic hardware
        • Baseband/SMS
        • Bluetooth
        • Camera/Flashlight
        • IR remote
        • Speaker/Microphone
        • Wi-Fi
      • Extras
        • Camera API2 (with patch) [17.1 +]
        • Edge gesture (in Settings > System > Buttons) [16.0 +]
        • Overclock control (in Settings > Battery > Battery saver and performance) [17.1 +]
        • Screen refresh rate (in Settings > Display) [17.1 +]
    • Not working
      • SELinux permissive [16.0 +]
      • VOLTE (won't fix because of no compatible IMS stacks) [16.0 +]
      • WFD/ScreenCast/MiraCast (depreciated in AOSP after Android 9) [16.0 +]

    DOWNLOAD

    SOURCE

    Thanks to all developers and users (Gah0 | Mortezadadgar | Xiaomi classic dev | ...) who contributed to Mi-4c/Mi-4s (including other devices shipped with MSM8992/8994 SOC) or gave me help!
    6
    TIPS
    Here are some tips which may improve your experience or resolve some problems.
    • Basic quality assurance: I only have one smart phone (3+32GB Mi-4c ×1), so the ROMs here should at least satisfy my daily usage.
      • This project will be kept maintained even after I bought my new mobile phone (8+128GB Mi-Mix-2 ×1) in 2021. My Mi-4c is one of the most meaningful items of my own, it's not easy to leave it behind in the drawer and say goodbye. The new battery and rear cover (thanks to yipinghuang1991) will refresh this old device and make it usable again.
    • Even though the signal icon in status bar shows "No signal" at the first minute after boot, the device is still able to receive SMS and phone calls (so the device does have signal, but the system doesn't admit it at all).
    • If the free space in /system is not enough to install GAPPs, try to delete /system/fonts/NotoSansCJK.ttc to get about 100MB free space (If Chinese/Japanese/Korean is not your main language). Removing the prebuilt Webview packages (about 120MB) after installed another one is also a solution.
    • If you found random reboot on your device with overclock enabled (or just updated to lineage-17.1-20201216 and left overclock option unchanged), please disable this feature to see if this issue is resolved. Go to Settings > System > Battery > Battery saver and performance, enable then disable "High performance mode", and reboot your device. If you are using lineage-17.1-20210209 or newer, it's no need to do such steps after a clean install (as both persist.sys.cpu_overclock and persist.vendor.edge_touch_mode are default to false by default).
    • It's highly recommended to disable system logs to reduce resource consumption (for better performance and privacy), unless you're going to collect system logs. Go to Settings > System > Developer options, and set the value of "Logger buffer sizes" to off.
    • It's not recommended to use SELinux enforcing mode even if it's supported in some builds. Also, please consider the negative effect of I/O performance before enabling disk encryption, unless you really want to.
    • You could download the latest (or nightly) kernel image for Mi-4c/4s (packed with AnyKernel3) on GitHub Releases or AFH. Different from the boot image (boot.img), AnyKernel3 will replace old kernel in device regardless of the ROM version. Therefore, this new kernel image is suitable for lineage-16.0/17.1/18.1, and 14.1/15.1 (may need to modify the init scripts to change CPU scheduler, as interactive has been replaced by sched). For installation, just flash the zip file aqua+libra-AnyKernel3-date-commit.zip in recovery like other custom kernels and ROMs.

    BUILD
    As all source codes and custom changes in my LineageOS ROMs are open-source, you are permitted to build your own ROM or kernel (not only for LineageOS) with my sources for non-commercial purpose.

    There are many documents about how to build custom Android ROMs in Linux/OSX, so I will not post these basic steps here to reduce redundancy. However, there are still some important things which may not be included in other documents. Here are some basic steps about what you should do (using lineage-17.1 as example), you can also take a reference to other tutorials.
    • Install necessary packages
      • There are a number of "necessary" packages listed in most tutorials, but not all of them are needed. Here are the packages you need to install manually on Ubuntu or Debian.
        • Necessary packages: sudo apt install bc bison git gnupg make rsync unzip zip
        • Optional packages: sudo apt install ccache repo
        • It's optional to install and setup ccache to reduce build time.
        • As libncurses5 is needed by some components, you should either install it (not recommend) or make symlinks to libncurses6 (which has been installed by default) like this: libncurses.so.5 -> libncurses.so.6 + libncursesw.so.5 -> libncursesw.so.6 + libtinfo.so.5 -> libtinfo.so.6
    • Sync Android sources
      • You need to download and update your local repo with upstream sources regularly, in order to get new changes as soon as possible (just like other open-source projects).
        • Init repo to current directory: repo init -u https://github.com/LineageOS/android.git -b lineage-17.1 --depth=1
        • Sync all repos and prune unused branches: repo sync --prune
      • If nothing wrong happened, the LineageOS sources have been downloaded to your computer (about 100GB). Here are some commands which might be useful in the future.
        • Show all local changes of your repos: repo status or repo diff
        • Perform any operations to all repos: repo forall -c "xxx"
    • Setup local manifest
      • To sync your Android sources with upstream repos easily, it's recommended to create a local manifest in ./repo/local_manifests/. The local manifest should be a XML file like the following one, any filename is accepted (file: libra.xml).
        XML:
        <?xml version="1.0" encoding="UTF-8"?>
        <manifest>
          <project name="BYZYB/android_device_xiaomi_libra" path="device/xiaomi/libra" remote="github" revision="lineage-17.1" />
          <project name="BYZYB/android_kernel_xiaomi_libra" path="kernel/xiaomi/libra" remote="github" revision="master" />
          <project name="BYZYB/android_vendor_xiaomi_libra" path="vendor/xiaomi/libra" remote="github" revision="lineage-16.0" />
          <project name="LineageOS/android_hardware_sony_timekeep" path="hardware/sony/timekeep" remote="github" revision="lineage-17.1" />
          <project name="LineageOS/android_hardware_xiaomi" path="hardware/xiaomi" remote="github" revision="lineage-17.1" />
        </manifest>
    • Resolve build errors
      • Due to some hacks in my device configurations which are conflict with Android build rules, there might be some build errors if using all my repos directly. To resolve this issue, you need to modify project build/make/manually on your disk. After that, you should be able to prepare the necessary environment for Android build without errors.
        • Setup build namespace only: . build/envsetup.sh
        • Prepare build environment for Mi-4c with a specified build variant (xxx = eng/userdebug/user): . build/envsetup.sh && lunch lineage_libra-xxx
      • If you want to build the ROM in "user" build variant instead of the default "userdebug", more changes are needed to avoid build errors or potential bootloop. The following commands are some ways to build a full ROM.
        • Build full ROM in "user" variant: brunch lineage_libra-user
        • Build full ROM in "userdebug" variant: brunch lineage_libra-userdebug
        • Build full ROM with a specified number of threads (x ≤ physical CPU cores): lunch lineage_libra-xxx && make -jx
        • If you have lunch before, here is the simplest way: m
      • As git patch files are similar to git diff, you can always do these changes manually without using git am xxx.patch && git reset HEAD^ or other shell commands.
    • Kernel build toolchains
      • The kernel supports to be built with gcc-9+ or clang-10+. As Link-Time-Optimization (LTO) for Clang is enabled by default (config: CONFIG_LTO_CLANG), building the kernel with GCC directly will result in build errors. In conclusion, it's recommended to choose Clang as your toolchains for both faster build speed and better performance.
      • As VDSO compat is enabled (config: CONFIG_COMPAT_VDSO), both arm and arm64 toolchains are needed to build the kernel. Clang could handle different cross compile targets easily (thanks to LLVM), but GCC could not. Also, though the kernel sources are compiled by clang, they will be linked by LD (included in GCC toolchains -> Binutils) with LLVM plugins. In conclusion, if the ROM you are building provides legacy gcc-4.9 toolchains, it should be safe to go ahead without installing GCC toolchains or Binutils. Otherwise, you need to install both Binutils and Clang packages in your computer to avoid build problems.
      • If you are using Ubuntu or Debian on your computer, please install the following packages.
        • For Ubuntu or Debian: sudo apt install clang llvm-dev
        • For ROMs without legacy gcc-4.9 toolchains: sudo apt install binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf
      • Then you should be able to build the kernel without modifying build configs.
        • Build kernel image only: make bootimage
        • Build recovery image only: make recoveryimage
    • Apply custom changes (optional)
    2
    Thanks for the fast reply. So it's not possible to disable the pop up without updating to LineageOS 17? It's not a big issue but I want to be sure.

    Technically, yes. We cannot get rid of the pop-ups unless disabling permission review. You may try to decompile framework-res.apk (or generate a RRO overlay to override default configs), find "config_permissionReviewRequired" in "res/values/config.xml" and set it to "false".
    2
    :good: :victory: Finally, my phone do no longer randomly reboots.
    I reduced the speed to around 144k with a root app called "CpuSpeed". Thanks for the important note!

    If CPU/GPU overclock is the reason that caused random reboot (it's surely possible), it means the CPU (or msm8992 SOC) in some devices has different hardware quality than others (just as the screen: only some of them support 75Hz refresh rate, others will stop working). That's why this problem doesn't happens to all Mi-4c/4s (My device doesn't reboot even when overclocking the big cores to 1.8GHz).
    1
    Finally got the time to move from the last xiaomi.eu v10.1.1.0 release to lineage-18.1-20210718 . woa, first impressions is smooth.

    Install was however quite annoying. I found some of the pointers in the previous pages, hinting to remove the CJK fonts to get space for GApps.

    I tried installing OpenGApps, and their pico versions won't fit when you just remove the CJK fonts, so you have to dig around trying to find stuff you won't need. I believe i ended up needing about 260mb of free space just to install the pico version.
    Removing the WebView is a bad idea, as the Google setup wizard ends up using it (as far as I can read elsewhere). I experienced a black screen, which made it impossible to finish the setup. When I tried not removing the WebView, then it worked perfectly.
    However I needed to spend way to much time trying to find other stuff to remove. I ended up removing all sorts of LineageOS apps, like the recorder, wallpaper (this obviously made the Trebuchet wallpaper change menu fail), and others - I dont entirely remember all of them anymore.

    Hints to which GApps that will fit for 18.1, and what else to remove than CJK fonts would be nice in the first post. The notes about this seems quite outdated.

    I'm not entirely sure if my battery is just old or if something else is going on. It seems to drain battery very fast, according to the old xiaomi.eu release I was running. However when it turns off, when battery is empty, and I plug it in a charger for 2 seconds, remove the charger and turn it on again, then it claims to have about 60% battery, and it will continue to work for quite some time before dying completely.

    Everything seemed to work perfectly. But, after a few days of use, a few things suddenly stopped working:
    1. The settings menu used to have a search bar at the top, as seen on the following image. However I now just have a blank space of about 1-2cm and then it starts listing the Settings menus.

    2. It seems like the settings generally is missing things. settings -> system feels somewhat empty.
      And clicking on the build number a few hundred times doesn't trigger the developer options menu.
      I believe there should be a settings -> system -> buttons menu, but I cant find it. It generally seems like the "Advanved" dropdown is missing.

    3. Task switcher / recent apps no longer comes up when pressing the recents button. I feel the haptic feedback, so its not the button that is defective.

    4. Pulling down the notification curtain, it no longer shows any notifications. It says
      "No notifications", but I can hear the notification sound when they happen.
      And I can no longer pull it further down to expand the first row of toggles (wifi, phone data, etc).

    5. The power menu (when holding the power button for a few seconds) used to show Google Home and other "smart" apps, and suggest that I add smart devices to be toggled in there.

    I'll try to see if a factory reset will do the trick.

    Update: It did. All is now back to normal. The quetion now is just what I did to **** it up.
    The problem you mentioned should be "Initial setup not finished". That's an old and common problem (exactly, a security feature) of Android. In such situations, you cannot expand quick settings, cannot open recent apps, besides have limited access to Settings. If you deleted too many basic apps from system (exactly, the LineageOS Setup Wizard), the initial setup may fail and cause the problem. For solutions, run the setup again or manually make your device provisioned using shell commands:
    Code:
    settings put secure user_setup_complete 1
    settings put global device_provisioned 1
    OpenGapps is surely a good choice, but you can still try BitGapps or other ones with less disk space requirement. Delete the prebuilt Webview package is an alternative to the font file, but only after installing a new version (or the same version) of Webview to "/data".