summaryrefslogtreecommitdiff
path: root/java/app.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-12-03 01:33:09 +0000
committer Spandan Das <spandandas@google.com> 2024-12-03 02:30:04 +0000
commit10c4136b1f838de9c0f3832f642eb92e439dce1d (patch)
tree974baaf8ac30e3ca20aef977095532feddc8d978 /java/app.go
parent4e305cec97bd9bb6a9e4472a167efc4ac11a0836 (diff)
Reland "Skip packaging cross container cc deps of apk-in-apex"
This relands https://r.android.com/3375509, but uses `NotInPlatform` of the top-level app in `collectAppDeps`. The original implementation was reverted because it skipped packaging jni lib deps that crossed an api domain boundary. This is the intended behavior for apk-in-apex, but runs into issues for android_test. The linkerconfig for these has been setup to allow access to LLNDK (in system) and LLNDK_MOVED_TO_APEX_LIBRARIES. Other libraries like `libnativebridge` cannot be accessed by tests on device, so the tests need their own copy. Test: m ArtServiceTests Test: verified that the contents of the apk are same before and after Bug: 375473764 Change-Id: I3a3985e576959c3113fc1e11f43dbe669603ec22
Diffstat (limited to 'java/app.go')
-rw-r--r--java/app.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/app.go b/java/app.go
index 34a548e5a..4dea7dc1b 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1082,7 +1082,18 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx)
}
jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps,
- checkNativeSdkVersion, func(dep cc.LinkableInterface) bool { return !dep.IsNdk(ctx.Config()) && !dep.IsStubs() })
+ checkNativeSdkVersion, func(parent, child android.Module) bool {
+ apkInApex := ctx.Module().(android.ApexModule).NotInPlatform()
+ childLinkable, _ := child.(cc.LinkableInterface)
+ parentLinkable, _ := parent.(cc.LinkableInterface)
+ useStubsOfDep := childLinkable.IsStubs()
+ if apkInApex && 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
+ })
var certificates []Certificate
@@ -1117,7 +1128,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
func collectJniDeps(ctx android.ModuleContext,
shouldCollectRecursiveNativeDeps bool,
checkNativeSdkVersion bool,
- filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) {
+ filter func(parent, child android.Module) bool) ([]jniLib, android.Paths) {
var jniLibs []jniLib
var prebuiltJniPackages android.Paths
seenModulePaths := make(map[string]bool)
@@ -1128,7 +1139,7 @@ func collectJniDeps(ctx android.ModuleContext,
if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) {
if dep, ok := module.(cc.LinkableInterface); ok {
- if filter != nil && !filter(dep) {
+ if filter != nil && !filter(parent, module) {
return false
}