Camera: Generate HIDL metadata modules
- Add HidlMetadata.mako template for creating HIDL types.hal files
- Add necessary helpers and model properties to easily find sections and entries added in a given
HIDL version
- Ensure the HIDL version also shows up in the first entry of each section in the camera_metadata
C headers
- Add HIDL output to metadata-generate (though each new HIDL version needs to have a few lines added)
Bug: 33262893
Test: Verify generated HIDL output manually, build, and HIDL built-in sanity checks.
Add a few test entries and sections with different HIDL versions to see that generated code is right.
Change-Id: I9ee3b0839bab4b3efed415dab4208bacdbad56b1
diff --git a/camera/docs/metadata-generate b/camera/docs/metadata-generate
index 27c7811..58b5565 100755
--- a/camera/docs/metadata-generate
+++ b/camera/docs/metadata-generate
@@ -36,6 +36,7 @@
thisdir=$(cd "$(dirname "$0")"; pwd)
fwkdir="$ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/camera2/"
fwkdir_html="$ANDROID_BUILD_TOP/frameworks/base/docs/html/reference"
+hidldir="$ANDROID_BUILD_TOP/hardware/interfaces/camera/metadata"
ctsdir="$ANDROID_BUILD_TOP/cts/tests/camera/src/android/hardware/camera2/cts"
outdir="$ANDROID_PRODUCT_OUT/obj/ETC/system-media-camera-docs_intermediates"
ndk_header_dir="$ANDROID_BUILD_TOP/frameworks/av/camera/ndk/include/camera"
@@ -61,9 +62,10 @@
local in="$1"
local out="$2"
local intermediates="$3"
+ local hal_version="${4:-3.2}"
local spec_file=$thisdir/metadata_definitions.xml
- python $thisdir/metadata_parser_xml.py $spec_file $in $out
+ python $thisdir/metadata_parser_xml.py $spec_file $in $out $hal_version
local succ=$?
@@ -197,6 +199,13 @@
gen_file camera_metadata_tag_info.mako ../src/camera_metadata_tag_info.c || exit 1
gen_file camera_metadata_tags.mako ../include/system/camera_metadata_tags.h || exit 1
+# Generate HIDL metadata modules - new versions need to be added here manually
+mkdir -p "${hidldir}/3.2"
+gen_file_abs HidlMetadata.mako "$hidldir/3.2/types.hal" yes 3.2 || exit 1
+# Uncomment below to generate 3.3 HIDL module
+#mkdir -p "${hidldir}/3.3"
+#gen_file_abs HidlMetadata.mako "$hidldir/3.3/types.hal" yes 3.3 || exit 1
+
#Generate NDK header
gen_file_abs ndk_camera_metadata_tags.mako "$ndk_header_dir/NdkCameraMetadataTags.h" yes || exit 1