From db8df6a21a438a2874e3cce287468c397976e612 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 12 Jul 2022 13:13:05 +0000 Subject: [PATCH] Allow permission to be treated as optional at build time Although Permission is not an optional module on GMS capable devices it is optional for non-GMS capable devices and so needs to support being treated as optional at build time. Which means that an OEM needs to be able to choose whether to use the prebuilt Permission module or build their own module from source. This is safe even though permission is not an optional mainline module because devices that support mainline must pass GTS and testModulesSignedCorrectly and testModulesPreloadedCorrectly in GTS currently tests this, along with testMainlineApprovedTrain which checks mandatory/optional, signing keys, and if what's preloaded are part of approved trains. Bug: 238175656 Test: packages/modules/common/build/mainline_modules_sdks.sh # Check that permission sdk snapshot uses a permission specific # Soong config variable. Change-Id: I8278622fedbba0292f7cab1114170394cf429849 --- build/mainline_modules_sdks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py index e1c9228..cbc5e8f 100755 --- a/build/mainline_modules_sdks.py +++ b/build/mainline_modules_sdks.py @@ -739,6 +739,19 @@ class MainlineModule: # # This field records the last build release in which they are optional. It # defaults to None which indicates that the module was never optional. + # + # TODO(b/238203992): remove the following warning once all modules can be + # treated as optional at build time. + # + # DO NOT use this attr for anything other than controlling whether the + # generated snapshot uses its own Soong config variable or the common one. + # That is because this is being temporarily used to force Permission to have + # its own Soong config variable even though Permission is not actually + # optional at runtime on a GMS capable device. + # + # b/238203992 will make all modules have their own Soong config variable by + # default at which point this will no longer be needed on Permission and so + # it can be used to indicate that a module is optional at runtime. last_optional_release: typing.Optional[BuildRelease] = None # The short name for the module. @@ -881,6 +894,11 @@ MAINLINE_MODULES = [ # that are provided in R by non-updatable parts of the # bootclasspath. ]), + # Although Permission is not, and has never been, optional for GMS + # capable devices it does need to be treated as optional at build time + # when building non-GMS devices. + # TODO(b/238203992): remove once all modules are optional at build time. + last_optional_release=LATEST, ), MainlineModule( apex="com.android.scheduling",