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
diff --git a/android/apex.go b/android/apex.go
index 8d99d56..a93baf6 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -178,8 +178,16 @@
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 {