Merge initHiddenAPI and hiddenAPIUpdatePaths

These two methods did very similar jobs and merging them together
simplifies the behavior.

Bug: 179354495
Test: m droid
Merged-In: Ibe1a23d54105e6a0e5693079cd8743679301fc85
Change-Id: Ibe1a23d54105e6a0e5693079cd8743679301fc85
(cherry picked from commit 74d18d1d6f)
This commit is contained in:
Paul Duffin
2021-05-14 14:18:47 +01:00
parent 59190602af
commit f88ab95d85
4 changed files with 26 additions and 36 deletions

View File

@@ -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)
@@ -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
}
@@ -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.
@@ -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))