Implement your own HIDL
This note will explain the purpose of HIDL (.hal), how to implment, how to build and how to use those libraries? HIDL | Android Open Source Project​
Purpose: HIDL is intended to be used for inter-process communication (IPC). Some HALs are using another IPC methods like JNI or Socket to communicate with processes.
​
​
What do we do for HIDL? How to implement ? 1. (C++->.so)OEM/Vendor should write HAL (server) to register service to system. https://source.android.com/devices/architecture/hidl/services#register​
​
​
​
​
Ref. https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/master/radio/1.5/ 3. Add your HAL to framework (client) and let upper layer’s service know your driver’s service. (.java) https://source.android.com/devices/architecture/hidl-java
​
​
source system/tools/hidl/update-makefiles-helper.sh
do_makefiles_update \
"{HIDL library name}:{path}"
Output: out/soong/.intermediates/hardware/interfaces/ … / You can find .java and .so which are generated by your HIDL. Method 2: using hidl-gen tool: You may use hidl-gen -h to find the manual. hidl-gen -o {output_path} -L {language} -r {interface name with path}:{interface path} -r android.hidl:system/libhidl/transport {output library name} e.g.
hidl-gen -o output -L c++ -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport [email protected]::INfc.hal
Hash:
hidl-gen -L hash -r vendor.awesome:vendor/awesome/hardware/interfaces -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport [email protected]
Copy link