Loading java/config/config.go +0 −6 Original line number Diff line number Diff line Loading @@ -33,12 +33,6 @@ var ( DefaultLambdaStubsLibrary = "core-lambda-stubs" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar" // A list of the jars that provide information about usages of the hidden API. HiddenAPIExtraAppUsageJars = []string{ // The core-oj-hiddenapi provides information for the core-oj jar. "core-oj-hiddenapi", } DefaultJacocoExcludeFilter = []string{"org.junit.*", "org.jacoco.*", "org.mockito.*"} InstrumentFrameworkModules = []string{ Loading java/hiddenapi.go +29 −9 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ package java import ( "strings" "github.com/google/blueprint" "android/soong/android" "android/soong/java/config" ) var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", blueprint.RuleParams{ Loading Loading @@ -56,22 +57,41 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOu uncompressDex bool) android.ModuleOutPath { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { isBootJar := inList(ctx.ModuleName(), ctx.Config().BootJars()) if isBootJar || inList(ctx.ModuleName(), config.HiddenAPIExtraAppUsageJars) { name := ctx.ModuleName() // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // for the boot jar module <x>. Otherwise, the module provides information for itself. // Either way extract the name of the boot jar module. bootJarName := strings.TrimSuffix(name, "-hiddenapi") // If this module is on the boot jars list (or providing information for a module // on the list) then extract the hiddenapi information from it, and if necessary // encode that information in the generated dex file. // // It is important that hiddenapi information is only gathered for/from modules on // that are actually on the boot jars list because the runtime only enforces access // to the hidden API for the bootclassloader. If information is gathered for modules // not on the list then that will cause failures in the CtsHiddenApiBlacklist... // tests. if inList(bootJarName, ctx.Config().BootJars()) { // Derive the greylist from classes jar. flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv") metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv") hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, implementationJar) h.flagsCSVPath = flagsCSV h.metadataCSVPath = metadataCSV } if isBootJar { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", ctx.ModuleName()+".jar") // If this module is actually on the boot jars list and not providing // hiddenapi information for a module on the boot jars list then encode // the gathered information in the generated dex file. if name == bootJarName { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") h.bootDexJarPath = dexJar hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) dexJar = hiddenAPIJar } } } return dexJar } Loading java/hiddenapi_singleton.go +7 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,13 @@ func stubFlagsRule(ctx android.SingletonContext) { // Public API stubs publicStubModules := []string{ "android_stubs_current", "android.test.base.stubs", } // Add the android.test.base to the set of stubs only if the android.test.base module is on // the boot jars list as the runtime will only enforce hiddenapi access against modules on // that list. if inList("android.test.base", ctx.Config().BootJars()) { publicStubModules = append(publicStubModules, "android.test.base.stubs") } // System API stubs Loading Loading
java/config/config.go +0 −6 Original line number Diff line number Diff line Loading @@ -33,12 +33,6 @@ var ( DefaultLambdaStubsLibrary = "core-lambda-stubs" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar" // A list of the jars that provide information about usages of the hidden API. HiddenAPIExtraAppUsageJars = []string{ // The core-oj-hiddenapi provides information for the core-oj jar. "core-oj-hiddenapi", } DefaultJacocoExcludeFilter = []string{"org.junit.*", "org.jacoco.*", "org.mockito.*"} InstrumentFrameworkModules = []string{ Loading
java/hiddenapi.go +29 −9 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ package java import ( "strings" "github.com/google/blueprint" "android/soong/android" "android/soong/java/config" ) var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", blueprint.RuleParams{ Loading Loading @@ -56,22 +57,41 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOu uncompressDex bool) android.ModuleOutPath { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { isBootJar := inList(ctx.ModuleName(), ctx.Config().BootJars()) if isBootJar || inList(ctx.ModuleName(), config.HiddenAPIExtraAppUsageJars) { name := ctx.ModuleName() // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // for the boot jar module <x>. Otherwise, the module provides information for itself. // Either way extract the name of the boot jar module. bootJarName := strings.TrimSuffix(name, "-hiddenapi") // If this module is on the boot jars list (or providing information for a module // on the list) then extract the hiddenapi information from it, and if necessary // encode that information in the generated dex file. // // It is important that hiddenapi information is only gathered for/from modules on // that are actually on the boot jars list because the runtime only enforces access // to the hidden API for the bootclassloader. If information is gathered for modules // not on the list then that will cause failures in the CtsHiddenApiBlacklist... // tests. if inList(bootJarName, ctx.Config().BootJars()) { // Derive the greylist from classes jar. flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv") metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv") hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, implementationJar) h.flagsCSVPath = flagsCSV h.metadataCSVPath = metadataCSV } if isBootJar { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", ctx.ModuleName()+".jar") // If this module is actually on the boot jars list and not providing // hiddenapi information for a module on the boot jars list then encode // the gathered information in the generated dex file. if name == bootJarName { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") h.bootDexJarPath = dexJar hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) dexJar = hiddenAPIJar } } } return dexJar } Loading
java/hiddenapi_singleton.go +7 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,13 @@ func stubFlagsRule(ctx android.SingletonContext) { // Public API stubs publicStubModules := []string{ "android_stubs_current", "android.test.base.stubs", } // Add the android.test.base to the set of stubs only if the android.test.base module is on // the boot jars list as the runtime will only enforce hiddenapi access against modules on // that list. if inList("android.test.base", ctx.Config().BootJars()) { publicStubModules = append(publicStubModules, "android.test.base.stubs") } // System API stubs Loading