Android: Treble and APEX

DmFrPro
3 min readFeb 21, 2021

Many android users wondered why updates arrive with a long delay on smartphones with the Android operating system. And if iPhone devices receive updates almost immediately after the release of the new iOS, then in the case of Samsung’s flagmans, Oneplus, the OS update comes at best in a month or two, if at all. In the budget segment the situation is the most deplorable: very few phones are supported by the manufacturer.

Android

In this article I will tell you about Project Treble, which will decrease updates delay totally.

Project Treble

Project Treble logo

Before Android 8.1 Oreo, the OS was architecturally built so that after every release of a new version of Android, suppliers of phone components (cameras, sensors, chips, etc.) had to almost completely redo the binaries and HALs for the new architecture. This scheme had only a negative effect: it took months to wait for the blobs to be updated, and many manufacturers simply gave up on supporting devices.

With the release of Android 8.1 Oreo, Google introduced a new architecture of the operating system with a separate vendor partition, in which BLOBs and HALs were stored.

BLOB (Binary Large OBject) is a large binary file that may consists of HAL, driver, etc.

HAL (Hardware Abstraction Layer) is a layer between hardware and software (specially in Android between drivers and process implemetation).

The architecture of the system was adapted so now device manufacturers didn’t have to wait for binaries from suppliers with every update of Android.

Difference between Non-Treble and Treble updates

All devices that ship with Android 8.1 Oreo from the factory have Treble support by default. For devices with older versions, Treble support can be obtained by installing Treble-TWRP Recovery, which can mount directories with binaries as a separate vendor section.

In my next articles I will show you how the structure of any TWRP recovery and how to add Treble support for every device by patching TWRP image.

Moreover, Treble upgraded the security of connection between process and the kernel. The main feature of vendor interface is separated HALs.

Before Android 8.1, manufacturers had to update HALs every time the update was released. Now, they don’t need to patch HALs, and process instance can easy use HALs without any required updates. Also, separation of HALs from the process increased security and fault tolerance.

Separated HALs in Project Treble

Treble brought us GSI ROMs— these are universal system images that can be installed on any Treble smartphone. To do this, we need the system image itself and the vendor archive for your device.

Project APEX

In Android 10 update, Google shown us a new feature which can simplify minor updates.

In the previous versions of the OS manufacturers had to make a full zip package that can be installed through the Recovery menu (it’s a default update, when phone reboots, updates and then reboots to the new system).

Now, Android can get APEX packages and update some binaries, services at the background, abd after default reboot these patches apply to the current OS. This type of update looks like update on every Linux distribution by package manager.

Sources

This article is based on my previously made article in VK Unix Power group.
Source

--

--

DmFrPro

throw new NoSuchElementException("Bio is not found");