Revert^2 "Do not dexpreopt system server jars from updatable modules."

This reverts commit 01f6b0a656.

Reason for revert: Build failure is not reproducible.
Forrest build on the same build ID 6033773 and same target
cf_x86_phone-userdebug_coverage finished successfully.

Change-Id: I5077f8332aa0b8037e324b89d41f35b86b8cf216
This commit is contained in:
Ulyana Trafimovich 2019-11-27 12:26:49 +00:00
parent 01f6b0a656
commit f2cb7e959b
2 changed files with 19 additions and 13 deletions

View file

@ -102,6 +102,13 @@ func dexpreoptDisabled(global GlobalConfig, module ModuleConfig) bool {
return true return true
} }
// Don't preopt system server jars that are updatable.
for _, p := range global.UpdatableSystemServerJars {
if _, jar := SplitApexJarPair(p); jar == module.Name {
return true
}
}
// If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip // If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip
// Also preopt system server jars since selinux prevents system server from loading anything from // Also preopt system server jars since selinux prevents system server from loading anything from
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
@ -537,6 +544,16 @@ func makefileMatch(pattern, s string) bool {
} }
} }
// Expected format for apexJarValue = <apex name>:<jar name>
func SplitApexJarPair(apexJarValue string) (string, string) {
var apexJarPair []string = strings.SplitN(apexJarValue, ":", 2)
if apexJarPair == nil || len(apexJarPair) != 2 {
panic(fmt.Errorf("malformed apexJarValue: %q, expected format: <apex>:<jar>",
apexJarValue))
}
return apexJarPair[0], apexJarPair[1]
}
func contains(l []string, s string) bool { func contains(l []string, s string) bool {
for _, e := range l { for _, e := range l {
if e == s { if e == s {

View file

@ -15,7 +15,6 @@
package java package java
import ( import (
"fmt"
"path/filepath" "path/filepath"
"strings" "strings"
@ -66,16 +65,6 @@ func setDexpreoptTestGlobalConfig(config android.Config, globalConfig dexpreopt.
var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig") var dexpreoptGlobalConfigKey = android.NewOnceKey("DexpreoptGlobalConfig")
var dexpreoptTestGlobalConfigKey = android.NewOnceKey("TestDexpreoptGlobalConfig") var dexpreoptTestGlobalConfigKey = android.NewOnceKey("TestDexpreoptGlobalConfig")
// Expected format for apexJarValue = <apex name>:<jar name>
func splitApexJarPair(apexJarValue string) (string, string) {
var apexJarPair []string = strings.SplitN(apexJarValue, ":", 2)
if apexJarPair == nil || len(apexJarPair) != 2 {
panic(fmt.Errorf("malformed apexJarValue: %q, expected format: <apex>:<jar>",
apexJarValue))
}
return apexJarPair[0], apexJarPair[1]
}
// systemServerClasspath returns the on-device locations of the modules in the system server classpath. It is computed // systemServerClasspath returns the on-device locations of the modules in the system server classpath. It is computed
// once the first time it is called for any ctx.Config(), and returns the same slice for all future calls with the same // once the first time it is called for any ctx.Config(), and returns the same slice for all future calls with the same
// ctx.Config(). // ctx.Config().
@ -89,9 +78,9 @@ func systemServerClasspath(ctx android.PathContext) []string {
filepath.Join("/system/framework", m+".jar")) filepath.Join("/system/framework", m+".jar"))
} }
for _, m := range global.UpdatableSystemServerJars { for _, m := range global.UpdatableSystemServerJars {
apex, jar := splitApexJarPair(m) apex, jar := dexpreopt.SplitApexJarPair(m)
systemServerClasspathLocations = append(systemServerClasspathLocations, systemServerClasspathLocations = append(systemServerClasspathLocations,
filepath.Join("/apex", apex, "javalib", jar + ".jar")) filepath.Join("/apex", apex, "javalib", jar+".jar"))
} }
return systemServerClasspathLocations return systemServerClasspathLocations
}) })