You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
4.4 KiB

DEVICE_SEPOLICY_DIR := $(DEVICE_HUANGLONG)/sepolicy
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS_LIST += $(sort $(patsubst ./%,%, \
$(shell find $(DEVICE_SEPOLICY_DIR)/public -type f -exec dirname {} \; | sort -u) ))
# 区分不同 Android 版本的 Sepolicy 目录列表
SEPOLICY_PUBLIC_API_DIRS := \
$(DEVICE_SEPOLICY_DIR)/public/device/property \
# 从 SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS_LIST 列表中移除匹配 SEPOLICY_PUBLIC_API_DIRS/api 路径的目录
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(filter-out $(addsuffix /api%, $(SEPOLICY_PUBLIC_API_DIRS)), $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS_LIST))
# 添加当前Android版本的 Sepolicy 目录
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(addsuffix /api_$(PLATFORM_SDK_VERSION), $(SEPOLICY_PUBLIC_API_DIRS))
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS_LIST := $(sort $(patsubst ./%,%, \
$(shell find $(DEVICE_SEPOLICY_DIR)/private -type f -exec dirname {} \; | sort -u) ))
# 区分不同 Android 版本的 Sepolicy 目录列表
SEPOLICY_PRIVATE_API_DIRS := \
$(DEVICE_SEPOLICY_DIR)/private/vendor/open_source/nxplayer \
$(DEVICE_SEPOLICY_DIR)/private/packages/thirdpartyapps \
# 从 SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS_LIST 列表中移除匹配 SEPOLICY_PRIVATE_API_DIRS/api 路径的目录
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(filter-out $(addsuffix /api%, $(SEPOLICY_PRIVATE_API_DIRS)), $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS_LIST))
# 添加当前Android版本的 Sepolicy 目录
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(addsuffix /api_$(PLATFORM_SDK_VERSION), $(SEPOLICY_PRIVATE_API_DIRS))
# vendor 域所有 Sepolicy 目录
BOARD_SEPOLICY_DIRS_LIST := $(sort $(patsubst ./%,%, \
$(shell find $(DEVICE_SEPOLICY_DIR)/vendor -type f -exec dirname {} \; | sort -u) ))
# 区分不同产品的 Sepolicy 目录列表
PRODUCT_SEPOLICY_DIRS := \
$(DEVICE_SEPOLICY_DIR)/vendor/device/partition \
# 区分不同 Android 版本的 Sepolicy 目录列表
SEPOLICY_API_DIRS := \
$(DEVICE_SEPOLICY_DIR)/vendor/aosp/native \
$(DEVICE_SEPOLICY_DIR)/vendor/aosp/packages \
$(DEVICE_SEPOLICY_DIR)/vendor/aosp/storage \
$(DEVICE_SEPOLICY_DIR)/vendor/device/property \
$(DEVICE_SEPOLICY_DIR)/vendor/haldefault/drm/hal_drm_clearkey_default \
$(DEVICE_SEPOLICY_DIR)/vendor/haldefault/drm/hal_drm_widevine_default \
$(DEVICE_SEPOLICY_DIR)/vendor/haldefault/hwgraphics \
$(DEVICE_SEPOLICY_DIR)/vendor/hardware/gnss \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_system/bootvideo \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_system/imperf_framework \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_system/mediaserver \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_system/xrengine \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_system/ebaid \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_vendor/ir_user \
$(DEVICE_SEPOLICY_DIR)/vendor/modules_vendor/kdump \
$(DEVICE_SEPOLICY_DIR)/vendor/packages/thirdpartyapps \
$(DEVICE_SEPOLICY_DIR)/vendor/thirdparty/wifi_bt \
$(DEVICE_SEPOLICY_DIR)/vendor/packages/ImStandbyService \
$(DEVICE_SEPOLICY_DIR)/vendor/open_source/Exoplayer \
# 从 BOARD_SEPOLICY_DIRS_LIST 列表中移除匹配 PRODUCT_SEPOLICY_DIRS 和 SEPOLICY_API_DIRS/api 路径的目录
BOARD_SEPOLICY_DIRS += $(filter-out $(addsuffix %, $(PRODUCT_SEPOLICY_DIRS)) $(addsuffix /api%, $(SEPOLICY_API_DIRS)), $(BOARD_SEPOLICY_DIRS_LIST))
# 添加当前产品的 Sepolicy 目录
BOARD_SEPOLICY_DIRS += $(addsuffix /$(PRODUCT_TYPE)/$(CHIP_VERSION), $(PRODUCT_SEPOLICY_DIRS))
# 添加当前Android版本的 Sepolicy 目录
BOARD_SEPOLICY_DIRS += $(addsuffix /api_$(PLATFORM_SDK_VERSION), $(SEPOLICY_API_DIRS))
-include $(SOC_PLATFORM_PATH)/development/sepolicy/public/BoardSepolicy.mk
# 移除 PRODUCT_SEPOLICY_EXCLUDED 和 PRODUCT_SEPOLICY_EXCLUDED/* 的路径和目录
BOARD_SEPOLICY_DIRS := $(filter-out $(PRODUCT_SEPOLICY_EXCLUDED) $(addsuffix /%, $(PRODUCT_SEPOLICY_EXCLUDED)), $(BOARD_SEPOLICY_DIRS))
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS := $(filter-out $(PRODUCT_SEPOLICY_EXCLUDED) $(addsuffix /%, $(PRODUCT_SEPOLICY_EXCLUDED)), $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS))
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS := $(filter-out $(PRODUCT_SEPOLICY_EXCLUDED) $(addsuffix /%, $(PRODUCT_SEPOLICY_EXCLUDED)), $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS))
# If Android sdk version <=29, use BOARD_PLAT_PUBLIC_SEPOLICY_DIR and BOARD_PLAT_PRIVATE_SEPOLICY_DIR instead.
ifeq ($(shell test $(PLATFORM_SDK_VERSION) && test $(PLATFORM_SDK_VERSION) -le 29; echo $$?), 0)
BOARD_PLAT_PUBLIC_SEPOLICY_DIR += $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS)
BOARD_PLAT_PRIVATE_SEPOLICY_DIR += $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS)
endif