Make SystemServerJars ConfiguredJarList.
Consistent with plumbing of boot jars. SystemServerJars only support /system/framework/ jars.
Bug: 180105615, 155630745
Test: m && launch_cvd
Change-Id: I58b005b7c4103c8e250090e995b1d9b2f9ed4a76
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index 7397919..24492d4 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -49,7 +49,7 @@
ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX
- SystemServerJars []string // jars that form the system server
+ SystemServerJars android.ConfiguredJarList // jars that form the system server
SystemServerApps []string // apps that are loaded into system server
UpdatableSystemServerJars android.ConfiguredJarList // jars within apex that are loaded into system server
SpeedApps []string // apps that should be speed optimized
@@ -604,7 +604,7 @@
BootJars: android.EmptyConfiguredJarList(),
UpdatableBootJars: android.EmptyConfiguredJarList(),
ArtApexJars: android.EmptyConfiguredJarList(),
- SystemServerJars: nil,
+ SystemServerJars: android.EmptyConfiguredJarList(),
SystemServerApps: nil,
UpdatableSystemServerJars: android.EmptyConfiguredJarList(),
SpeedApps: nil,
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 628197c..c9a80f8 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -120,7 +120,7 @@
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
// or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options.
if global.OnlyPreoptBootImageAndSystemServer && !global.BootJars.ContainsJar(module.Name) &&
- !contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk {
+ !global.SystemServerJars.ContainsJar(module.Name) && !module.PreoptExtractedApk {
return true
}
@@ -362,7 +362,7 @@
if !android.PrefixInList(preoptFlags, "--compiler-filter=") {
var compilerFilter string
- if contains(global.SystemServerJars, module.Name) {
+ if global.SystemServerJars.ContainsJar(module.Name) {
// Jars of system server, use the product option if it is set, speed otherwise.
if global.SystemServerCompilerFilter != "" {
compilerFilter = global.SystemServerCompilerFilter
@@ -416,7 +416,7 @@
// PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
// PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
- if contains(global.SystemServerJars, module.Name) {
+ if global.SystemServerJars.ContainsJar(module.Name) {
if global.AlwaysSystemServerDebugInfo {
debugInfo = true
} else if global.NeverSystemServerDebugInfo {
@@ -524,7 +524,7 @@
// from java subpackage to dexpreopt.
func NonUpdatableSystemServerJars(ctx android.PathContext, global *GlobalConfig) []string {
return ctx.Config().Once(nonUpdatableSystemServerJarsKey, func() interface{} {
- return android.RemoveListFromList(global.SystemServerJars, global.UpdatableSystemServerJars.CopyOfJars())
+ return android.RemoveListFromList(global.SystemServerJars.CopyOfJars(), global.UpdatableSystemServerJars.CopyOfJars())
}).([]string)
}
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 0020a2d..3113eb3 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -150,7 +150,7 @@
global := dexpreopt.GetGlobalConfig(ctx)
- isSystemServerJar := inList(ctx.ModuleName(), global.SystemServerJars)
+ isSystemServerJar := global.SystemServerJars.ContainsJar(ctx.ModuleName())
bootImage := defaultBootImageConfig(ctx)
if global.UseArtImage {
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 0ab6502..72b61e3 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -39,10 +39,9 @@
// 2) The jars that are from an updatable apex.
systemServerClasspathLocations = append(systemServerClasspathLocations,
global.UpdatableSystemServerJars.DevicePaths(ctx.Config(), android.Android)...)
- if len(systemServerClasspathLocations) != len(global.SystemServerJars)+global.UpdatableSystemServerJars.Len() {
- panic(fmt.Errorf("Wrong number of system server jars, got %d, expected %d",
- len(systemServerClasspathLocations),
- len(global.SystemServerJars)+global.UpdatableSystemServerJars.Len()))
+
+ if expectedLen := global.SystemServerJars.Len() + global.UpdatableSystemServerJars.Len(); expectedLen != len(systemServerClasspathLocations) {
+ panic(fmt.Errorf("wrong number of system server jars, got %d, expected %d", len(systemServerClasspathLocations), expectedLen))
}
return systemServerClasspathLocations
})