Convert checkApexAvailability to use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I7582db8e22e94d0a9db7715a76bb6ed34c166a4e
diff --git a/java/base.go b/java/base.go
index f26404b..b579a5d 100644
--- a/java/base.go
+++ b/java/base.go
@@ -838,13 +838,18 @@
}
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 {