[ROM][Android 8/9/10][Unofficial] LineageOS for Mi-4c/Mi-4s

lizerome

Member
Jun 22, 2020
7
1
0
Thanks a lot for your detailed testing. I'm investigating on these problems, this reply may be updated later.

What I know for now
  • The "force USB quick charging" driver makes USB charging faster (even faster than original charger), but also makes it unable to deep sleep during this period.
  • According to the default core control configs, the big/little cores should be always online (see the value of "/sys/devices/system/cpu/cpux/core_ctl/min_cpus"), but it might also be offlined by thermal engine.
  • Airplane mode or Power saving mode (in "Settings-Battery") may cause it unable to deep sleep. Also, the mobile signal may show 0% for about 1 minute after boot. If you turn on Airplane mode at this time or there is a phone call coming in (even if it shows no signal, it has surely got signal, so phone calls and SMS could come in), the deep sleep mode may not work. WLAN could also affect deep sleep, but the possibility is low after April rom update.
At this point I'm almost certain that discharging the phone to 0% and booting it from there has something to do with this. As I was using my phone I realized that it was on the charger because the battery died on my way home, so I checked the CPU stats. And behold:



Cores are offline, deep sleep is broken. Discharging the battery to 0%, putting it on the charger and booting the phone seems to be a 100% guaranteed way to reproduce the "big cores are offline" issue. Whatever is disabling them gets triggered there, and is never overridden after several hours/days of use until the phone is rebooted.

The deep sleep issue is trickier, quick USB charging temporarily disabling it makes sense (and is a very minor bug, if even that) but there seems to be a way to "break" it permanently similar to the big cores. Some combination of turning radios on or off triggers it, and it stays like that until a reboot. In this case, most likely 21 minutes after I turned the phone on (maybe I switched from mobile data to WLAN or enabled Bluetooth by accident or something similar - I was NOT using USB charging). I'll try messing around with them and see if I can find a way to reproduce the bug reliably.

Edit: Just disabling/enabling WLAN, mobile data, location, bluetooth, battery saver, airplane mode or even the flashlight doesn't cause sleep to stop working, even temporarily. So it's probably a combination of things, or you have to be (un)lucky enough for it to trigger.
 
Last edited:

Paul-DS

New member
Aug 14, 2019
4
1
0
First, thank you so much for making this device live !

I encountered few issues with LineageOS 17:
- As mentioned by @Sebbo06, I had the issue with the back button being triggered without touching it. It happened mostly when charging. The fix "echo 1440000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" didn't fix the issue. I have a bad quality replacement battery, so maybe the problem is coming from there ?
- My disk space was only 15GB, whereas I have a 32GB device. I don't know if it's coming from LineageOS 17 or from Magisk (I saw that a partition dedicated to Magisk was taking ~7GB of disk space). If it's coming from Magisk, is there any other solution to get root permissions ? Or a solution to use Magisk without creating this 7GB dedicated partition ?

Given that I use this device for my daily usage, I couldn't use it with LineageOS 17, so I installed LineageOS 16. I don't have any issue with it for now (using it for few hours only). The only bug I found is the disk encryption that get stuck at "Time remaining 0:00".

I'll order a Green cell battery and try again LineageOS 17 with it.

Don't hesitate to tell me if you need any help on this project, I'm also a developer, and I'd be more than happy to help.

Hi WJXXBSH,
I have sadly a problem with latest version 20200430.
After a little time, the phone closed almost every app after start and went back to home screen.
In the same time the internal vibration sensor clocked like a clock nearly every 1-2 seconds.
After a reboot it works for a while and begins again.

Any hint how to fix this.

Thanks in advanced.
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
First, thank you so much for making this device live !

I encountered few issues with LineageOS 17:
- As mentioned by @Sebbo06, I had the issue with the back button being triggered without touching it. It happened mostly when charging. The fix "echo 1440000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" didn't fix the issue. I have a bad quality replacement battery, so maybe the problem is coming from there ?
- My disk space was only 15GB, whereas I have a 32GB device. I don't know if it's coming from LineageOS 17 or from Magisk (I saw that a partition dedicated to Magisk was taking ~7GB of disk space). If it's coming from Magisk, is there any other solution to get root permissions ? Or a solution to use Magisk without creating this 7GB dedicated partition ?

Given that I use this device for my daily usage, I couldn't use it with LineageOS 17, so I installed LineageOS 16. I don't have any issue with it for now (using it for few hours only). The only bug I found is the disk encryption that get stuck at "Time remaining 0:00".

I'll order a Green cell battery and try again LineageOS 17 with it.

Don't hesitate to tell me if you need any help on this project, I'm also a developer, and I'd be more than happy to help.
Mi-4c has a feature called "edge gesture", which usually cause back action accidentally (so changing the CPU frequency has no relation with it). You could disable it in "Settings-System-Buttons-(the last item)-Edge Gesture". If the problem still happens after disabling edge gesture, it's probably caused by the static electricity (or unstable current) from the charger, try to charge the device with other ways may fix it.
By using "df -h" to show disk space, I got 26GB available in "/data" and "1.8GB" in "/", which are typical values of a 32GB device. I don't use Magisk, so I'm not sure if Magisk could cause this problem. If you just want root access, you could enable addon-su in "Settings-System-Developer settings-Root access".
Disk encryption is not supported on these roms. It's not recommended to use it because of bad I/O performance.
 
Last edited:

Kayoo80

Member
May 18, 2020
13
1
0
Hello Kayoo80. Yes Yoann from Mr Aulas, Olympique Lyonnais :laugh: (Not to get confused I'm just using the username)

The modules are on Magisk. If they disappear have a look at the modules official website. Ainur website is

http://ainuraudio.ru/

Narsil is wide. Sauron a bit more compact.
Thanks Gourcuff ! When you install Narsil or Sauron, do you have an app or access to an equalizer (access it in Spotify for example) ? Iinstalled Narsil and have no app or access to an equalizer. Any advice ?
 

Gourcuff14

Senior Member
Feb 19, 2018
94
4
8
Thanks Gourcuff ! When you install Narsil or Sauron, do you have an app or access to an equalizer (access it in Spotify for example) ? Iinstalled Narsil and have no app or access to an equalizer. Any advice ?
No app it inbeds itself within the system and works accordingly to its set up. In short it is a modification to hardware. It isn't a generic software. It's meant to enhance hardware capabilities. A firmware flash if you like or kernel.

You can install other modules alongside Ainur modules but you may need extra configuration for that setup, example audio modification library allows multiple audio modules to run together.

Have a look at Ainur further if you want to tweak its setup. And read other modules compatibility if there are any guidelines. Otherwise toy with it, see what works for you.
 

Paul-DS

New member
Aug 14, 2019
4
1
0
Mi-4c has a feature called "edge gesture", which usually cause back action accidentally (so changing the CPU frequency has no relation with it). You could disable it in "Settings-System-Buttons-(the last item)-Edge Gesture". If the problem still happens after disabling edge gesture, it's probably caused by the static electricity (or unstable current) from the charger, try to charge the device with other ways may fix it.
By using "df -h" to show disk space, I got 26GB available in "/data" and "1.8GB" in "/", which are typical values of a 32GB device. I don't use Magisk, so I'm not sure if Magisk could cause this problem. If you just want root access, you could enable addon-su in "Settings-System-Developer settings-Root access".
Disk encryption is not supported on these roms. It's not recommended to use it because of bad I/O performance.
Thank you for your quick answer.

I tried again Lineage 17.
I installed it without Magisk, and the disk space seems to be ok now.
Disabling the edge gesture fixed the problem of the back button :good: Is it be possible to disable it by default on the ROM ? If it doesn't bring any value, it will avoid this potential issue for the next users.

It's been 1 day since I installed it, and it seems to be working pretty well.
I just found few other bugs:
- Few unintended restarts. Is there any log that would be interesting for you, to see why it happens ?
- The GPS doesn't seem to work. With Google Maps, I'm correctly located on the map. Even when moving, the location updates correctly. But when I start the "Driving" mode, the location stop being refreshed. I tried with Waze also, and the app says "No GPS available". The Location is correctly enabled on my device, as well as "High accuracy" option.
- When I tried to use my bluetooth headphones, the bluetooth option was constantly stopping/starting just after connecting the device. I found an option "Audio HD: Audio Qualcomm aptX" enabled by default for this device. Disabling it fixed the issue. No problem with my bluetooth speaker (this Audio HD option isn't available).

Thanks !
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
Thank you for your quick answer.

I tried again Lineage 17.
I installed it without Magisk, and the disk space seems to be ok now.
Disabling the edge gesture fixed the problem of the back button :good: Is it be possible to disable it by default on the ROM ? If it doesn't bring any value, it will avoid this potential issue for the next users.

It's been 1 day since I installed it, and it seems to be working pretty well.
I just found few other bugs:
- Few unintended restarts. Is there any log that would be interesting for you, to see why it happens ?
- The GPS doesn't seem to work. With Google Maps, I'm correctly located on the map. Even when moving, the location updates correctly. But when I start the "Driving" mode, the location stop being refreshed. I tried with Waze also, and the app says "No GPS available". The Location is correctly enabled on my device, as well as "High accuracy" option.
- When I tried to use my bluetooth headphones, the bluetooth option was constantly stopping/starting just after connecting the device. I found an option "Audio HD: Audio Qualcomm aptX" enabled by default for this device. Disabling it fixed the issue. No problem with my bluetooth speaker (this Audio HD option isn't available).

Thanks !
For there is someone who likes to use edge gesture, this feature should not be removed. You could disable this feature then disable app "Edge Gesture" (or "Advanced Settings"?) to get rid of it.
There is no random restart happened on my device for a long time. At past, CPU overclock had caused random reboots on some devices, but the CPU frequency has been back to stock in the latest version.
The GPS feature works well in southeast China, nothing wrong happened when using map navigation.
For the bluetooth audio problem, I'm sure it's caused by the aptx libraries "libaptX_encoder.so" or "libaptXHD_encoder.so". I have tested the aptx blobs from another Xiaomi device, though it fixed issues on some headphones, it also broke it on others. If you like, you could download and replace the libraries from this commit.
 
Last edited:

lizerome

Member
Jun 22, 2020
7
1
0
Thank you for your quick answer.

I tried again Lineage 17.
I installed it without Magisk, and the disk space seems to be ok now.
Disabling the edge gesture fixed the problem of the back button :good: Is it be possible to disable it by default on the ROM ? If it doesn't bring any value, it will avoid this potential issue for the next users.

It's been 1 day since I installed it, and it seems to be working pretty well.
I just found few other bugs:
- Few unintended restarts. Is there any log that would be interesting for you, to see why it happens ?
- The GPS doesn't seem to work. With Google Maps, I'm correctly located on the map. Even when moving, the location updates correctly. But when I start the "Driving" mode, the location stop being refreshed. I tried with Waze also, and the app says "No GPS available". The Location is correctly enabled on my device, as well as "High accuracy" option.
- When I tried to use my bluetooth headphones, the bluetooth option was constantly stopping/starting just after connecting the device. I found an option "Audio HD: Audio Qualcomm aptX" enabled by default for this device. Disabling it fixed the issue. No problem with my bluetooth speaker (this Audio HD option isn't available).

Thanks !
In my experience, the 4C's GPS module is a pile of garbage. I've been using this phone regularly for about five years now, and I don't recall the GPS working properly pretty much ever. Whether I was using the official Chinese MIUI rom, the build of xiaomi.eu that came preinstalled on the phone, the official LineageOS builds or some other ROM, it would take 9-10 tries with a GPS testing application to get a proper fix and have it display my location. If I'm using a fitness/running tracking application or Google Maps, it only manages to update the position once every 10 minutes, and the results are usually wildly inaccurate (if I'm walking on a road, it could update itself to a coordinate that is FURTHER BACK than I was originally, then five minutes later show me on a completely different road parallel to the one I was on). Just an anecdote of course, but I doubt that it's caused by this specific ROM, or that it could be fixed by it (unless it worked fine for you before, and your phone has different/better components).

It wouldn't surprise me either if Xiaomi specifically tuned this thing to work in China, and didn't care about anywhere else (the phone technically doesn't even have an official global ROM).
 

corwinux

Member
Apr 17, 2012
13
3
0
androidfilehost.com
In my experience, the 4C's GPS module is a pile of garbage. I've been using this phone regularly for about five years now, and I don't recall the GPS working properly pretty much ever. Whether I was using the official Chinese MIUI rom, the build of xiaomi.eu that came preinstalled on the phone, the official LineageOS builds or some other ROM, it would take 9-10 tries with a GPS testing application to get a proper fix and have it display my location. If I'm using a fitness/running tracking application or Google Maps, it only manages to update the position once every 10 minutes, and the results are usually wildly inaccurate (if I'm walking on a road, it could update itself to a coordinate that is FURTHER BACK than I was originally, then five minutes later show me on a completely different road parallel to the one I was on). Just an anecdote of course, but I doubt that it's caused by this specific ROM, or that it could be fixed by it (unless it worked fine for you before, and your phone has different/better components).

It wouldn't surprise me either if Xiaomi specifically tuned this thing to work in China, and didn't care about anywhere else (the phone technically doesn't even have an official global ROM).
That's weird, i've been using this phone for more than 3 years in Europe, and still using it with lineage, MoKee, /e/ and never had any of those issues with osmand when hiking, cycling, driving and for geocaching.
gps has been working just fine for me.
 

lizerome

Member
Jun 22, 2020
7
1
0
That's weird, i've been using this phone for more than 3 years in Europe, and still using it with lineage, MoKee, /e/ and never had any of those issues with osmand when hiking, cycling, driving and for geocaching.
gps has been working just fine for me.
How fast/accurate would you say it is?

In my case, Xiaomi's own fitness tracking app and Google Maps tend to be more or less functional, but obscure/third party apps like the GPS tester on the Play Store or Pokémon Go are a crapshoot. Pic related is a screenshot from back in 2017 when I was using the official MIUI ROM, and one I took just now. I remember I could get it to work maybe ONCE, by restarting the app a dozen times, clearing the cache over and over again and waiting half an hour. Same with Pokémon Go, it would usually take several minutes of waiting in the middle of the ocean before I could play the game, since it would always report my GPS coordinates as 0,0 at the start.



If I'm using Mi Fit or Google Maps, the actual coordinates are usually off by dozens of meters, and it seems to update really infrequently. The third screenshot above is a recording of me walking in a straight path over the course of two hours without stopping. It's almost like the app updated my position once every 10 minutes, and it picked a completely random point within a 50 meter circle of where I was at the time (which is why it's zig-zagging all over the place, showing me on completely different roads and making it seem like I went backwards at multiple points). It's even more noticeable when I'm biking. I went to the end of a straight 15km bike path, turned back, and cycled back to the starting point. During the entire trip, it updated my position TWICE. Once at the start, and once near the middle of the path, while I was already on my way back. The "route" shown in the activity log was a straight line with two points.

To be fair though, it's entirely possible that different phones have different GPS modules in them (like how some 4Cs have 60Hz screens and some have 75Hz), or I'm just unlucky and got a defective unit. I don't mind it that much, it's just about my only complaint with this phone in terms of hardware (besides the ridiculously scarce storage and RAM on the 2GB model).
 
Last edited:

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
Why in the newest build based on Pie or Q SELinux has been disabled? Any pros, cons?

Thanks!
If you want to get full control of the rom or need root access, selinux should be disabled to avoid troubles. If selinux is enabled, the root access (only the built-in addon-su, magisk is not affected on 17.1) is limited and some operations to the system may fail. If "Root access" is disabled in "Developer options", selinux should be enabled as soon as boot completed (if you see a notification about "selinux is disabled", don't worry about it). You could also check selinux status in "Security center" or using shell command "getenforce".
 
  • Like
Reactions: gregory_cooky

sabbath88

Senior Member
Nov 11, 2010
74
2
0
Hello,
Thank you WJXXBSH for your work.
Is it normal that back button is so sensitive? It happens to me so othen that apps getting closed.
I recorded short video to show how it looks (sorry for noises in backgound). Each time it is happening there is vibration that can you hear. Button is pressed also when I am on desktop (I feel vibration)
https://streamable.com/i44svn
I think it happend me also on some other android 10 custom rom.. on android 7 there was no such a problem.
in TWRP there is fine, no random clicks.
Is it some gesture or something?
my phone is mi4c, lineage-17.1-20200714-UNOFFICIAL-libra.zip, TWRP-20190528-3.3.1.0-libra.img
 

WJXXBSH

Senior Member
Dec 22, 2018
86
56
18
Hello,
Thank you WJXXBSH for your work.
Is it normal that back button is so sensitive? It happens to me so othen that apps getting closed.
I recorded short video to show how it looks (sorry for noises in backgound). Each time it is happening there is vibration that can you hear. Button is pressed also when I am on desktop (I feel vibration)
https://streamable.com/i44svn
I think it happend me also on some other android 10 custom rom.. on android 7 there was no such a problem.
in TWRP there is fine, no random clicks.ypur
Is it some gesture or something?
my phone is mi4c, lineage-17.1-20200714-UNOFFICIAL-libra.zip, TWRP-20190528-3.3.1.0-libra.img
I think your problem is caused by "Edge Gesture", which causes back when double-click the edges of screen. If you don't need this feature (I also found it too sensitive that often causes accidental backs), just disable it in "Settings - System - Buttons - Edge Gesture".
 
Last edited:
  • Like
Reactions: sabbath88

sabbath88

Senior Member
Nov 11, 2010
74
2
0
Thanks so much WJXXBSH that will help me.
Another thing is.. I am trying to set up Family Link for children, but it says that I cannot be set up on this device.
Does anyone have experience with this app? I'm not sure if this is a problem with the custom rom in general or just with this specific build
 

Kayoo80

Member
May 18, 2020
13
1
0
Thanks so much WJXXBSH that will help me.
Another thing is.. I am trying to set up Family Link for children, but it says that I cannot be set up on this device.
Does anyone have experience with this app? I'm not sure if this is a problem with the custom rom in general or just with this specific build
Mine is working without any problem !
 
  • Like
Reactions: sabbath88

gregory_cooky

Member
Mar 31, 2016
6
0
1
I've been using a dictionary with offline license key on Android 7, 7.1 and 9 without problems. After installing your last Build WJXXBSH there's an error that the license key is not for that device :) What is pretty funny. I'm wondering if Android 10 generates different Device ID or there's other answer/solution for that? I'm asking here before I ask dictionary's developer for generating new key again...

Thank you! :cowboy:
 

haytona

Member
Dec 23, 2013
22
8
0
:angel:WJXXBSH:angel:, thank you for your hard and continuing work!

I've been able to update my MI 4C to Android 10! It was part of the journey so my children could watch Disney+ (turns out that it needed to be side loaded anyways however it is up-to-date now).

Can I suggest that the edge gesture fix be added to the #2 post under notes? I also encountered this and was quite confused until finding this thread. I wish I'd found this thread earlier as I hit the system space issue for GApps and after a lot of googling used .gapps-config.txt to remove many pre-installed apps. The font removal is much easier (assuming you don't need those characters).

Thanks again and long live this light weight plastic backed phone! The pixel 4a just might get onto my Christmas list.
 

lousido

Member
Jul 12, 2009
10
1
23
Hello, I have installed the new version 20200812, everything is correct except that the bluetooth is not connected. It may be an error?
Thank you very much for your work WJXXBSH

sorry.
I have already read that it does not work in this version.
Thank you
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone