Loading java/base.go +2 −2 Original line number Diff line number Diff line Loading @@ -1217,8 +1217,8 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { return } // Update hidden API paths. j.hiddenAPIUpdatePaths(ctx, dexOutputFile, j.implementationJarFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputFile, j.implementationJarFile) // Encode hidden API flags in dex file. dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile, proptools.Bool(j.dexProperties.Uncompress_dex)) Loading java/hiddenapi.go +18 −23 Original line number Diff line number Diff line Loading @@ -79,12 +79,29 @@ type hiddenAPIIntf interface { var _ hiddenAPIIntf = (*hiddenAPI)(nil) // Initialize the hiddenapi structure func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext) { func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar, classesJar android.Path) { // Save the classes jars even if this is not active as they may be used by modular hidden API // processing. classesJars := android.Paths{classesJar} ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) { javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo) classesJars = append(classesJars, javaInfo.ImplementationJars...) }) h.classesJarPaths = classesJars // Save the unencoded dex jar so it can be used when generating the // hiddenAPISingletonPathsStruct.stubFlags file. h.bootDexJarPath = dexJar // If hiddenapi processing is disabled treat this as inactive. if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { return } // The context module must implement hiddenAPIModule. module := ctx.Module().(hiddenAPIModule) // If the frameworks/base directories does not exist and no prebuilt hidden API flag files have // been configured then it is not possible to do hidden API encoding. if !ctx.Config().FrameworksBaseDirExists(ctx) && ctx.Config().PrebuiltHiddenApiDir(ctx) == "" { Loading @@ -95,7 +112,6 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext) { // 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 CtsHiddenApiBlocklist... tests. module := ctx.Module() h.active = isModuleInBootClassPath(ctx, module) if !h.active { // The rest of the properties will be ignored if active is false. Loading Loading @@ -170,27 +186,6 @@ func (h *hiddenAPI) hiddenAPIEncodeDex(ctx android.ModuleContext, dexJar android return dexJar } // hiddenAPIUpdatePaths generates ninja rules to extract the information from the classes // jar, and outputs it to the appropriate module specific CSV file. // // It also makes the dex jar available for use when generating the // hiddenAPISingletonPathsStruct.stubFlags. func (h *hiddenAPI) hiddenAPIUpdatePaths(ctx android.ModuleContext, dexJar, classesJar android.Path) { // Save the classes jars even if this is not active as they may be used by modular hidden API // processing. classesJars := android.Paths{classesJar} ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) { javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo) classesJars = append(classesJars, javaInfo.ImplementationJars...) }) h.classesJarPaths = classesJars // Save the unencoded dex jar so it can be used when generating the // hiddenAPISingletonPathsStruct.stubFlags file. h.bootDexJarPath = dexJar } // buildRuleToGenerateAnnotationFlags builds a ninja rule to generate the annotation-flags.csv file // from the classes jars and stub-flags.csv files. // Loading java/java.go +5 −9 Original line number Diff line number Diff line Loading @@ -481,9 +481,6 @@ func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo } func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Initialize the hiddenapi structure. j.initHiddenAPI(ctx) j.sdkVersion = j.SdkVersion(ctx) j.minSdkVersion = j.MinSdkVersion(ctx) Loading Loading @@ -1239,9 +1236,6 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.sdkVersion = j.SdkVersion(ctx) j.minSdkVersion = j.MinSdkVersion(ctx) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx) if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() { j.hideApexVariantFromMake = true } Loading Loading @@ -1313,7 +1307,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo) if dexOutputPath := di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar"); dexOutputPath != nil { j.dexJarFile = dexOutputPath j.hiddenAPIUpdatePaths(ctx, dexOutputPath, outputFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputPath, outputFile) } else { // This should never happen as a variant for a prebuilt_apex is only created if the // prebuilt_apex has been configured to export the java library dex file. Loading Loading @@ -1344,8 +1340,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } // Update hidden API paths. j.hiddenAPIUpdatePaths(ctx, dexOutputFile, outputFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputFile, outputFile) // Encode hidden API flags in dex file. dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile, proptools.Bool(j.dexProperties.Uncompress_dex)) Loading java/sdk_library.go +1 −2 Original line number Diff line number Diff line Loading @@ -2121,8 +2121,7 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo) if dexOutputPath := di.PrebuiltExportPath(module.BaseModuleName(), ".dexjar"); dexOutputPath != nil { module.dexJarFile = dexOutputPath module.initHiddenAPI(ctx) module.hiddenAPIUpdatePaths(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0]) module.initHiddenAPI(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0]) } else { // This should never happen as a variant for a prebuilt_apex is only created if the // prebuilt_apex has been configured to export the java library dex file. Loading Loading
java/base.go +2 −2 Original line number Diff line number Diff line Loading @@ -1217,8 +1217,8 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { return } // Update hidden API paths. j.hiddenAPIUpdatePaths(ctx, dexOutputFile, j.implementationJarFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputFile, j.implementationJarFile) // Encode hidden API flags in dex file. dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile, proptools.Bool(j.dexProperties.Uncompress_dex)) Loading
java/hiddenapi.go +18 −23 Original line number Diff line number Diff line Loading @@ -79,12 +79,29 @@ type hiddenAPIIntf interface { var _ hiddenAPIIntf = (*hiddenAPI)(nil) // Initialize the hiddenapi structure func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext) { func (h *hiddenAPI) initHiddenAPI(ctx android.ModuleContext, dexJar, classesJar android.Path) { // Save the classes jars even if this is not active as they may be used by modular hidden API // processing. classesJars := android.Paths{classesJar} ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) { javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo) classesJars = append(classesJars, javaInfo.ImplementationJars...) }) h.classesJarPaths = classesJars // Save the unencoded dex jar so it can be used when generating the // hiddenAPISingletonPathsStruct.stubFlags file. h.bootDexJarPath = dexJar // If hiddenapi processing is disabled treat this as inactive. if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { return } // The context module must implement hiddenAPIModule. module := ctx.Module().(hiddenAPIModule) // If the frameworks/base directories does not exist and no prebuilt hidden API flag files have // been configured then it is not possible to do hidden API encoding. if !ctx.Config().FrameworksBaseDirExists(ctx) && ctx.Config().PrebuiltHiddenApiDir(ctx) == "" { Loading @@ -95,7 +112,6 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext) { // 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 CtsHiddenApiBlocklist... tests. module := ctx.Module() h.active = isModuleInBootClassPath(ctx, module) if !h.active { // The rest of the properties will be ignored if active is false. Loading Loading @@ -170,27 +186,6 @@ func (h *hiddenAPI) hiddenAPIEncodeDex(ctx android.ModuleContext, dexJar android return dexJar } // hiddenAPIUpdatePaths generates ninja rules to extract the information from the classes // jar, and outputs it to the appropriate module specific CSV file. // // It also makes the dex jar available for use when generating the // hiddenAPISingletonPathsStruct.stubFlags. func (h *hiddenAPI) hiddenAPIUpdatePaths(ctx android.ModuleContext, dexJar, classesJar android.Path) { // Save the classes jars even if this is not active as they may be used by modular hidden API // processing. classesJars := android.Paths{classesJar} ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) { javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo) classesJars = append(classesJars, javaInfo.ImplementationJars...) }) h.classesJarPaths = classesJars // Save the unencoded dex jar so it can be used when generating the // hiddenAPISingletonPathsStruct.stubFlags file. h.bootDexJarPath = dexJar } // buildRuleToGenerateAnnotationFlags builds a ninja rule to generate the annotation-flags.csv file // from the classes jars and stub-flags.csv files. // Loading
java/java.go +5 −9 Original line number Diff line number Diff line Loading @@ -481,9 +481,6 @@ func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo } func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Initialize the hiddenapi structure. j.initHiddenAPI(ctx) j.sdkVersion = j.SdkVersion(ctx) j.minSdkVersion = j.MinSdkVersion(ctx) Loading Loading @@ -1239,9 +1236,6 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.sdkVersion = j.SdkVersion(ctx) j.minSdkVersion = j.MinSdkVersion(ctx) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx) if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() { j.hideApexVariantFromMake = true } Loading Loading @@ -1313,7 +1307,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo) if dexOutputPath := di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar"); dexOutputPath != nil { j.dexJarFile = dexOutputPath j.hiddenAPIUpdatePaths(ctx, dexOutputPath, outputFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputPath, outputFile) } else { // This should never happen as a variant for a prebuilt_apex is only created if the // prebuilt_apex has been configured to export the java library dex file. Loading Loading @@ -1344,8 +1340,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } // Update hidden API paths. j.hiddenAPIUpdatePaths(ctx, dexOutputFile, outputFile) // Initialize the hiddenapi structure. j.initHiddenAPI(ctx, dexOutputFile, outputFile) // Encode hidden API flags in dex file. dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile, proptools.Bool(j.dexProperties.Uncompress_dex)) Loading
java/sdk_library.go +1 −2 Original line number Diff line number Diff line Loading @@ -2121,8 +2121,7 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo) if dexOutputPath := di.PrebuiltExportPath(module.BaseModuleName(), ".dexjar"); dexOutputPath != nil { module.dexJarFile = dexOutputPath module.initHiddenAPI(ctx) module.hiddenAPIUpdatePaths(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0]) module.initHiddenAPI(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0]) } else { // This should never happen as a variant for a prebuilt_apex is only created if the // prebuilt_apex has been configured to export the java library dex file. Loading