diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/base.go | 11 | ||||
-rw-r--r-- | java/sdk_library_internal.go | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/java/base.go b/java/base.go index f26404b8c..b579a5d0f 100644 --- a/java/base.go +++ b/java/base.go @@ -838,13 +838,18 @@ func (j *Module) TargetSdkVersion(ctx android.EarlyModuleContext) android.ApiLev } func (j *Module) AvailableFor(what string) bool { - if what == android.AvailableToPlatform && Bool(j.deviceProperties.Hostdex) { + return android.CheckAvailableForApex(what, j.ApexAvailableFor()) +} + +func (j *Module) ApexAvailableFor() []string { + list := j.ApexModuleBase.ApexAvailable() + if Bool(j.deviceProperties.Hostdex) { // Exception: for hostdex: true libraries, the platform variant is created // even if it's not marked as available to platform. In that case, the platform // variant is used only for the hostdex and not installed to the device. - return true + list = append(list, android.AvailableToPlatform) } - return j.ApexModuleBase.AvailableFor(what) + return android.FirstUniqueStrings(list) } func (j *Module) staticLibs(ctx android.BaseModuleContext) []string { diff --git a/java/sdk_library_internal.go b/java/sdk_library_internal.go index 768e57a11..ec9c160ea 100644 --- a/java/sdk_library_internal.go +++ b/java/sdk_library_internal.go @@ -15,12 +15,13 @@ package java import ( - "android/soong/android" - "android/soong/etc" "fmt" "path" "strings" + "android/soong/android" + "android/soong/etc" + "github.com/google/blueprint/proptools" ) @@ -778,7 +779,11 @@ var _ etc.PrebuiltEtcModule = (*sdkLibraryXml)(nil) // from android.ApexModule func (module *sdkLibraryXml) AvailableFor(what string) bool { - return true + return android.CheckAvailableForApex(what, module.ApexAvailableFor()) +} + +func (module *sdkLibraryXml) ApexAvailableFor() []string { + return []string{android.AvailableToPlatform, android.AvailableToAnyApex} } func (module *sdkLibraryXml) DepsMutator(ctx android.BottomUpMutatorContext) { |