diff --git a/android/apex.go b/android/apex.go index 2ac6ed08d..683e50162 100644 --- a/android/apex.go +++ b/android/apex.go @@ -84,6 +84,9 @@ type ApexInfo struct { // Returns the name of the test apexes that this module is included in. TestApexes []string + + // Returns the name of the overridden apex (com.android.foo) + BaseApexName string } // AllApexInfo holds the ApexInfo of all apexes that include this module. diff --git a/apex/apex.go b/apex/apex.go index c19732eb1..97aedfacc 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1040,6 +1040,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) { InApexModules: []string{a.Name()}, // could be com.mycompany.android.foo ApexContents: []*android.ApexContents{apexContents}, TestApexes: testApexes, + BaseApexName: mctx.ModuleName(), } mctx.WalkDeps(func(child, parent android.Module) bool { if !continueApexDepsWalk(child, parent) { diff --git a/java/sdk_library.go b/java/sdk_library.go index e9fa83ae7..c19b07bb6 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -3279,7 +3279,7 @@ func (module *sdkLibraryXml) implPath(ctx android.ModuleContext) string { // TODO(b/146468504): ApexVariationName() is only a soong module name, not apex name. // In most cases, this works fine. But when apex_name is set or override_apex is used // this can be wrong. - return fmt.Sprintf("/apex/%s/javalib/%s.jar", apexInfo.ApexVariationName, implName) + return fmt.Sprintf("/apex/%s/javalib/%s.jar", apexInfo.BaseApexName, implName) } partition := "system" if module.SocSpecific() {