summaryrefslogtreecommitdiff
path: root/java/hiddenapi_modular.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2022-04-28 17:45:11 +0100
committer Paul Duffin <paulduffin@google.com> 2022-04-28 18:34:48 +0100
commit09817d66dea3639528b35a5b61ddce78766d198c (patch)
treefcf6479a6e90192cb5c2e64a83245f534e9325d4 /java/hiddenapi_modular.go
parentfcf0b686aa0e00a76232f801fbe01707fb7be78f (diff)
hiddenapi: Prevent libraries for Q/R from include S+ flags.
The Q and R runtimes can handle Q/R flags but not S flags. So, this change verifies that any library that can run on Q/R (min_sdk_version <= R) by adding --max-hiddenapi-level=max-target-r to the "hiddenapi encode" command. That will cause a failure if any S+ flags are found in the flags to encode. Bug: 172453495 Test: m droid && launch_cvd Cherry pick changes in https://r.android.com/q/topic:max-target-s Add @UnsupportedAppUsage maxTargetSdk=S in classes in framework-permission (for r/q) and framework-permission-s (nominally for S+). I had to incresed the min_sdk_version in the latter to 31 (S) as it was still set at 30 (R). Change-Id: Ie0f68482603adc7b4e3d7a5c81bf203d81a84a9e
Diffstat (limited to 'java/hiddenapi_modular.go')
-rw-r--r--java/hiddenapi_modular.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index 534a8145f..c90b2ff97 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -1104,7 +1104,7 @@ func hiddenAPIRulesForBootclasspathFragment(ctx android.ModuleContext, contents
for _, name := range android.SortedStringKeys(bootDexInfoByModule) {
bootDexInfo := bootDexInfoByModule[name]
unencodedDex := bootDexInfo.path
- encodedDex := hiddenAPIEncodeDex(ctx, unencodedDex, allFlagsCSV, bootDexInfo.uncompressDex, outputDir)
+ encodedDex := hiddenAPIEncodeDex(ctx, unencodedDex, allFlagsCSV, bootDexInfo.uncompressDex, bootDexInfo.minSdkVersion, outputDir)
encodedBootDexJarsByModule[name] = encodedDex
}
@@ -1188,6 +1188,9 @@ type bootDexInfo struct {
// Indicates whether the dex jar needs uncompressing before encoding.
uncompressDex bool
+
+ // The minimum sdk version that the dex jar will be used on.
+ minSdkVersion android.SdkSpec
}
// bootDexInfoByModule is a map from module name (as returned by module.Name()) to the boot dex
@@ -1213,6 +1216,7 @@ func extractBootDexInfoFromModules(ctx android.ModuleContext, contents []android
bootDexJarsByModule[module.Name()] = bootDexInfo{
path: bootDexJar,
uncompressDex: *hiddenAPIModule.uncompressDex(),
+ minSdkVersion: hiddenAPIModule.MinSdkVersion(ctx),
}
}