Return false in DirectlyInAnyApex for host libraries.

Host doesn't have apexes.

Bug: 122947954
Test: build dex2oat, check that libnativebridge is installed.
Change-Id: I3548e3f155a200e56d71e88631b71511bad84161
This commit is contained in:
Nicolas Geoffray
2019-01-15 19:53:23 +00:00
parent 63d91fad6a
commit c22c1bf130
3 changed files with 18 additions and 6 deletions

View File

@@ -178,8 +178,16 @@ func DirectlyInApex(apexName string, moduleName string) bool {
return false
}
type hostContext interface {
Host() bool
}
// Tests whether a module named moduleName is directly depended on by any APEX.
func DirectlyInAnyApex(moduleName string) bool {
func DirectlyInAnyApex(ctx hostContext, moduleName string) bool {
if ctx.Host() {
// Host has no APEX.
return false
}
apexNamesMapMutex.Lock()
defer apexNamesMapMutex.Unlock()
if apexNames, ok := apexNamesMap()[moduleName]; ok {