Revert "Revert "Never strip and store dex files uncompressed when they are preopted on system.""
This reverts commit 67e8ec1973700bbdbc4cd68b3493d56d270ca377.
Test: build && atest android.text.cts.EmojiTest#testEmojiGlyphWebView on Cuttlefish
Exempt-From-Owner-Approval: Got +2 from Colin, latest PS is a rebase across conflicts.
Change-Id: I99faf0f2ec698d70c107516bd43756b9ddcb90d0
diff --git a/java/app.go b/java/app.go
index 9697582..05d1927 100644
--- a/java/app.go
+++ b/java/app.go
@@ -171,9 +171,18 @@
}
// Uncompress dex in APKs of privileged apps, and modules used by privileged apps.
- return ctx.Config().UncompressPrivAppDex() &&
+ if ctx.Config().UncompressPrivAppDex() &&
(Bool(a.appProperties.Privileged) ||
- inList(ctx.ModuleName(), ctx.Config().ModulesLoadedByPrivilegedModules()))
+ inList(ctx.ModuleName(), ctx.Config().ModulesLoadedByPrivilegedModules())) {
+ return true
+ }
+
+ // Uncompress if the dex files is preopted on /system.
+ if !a.dexpreopter.dexpreoptDisabled(ctx) && (ctx.Host() || !odexOnSystemOther(ctx, a.dexpreopter.installPath)) {
+ return true
+ }
+
+ return false
}
func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
@@ -232,7 +241,6 @@
}
func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path {
- a.deviceProperties.UncompressDex = a.shouldUncompressDex(ctx)
var installDir string
if ctx.ModuleName() == "framework-res" {
@@ -244,6 +252,9 @@
installDir = filepath.Join("app", a.installApkName)
}
a.dexpreopter.installPath = android.PathForModuleInstall(ctx, installDir, a.installApkName+".apk")
+ a.dexpreopter.isInstallable = Bool(a.properties.Installable)
+ a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx)
+ a.deviceProperties.UncompressDex = a.dexpreopter.uncompressedDex
if ctx.ModuleName() != "framework-res" {
a.Module.compile(ctx, a.aaptSrcJar)