Patch to fix Aug train issue with tethering
A temporary patch to fix issues with the tethering module sdk in the
August train. This will be reverted immediately and only used for
specific builds for the August train and possibly the September train
if this has not been fixed properly by then. The proper fix will be
implemented under b/238472881.
This patch removes framework-tethering-t from the snapshot's Android.bp
file and removes its effect on the hidden API flag files too.
Bug: 238472881
Test: build train
Change-Id: I57969b85a12e9e5a3fc76c055b260cec5d5f7d7f
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index b6b179c..85c17d3 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -769,7 +769,7 @@
// their own.
if output.SignaturePatternsPath == nil {
output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
- ctx, output.AllFlagsPath, []string{"*"}, nil, nil)
+ ctx, output.AllFlagsPath, []string{"*"}, nil, nil, "")
}
// Initialize a HiddenAPIInfo structure.
@@ -853,12 +853,10 @@
return false
}
-// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
-// for the fragment as well as encoding the flags in the boot dex jars.
-func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
+func (b *BootclasspathFragmentModule) generateHiddenApiFlagRules(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput, bootDexInfoByModule bootDexInfoByModule, suffix string) HiddenAPIFlagOutput {
// Generate the rules to create the hidden API flags and update the supplied hiddenAPIInfo with the
// paths to the created files.
- output := hiddenAPIRulesForBootclasspathFragment(ctx, contents, input)
+ flagOutput := hiddenAPIFlagRulesForBootclasspathFragment(ctx, bootDexInfoByModule, contents, input, suffix)
// If the module specifies split_packages or package_prefixes then use those to generate the
// signature patterns.
@@ -866,8 +864,8 @@
packagePrefixes := b.sourceOnlyProperties.Hidden_api.Package_prefixes
singlePackages := b.sourceOnlyProperties.Hidden_api.Single_packages
if splitPackages != nil || packagePrefixes != nil || singlePackages != nil {
- output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
- ctx, output.AllFlagsPath, splitPackages, packagePrefixes, singlePackages)
+ flagOutput.SignaturePatternsPath = buildRuleSignaturePatternsFile(
+ ctx, flagOutput.AllFlagsPath, splitPackages, packagePrefixes, singlePackages, suffix)
} else if !b.isTestFragment() {
ctx.ModuleErrorf(`Must specify at least one of the split_packages, package_prefixes and single_packages properties
If this is a new bootclasspath_fragment or you are unsure what to do add the
@@ -879,6 +877,49 @@
should specify here. If you are happy with its suggestions then you can add
the --fix option and it will fix them for you.`, b.BaseModuleName())
}
+ return flagOutput
+}
+
+// produceHiddenAPIOutput produces the hidden API all-flags.csv file (and supporting files)
+// for the fragment as well as encoding the flags in the boot dex jars.
+func (b *BootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
+ // Gather information about the boot dex files for the boot libraries provided by this fragment.
+ bootDexInfoByModule := extractBootDexInfoFromModules(ctx, contents)
+
+ flagOutput := b.generateHiddenApiFlagRules(ctx, contents, input, bootDexInfoByModule, "")
+
+ encodedBootDexFilesByModule := hiddenAPIEncodeRulesForBootclasspathFragment(ctx, bootDexInfoByModule, flagOutput.AllFlagsPath)
+
+ output := &HiddenAPIOutput{
+ HiddenAPIFlagOutput: flagOutput,
+ EncodedBootDexFilesByModule: encodedBootDexFilesByModule,
+ }
+
+ config := ctx.Config()
+ targetApiLevel := android.ApiLevelOrPanic(ctx,
+ config.GetenvWithDefault("SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE", "current"))
+
+ filterContents := []android.Module{}
+ for _, module := range contents {
+ minApiLevel := android.MinApiLevelForSdkSnapshot(ctx, module)
+ if minApiLevel.GreaterThan(targetApiLevel) {
+ delete(bootDexInfoByModule, module.Name())
+ delete(input.StubDexJarsByScope, module.Name())
+ continue
+ }
+
+ filterContents = append(filterContents, module)
+ }
+
+ if len(filterContents) != len(contents) {
+ flagOutput = b.generateHiddenApiFlagRules(ctx, filterContents, input, bootDexInfoByModule, "-for-sdk-snapshot")
+ }
+
+ // Copy the information and make it available for sdk snapshot.
+ ctx.SetProvider(HiddenAPIInfoForSdkProvider, HiddenAPIInfoForSdk{
+ FlagFilesByCategory: input.FlagFilesByCategory,
+ HiddenAPIFlagOutput: flagOutput,
+ })
return output
}
@@ -1044,7 +1085,7 @@
// Get the hidden API information from the module.
mctx := ctx.SdkModuleContext()
- hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoProvider).(HiddenAPIInfo)
+ hiddenAPIInfo := mctx.OtherModuleProvider(module, HiddenAPIInfoForSdkProvider).(HiddenAPIInfoForSdk)
b.Flag_files_by_category = hiddenAPIInfo.FlagFilesByCategory
// Copy all the generated file paths.
@@ -1223,6 +1264,15 @@
output.FilteredStubFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_stub_flags, output.StubFlagsPath)
output.FilteredFlagsPath = pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Filtered_flags, output.AllFlagsPath)
+ // If the prebuilts module does not provide a signature patterns file then generate one from the
+ // flags.
+ // TODO(b/192868581): Remove once the prebuilts all provide a signature patterns file of their
+ // own.
+ if output.SignaturePatternsPath == nil {
+ output.SignaturePatternsPath = buildRuleSignaturePatternsFile(
+ ctx, output.AllFlagsPath, []string{"*"}, nil, nil, "")
+ }
+
return &output
}