apex: do not follow jni_libs from android_app
Because APK-in-APEX embeds its jni_libs in it. We don't have to follow
deps of jni_libs.
Bug: 146992436
Test: m com.android.tethering
deapexer extract com.android.tethering.apex apex
ls apex # there should be no /lib dir
Merged-In: Ifa1a6430a420ae7376b155cd59b8ece462cced7e
Change-Id: Ifa1a6430a420ae7376b155cd59b8ece462cced7e
(cherry picked from commit b7bebe2616184a02008d6ed3729845445a2310ca)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e694435..b56909c 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2889,9 +2889,19 @@
cc_library_shared {
name: "libjni",
srcs: ["mylib.cpp"],
+ shared_libs: ["libfoo"],
stl: "none",
system_shared_libs: [],
apex_available: [ "myapex" ],
+ sdk_version: "current",
+ }
+
+ cc_library_shared {
+ name: "libfoo",
+ stl: "none",
+ system_shared_libs: [],
+ apex_available: [ "myapex" ],
+ sdk_version: "current",
}
`)
@@ -2902,16 +2912,19 @@
ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk")
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv/AppFooPriv.apk")
- // JNI libraries are embedded inside APK
- appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni lib")
- libjniOutput := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
- ensureListContains(t, appZipRule.Implicits.Strings(), libjniOutput.String())
- // ... uncompressed
+ appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni libs")
+ // JNI libraries are uncompressed
if args := appZipRule.Args["jarArgs"]; !strings.Contains(args, "-L 0") {
- t.Errorf("jni lib is not uncompressed for AppFoo")
+ t.Errorf("jni libs are not uncompressed for AppFoo")
}
- // ... and not directly inside the APEX
- ensureNotContains(t, copyCmds, "image.apex/lib64/libjni.so")
+ // JNI libraries including transitive deps are
+ for _, jni := range []string{"libjni", "libfoo"} {
+ jniOutput := ctx.ModuleForTests(jni, "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
+ // ... embedded inside APK (jnilibs.zip)
+ ensureListContains(t, appZipRule.Implicits.Strings(), jniOutput.String())
+ // ... and not directly inside the APEX
+ ensureNotContains(t, copyCmds, "image.apex/lib64/"+jni+".so")
+ }
}
func TestApexWithAppImports(t *testing.T) {