{"docs":[{"id":151,"title":"Android HALs: How Android Talks to Custom Hardware","heading":"Android HALs: How Android Talks to Custom Hardware","subheading":null,"category":"Device Drivers","body":{"root":{"type":"root","children":[{"type":"heading","tag":"h3","version":1,"children":[{"type":"text","text":"Standard or custom HAL","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Where Android already defines a HAL for the device class, such as sensors, camera, audio, lights or power, implement that interface. The framework, apps and compatibility tests then work without changes.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"For hardware with no standard HAL, define a vendor AIDL interface marked as stable, version it, and freeze each version before shipping. Expose it through a system service or privileged app, and write SELinux policy that grants only the HAL process access to the device node.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"tags":"Device Drivers, Android, HAL, AIDL","cardCta":{"label":null,"link":null},"pageCta":{"label":"Talk to AAVICO engineering","link":"/contact"},"excerpt":"A kernel driver alone does not make hardware usable on Android. The hardware abstraction layer connects it to the framework, and since Treble it has a strict, versioned shape.","featuredImage":null,"type":"Blog","readTime":"3 min read","publishedAt":"2026-11-15T19:30:00.000Z","heroImage":null,"introText":"On a Linux system an application can often open a device node and start talking to hardware. Android does not work that way. Apps call framework APIs, framework services call a hardware abstraction layer, and only the HAL talks to the kernel driver. Since Android 8 that HAL usually runs as a separate process behind a versioned interface, so the vendor and framework sides can be updated independently.","metrics":[{"id":"android-hals-how-android-talks-to-custom-hardwar-metric-1","value":"Android 8","label":"Project Treble moved HALs behind stable interfaces, separating vendor code from the framework.","icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-metric-2","value":"AIDL","label":"The interface language for new HALs. HIDL is deprecated and should not be used for new work.","icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-metric-3","value":"Binder","label":"The inter-process transport between framework services and HAL processes.","icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-metric-4","value":"VINTF","label":"Manifests and compatibility matrices declaring which HAL versions a device provides and the framework needs.","icon":null}],"gallery":[],"challenge":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Teams new to Android often write a kernel driver, open up the permissions on its device node and call it from an app through JNI. It may work on a development build, but SELinux will deny it on a production build, it bypasses the permission model, and it breaks the separation that lets the system image be updated without rebuilding vendor code.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"The opposite mistake is forcing custom hardware into a standard HAL that does not fit, such as presenting a measurement instrument as a sensor, and losing the controls the product actually needs.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"blockquote":{"quote":"On Android the kernel driver is only half the job; the HAL interface is the contract everything above it depends on.","author":"","role":"AAVICO Engineering"},"supportImage1":null,"deliverables":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Check whether a standard Android HAL covers the device. If one does, implement it rather than inventing a parallel path.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"If not, design a small vendor AIDL interface around what the product needs, not around the register map, and declare it in the device VINTF manifest.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Write the HAL service, init script and SELinux policy together, and test on a user build, as customers will run it.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"results":[{"id":"android-hals-how-android-talks-to-custom-hardwar-result-1","title":"Updatable System","description":"Vendor and framework code can be updated independently because they meet at a versioned interface."},{"id":"android-hals-how-android-talks-to-custom-hardwar-result-2","title":"Security","description":"Only the HAL process touches the hardware, and SELinux enforces that on every build."},{"id":"android-hals-how-android-talks-to-custom-hardwar-result-3","title":"Compatibility","description":"Standard HALs keep the device passing vendor tests and working with ordinary apps."},{"id":"android-hals-how-android-talks-to-custom-hardwar-result-4","title":"Maintainability","description":"A frozen, versioned interface lets the HAL evolve without breaking existing clients."}],"lookingAhead":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Keep the HAL thin. Put policy and product logic in the framework or app layer, where it is easier to change and test.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"An existing Linux user-space library can sit inside the HAL, if its licence and dependencies suit the vendor partition.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"supportImage2":null,"testimonial":{"quote":null,"author":null,"role":null,"photo":null},"challengesSolved":[{"id":"android-hals-how-android-talks-to-custom-hardwar-challenge-1","title":"Apps opening device nodes directly","description":null,"icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-challenge-2","title":"SELinux denials found only on user builds","description":null,"icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-challenge-3","title":"A new HAL written in deprecated HIDL","description":null,"icon":null},{"id":"android-hals-how-android-talks-to-custom-hardwar-challenge-4","title":"Unversioned interfaces that break clients on update","description":null,"icon":null}],"relatedPosts":[],"contactUs":{"show":true},"updatedAt":"2026-11-15T17:32:32.682Z","createdAt":"2026-11-15T17:32:32.682Z"}],"hasNextPage":false,"hasPrevPage":false,"limit":10,"nextPage":null,"page":1,"pagingCounter":1,"prevPage":null,"totalDocs":1,"totalPages":1}