Add device/fwk compatibility matrices to device.
Also renamed matrix.xml to compatibility_matrix.xml.
Test: make and ensure vendor/compatibility_matrix.xml is there.
Test: adb shell vintf (see matrices, compatible = true)
Bug: 37321309
Change-Id: I4ebbedf47a576a50a42df53b72e507ed31ef2e56
diff --git a/core/Makefile b/core/Makefile
index ea6d2d4..d5f8373 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2341,6 +2341,7 @@
endif
@# Metadata for compatibility verification.
$(hide) cp $(BUILT_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
+ $(hide) cp $(BUILT_SYSTEM_COMPATIBILITY_MATRIX) $(zip_root)/META/system_compatibility_matrix.xml
ifdef BUILT_VENDOR_MANIFEST
$(hide) cp $(BUILT_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
endif
diff --git a/core/config.mk b/core/config.mk
index 6d5feb3..559b987 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -687,6 +687,7 @@
endif
FRAMEWORK_MANIFEST_FILE := system/libhidl/manifest.xml
+FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.xml
# ###############################################################
# Set up final options.
diff --git a/target/board/Android.mk b/target/board/Android.mk
index a24abbe..6f0731b 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -30,6 +30,7 @@
# Copy compatibility metadata to the device.
+# Device Manifest
ifdef DEVICE_MANIFEST_FILE
include $(CLEAR_VARS)
LOCAL_MODULE := manifest.xml
@@ -45,16 +46,24 @@
BUILT_VENDOR_MANIFEST := $(LOCAL_BUILT_MODULE)
endif
+# Device Compatibility Matrix
ifdef DEVICE_MATRIX_FILE
include $(CLEAR_VARS)
-LOCAL_MODULE := matrix.xml
+LOCAL_MODULE := compatibility_matrix.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)
-LOCAL_PREBUILT_MODULE_FILE := $(DEVICE_MATRIX_FILE)
+
+GEN := $(local-generated-sources-dir)/compatibility_matrix.xml
+$(GEN): $(DEVICE_MATRIX_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
+ # TODO(b/37342627): put BOARD_VNDK_VERSION & BOARD_VNDK_LIBRARIES into device matrix.
+ $(HOST_OUT_EXECUTABLES)/assemble_vintf -i $< -o $@
+
+LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
BUILT_VENDOR_MATRIX := $(LOCAL_BUILT_MODULE)
endif
+# Framework Manifest
include $(CLEAR_VARS)
LOCAL_MODULE := system_manifest.xml
LOCAL_MODULE_STEM := manifest.xml
@@ -68,3 +77,19 @@
LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
BUILT_SYSTEM_MANIFEST := $(LOCAL_BUILT_MODULE)
+
+# Framework Compatibility Matrix
+include $(CLEAR_VARS)
+LOCAL_MODULE := system_compatibility_matrix.xml
+LOCAL_MODULE_STEM := compatibility_matrix.xml
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT)
+
+GEN := $(local-generated-sources-dir)/compatibility_matrix.xml
+$(GEN): $(FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
+ # TODO(b/37405869) (b/37715375) inject avb versions as well for devices that have avb enabled.
+ POLICYVERS=$(POLICYVERS) BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) $(HOST_OUT_EXECUTABLES)/assemble_vintf -i $< -o $@
+
+LOCAL_PREBUILT_MODULE_FILE := $(GEN)
+include $(BUILD_PREBUILT)
+BUILT_SYSTEM_COMPATIBILITY_MATRIX := $(LOCAL_BUILT_MODULE)
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index b88a143..06c9c13 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -86,9 +86,10 @@
tzdatacheck \
vndservice \
vndservicemanager \
- matrix.xml \
+ compatibility_matrix.xml \
manifest.xml \
system_manifest.xml \
+ system_compatibility_matrix.xml \
# SELinux packages
PRODUCT_PACKAGES += \