How boundarydevices/android_hardware_imx works
Project type and purpose
• This is an Android system-level “HAL monorepo” for NXP-based hardware. It implements multiple Hardware Abstraction Layers (HALs) and services (Audio, Bluetooth, Camera, Display, EVS, USB, Power, Thermal, Sensor, Vehicle, Secure Enclave, etc.) using HIDL or AIDL, exposing them as binder services to the Android framework.
File structure
• Top-level directories correspond to individual HAL modules (alsa, audio, bluetooth, camera, display, evs, usb, power, thermal, sensor, vehicle, secure-enclave, etc.).
• Each module contains:
• Source files (.cpp/.h) implementing the service logic
• Android.bp build scripts
• HIDL/AIDL interface definitions (.hal or .aidl)
• Service registration files (.rc, .xml)
• There are shared libraries (libedid, libextcam) and common code (vehicle/common, sv/corelib).
• gtest folders provide unit and integration tests.
• Build configuration files at root (.clang-format, PREUPLOAD.cfg, MODULE_LICENSE_APACHE2) show it's using Soong and Android’s build rules.
What the README would tell you
• (Empty here, but typically would list supported interfaces, versions, and high-level architecture.)
a. Main components
• Android Framework Layer (AudioFlinger, CameraService, BluetoothManager, SurfaceFlinger, PowerManagerService, etc.)
• HIDL/AIDL Binder Interfaces (android.hardware.audio@X.X, android.hardware.bluetooth@X.X, android.hardware.camera.device@X.X, hwcomposer3, etc.)
• HAL Modules (audio/default, bluetooth/, camera/, display/hwcomposer3, sensor/, power/, etc.)
• Shared Libraries (libedid, libextcam, vehicle/common)
• Kernel Drivers (ALSA, V4L2, DRM, ION, IIO, USB, Thermal zones, Power hints, Vehicle CAN, Secure Enclave)
• Hardware Blocks (Audio CODEC, Bluetooth chip, Camera sensor+ISP, Display controllers, EVS cameras and displays, USB PHYs, CPU/GPU, Thermal sensors, Vehicle network, Secure element)
b. Relationships and interactions
• Android Framework calls into HIDL/AIDL stubs via Binder IPC.
• HIDL/AIDL stubs dispatch to HAL module implementations (each running as a separate service process).
• HAL modules invoke lower-level libs or kernel drivers via ioctl, read/write, ALSA lib, tinyalsa, V4L2 APIs, DRM ioctls, ION, IIO, CAN sockets.
• Kernel drivers talk directly to hardware over bus (I2C, SPI, PCIe, USB).
• Some modules share common code (e.g., vehicle/common classes used by vehicle/impl).
c. Architectural patterns and design principles
• Modular per-interface service processes for isolation and independent updates.
• Binder IPC boundary between Framework and HAL.
• HIDL/AIDL as the versioned IDL layer.
• Common utility libraries for code reuse.
• Clear separation of concerns: service registration (.rc/.xml) separate from implementation.
d. Key technologies/frameworks
• Soong build system (Android.bp)
• HIDL and AIDL
• Binder IPC
• ALSA/tinyalsa for audio
• V4L2 for camera/EVS
• DRM/ION for display
• IIO for sensors
• Linux kernel drivers for each hardware block