From c7670e5c55dd149cceb4b12d89ccadfa8c40ee4f Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 7 Sep 2018 16:01:38 -0700 Subject: [PATCH] Apply '--fake-treble' flag to the intended devices (for the build-time tests) treble_sepolicy_tests applies tests to the SEPolicy for devices which implement the SEPolicy split introduced in Android O. For devices which turn this on and also implement all of the other requirements which together compose PRODUCT_FULL_TREBLE, these tests help ensure that the backwards compatibility which this feature adds is possible. When this test was originally written, devices which specified PRODUCT_FULL_TREBLE_OVERRIDE were only those devices with a PRODUCT_SHIPPING_API_LEVEL of < 26. This allowed them to update to use these features but maintain some legacy behaviors. For these devices, to achieve the same backwards compatibility guarantees, much other/extra work would have to be done (if it is possible at all). Since that time, a new category of devices take advantage of PRODUCT_FULL_TREBLE_OVERRIDE. These devices must either not define a PRODUCT_SHIPPING_API_LEVEL or they apply this flag even though it is not required to be applied. For these cases, the full test suite not being run has caused problems because these failures aren't discoverred until later (when compliance tests are run). Fixes: 112933807 Test: treble_sepolicy_tests on marlin, walleye, and 'some other device' (mma here runs this with the correct parameters) Change-Id: I04c42d3cb86cda3c82f285919b40ba94e1332daa --- treble_sepolicy_tests_for_release.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/treble_sepolicy_tests_for_release.mk b/treble_sepolicy_tests_for_release.mk index 5529a7e9f..5fb18bff6 100644 --- a/treble_sepolicy_tests_for_release.mk +++ b/treble_sepolicy_tests_for_release.mk @@ -85,11 +85,19 @@ $(treble_sepolicy_tests_$(version)): PRIVATE_SEPOLICY := $(built_sepolicy) $(treble_sepolicy_tests_$(version)): PRIVATE_SEPOLICY_OLD := $(built_$(version)_plat_sepolicy) $(treble_sepolicy_tests_$(version)): PRIVATE_COMBINED_MAPPING := $($(version)_mapping.combined.cil) $(treble_sepolicy_tests_$(version)): PRIVATE_PLAT_SEPOLICY := $(built_plat_sepolicy) -ifeq ($(PRODUCT_FULL_TREBLE_OVERRIDE),true) -$(treble_sepolicy_tests_$(version)): PRIVATE_FAKE_TREBLE := --fake-treble -else $(treble_sepolicy_tests_$(version)): PRIVATE_FAKE_TREBLE := -endif +ifeq ($(PRODUCT_FULL_TREBLE_OVERRIDE),true) +ifdef PRODUCT_SHIPPING_API_LEVEL +# These requirements were originally added in Android Oreo. Devices +# launching after this should not distinguish between +# PRODUCT_FULL_TREBLE and PRODUCT_FULL_TREBLE_OVERRIDE since this could +# lead to release problems where they think they pass this test but +# fail it when it actually gets runned for compliance. +ifeq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),) +$(treble_sepolicy_tests_$(version)): PRIVATE_FAKE_TREBLE := --fake-treble +endif # if PRODUCT_SHIPPING_API_LEVEL < 26 (Android Oreo) +endif # PRODUCT_SHIPPING_API_LEVEL defined +endif # PRODUCT_FULL_TREBLE_OVERRIDE = true $(treble_sepolicy_tests_$(version)): $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests \ $(all_fc_files) $(built_sepolicy) $(built_plat_sepolicy) \ $(built_$(version)_plat_sepolicy) $($(version)_compat) $($(version)_mapping.combined.cil)