From ad6231f5463eafae32f1d0733555ef49c4166248 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Wed, 29 Nov 2017 16:16:26 +0800 Subject: [PATCH] Add /odm/etc/selinux/odm_hwservice_contexts Bug: 64240127 Test: normal boot and recovery boot a device Change-Id: I22d29e8476380d19aca1be359e0228ab6bbc3b0f --- Android.mk | 30 +++++++++++++++++++++++++++++- private/file_contexts | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 24176e84d..d2f2fbbe4 100644 --- a/Android.mk +++ b/Android.mk @@ -256,7 +256,8 @@ LOCAL_REQUIRED_MODULES += \ odm_sepolicy.cil \ odm_file_contexts \ odm_seapp_contexts \ - odm_property_contexts + odm_property_contexts \ + odm_hwservice_contexts endif include $(BUILD_PHONY_PACKAGE) @@ -1375,6 +1376,33 @@ $(LOCAL_BUILT_MODULE): $(vendor_hwservice_contexts.tmp) $(built_sepolicy) $(HOST vendor_hwsvcfiles := vendor_hwservice_contexts.tmp := +################################## +include $(CLEAR_VARS) + +LOCAL_MODULE := odm_hwservice_contexts +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux + +include $(BUILD_SYSTEM)/base_rules.mk + +odm_hwsvcfiles := $(call build_policy, hwservice_contexts, $(BOARD_ODM_SEPOLICY_DIRS)) + +odm_hwservice_contexts.tmp := $(intermediates)/odm_hwservice_contexts.tmp +$(odm_hwservice_contexts.tmp): PRIVATE_SVC_FILES := $(odm_hwsvcfiles) +$(odm_hwservice_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) +$(odm_hwservice_contexts.tmp): $(odm_hwsvcfiles) + @mkdir -p $(dir $@) + $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ + +$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) +$(LOCAL_BUILT_MODULE): $(odm_hwservice_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) + @mkdir -p $(dir $@) + sed -e 's/#.*$$//' -e '/^$$/d' $< > $@ + $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e -l $(PRIVATE_SEPOLICY) $@ + +odm_hwsvcfiles := +odm_hwservice_contexts.tmp := ################################## include $(CLEAR_VARS) diff --git a/private/file_contexts b/private/file_contexts index fd2eeaecd..c469565c9 100644 --- a/private/file_contexts +++ b/private/file_contexts @@ -343,6 +343,7 @@ /(odm|vendor/odm)/etc/selinux/odm_file_contexts u:object_r:file_contexts_file:s0 /(odm|vendor/odm)/etc/selinux/odm_seapp_contexts u:object_r:seapp_contexts_file:s0 /(odm|vendor/odm)/etc/selinux/odm_property_contexts u:object_r:property_contexts_file:s0 +/(odm|vendor/odm)/etc/selinux/odm_hwservice_contexts u:object_r:hwservice_contexts_file:s0 ############################# # Product files