Split DepIsInSameApex into outgoing and incoming

Prepare for calling DepIsInSameApex from the apex transition mutator
by splitting all the implementations in two, one that is called on the
outgoing module and only takes the depTag, and one that is called on the
incoming module and only takes the depTag.

apexBundle.depVisitor was passing the child into android.IsDepInSameApex
for both the parent and child paramters.  The parent field was only
used to find the type on which to call DepIsInSameApex, so this
effectively used the child's implementation of DepIsInSameApex.  That
used to be necessary when the parent and child were of different
module types, as the parent module type may not have been aware
of the rules for the child module type, but is no longer necessary
with split outgoing and incoming DepIsInSameApex.

Bug: 372543712
Test: all soong tests pass
Change-Id: If7c81ec3f7b1ea69d77e9ad7694e238820194e59
diff --git a/rust/rust.go b/rust/rust.go
index 1417c08..64cfa40 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1824,43 +1824,18 @@
 }
 
 // Implements android.ApexModule
-func (mod *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
-	depTag := ctx.OtherModuleDependencyTag(dep)
-
-	if ccm, ok := dep.(*cc.Module); ok {
-		if ccm.HasStubsVariants() {
-			if cc.IsSharedDepTag(depTag) {
-				// dynamic dep to a stubs lib crosses APEX boundary
-				return false
-			}
-			if cc.IsRuntimeDepTag(depTag) {
-				// runtime dep to a stubs lib also crosses APEX boundary
-				return false
-			}
-
-			if cc.IsHeaderDepTag(depTag) {
-				return false
-			}
-		}
-		if mod.Static() && cc.IsSharedDepTag(depTag) {
-			// shared_lib dependency from a static lib is considered as crossing
-			// the APEX boundary because the dependency doesn't actually is
-			// linked; the dependency is used only during the compilation phase.
-			return false
-		}
-	}
-
+func (mod *Module) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
 	if depTag == procMacroDepTag || depTag == customBindgenDepTag {
 		return false
 	}
 
-	if rustDep, ok := dep.(*Module); ok && rustDep.ApexExclude() {
-		return false
-	}
-
 	return true
 }
 
+func (mod *Module) IncomingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
+	return !mod.ApexExclude()
+}
+
 // Overrides ApexModule.IsInstallabeToApex()
 func (mod *Module) IsInstallableToApex() bool {
 	if mod.compiler != nil {