BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Articles Is Project Treble the Answer to Android Updates?

Is Project Treble the Answer to Android Updates?

Bookmarks

Key Takeaways

  • While iOS updates can be usually installed on all supported devices the day they are released, Android updates are annoyingly slow to roll out.
  • Project Treble is an attempt to remedy this entire set of problems by relying on a clearer split between hardware and software through the Hardware Abstraction Layer (HAL).
  • Before Project Treble and Android Oreo, the vendor’s low-level hardware code and Google’s higher level AOSP operating system, including the HAL, were a monolith. 
  • Thanks to Project Treble’s integration, Google will be able to update the higher level AOSP operating system code to the latest version while OEMs will update the lower level hardware-related components.
  • Key to Project Treble are the definition of a clear interface between the HAL and its users through the Hardware Definition Language (HIDL) and the Android Vendor Test Suite (VTS), a set of tests that validates compatibility of the upgraded OS with the vendor implementation. About 60 HIDLs exist in the current iteration of Android.

 

While iOS updates can be usually installed on all supported devices the day they are released, Android updates are annoyingly slow to roll out. In fact, Android smartphones are lucky if they receive a couple of updates, with lower cost smartphones possibly never receiving a single software update in their entire lifecycle.

As it is known Fragmentation has been a major problem in the Android world for several years, making it more complex to build apps for the platform. The lack of security, growing vulnerability, and incompatibility are some of the major concerns for Google, OEMs, and users.

Project Treble is an attempt to remedy this entire set of problems. Before introducing it, it is helpful you understand the role the Hardware Abstraction Layer (HAL)  plays in the Android OS framework.

Hardware Abstraction Layer (HAL)

The Hardware abstraction layer enables an OS to talk to the device hardware hiding its peculiarities from higher level programs. In other words, the HAL separates a device hardware from its Operating System, as the following image shows.

Just below the HAL lies the Linux kernel, which handles the hardware specific communication between the HAL and the device’s hardware components. Unlike iOS devices, Android devices tend to have  different set of hardware components, which make the compiled Linux binary different for each device. This is in a nutshell where the fragmentation problem lies.

Before Project Treble

Before Project Treble and Android Oreo, the vendor’s low-level hardware code and Google’s higher level AOSP operating system, including the HAL, were a monolith.

https://s.aolcdn.com/hss/storage/midas/4c368976b4fcd8effea6a3ea41efe6e4/205263229/image_1_flowchart.png

That is, before Project Treble, for a vendor to upgrade its device to the latest version of Android, they had to update the vendor’s low-level hardware code and Google’s higher level AOSP operating system, which delayed upgrades to Android devices and put them under a security risk.

https://cdn57.androidauthority.net/wp-content/uploads/2017/11/Project-Treble-before-and-after-e1511881174506.png

Moreover, manufacturers had to wait for their hardware partners to issue driver updates to ensure hardware compatibility to the latest version of Android. Unlike your Windows PCs and Macs, Androids aren’t plug n play.

What is Project Treble and what Google is trying to achieve with it?

The major problem with Android updates is that phone manufacturers are slow to release them. Worse still, handset support is re-evaluated as new models arrive. Consumers have been vocal about this complaint to manufactures and Google for ages. Now, the arrival of Google’s Project Treble may change the way manufacturers issue software updates.

Project Treble is part of Android Oreo and brings a key re-architecture of the OS framework. The project’s main goal is to make Android updates faster and easier. Treble is perhaps one of the major changes announced with Android Oreo, but one that consumers won’t even realize is there as it is well under the hood. Nonetheless, the benefits are countless.

Yet, don’t get your hopes too high already as it will be still up to vendors to upgrade devices they sell.

What Project Treble isn’t?

Contrary to what you could believe, though, Project Treble won’t convert every device shipped with Android Oreo into a Pixel or a Nexus. Indeed, Google isn’t handling software updates itself and Android manufacturers still need to compile and roll out their updates. The Project is an effort by Google to speed up over-the-air (OTA) updates, but the responsibility to issue OTA updates still remains with the vendors. OTA updates will be pushed to your devices like any other update. You’ll see the Android update notification appearing more often, if Project Treble is successful.

What architectural changes Project Treble brings to the OS Framework?

Project Treble separates the Android OS framework from the vendor’s hardware code implementations. With that separation in place and thanks to Project Treble’s integration, Google will be able to update the higher level AOSP operating system code to the latest version while OEMs will update the lower level hardware-related components.

But that doesn’t solve the entire problem. OEMs still have to update the lower level components. And they still have to rely on SoC vendors who provide much of the hardware code, which defeats the whole purpose of the Project.

To counter this problem, Google has found a solution with the HAL interface definition language  which aims to to reduce reliance on HAL by abstracting its specifics. The rest is dependent on vendors and OEMs.

Solving the HAL issues with HIDLs

As we discussed above, the HAL facilitates the communication between the hardware components and the application. Android O formalized the division between HAL hardware components, like audio or the camera, and their clients on the the OS layer. These new formal divisions that specify the interface between an HAL and its users are described through an Hardware Definition Language (HIDL). About 60 HIDL packages exist in the current iteration of Android. HIDL packages can replace the OS frameworks without the need to rebuild the HAL and thus cut a vendor’s dependency on SoC makers to issue the next OTA update. That implies OTA updates can be issued without the need to recompile the HAL to absorb the changes brought in by the new Android version.

https://cdn57.androidauthority.net/wp-content/uploads/2017/11/Android-Architecture-Pre-Oreo-712x400.png

https://cdn57.androidauthority.net/wp-content/uploads/2017/11/Android-Architecture-Post-Oreo-712x400.png

Of course, the hardware of Android devices awaiting upgrade to the next version of Android has to be compatible with that version. Before Treble, to issue a software update Android vendors were dependent on silicon manufacturers regardless of the device’s hardware compatibility with the current Android version. As Project Treble leaves the original vendor implementation intact, which includes hardware-specific code from silicon manufacturers (Qualcomm, Mediatek, Samsung etc.) and only updates the Android OS framework, this is not the case anymore.

The new Android version now only needs to be compatible with the unchanged vendor implementation of the Android device to be upgraded, which can be ensured for example by passing the Android Vendor Test Suite. The Android Vendor Test Suite (VTS) is a set of tests that validates compatibility of the upgraded OS with the vendor implementation. Once the compatibility is established, OEMs just have to update the  AOSP operating system of OS framework to issue an OTA. VTS is a hardware-focused analog to the Compatibility Test Suite (CTS), which ensures the Android app APIs are properly implemented on a device.

Passing Android Vendor Test Suite (VTS) is essential for an Android device as the goal of HIDL is to replace OS framework without rebuilding HALs. HALs are built by silicon vendors and stay in the vendor partition of the device, enabling the OS framework, in its own partition, to be replaced with an OTA without recompiling the HALs.

Anyway, updating the AOSP OS is the minimum requirement to issue an OTA, but most vendors take the opportunity of an update to reskin the UI layer as well as bake their own software add-ons in. This takes time. So don’t expect Android upgrades to appear on your device within a few weeks of their release to the public. That honor still belongs to the Pixels and Nexus-es of the world.

In a nutshell, while the upgrade equation remains the same, Project Treble has taken away dependency from silicon vendors.

Reception

Leading online publications praised Project Treble for ironing out one of the biggest problems in the Android ecosystem, including the following:

  • This Android Oreo Feature Could Fix a Huge Google Problem, wrote Time Magazine.
  • Techradar called Project Treble the most important Android update you've never heard of.
  • XDA forums’ Mishaal Rahmaan called it a revolution in custom ROMs as Project Treble makes Porting Android Oreo a 1 Day Job.
  • Andy Rubin’s Essential Phone, Huawei, Asus, all embraced Project Treble with open arms when upgrading their devices to Oreo.

However, a lot of manufacturers did not choose to add support for Project Treble when upgrading their devices to Oreo. It seems Android manufacturers are apprehensive over the architectural changes Project Treble brings to the OS frameworks, as the following list of devices that will support Project Treble upon upgrading to Android Oreo shows.

Why a few Android OEMs are opting out of it?

Understanding Android manufacturers apprehension with Project Treble

The apprehension is particular to Android vendors upgrading their device from Nougat to Oreo. A OnePlus staff member gave a reasonable reason behind the apprehension during an AMA session:

Project Treble requires a storage partition, by which the Android framework and vendor image are separated. However, because partitions were not required of Android N and previous versions of Android, all of our current devices do not feature a partition. According to our tests, if we were to modify the partition layout via OTA there is a risk that devices will brick during the partitioning. We feel this poses too great a risk for our community of users, which is why we have decided not to implement Project Treble on current OnePlus devices

Chinese smartphone brand OnePlus was the first OEM to opt out of Project Treble for its current and last range of flagship devices on Android Nougat.

Nokia was the second company to make their hesitation with the project public, particularly when it comes to updating the current devices to Android Oreo that support the Project:

HMD is fully committed to implementing Project Treble on all new Android Oreo products in the near future, and we apologise for any disappointment this may cause.

Final Thoughts

It’s indeed a great time for Android app developers and users as Google is finally addressing one of the great annoyances with its, otherwise, versatile operating system. Project Treble means phones will have longer support cycles rather than just two years, which most flagships have today, although, at the end of the day, it will be up to the OEM’s discretion to issue or not to issue an upgrade.

About the Author

Shahid Mansuri Co-founded Peerbits, one of the leading Android mobile app development company USA, in 2011. His visionary leadership and flamboyant management style have yield fruitful results for the company. He believes in sharing his strong knowledge base with leaned concentration on entrepreneurship and business. Being an avid nature lover, he likes to flaunt his pajamas on beach during the vacations.

Rate this Article

Adoption
Style

BT