Stubs dependency is not installed

When the stubs variant of a library is dependend by a platform component
and the library is included in one or more APEX, the library is not
installed to the platform, because it is provided by APEX.

Bug: 120266448
Test: m
Test: add stubs: { versions: ["1"], }, to libnetd_resolv
then build netd. libnetd_resolv.so does not exist under /system.

Change-Id: I09b78e38df285033ef6e9c85f7ea4b0274e85070
diff --git a/android/apex.go b/android/apex.go
index 3a191cf..9d65c08 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -158,6 +158,14 @@
 	return false
 }
 
+// Tests if moduleName is included in any APEX.
+func InAnyApex(config Config, moduleName string) bool {
+	bundleNamesMapMutex.Lock()
+	defer bundleNamesMapMutex.Unlock()
+	bundleNames, ok := apexBundleNamesMap(config)[moduleName]
+	return ok && len(bundleNames) > 0
+}
+
 func InitApexModule(m ApexModule) {
 	base := m.apexModuleBase()
 	base.canHaveApexVariants = true