Merge "Store uncompressed and aligned DEX files for java libs in APEXes."
diff --git a/apex/apex_test.go b/apex/apex_test.go
index b7dd7fb..c7ecbc9 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3014,7 +3014,7 @@
 	ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv/AppFooPriv.apk")
 
 	// JNI libraries are embedded inside APK
-	appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Rule("zip")
+	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
diff --git a/java/java.go b/java/java.go
index 794ee68..ed3dca9 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1727,6 +1727,11 @@
 }
 
 func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bool {
+	// Store uncompressed (and aligned) any dex files from jars in APEXes.
+	if am, ok := ctx.Module().(android.ApexModule); ok && !am.IsForPlatform() {
+		return true
+	}
+
 	// Store uncompressed (and do not strip) dex files from boot class path jars.
 	if inList(ctx.ModuleName(), ctx.Config().BootJars()) {
 		return true