APEX should require base module of stub libraries

Bug: 155841765
Bug: 7456955
Test: m nothing and check the content of out/soong/Android-*.mk
Change-Id: I1f109c27a5e9bcfeb3a887b2e8d6a2cf983aa730
diff --git a/apex/apex.go b/apex/apex.go
index d196e95..88cb55b 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2099,8 +2099,8 @@
 							//
 							// Always include if we are a host-apex however since those won't have any
 							// system libraries.
-							if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.requiredDeps) {
-								a.requiredDeps = append(a.requiredDeps, cc.Name())
+							if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.BaseModuleName(), a.requiredDeps) {
+								a.requiredDeps = append(a.requiredDeps, cc.BaseModuleName())
 							}
 							requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base())
 							// Don't track further