What are the difference between AIDL and HAL?

Viewed 28

Can someone tell me that what is the differences between AIDL over HAL? It is too much confusing for me.

1 Answers

AIDL has been around longer than HIDL (only from Android 8 to Android 10), and is used in many other places, such as between Android framework components or in apps. Now that AIDL has stability support, it’s possible to implement an entire stack with a single IPC runtime. AIDL also has a better versioning system than HIDL. AIDL HAL interfaces#

For an AIDL interface to be used between system and vendor, the interface needs two changes:

Every type definition must be annotated with @VintfStability.
The aidl_interface declaration needs to include stability: "vintf",

AOSP Stable AIDL interfaces for HALs are in the same base directories as HIDL interfaces, in aidl folders.

hardware/interfaces
frameworks/hardware/interfaces
system/hardware/interfaces
Example:
hardware/interfaces/light/aidl/Android.bp

aidl_interface {
    name: "android.hardware.light",
    vendor_available: true,
    srcs: [
        "android/hardware/light/*.aidl",
    ],
    stability: "vintf",
    backend: {
        java: {
            sdk_version: "module_current",
        },
        ndk: {
            vndk: {
                enabled: true,
            },
        },
    },
    versions: ["1"],
}
Related