Revert "Skip packaging cross container cc deps of apk-in-apex"

This reverts commit 6e0c11049d859040c125f19cfab01d473b4bd398.

Reason for revert: Droidmonitor created revert due to b/381931089. Will be verifying through ABTD before submission.

Change-Id: Id5cb534132c1db84cfda5f1da5c62c0a26bce19c
diff --git a/java/app.go b/java/app.go
index 832a083..7f80160 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1082,17 +1082,7 @@
 			app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx)
 	}
 	jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps,
-		checkNativeSdkVersion, func(parent, child android.Module) bool {
-			childLinkable, _ := child.(cc.LinkableInterface)
-			parentLinkable, _ := parent.(cc.LinkableInterface)
-			useStubsOfDep := childLinkable.IsStubs()
-			if parent.(android.ApexModule).NotInPlatform() && parentLinkable != nil {
-				// APK-in-APEX
-				// If the parent is a linkable interface, use stubs if the dependency edge crosses an apex boundary.
-				useStubsOfDep = useStubsOfDep || (childLinkable.HasStubsVariants() && cc.ShouldUseStubForApex(ctx, parent, child))
-			}
-			return !childLinkable.IsNdk(ctx.Config()) && !useStubsOfDep
-		})
+		checkNativeSdkVersion, func(dep cc.LinkableInterface) bool { return !dep.IsNdk(ctx.Config()) && !dep.IsStubs() })
 
 	var certificates []Certificate
 
@@ -1127,7 +1117,7 @@
 func collectJniDeps(ctx android.ModuleContext,
 	shouldCollectRecursiveNativeDeps bool,
 	checkNativeSdkVersion bool,
-	filter func(parent, child android.Module) bool) ([]jniLib, android.Paths) {
+	filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) {
 	var jniLibs []jniLib
 	var prebuiltJniPackages android.Paths
 	seenModulePaths := make(map[string]bool)
@@ -1138,7 +1128,7 @@
 
 		if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) {
 			if dep, ok := module.(cc.LinkableInterface); ok {
-				if filter != nil && !filter(parent, module) {
+				if filter != nil && !filter(dep) {
 					return false
 				}