Fix apex to follow deps of modules with stubs.

In case that an apex module depends on a module with stubs directly
*and* indirectly, the build system should follow the deps graph further.

Note that WalkDeps() visits deps in DFS and it won't visit again visited
modules.

Bug: n/a
Test: m (apex_test.go amended)
Change-Id: I1a6f135dbda6d1eb641575a3fbbc9bbee0622076
diff --git a/android/apex.go b/android/apex.go
index 3da4828..0d03678 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -228,6 +228,14 @@
 	apexNames[apexName] = apexNames[apexName] || directDep
 }
 
+// TODO(b/146393795): remove this when b/146393795 is fixed
+func ClearApexDependency() {
+	m := apexNamesMap()
+	for k := range m {
+		delete(m, k)
+	}
+}
+
 // Tests whether a module named moduleName is directly depended on by an APEX
 // named apexName.
 func DirectlyInApex(apexName string, moduleName string) bool {