Don't dexpreopt APEX variant modules
Java modules that are APEX variant won't be dexpreopted.
After applying this CL,
- $(ANDROID_PRODUCT_OUT)/apex/com.android.appsearch/javalib/service-appsearch.jar
- $(ANDROID_PRODUCT_OUT)/apex/com.android.cronet/javalib/org.chromium.net.cronet.jar
- $(ANDROID_PRODUCT_OUT)/apex/com.android.os.statsd/javalib/service-statsd.jar
- $(ANDROID_PRODUCT_OUT)/apex/com.android.telephony/app/StkLib/StkLib.apk
above four files are not preopted, thus the dex files aren't uncompressed.
FIle size of JAR/APK is (before / after):
- service-appsearch.jar: 697594 / 273354
- org.chromium.net.cronet.jar: 607206 / 239990
- service-statsd.jar: 90806 / 41857
- StkLib.apk: 6424332 / 2942719
File size of APEX is (before / after):
- com.android.appsearch.apex: 854851 / 432963
- com.android.cronet.apex: 4982739 / 4618195
- com.android.os.statsd.apex: 322319 / 322319
- com.android.telephony.apex: 6596717 / 3111021
Bug: 146984232
Test: lunch aosp_cf_x86_phone-userdebug; m
Test: Build aosp_cf_x86_phone with and w/o this CL and compare artifacts.
After applying this CL, javalibs and apps embedded inside APEX
were not preopted, thus dex file are not uncompressed.
Change-Id: I296173bc29d0df0c4d5cc59e4b070e5c4d3b50d5
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 479dec6..2ee5f8d 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -85,6 +85,11 @@
return true
}
+ // Don't preopt APEX variant module
+ if am, ok := ctx.Module().(android.ApexModule); ok && !am.IsForPlatform() {
+ return true
+ }
+
// TODO: contains no java code
return false