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/java/sdk_library.go b/java/sdk_library.go
index 7891776..991f847 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1282,7 +1282,7 @@
 func CheckMinSdkVersion(ctx android.ModuleContext, module *Library) {
 	android.CheckMinSdkVersion(ctx, module.MinSdkVersion(ctx), func(c android.BaseModuleContext, do android.PayloadDepsCallback) {
 		ctx.WalkDeps(func(child android.Module, parent android.Module) bool {
-			isExternal := !module.depIsInSameApex(ctx, child)
+			isExternal := !android.IsDepInSameApex(ctx, module, child)
 			if am, ok := child.(android.ApexModule); ok {
 				if !do(ctx, parent, am, isExternal) {
 					return false
@@ -1636,15 +1636,14 @@
 }
 
 // Implements android.ApexModule
-func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
-	depTag := mctx.OtherModuleDependencyTag(dep)
+func (module *SdkLibrary) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
 	if depTag == xmlPermissionsFileTag {
 		return true
 	}
-	if dep.Name() == module.implLibraryModuleName() {
+	if depTag == implLibraryTag {
 		return true
 	}
-	return module.Library.DepIsInSameApex(mctx, dep)
+	return module.Library.OutgoingDepIsInSameApex(depTag)
 }
 
 // Implements android.ApexModule
@@ -2059,8 +2058,7 @@
 var _ android.ApexModule = (*SdkLibraryImport)(nil)
 
 // Implements android.ApexModule
-func (module *SdkLibraryImport) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
-	depTag := mctx.OtherModuleDependencyTag(dep)
+func (module *SdkLibraryImport) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
 	if depTag == xmlPermissionsFileTag {
 		return true
 	}