← Back to Blogs

AIDL vs HIDL - and Why AIDL Won

Interface definition languages in AOSP explained

1 min read

When Android 8 introduced Project Treble, it needed a way to define stable interfaces between the framework and vendor HAL code. The answer was HIDL (HAL Interface Definition Language). But Android 11 introduced AIDL for HALs, and Android is now migrating everything away from HIDL. Here's what these are and why the migration happened.

What is an IDL?

An Interface Definition Language (IDL) is a way to describe an API contract in a language-neutral way. You write the interface once in .aidl or .hal files, and the build system generates the client/server stubs automatically in C++ and Java. Both sides use these stubs - neither knows the other's internal implementation.

HIDL - HAL Interface Definition Language

HIDL was created specifically for HALs in Android 8. It has its own syntax, its own transport mechanism (hwbinder - a separate Binder domain for HALs), and its own tooling (hidl-gen).

HIDL Communication Flow

  Android Framework (System partition)
           │
           │  calls via hwbinder
           ▼
  ┌────────────────────────┐
  │   HIDL Interface       │
  │  android.hardware.     │  ← defined in .hal files
  │  camera@2.4::ICamera   │
  └───────────┬────────────┘
              │  implemented by vendor
              ▼
  ┌────────────────────────┐
  │  Vendor HAL Process    │  ← runs in /vendor partition
  │  (camera HAL server)   │
  └────────────────────────┘

AIDL - Android Interface Definition Language

AIDL has existed in Android since the beginning - it was always used for app ↔ system service communication (like binding to a service). In Android 11, AIDL was extended to also work for HAL interfaces, using the same regular Binder that the rest of Android uses.

AIDL Communication Flow

  Android Framework (System partition)
           │
           │  calls via regular Binder
           ▼
  ┌────────────────────────┐
  │   AIDL Interface       │
  │  android.hardware.     │  ← defined in .aidl files
  │  camera.ICamera        │
  └───────────┬────────────┘
              │  implemented by vendor
              ▼
  ┌────────────────────────┐
  │  Vendor HAL Process    │  ← same Binder domain as framework
  │  (camera HAL server)   │
  └────────────────────────┘

HIDL vs AIDL - Side by Side

Why is Android Migrating to AIDL?

Rust and AIDL - The New Frontier

Bottom line: If you're writing a new HAL today, use AIDL HAL. HIDL still works in older devices, but if you're starting fresh on Android 12+, AIDL is the answer. And Rust? It's coming gradually - C++ isn't going anywhere.