Merge changes I473731a6,Icb91de93,I5a2edaf4 into tm-dev

* changes:
  Remove android.safetycenter from framework-permission bcp permitted_packges
  Change permitted_packages check to be per-jar rather than per-apex
  Revert "Relax apex package restriction for T+ jars"
This commit is contained in:
Spandan Das
2022-04-04 14:50:56 +00:00
committed by Android (Google) Code Review
4 changed files with 71 additions and 210 deletions

View File

@@ -2986,21 +2986,19 @@ func makeApexAvailableBaseline() map[string][]string {
}
func init() {
android.AddNeverAllowRules(createApexPermittedPackagesRules(qModulesPackages())...)
android.AddNeverAllowRules(createApexPermittedPackagesRules(rModulesPackages())...)
android.AddNeverAllowRules(createBcpPermittedPackagesRules(qBcpPackages())...)
android.AddNeverAllowRules(createBcpPermittedPackagesRules(rBcpPackages())...)
}
func createApexPermittedPackagesRules(modules_packages map[string][]string) []android.Rule {
rules := make([]android.Rule, 0, len(modules_packages))
for module_name, module_packages := range modules_packages {
func createBcpPermittedPackagesRules(bcpPermittedPackages map[string][]string) []android.Rule {
rules := make([]android.Rule, 0, len(bcpPermittedPackages))
for jar, permittedPackages := range bcpPermittedPackages {
permittedPackagesRule := android.NeverAllow().
BootclasspathJar().
With("apex_available", module_name).
WithMatcher("permitted_packages", android.NotInList(module_packages)).
WithMatcher("min_sdk_version", android.LessThanSdkVersion("Tiramisu")).
Because("jars that are part of the " + module_name +
" module may only use these package prefixes: " + strings.Join(module_packages, ",") +
" with min_sdk < T. Please consider the following alternatives:\n" +
With("name", jar).
WithMatcher("permitted_packages", android.NotInList(permittedPackages)).
Because(jar +
" bootjar may only use these package prefixes: " + strings.Join(permittedPackages, ",") +
". Please consider the following alternatives:\n" +
" 1. If the offending code is from a statically linked library, consider " +
"removing that dependency and using an alternative already in the " +
"bootclasspath, or perhaps a shared library." +
@@ -3008,57 +3006,56 @@ func createApexPermittedPackagesRules(modules_packages map[string][]string) []an
" 3. Jarjar the offending code. Please be mindful of the potential system " +
"health implications of bundling that code, particularly if the offending jar " +
"is part of the bootclasspath.")
rules = append(rules, permittedPackagesRule)
}
return rules
}
// DO NOT EDIT! These are the package prefixes that are exempted from being AOT'ed by ART on Q/R/S.
// DO NOT EDIT! These are the package prefixes that are exempted from being AOT'ed by ART.
// Adding code to the bootclasspath in new packages will cause issues on module update.
func qModulesPackages() map[string][]string {
func qBcpPackages() map[string][]string {
return map[string][]string{
"com.android.conscrypt": []string{
"conscrypt": []string{
"android.net.ssl",
"com.android.org.conscrypt",
},
"com.android.media": []string{
"updatable-media": []string{
"android.media",
},
}
}
// DO NOT EDIT! These are the package prefixes that are exempted from being AOT'ed by ART on R/S.
// DO NOT EDIT! These are the package prefixes that are exempted from being AOT'ed by ART.
// Adding code to the bootclasspath in new packages will cause issues on module update.
func rModulesPackages() map[string][]string {
func rBcpPackages() map[string][]string {
return map[string][]string{
"com.android.mediaprovider": []string{
"framework-mediaprovider": []string{
"android.provider",
},
"com.android.permission": []string{
"framework-permission": []string{
"android.permission",
//TODO(b/205719989): remove, do not cherry-pick anywhere
"android.safetycenter",
"android.app.role",
"com.android.permission",
"com.android.role",
},
"com.android.sdkext": []string{
"framework-sdkextensions": []string{
"android.os.ext",
},
"com.android.os.statsd": []string{
"framework-statsd": []string{
"android.app",
"android.os",
"android.util",
"com.android.internal.statsd",
"com.android.server.stats",
},
"com.android.wifi": []string{
"framework-wifi": []string{
"com.android.server.wifi",
"com.android.wifi.x",
"android.hardware.wifi",
"android.net.wifi",
},
"com.android.tethering": []string{
"framework-tethering": []string{
"android.net",
},
}