Store uncompressed and aligned DEX files for java libs in APEXes.
Test: aosp_walleye-userdebug boots.
Test: In internal, cherry-picked this CL, walleye-userdebug boots.
Test: In internal, ensure that DEX file wifi-service.jar in the
com.android.wifi APEX is now stored uncompressed:
$ zipinfo out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
Archive: out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
Zip file size: 3086879 bytes, number of entries: 3
-rw---- 2.0 fat 3086304 b- stor 08-Jan-01 00:00 classes.dex
-rw---- 2.0 fat 339 b- defN 80-Feb-01 00:00 META-INF/proguard/androidx-annotations.pro
-rw---- 2.0 fat 45 b- defN 08-Jan-01 00:00 META-INF/MANIFEST.MF
3 files, 3086688 bytes uncompressed, 3086480 bytes compressed: 0.0%
Before the change it was:
$ zipinfo out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
Archive: out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
Zip file size: 1241938 bytes, number of entries: 3
-rw---- 2.0 fat 3086304 bl defN 08-Jan-01 00:00 classes.dex
-rw---- 2.0 fat 339 b- defN 80-Feb-01 00:00 META-INF/proguard/androidx-annotations.pro
-rw---- 2.0 fat 45 b- defN 08-Jan-01 00:00 META-INF/MANIFEST.MF
3 files, 3086688 bytes uncompressed, 1241526 bytes compressed: 59.8%
Bug: 148099857
Bug: 146984232
Change-Id: Ia302967b280be85665032cc870c5d5d2419586fc
diff --git a/java/java.go b/java/java.go
index 4c6a5a5..1007a97 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1741,6 +1741,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