Android HIDL Interface access from Java

954 Views Asked by At

I have an AOSP build with a custom HAL layer service and I would like to know if it is at all possible to call the interface from Java.

The documentation from Google suggests you can (https://source.android.com/devices/architecture/hidl-java#modifying-your-java-source) but it isn't clear in terms of where you get the interface for the #import statement.

On my side I have the C++ code and the .hal file(s) but it isn't clear to me how to actually get to the point of importing these (Android Studio?) for Java to be able to access them.

1

There are 1 best solutions below

0
On

Turns out using hidl-gen is the way to go (once you figure out the command line arguments). In my case the conversion wasnt supported:

ERROR: is not Java compatible. The Java backend does NOT support union types nor native handles. In addition, vectors of arrays are limited to at most one-dimensional arrays and vectors of {vectors,interfaces} are not supported.