Skip to content

Commit bb4d016

Browse files
Chris GrossMichael Bestas
Chris Gross
authored and
Michael Bestas
committed
Only require compat mapping files if they exist.
Call build_policy when determing which compat mapping files should be included for a given partition. Bug: 168637766 Test: Built aosp_bonito-userdebug and saw that the compat mapping files in product/etc/sepolicy/mapping were no longer present. Test: Added a test 30.0.cil file to bonito's product private compat directory and saw that it was present at product/etc/sepolicy/mapping. Change-Id: I83cc28a159b24c0a2c0717dae461983250ab6c25
1 parent 2741936 commit bb4d016

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Android.mk

+13-4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ sepolicy_build_files := security_classes \
145145
genfs_contexts \
146146
port_contexts
147147

148+
sepolicy_compat_files := $(foreach ver, $(PLATFORM_SEPOLICY_COMPAT_VERSIONS), \
149+
$(addprefix compat/$(ver)/, $(addsuffix .cil, $(ver))))
150+
148151
# Security classes and permissions defined outside of system/sepolicy.
149152
security_class_extension_files := $(call build_policy, security_classes access_vectors, \
150153
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
@@ -370,8 +373,11 @@ endif
370373

371374
ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
372375
LOCAL_REQUIRED_MODULES += \
373-
system_ext_mapping_file \
374-
$(addprefix system_ext_,$(addsuffix .cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS))) \
376+
system_ext_mapping_file
377+
378+
system_ext_compat_files := $(call build_policy, $(sepolicy_compat_files), $(SYSTEM_EXT_PRIVATE_POLICY))
379+
380+
LOCAL_REQUIRED_MODULES += $(addprefix system_ext_, $(notdir $(system_ext_compat_files)))
375381

376382
endif
377383

@@ -396,8 +402,11 @@ endif
396402

397403
ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
398404
LOCAL_REQUIRED_MODULES += \
399-
product_mapping_file \
400-
$(addprefix product_,$(addsuffix .cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS))) \
405+
product_mapping_file
406+
407+
product_compat_files := $(call build_policy, $(sepolicy_compat_files), $(PRODUCT_PRIVATE_POLICY))
408+
409+
LOCAL_REQUIRED_MODULES += $(addprefix product_, $(notdir $(product_compat_files)))
401410

402411
endif
403412

0 commit comments

Comments
 (0)