The following resources provide details on code locations, tools, testing, and licensing.
The code for the queryable vendor interface object goes to
system/libvintf
(see the
queryable
API).
Handwriting manifest files and compatibility matrices can be tough. Use the following tools to generate a boilerplate manifest/compatibility matrix to start from.
LSHAL is a device-side tool that lists all registered HALs to
hwservicemanager
and all available passthrough implementations
(e.g. android.hardware.foo@1.0-impl.so
) on the device. It can also
generate a device manifest file based on the list:
adb shell su 0 /system/bin/lshal --init-vintf
Note the following:
hwservicemanager
and found
as a passthrough HAL, <transport>
is set to
hwbinder
.assemble_vintf
as explained below.vendor.img
actually provides.assemble_vintf
is a host-side tool that:
assemble_vintf -m --hals-only \ -i system/libhidl/manifest.xml \ -o device/manufacturer/device_name/compatibility_matrix.xml
Note that all HALs are set to optional="true"
.
assemble_vintf -m --hals-only \ -i device/foo/bar/manifest.xml \ -o path/to/place/output/compatibility_matrix.xml
Note that all HALs are set to optional="true"
.
At build time, if the following variables are
defined in device/manufacturer/device_name/BoardConfig.mk
:
DEVICE_MANIFEST_FILE := \ device/manufacturer/device_name/manifest.xml DEVICE_MATRIX_FILE := \ device/manufacturer/device_name/compatibility_matrix.xml
Then the following commands are executed (in the build system, modified to omit implementation details) to generate all XML files:
# device manifest; only when DEVICE_MANIFEST_FILE is set BOARD_SEPOLICY_VERS=10000.0 assemble_vintf \ $(addprefix,-i ,$(DEVICE_MANIFEST_FILE)) \ -o $(TARGET_OUT_VENDOR)/etc/vintf/manifest.xml # device compatibility matrix; only when DEVICE_MATRIX_FILE is set assemble_vintf \ -i $(DEVICE_MATRIX_FILE) \ -o $(TARGET_OUT_VENDOR)/etc/vintf/compatibility_matrix.xml # framework manifest assemble_vintf $(addprefix,-i ,system/libhidl/manifest.xml $(DEVICE_FRAMEWORK_MANIFEST_FILE)) \ -o $(TARGET_OUT)/manifest.xml \ -c $(TARGET_OUT_VENDOR)/etc/vintf/compatibility_matrix.xml # common framework compatibility matrix for each FCM version BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \ POLICYVERS=$(POLICYVERS) \ BOARD_AVB_VBMETA_VERSION=$(BOARD_AVB_VBMETA_VERSION) assemble_vintf \ $(addprefix,-i ,\ hardware/interfaces/compatibility_matrices/compatibility_matrix.empty.xml \ $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE)) \ -o $(TARGET_OUT)/etc/vintf/compatibility_matrix.empty.xml # framework compatibility matrices at each FCM version assemble_vintf -i hardware/interfaces/compatibility_matrices/compatibility_matrix.{level}.xml \ -o $(TARGET_OUT)/etc/vintf/compatibility_matrix.{level}.xml \ --kernel=... # Final framework compatibility matrix to check with device manifest. # Each input matrix should have a unique "level" attribute. PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \ assemble_vintf -i $(TARGET_OUT)/etc/vintf/compatibility_matrix.*.xml -o /tmp/compatibility_matrix.xml -c $(TARGET_OUT_VENDOR)/manifest.xml
Multiple device manifest fragments can be bundled at build time. For example:
<!-- device/manufacturer/device_name/manifest_common.xml --> <manifest version="1.0" type="device"> <!-- common HALs here --> </manifest>
<!-- device/manufacturer/device_name/ir.xml --> <manifest version="1.0" type="device"> <hal> <name>android.hardware.ir</name> <version>1.0</version> <!-- other fields --> </hal> </manifest>
# device/manufacturer/device_name/BoardConfig.mk DEVICE_MANIFEST_FILE := device/manufacturer/device_name/manifest_common.xml ifdef BOARD_ENABLE_IR DEVICE_MANIFEST_FILE += device/manufacturer/device_name/ir.xml endif
Then, assemble_vintf
adds Ir HAL to device manifest if BOARD_ENABLE_IR
is defined, and omits it if BOARD_ENABLE_IR
is not defined. The following commands
(modified to omit implementation details) are executed to generate the device manifest:
# if BOARD_ENABLE_IR is defined BOARD_SEPOLICY_VERS=10000.0 assemble_vintf \ -i device/manufacturer/device_name/manifest_common.xml:device/manufacturer/device_name/ir.xml \ -o $(TARGET_OUT_VENDOR)/manifest.xml # if BOARD_ENABLE_IR is not defined BOARD_SEPOLICY_VERS=10000.0 assemble_vintf \ -i device/manufacturer/device_name/manifest_common.xml \ -o $(TARGET_OUT_VENDOR)/manifest.xml
For details, see:
assemble_vintf --help
The platform/system/libvintf
project uses
GTest for
the serialization, deserialization, and compatibility checking.
tinyxml2
(external/tinyxml2) for serializing/deserializing the
object to/from XML. BSD-like license.libselinux
(external/selinux/libselinux) for getting policydb
version. Public domain license.libz
(external/zlib) for decompressing
/proc/config.gz
. BSD-like license.libvintf
project uses Apache 2.0 license (with appropriate
MODULE_LICENSE_APACHE2 and NOTICE files).