mobicore: split into legacy and treble folders
[GitHub/LineageOS/android_device_samsung_slsi_sepolicy.git] / sepolicy.mk
index 68644a687cf72f53ec8cd94858e382ca08f12f8c..09305d685dd99c7efc65ec317668faae1003843e 100644 (file)
@@ -18,6 +18,19 @@ BOARD_PLAT_PUBLIC_SEPOLICY_DIR += \
 BOARD_SEPOLICY_DIRS += \
     device/samsung_slsi/sepolicy/tee/teegris/vendor
 else ifeq ($(BOARD_SEPOLICY_TEE_FLAVOR),mobicore)
+POLICY_TYPE := legacy
+# a device might not set the shipping api level
+# check if its empty to avoid erroring out in the next if
+ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+$(warning no product shipping level defined, defaulting to legacy policy)
+# devices launched with oreo or later should be treble
+else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),)
+POLICY_TYPE := treble
+endif
+
+BOARD_SEPOLICY_DIRS += \
+    device/samsung_slsi/sepolicy/tee/mobicore/$(POLICY_TYPE)
+
 BOARD_SEPOLICY_DIRS += \
-    device/samsung_slsi/sepolicy/tee/mobicore
+    device/samsung_slsi/sepolicy/tee/mobicore/common
 endif