Reland: JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the
lib is embedded inside the APK.
This change also fixes a bug that APKs are not mutated for APEXes.
Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: I21ac24412b30c05afc03385655c6b196130dffe3
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 614164d..330dc3c 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2538,7 +2538,17 @@
ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk")
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv/AppFooPriv.apk")
- ensureContains(t, copyCmds, "image.apex/lib64/libjni.so")
+
+ // JNI libraries are embedded inside APK
+ appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Rule("zip")
+ libjniOutput := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_core_shared_myapex").Module().(*cc.Module).OutputFile()
+ ensureListContains(t, appZipRule.Implicits.Strings(), libjniOutput.String())
+ // ... uncompressed
+ if args := appZipRule.Args["jarArgs"]; !strings.Contains(args, "-L 0") {
+ t.Errorf("jni lib is not uncompressed for AppFoo")
+ }
+ // ... and not directly inside the APEX
+ ensureNotContains(t, copyCmds, "image.apex/lib64/libjni.so")
}
func TestApexWithAppImports(t *testing.T) {