• If you are experiencing issues logging in, we moved to a new and more secure software and older account passwords were not able to be migrated. We recommend trying to reset your password, then contacting us if there are issues.
  • Nearly done! Migration cleanup is mostly done. There are a small number of issues left that we continue to work on, but all the heavy lifting is done. We still would love to hear feedback over at this thread and also check out the new XDA app! Thanks and we hope you enjoy the new forums, and thanks for your support of XDA <3

[ROM][TREBLE] Project Treble for Xiaomi Redmi 4A &amp; 5A [UNIFIED]

33bca

Recognized Developer
Jun 5, 2013
892
3,615
93
Basel

Code:
#include <std_disclaimer.h>
/*
 * Your warranty is now void.
 *
 * We're 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 TREBLE
 * SUPPORT 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.
 *
 */
What is Project Treble:
Project Treble basically partitions your device into two separate partitions, a system and a vendor: system contains your generic system image, while vendor partition has your device specific files required for booting and running your phone. This way we can easily change the system image and be able to run our device on different system images with the same kernel and vendor partition
Read more about Project Treble

What's a GSI?:
A GSI literally means Generic System Image. It is a general system image meant for no specific device. Treble enabled devices have the capability to run a GSI. You can find a GSI here: Phh-Treble

Xiaomi Redmi 4A hardware vs Treble implementation:
Our Redmi 4A is an A-only device. This means that regarding the GSI images (GSI = Generic System Image) to be used, you need to get ARM64 and A-Only system images​

How to report bugs:
Logcat, a simple description of the bug, kmsg or dmseg depending on the bug​

What's Packaged in the zip:
A boot image (kernel)
A compressed vendor image (cust partition)​

How to use:
  • Reboot to recovery (Custom TWRP recovery for Redmi 4A - Direct link)
  • Format /system, /data and /cache
  • Install Treble flashable zip package (Project Treble flashable for Redmi 4A - Direct link)
  • Install the GSI system image you wish to use (How to flash a Generic System Image (GSI) on Project Treble supported devices - Direct link)
  • Reboot
Important notes:
  • Current minimal * required * firmware version is MIUI 8.3.29 Global dev, otherwise installation could have issues. Download the latest dev fastboot package directly from Xiaomi and flash it prior to installing LineageOS or, alternatively, download and install one of the latest custom packages containing firmware only (at your own risk).
  • 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.

Screenshots:


Broken:
  • WIFI MAC address gets randomly generated (only once, you will keep the same as long as you are on LOS)
  • Encryption (format data or remove encryption when coming from a non-treble rom)
  • Sepolicy is still permissive
  • Nothing else? Otherwise please report it!

Working:
  • Camera (and flashlight)
  • WiFi
  • Bluetooth
  • Telephony (Calls and Data)
  • Audio (Record and Playback)
  • Video Playback
  • Sensors
  • GPS
  • VoLTE (AOSP doesn't have the needed patches to get it working, but most other GSIs have them)

Credits & collaborations:
This work is due to efforts from RedmiDevs founding members that did the full device bring-up. Huge thanks to @xboxfanj for all the help during that bring-up.
Finally, all RedmiDevs & LineageOS team would like to thank everyone involved in helping with testing, coding, debugging & documenting! Enjoy!
And I would give a special thanks to Baron Bronson for providing his device for developing!​


Device wiki:

XDA:DevDB Information
Project Treble, ROM for the Xiaomi Redmi 4A & 5A

Contributors:
33bca
ROM OS Version: 8.1 Oreo
ROM Kernel: Linux 3.18.71
ROM Firmware Required: MIUI 8.4.12 dev

Version Information
Status: Beta

Created 2018-05-13
Last Updated 2018-05-24
 
Last edited:

33bca

Recognized Developer
Jun 5, 2013
892
3,615
93
Basel
Changelog:
V1 - 13.05.2018
- Initial Release

V2 - 24.05.2018
- Unified with Redmi 5A from now on!
- Added full RGB LED (It's slow while selecting the colors, but I'll improve the HAL soon)
- Added new poweroff charging animations (Yay, it even shows percentage)
- Fixed calls over bluetooth
- Updated screen off gestures ( Added some new goodies)
- Updated Camera to the latest CAF tag
- Updated Kernel to the latest CAF tag
 
Last edited:

MaxisMan

Senior Member
Dec 9, 2014
585
250
63
There seems to be no option in TWRP to flash the system image, only for boot and recovery. Do we flash it via fastboot?
 

33bca

Recognized Developer
Jun 5, 2013
892
3,615
93
Basel
Update

  • Unified with Redmi 5A from now on!
  • Added full RGB LED (It's slow while selecting the colors, but I'll improve the HAL soon)
  • Added new poweroff charging animations (Yay, it even shows percentage)
  • Fixed calls over bluetooth
  • Updated screen off gestures ( Added some new goodies)
  • Updated Camera to the latest CAF tag
  • Updated Kernel to the latest CAF tag

You can find the remaining bugs in the OP.
Due to my broken Redmi 4A I can't deliver that many and bigger updates. I should receive the replacement parts in about a month. (I didn't find any faster delivery at a reasonable price..)

Grab the update here!

BTW: You will need a TWRP with custom vendor support like this one.
 

33bca

Recognized Developer
Jun 5, 2013
892
3,615
93
Basel
There seems to be no option in TWRP to flash the system image, only for boot and recovery. Do we flash it via fastboot?
Do we need any special version of TWRP for this ?
I want to know it too.
You will need at least a recovery with vendor partition support, you can check this one out: https://androidfilehost.com/?fid=818222786056029479

Is this a ROM or a file
A flashable ZIP that contains the vendor and boot image.
 

NotAPerso

Member
Apr 13, 2018
20
8
0
Does the decryption issue just mean when flashing to treble that the device must be unencrypted or that I also can't encrypt after flashing a GSI? If only the former then it's annoying but not too bad. If the later, I hope it can be fixed soon as I like device security.
 
  • Like
Reactions: DodoGTA

cyborgmanu

Senior Member
May 10, 2013
101
36
0
New Delhi
How do I go back to the stock MIUI ROM after following the given steps and installing a Generic System Image?
Can all of this be reverted by installing a MIUI ROM via Mi Flash?