In a nutshell, Project Treble is perhaps the most significant low-level change to the Android Framework in years. It involves separating vendor Hardware Abstraction Layers (HALs) from the Android Framework into a new vendor partition, and having the HALs communicate with the Android Framework through a new Vendor Interface via what’s called the HAL Interface Definition Language (HIDL). Doing this will theoretically speed up future software updates since device makers, also known as OEMs, will no longer have to wait for vendors like Qualcomm to upgrade their binaries before they can start work on the next version of Android (like Android P).
All Android devices that launch with Android 8.0 Oreo MUST be Project Treble compatible (which means that they must pass the Vendor Test Suite [VTS]), however, devices that upgrade to Android Oreo are not required to be. (You can check if your device is Treble-compatible by following our guide here.) While Google has been working with some OEMs to ensure Treble-compatibility on some devices, device makers such as OnePlus, Nokia, and Samsung have rolled out Oreo updates without Treble compatibility.
This is particularly a disappointment among members of our community because of the potential that Treble-compatibility brings to custom ROM development. After theorizing how it might benefit the custom ROM community, I was personally able to boot a generic AOSP Android 8.0 Oreo build (called a Generic System Image [GSI] by Google) onto my Huawei Mate 9. This opened up the floodgates of ROM development centered around the GSI, and other devices such as the Huawei Mate 10, Honor 8 Pro, and Honor 9 among others are able to run stable builds of AOSP Android Oreo as daily drivers. I personally am running a so-called “Treble ROM” on my own Huawei Mate 10 Pro, and thanks to projects such as the Xposed Framework with the GravityBox module, Substratum for themes, and my own framework overlay, there aren’t very many features that I’m missing.
So with all of the benefits that Treble seems to bring to custom ROM development, users have wondered if it is possible to “port” Treble compatibility. This is a challenge for developers as it means they have to first find space to use as a make-shift vendor partition (on devices that do not already have one) and then move all of the HALs out of the system partition into this new vendor partition, and then create the vendor interface themselves in HIDL. As always, developers of the XDA community were up to the challenge, and XDA Senior Member abhishek987 has just announced that he was able to successfully accomplish all of the above and thus bring full Project Treble compatibility to the Xiaomi Redmi Note 4 (mido).
Project Treble on the Xiaomi Redmi Note 4
How did he do it? He used the “cust” partition on the device for his make-shift vendor partition. The cust partition normally holds a lot of device-specific stuff from MIUI, so it’s essentially wasted space on an AOSP build. Using the approximately 830MB unused partition, he moved the vendor HALs from system into cust without needing to repartition—which was a justification that OEMs such as Nokia and OnePlus used in their statements about why they weren’t going to bring Treble compatibility to their devices.
Full Project Treble Compatibility on the Xiaomi Redmi Note 4
After some hard work getting the vendor interface working, he was able to boot up XDA Senior Member phhusson‘s Android 8.1 Oreo GSI without much effort. (Note: phhusson told me that abhishek987 had to change things around for it to work due to a lack of a “versioned VNDK.” Explaining that in detail would require another article on Treble, which I’m working on!)
If you want to install this LineageOS 15.1 ROM onto your Snapdragon Redmi Note 4, then you’ll want to thoroughly read abhishek987’s announcement post since it contains important information about the new flashing instructions.
This is without a doubt a major milestone in Treble-related custom ROM development. Once the developer posts his device trees, other custom ROM developers can re-base their ROM on this work—meaning you’ll see more than just LineageOS that is fully Treble compatible on the Redmi Note 4. And, now that this has been proven possible, we’re sure to see more developers attempt this on other devices. Indeed, I’ve already seen XDA Senior Recognized Developer codeworkx attempt to bring full Treble compatibility on the OnePlus 5/5T.
As for what this means going forward, Redmi Note 4 users have much to be excited about. Thanks to Treble support, the Redmi Note 4 should have a much, much easier time getting Android P up and running once the source code is made available. Treble is supposed to make it so a device with, say, Android 8.1 vendor is able to run an Android P system on top, but since Android P is not yet available we can’t test that claim ourselves. But when Android P does come around, we’ll be sure to try it out and potentially make the next big step in custom ROM development.
If you are interested in all things Project Treble, please follow the XDA Portal through our Project Treble tag or by using the XDA Labs app. Also, consider subscribing to our Treble-Enabled Device Development forum for more news like this.