Android VNDK: vendor native development kit introduction reason

Background:
Each manufacturer develops devices based on the Android system, and the underlying hardware-related drivers or some underlying functions are developed by the vendor.

Before Android 8.0, the modules developed by manufacturers were provided as dynamic libraries, which were directly called by the framework (directly called by native or Java modules through jni, in short, they were directly dependent).

The problems brought about bring trouble to the Android system upgrade. If the manufacturer does not provide the support of the new version of Android, the existing equipment cannot use the new version of the Android system.

In order to decouple the dependencies between the Android system and the vendor's development modules:
1) Introduce the HAL layer so that the framework does not directly depend on the binary interface developed by the vendor. The two rely on LL-NDK, VNDK, and VNDK-SP as needed, and use The aidl and binder mechanisms are decoupled.
2) Isolation is achieved by dividing the Android system partition and the vendor partition, which facilitates system upgrades. When upgrading the system, it can be upgraded separately, such as upgrading the Android system, without affecting the modules developed by the supplier.

insert image description here

VNDK is a specially selected library with stable interfaces. Both framework and HAL can rely on these libraries with confidence. System upgrades ensure that the interfaces provided by these libraries remain unchanged (header files and binary call interfaces).

Expand a little bit, the implementation method:
1) Introduce the isolation layer HAL (hardware abstract layer), so that there is no dependency between the vendor module and the underlying framework. The vendor module uses the underlying functions through HAL, and the vendor module can only depend on the native library of the same level .
2) HAL development: VNDK is a tool for developing HAL.
3) HAL interface definition: use AIDL (the old version is HIDL) to describe the function interface provided by HAL.
4) HAL implementation framework: hwbinder, combined with AIDL, with the help of the underlying binder mechanism, realizes the communication between the vendor module and the underlying module, while meeting the efficiency goals.
5) Use device tree overlay to solve hardware driver matching: device tree overlay. Simply put, Android provides a standard system and driver (dt), and the manufacturer provides dto, which covers part of the driver dt and adapts to specific device hardware. Among them, the Android system dt is the main version, and the device is matched through the SOC id; the dt provided by the manufacturer is matched with the device through the board id.
Moreover, dt and dto are in different partitions, and the Android system upgrade does not affect the manufacturer's dto.
6) sepolicy overlay, cover the original sepolicy of the system as needed, and customize the sepolicy required by HAL.

Guess you like

Origin blog.csdn.net/yinminsumeng/article/details/129486675