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

Search This thread

Big Dumb Object

Senior Member
May 22, 2020
the "disk quota" change in 20220319 might be the reason
Just to be clear: could this have something to do with the Camera API2 patch I'm using?

And one more little trick: if GApps/MicroG are installed as Magisk module, you don't need to remove NotoSansCJK font to free up space in /system anymore, as well as flashing GApps/MicroG with every ROM update. I picked the MinMicroG-Minimal variant, and it works smoothly.


Senior Member
Dec 22, 2018
Xiaomi Mi 4C
Xiaomi Mi Mix 2
Just to be clear: could this have something to do with the Camera API2 patch I'm using?

And one more little trick: if GApps/MicroG are installed as Magisk module, you don't need to remove NotoSansCJK font to free up space in /system anymore, as well as flashing GApps/MicroG with every ROM update. I picked the MinMicroG-Minimal variant, and it works smoothly.
After the May update, the "cust" partition is used as "vendor" to save more free space in "system". As TWRP doesn't support this partition change, that patch may modify some files in "/system/vendor" instead of "/cust", lead to an unexpected result. You can still extract the patch and copy the files manually (not in recovery).
There's another 100MB in "system" after the partition change, will that be enough for the GAPPs without deleting anything?

Big Dumb Object

Senior Member
May 22, 2020
will that be enough for the GAPPs without deleting anything?
I'm sorry — I've never installed GApps — only MicroG, which is supposedly more lightweight. But I think that with the extra 100MB this should no longer be a problem, considering that NotoSansCJK font is 117MB in size, and removing it was enough in the past.

By the way, I found a draft of a reply to an old complaint of mine that I for some reason didn't post here:
Guess I was able to localize the issue a bit. The app, which most notably ignored the network restrictions, and which I therefore used as my benchmark, operates with a rather uncommon permission DOWNLOAD_WITHOUT_NOTIFICATION. Maybe your ROM can't handle this permission well?
Eventually I just gave up on that, but you might be just curious to hear about my discovery.


Feb 27, 2010
I am using the last version and I have some issues when I turn On Bluetooth, it turns OFF after a few seconds.

Was not having issues a few months ago, anyone has the same issues?


Senior Member
Dec 22, 2018
Xiaomi Mi 4C
Xiaomi Mi Mix 2
I am using the last version and I have some issues when I turn On Bluetooth, it turns OFF after a few seconds.

Was not having issues a few months ago, anyone has the same issues?
Bluetooth works fine on my Mi-4c with lineage-18.1-20220915, it still keeps on after a few minutes. Did you modify the Bluetooth configs in Develper Options, or set the device name to some special ones?


Feb 27, 2010
I have just wiped everything and installed (lineage-18.1-20220915) again and Gapps, didn't change anything or install anything.
After first booting I can't turn on bluetooth ON more than a couple of seconds, before it goes OFF. Also can't see any bluetooth device to pair while trying to stay ON.

Top Liked Posts

  • There are no posts matching your filters.
  • 16
    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.

    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 system. [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 +]
    • ...

    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 +]



    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!
    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.

    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-18.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.
        • sudo apt install bc bison git gnupg make repo rsync unzip zip
    • 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-18.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 version="1.0" encoding="UTF-8"?>
          <project name="BYZYB/android_device_xiaomi_libra" path="device/xiaomi/libra" remote="github" revision="lineage-18.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-18.1" />
          <project name="LineageOS/android_hardware_xiaomi" path="hardware/xiaomi" remote="github" revision="lineage-18.1" />
    • 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 (like LineageOS based projects), 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 (choose one way).
        • Using prebuilt toolchains in Android repo (recommend): sudo apt install libc6-dev libgcc-12-dev
        • Using toolchaings in your distribution: 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)
    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.
    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".
    Problems about v18:
    1) I cannot install Gapps no matter what. I have deleted font files, as well as modified pico. I have 190mb free space in /system. However still face with error 70. For this time, I couldn't pass this.
    2) TWRP rebuilt link has no mirror.
    3) Sometimes I cannot mount /data from TWRP, this is the first time I see this issue. I don't want to change the filesystem to ext4 everytime, since it erases data.

    I have been using this phone (Mi4c/3GB) since 2015 and I always used Cyanogenmod/LOS. So the quality of the roms have been degrading day by day. I'm gonna go back to v14.
    For problem #1:
    The free space in system partition is still not enough since Android 11, even without the full-weight NotoCJK fonts. A possible solution is to install Google Webview before GAPPs, then remove the prebuilt webview package to save another 100MB space. It should be enough for pico GAPPs.

    For problem #2/#3:
    This issue is caused by disk quota, which was introduced last year (reason). Disk quota will not change the file system to another one, so it's still EXT4 (or F2FS) on your device. However, the EXT4 module in this ROM is backported from linux-3.18, which may break the compatibility with the kernel in TWRP. That's why problem #2 happened.
    This feature seems to bring more trouble than advantages, as other users also reported similar problems. As a result, it will be removed in the next ROM update, no "rebuilt TWRP" is needed anymore.
    You could also download the rebuilt TWRP from GitHub Realeses.

    Sorry for the inconvenience of this ROM. After I graduated and went to work last year, the time I spent on this ROM project is much less than before, and may not be able to deal with these things on time. This project is actually in a "maintaining" status, rather than "active development" in the old days.