From e8b00d69c04e18ec48177a1fa1c99884170d50c7 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 21 Dec 2018 15:54:16 +0000 Subject: [PATCH] Preopt: Do not strip non-image boot class path jars. Test: Pixel 2 XL boots. Bug: 119868597 Change-Id: I7bd3b7655aecf1a8c26dd8d4d18d3eec685ece88 --- android/config.go | 8 ++++++++ android/variable.go | 3 +++ dexpreopt/config.go | 1 + java/java.go | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/android/config.go b/android/config.go index 38f6ec8ac..f5ea38133 100644 --- a/android/config.go +++ b/android/config.go @@ -749,6 +749,14 @@ func (c *config) ModulesLoadedByPrivilegedModules() []string { return c.productVariables.ModulesLoadedByPrivilegedModules } +func (c *config) BootJars() []string { + return c.productVariables.BootJars +} + +func (c *config) PreoptBootJars() []string { + return c.productVariables.PreoptBootJars +} + func (c *config) DisableDexPreopt(name string) bool { return Bool(c.productVariables.DisableDexPreopt) || InList(name, c.productVariables.DisableDexPreoptModules) } diff --git a/android/variable.go b/android/variable.go index 7e976cd60..ddaf166a3 100644 --- a/android/variable.go +++ b/android/variable.go @@ -198,6 +198,9 @@ type productVariables struct { UncompressPrivAppDex *bool `json:",omitempty"` ModulesLoadedByPrivilegedModules []string `json:",omitempty"` + BootJars []string `json:",omitempty"` + PreoptBootJars []string `json:",omitempty"` + DisableDexPreopt *bool `json:",omitempty"` DisableDexPreoptModules []string `json:",omitempty"` DexPreoptProfileDir *string `json:",omitempty"` diff --git a/dexpreopt/config.go b/dexpreopt/config.go index 6b5c40d60..503af7efa 100644 --- a/dexpreopt/config.go +++ b/dexpreopt/config.go @@ -36,6 +36,7 @@ type GlobalConfig struct { PreoptBootClassPathDexLocations []string // virtual locations of boot class path files BootJars []string // modules for jars that form the boot class path + PreoptBootJars []string // modules for jars that form the boot image SystemServerJars []string // jars that form the system server SystemServerApps []string // apps that are loaded into system server SpeedApps []string // apps that should be speed optimized diff --git a/java/java.go b/java/java.go index fa4aee43d..a23835bb8 100644 --- a/java/java.go +++ b/java/java.go @@ -1364,6 +1364,12 @@ type Library struct { } func (j *Library) shouldUncompressDex(ctx android.ModuleContext) bool { + // Store uncompressed (and do not strip) dex files from boot class path jars that are not + // part of the boot image. + if inList(ctx.ModuleName(), ctx.Config().BootJars()) && + !inList(ctx.ModuleName(), ctx.Config().PreoptBootJars()) { + return true + } return false }