From c4f4cedc4795f5bc77553c5c3f6244192f01b298 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Thu, 27 May 2021 11:17:00 +0000 Subject: [PATCH] Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx." Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719298 Bug: 180325915 Change-Id: I1fd96bad2326612d153fed31308914902f58d3ec Merged-In: Icbe4e025ce1a4c8dd258ff95d326ca2f27905188 (cherry picked from commit f4c44417a3c769be884ee1c2bdcd95689b5cecb4) --- android/apex.go | 13 ------------- apex/prebuilt.go | 7 ++++--- java/hiddenapi_singleton.go | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/android/apex.go b/android/apex.go index 4b744364a..a79b207a8 100644 --- a/android/apex.go +++ b/android/apex.go @@ -117,19 +117,6 @@ func (i ApexInfo) InApexVariant(apexVariant string) bool { return false } -// InApexByBaseName tells whether this apex variant of the module is part of the given apexVariant -// or not, where the APEX is specified by its canonical base name, i.e. typically beginning with -// "com.android.". In particular this function doesn't differentiate between source and prebuilt -// APEXes, where the latter may have "prebuilt_" prefixes. -func (i ApexInfo) InApexVariantByBaseName(apexVariant string) bool { - for _, a := range i.InApexVariants { - if RemoveOptionalPrebuiltPrefix(a) == apexVariant { - return true - } - } - return false -} - func (i ApexInfo) InApexModule(apexModuleName string) bool { for _, a := range i.InApexModules { if a == apexModuleName { diff --git a/apex/prebuilt.go b/apex/prebuilt.go index bdd407952..f0eee6c75 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -227,10 +227,11 @@ func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) { }) // Create an ApexInfo for the prebuilt_apex. + apexVariationName := android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()) apexInfo := android.ApexInfo{ - ApexVariationName: android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName()), - InApexVariants: []string{mctx.ModuleName()}, - InApexModules: []string{mctx.ModuleName()}, + ApexVariationName: apexVariationName, + InApexVariants: []string{apexVariationName}, + InApexModules: []string{apexVariationName}, ApexContents: []*android.ApexContents{apexContents}, ForPrebuiltApex: true, } diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index bdf055abc..52934a327 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -171,7 +171,7 @@ func isModuleInConfiguredList(ctx android.BaseModuleContext, module android.Modu // A platform variant is required but this is for an apex so ignore it. return false } - } else if !apexInfo.InApexVariantByBaseName(requiredApex) { + } else if !apexInfo.InApexVariant(requiredApex) { // An apex variant for a specific apex is required but this is the wrong apex. return false }