From b27c2e8af953bf78701b6f0a8c07db070f4e9e68 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Wed, 23 Sep 2020 19:15:20 +0900 Subject: [PATCH] Use file_contexts for flattened apexes Because flattened apexes are installed in //apex, associated file_contexts file should be modified to accommodate path changes and also merged into target-wide file_contexts.bin file. Soong now emits modified file_contexts via LOCAL_FILE_CONTEXTS, and these files are collected into a temporary file_contexts.modules.tmp file, which is used as an additional input of file_contexts.bin. Bug: 166518492 Test: m file_contexts.bin check the contents of file_contexts.concat.tmp file Change-Id: I002a2294af9e06baeaf54bc5a9a5380d23b8a3da --- core/Makefile | 6 ++++++ core/base_rules.mk | 3 +++ core/clear_vars.mk | 1 + 3 files changed, 10 insertions(+) diff --git a/core/Makefile b/core/Makefile index 37ff378833..61dcf3edf1 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1286,7 +1286,13 @@ endif # Get a colon-separated list of search paths. INTERNAL_USERIMAGES_BINARY_PATHS := $(subst $(space),:,$(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))) +# Collects file_contexts files from modules to be installed +$(call merge-fc-files, \ + $(sort $(foreach m,$(product_MODULES),$(ALL_MODULES.$(m).FILE_CONTEXTS))),\ + $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.modules.tmp) + SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin + INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC) ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) diff --git a/core/base_rules.mk b/core/base_rules.mk index 58be7a2d75..adf61f111f 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -987,6 +987,9 @@ ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SU ALL_MODULES.$(my_register_name).TEST_CONFIG := $(test_config) ALL_MODULES.$(my_register_name).EXTRA_TEST_CONFIGS := $(LOCAL_EXTRA_FULL_TEST_CONFIGS) ALL_MODULES.$(my_register_name).TEST_MAINLINE_MODULES := $(LOCAL_TEST_MAINLINE_MODULES) +ifndef LOCAL_IS_HOST_MODULE +ALL_MODULES.$(my_register_name).FILE_CONTEXTS := $(LOCAL_FILE_CONTEXTS) +endif test_config := INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index d515db3ce4..7d79bafb5a 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -102,6 +102,7 @@ LOCAL_EXTRA_FULL_TEST_CONFIGS:= LOCAL_EXTRACT_APK:= LOCAL_EXTRACT_DPI_APK:= LOCAL_FDO_SUPPORT:= +LOCAL_FILE_CONTEXTS:= LOCAL_FINDBUGS_FLAGS:= LOCAL_FORCE_STATIC_EXECUTABLE:= LOCAL_FULL_CLASSES_JACOCO_JAR:=