Debugging AIDL Interfaces in Android Source Code
AIDL Command Locations
android_source/system/tools/aidl
android_source/system/tools/hidl
android_source/system/tools$ ls
aidl hidl mkbootimg release_tools sysprop xsdc
After full Android build, AIDL command path:
out/host/linux-x86/bin/aidl
Generated Java/C++ files location:
out/soong/.intermediates
Practical Example
Example: ICameraServiceListener.aidl compiled to C++:
Source: frameworks/av/camera/aidl/android/hardware/ICameraServiceListener.aidl
Generated files: IXXX.aidl → IXXX.cpp IXXX.h BnXXX.h, BpXXX.h
out/soong/.intermediates/frameworks/av/camera$ find ./ -name *CameraServiceListener*
./libcamera_client/android_arm_armv8-a_shared/gen/aidl/android/hardware/BnCameraServiceListener.h
./libcamera_client/android_arm_armv8-a_shared/gen/aidl/android/hardware/ICameraServiceListener.cpp
./libcamera_client/android_arm_armv8-a_shared/gen/aidl/android/hardware/ICameraServiceListener.h
./libcamera_client/android_arm_armv8-a_shared/gen/aidl/android/hardware/BpCameraServiceListener.h
Manual Java compilation:
android_sources$ ./out/host/linux-x86/bin/aidl --lang=java -t -I ./frameworks/base/core/java/ -p ./prebuilts/sdk/current/public/framework.aidl ./frameworks/av/camera/aidl/android/hardware/ICameraServiceListener.aidl -o ~/workspace/test_app/aidl/
ICameraService.aidl to Java:
android_sources$ ./out/host/linux-x86/bin/aidl --lang=java -t -I ./frameworks/base/core/java/ -I ./frameworks/av/camera/aidl/ -p ./prebuilts/sdk/current/public/framework.aidl ./frameworks/av/camera/aidl/android/hardware/ICameraService.aidl -o ~/workspace/test_app/aidl/
Missing Java Generaiton for ICameraServiceListener.aidl
Java file are not generated for ICameraServiceListener.aidl because the Android.bp configuration lacks export_aidl_headers: true.
libcamera_client_aidl is referenced by both frameworks/base/Android.bp and frameworks/av/camera/Android.bp.
One configuration generates Java files, while the other produces C++ implementations.
frameworks/av/camera/Android.bp
// AIDL interface between camera clients and camera service
filegroup {
name: "libcamera_client_aidl",
srcs: [
"aidl/android/hardware/ICameraService.aidl",
"aidl/android/hardware/ICameraServiceListener.aidl",
"aidl/android/hardware/ICameraServiceProxy.aidl",
"aidl/android/hardware/camera2/ICameraDeviceCallbacks.aidl",
"aidl/android/hardware/camera2/ICameraDeviceUser.aidl",
"aidl/android/hardware/camera2/ICameraOfflineSession.aidl",
"aidl/android/hardware/camera2/ICameraInjectionCallback.aidl"