Introduction to HIDL for Android hardware communication

Introduction to HIDL for Android hardware communication

1. Introduction

HIDL stands for HAL interface definition language, which is the interface between Android Framework and Android HAL. HIDL is designed for inter-process communication (IPC), and the communication between processes uses the Binder mechanism;

After Android O (8.0), the underlying implementation has undergone major changes, the most notable of which is the full implementation of the HIDL mechanism. Today we will introduce it.

2. HIDL design purpose

Before Android O (8.0), system upgrades involved collaboration among multiple parties and were extremely troublesome. The introduction of the HIDL mechanism separates the framework from the HAL layer, so that the framework part can be directly overwritten and updated without recompiling the HAL. In this way, when the system is upgraded, OEM manufacturers can skip SoC manufacturers and upgrade the framework first.

2.1, before 8.0

The framework and hal are tightly coupled and exist in system.img. Therefore, when upgrading the version, the OEM manufacturer needs to adapt the framework and the SoC manufacturer needs to adapt the hal. Then, the changes are packaged into system.img, an OTA upgrade package is generated, and it is pushed to the mobile phone for OTA upgrade.

2.2, 8.0 and later

The framework and hal are decoupled. The framework exists in system.img and hal exists in vendor.img. When upgrading the version, it is divided into two upgrades:

  • Framework upgrade: OEM manufacturers adapt the framework, package the modifications to system.img, generate an OTA upgrade package, and push it to the mobile phone for OTA upgrade (the framework changes, but the hal layer remains unchanged).
  • Hal upgrade: SoC manufacturers adapt Hal, package the modifications to vendor.img, generate an OTA upgrade package, and push it to the mobile phone for OTA upgrade (framework changes, Hal layer changes).

3. HIDL Mechanism Evolution

3.1 Communication framework between old version Framework and HAL

In the old system architecture, the Android Framework layer and the Hal layer are packaged into a system.img, and the Framework and Hal layers are tightly coupled, using the corresponding hardware so library through linking. There are generally two ways of architecture between them:

3.2 HIDL Type Introduction

In order to solve the drawbacks of this tight coupling between the two, Google introduced HIDL to define the interface between Framework and HAL, which can be described by the following figure:

In fact, although Google launched this mechanism, many manufacturers did not keep up with the pace quickly. Therefore, in order to be forward compatible, Google defined three types:

  • ① This is the implementation architecture used by the Treble Project before, using the traditional HAL and the old version of HAL
  • ② Passthrough mode. As shown in the figure, the Framework and HAL layers work in the same process. The HAL below is a library encapsulated using HIDL, which is a passthrough HAL. These library files can also be used in ③ Binding mode
  • ③ Binderized mode. It is the direct HAL binderization, which becomes the binderized HAL. The Framework and HAL layers work in different processes, and IPC is performed between them through Binder.
  • ④ Pure binding. Compared with ③, the binding HAL does not include the direct HAL, so it is called pure binding

The above can be summarized as follows:


<<:  iOS 16.3 battery life test is out, improving

>>:  The official version of iOS 16.3.1 is here, and several new features will be released soon!

Recommend

Introduction and display styles of iQiyi advertising!

1. Introduction to iQiyi Promotion Platform As a ...

How can operations move from the extensive stage to the refined stage?

Last week I went to Didi and was invited to talk a...

Detailed explanation of the order design model in the e-commerce platform!

As a business subsystem, the order system is very...

How to discover user growth points through growth experiments?

Now that the traffic dividend has disappeared, re...

Is the “heavy fine” of 260 million for Kuaibo too much?

Only by changing the tendency of weak law enforcem...

up to date! Data rankings of 59 information flow advertising platforms!

The following is the latest traffic ranking of 59...

How to plan an event? 6 big steps!

The concept of "organizing an event" ma...

What is the promotion method of Xiaohongshu? How to promote Xiaohongshu?

In fact, most of the Xiaohongshu merchants are mo...

13 Content Creation Tips to Increase Conversion Rates (with Case Details)

Improving content conversion rate is the demand o...

Android ListView Optimization Best Practices

This blog teaches you how to use convertView and ...

Is 360 information flow advertising effective for men?

As a search engine media advertising platform, 36...