hostdex:true modules are available for platform

Java libraries with hostdex: true are available for the platform even if
it doesn't have "//apex_available:platform" in the apex_available
property. Note that the java libraries are still prevented from being
installed to the device.

Bug: 128708192
Test: m

Change-Id: I6463ebc59cf7fd861b812999d7a79c387bbb3335
This commit is contained in:
Jiyong Park
2019-12-03 00:43:57 +09:00
parent 2812df4edb
commit b02bb40f33
3 changed files with 22 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ import (
func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
hostDexNeeded := Bool(library.deviceProperties.Hostdex) && !library.Host()
if !library.IsForPlatform() {
// If the platform variant is available, don't emit hostdex modules from the APEX variants
// Don't emit hostdex modules from the APEX variants
hostDexNeeded = false
}
@@ -62,8 +62,14 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
var entriesList []android.AndroidMkEntries
mainEntries := android.AndroidMkEntries{Disabled: true}
// For a java library built for an APEX, we don't need Make module
if library.IsForPlatform() {
hideFromMake := !library.IsForPlatform()
// If not available for platform, don't emit to make.
if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
hideFromMake = true
}
if !hideFromMake {
mainEntries = android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(library.outputFile),