From 13df628b8f91b88e769a546caec67f3947c48b7d Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 23 Mar 2018 12:03:33 -0700 Subject: [PATCH] Build DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE ... along with compatibility_matrix.device.xml. The new module cm.device.xml contains the original content of empty.xml (kernel configs, sepolicy, etc.) as well as HALs from DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE. This variable points to a framework compatibility matrix that contains framework HALs as a vendor extension; all HALs in this file must be optional. Bug: 65028233 Test: m framework_compatibility_matrix.xml -j and manual inspection Test: vts_treble_vintf_test Change-Id: I94949f62f7f5b332d845f2e7fa4714df7c49ed3e Merged-In: I94949f62f7f5b332d845f2e7fa4714df7c49ed3e --- compatibility_matrices/Android.mk | 39 +++++++++++++++++-- .../compatibility_matrix.mk | 14 ++++++- compatibility_matrices/manifest.empty.xml | 1 + 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 compatibility_matrices/manifest.empty.xml diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index 71253dac78..a10d808d33 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -22,6 +22,7 @@ BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := $(LOCAL_PATH)/compatibility_matrix.mk LOCAL_ADD_VBMETA_VERSION := LOCAL_ASSEMBLE_VINTF_ENV_VARS := LOCAL_ASSEMBLE_VINTF_FLAGS := +LOCAL_WARN_REQUIRED_HALS := LOCAL_KERNEL_VERSIONS := LOCAL_GEN_FILE_DEPENDENCIES := @@ -57,14 +58,46 @@ include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) # Framework Compatibility Matrix (common to all FCM versions) include $(CLEAR_VARS) -LOCAL_MODULE_STEM := compatibility_matrix.empty.xml -LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM) +LOCAL_MODULE_STEM := compatibility_matrix.device.xml +# define LOCAL_MODULE and LOCAL_MODULE_CLASS for local-generated-sources-dir. +LOCAL_MODULE := framework_compatibility_matrix.device.xml +LOCAL_MODULE_CLASS := ETC + +ifndef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE +LOCAL_SRC_FILES := compatibility_matrix.empty.xml +else + +# DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE specify an absolute path +LOCAL_GENERATED_SOURCES := $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) + +# Enforce that DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE does not specify required HALs +# by checking it against an empty manifest. But the empty manifest needs to contain +# BOARD_SEPOLICY_VERS to be compatible with DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE. +my_manifest_src_file := $(LOCAL_PATH)/manifest.empty.xml +my_gen_check_manifest := $(local-generated-sources-dir)/manifest.check.xml +$(my_gen_check_manifest): PRIVATE_SRC_FILE := $(my_manifest_src_file) +$(my_gen_check_manifest): $(my_manifest_src_file) $(HOST_OUT_EXECUTABLES)/assemble_vintf + BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \ + IGNORE_TARGET_FCM_VERSION=true \ + $(HOST_OUT_EXECUTABLES)/assemble_vintf -i $(PRIVATE_SRC_FILE) -o $@ + +LOCAL_GEN_FILE_DEPENDENCIES += $(my_gen_check_manifest) +LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_gen_check_manifest)" + +my_gen_check_manifest := +my_manifest_src_file := + +endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE + LOCAL_ADD_VBMETA_VERSION := true LOCAL_ASSEMBLE_VINTF_ENV_VARS := \ POLICYVERS \ PLATFORM_SEPOLICY_VERSION \ PLATFORM_SEPOLICY_COMPAT_VERSIONS +LOCAL_WARN_REQUIRED_HALS := \ + "Error: DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX cannot contain required HALs." + include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) # Framework Compatibility Matrix @@ -78,7 +111,7 @@ LOCAL_REQUIRED_MODULES := \ framework_compatibility_matrix.1.xml \ framework_compatibility_matrix.2.xml \ framework_compatibility_matrix.current.xml \ - framework_compatibility_matrix.empty.xml + framework_compatibility_matrix.device.xml LOCAL_GENERATED_SOURCES := $(call module-installed-files,$(LOCAL_REQUIRED_MODULES)) ifdef BUILT_VENDOR_MANIFEST diff --git a/compatibility_matrices/compatibility_matrix.mk b/compatibility_matrices/compatibility_matrix.mk index 96815b83e1..abc679656b 100644 --- a/compatibility_matrices/compatibility_matrix.mk +++ b/compatibility_matrices/compatibility_matrix.mk @@ -29,8 +29,13 @@ ifndef LOCAL_MODULE_STEM $(error LOCAL_MODULE_STEM must be defined.) endif +ifndef LOCAL_MODULE LOCAL_MODULE := framework_$(LOCAL_MODULE_STEM) +endif + +ifndef LOCAL_MODULE_CLASS LOCAL_MODULE_CLASS := ETC +endif ifndef LOCAL_MODULE_PATH LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf @@ -76,13 +81,19 @@ my_matrix_src_files := \ $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) \ $(LOCAL_GENERATED_SOURCES) +ifneq (,$(strip $(LOCAL_WARN_REQUIRED_HALS))) +$(GEN): PRIVATE_ADDITIONAL_ENV_VARS += PRODUCT_ENFORCE_VINTF_MANIFEST=true +$(GEN): PRIVATE_COMMAND_TAIL := || (echo $(strip $(LOCAL_WARN_REQUIRED_HALS)) && false) +endif + $(GEN): PRIVATE_SRC_FILES := $(my_matrix_src_files) $(GEN): $(my_matrix_src_files) $(HOST_OUT_EXECUTABLES)/assemble_vintf $(foreach varname,$(PRIVATE_ENV_VARS),$(varname)="$($(varname))") \ + $(PRIVATE_ADDITIONAL_ENV_VARS) \ $(HOST_OUT_EXECUTABLES)/assemble_vintf \ -i $(call normalize-path-list,$(PRIVATE_SRC_FILES)) \ -o $@ \ - $(PRIVATE_FLAGS) + $(PRIVATE_FLAGS) $(PRIVATE_COMMAND_TAIL) LOCAL_PREBUILT_MODULE_FILE := $(GEN) LOCAL_SRC_FILES := @@ -91,6 +102,7 @@ LOCAL_GENERATED_SOURCES := LOCAL_ADD_VBMETA_VERSION := LOCAL_ASSEMBLE_VINTF_ENV_VARS := LOCAL_ASSEMBLE_VINTF_FLAGS := +LOCAL_WARN_REQUIRED_HALS := LOCAL_KERNEL_VERSIONS := LOCAL_GEN_FILE_DEPENDENCIES := my_matrix_src_files := diff --git a/compatibility_matrices/manifest.empty.xml b/compatibility_matrices/manifest.empty.xml new file mode 100644 index 0000000000..e50e0e539d --- /dev/null +++ b/compatibility_matrices/manifest.empty.xml @@ -0,0 +1 @@ +