Merge "Consistently use either "boot" or "apex" boot image as the default."
am: 13c929e32e
Change-Id: I7582db4dab5f44334b94f8114ac929d9e8892500
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 479dec6..1192d92 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -101,10 +101,6 @@
global := dexpreoptGlobalConfig(ctx)
bootImage := defaultBootImageConfig(ctx)
- defaultBootImage := bootImage
- if global.UseApexImage {
- bootImage = apexBootImageConfig(ctx)
- }
var archs []android.ArchType
for _, a := range ctx.MultiTargets() {
@@ -174,11 +170,8 @@
DexPreoptImagesDeps: imagesDeps,
DexPreoptImageLocations: bootImage.imageLocations,
- // We use the dex paths and dex locations of the default boot image, as it
- // contains the full dexpreopt boot classpath. Other images may just contain a subset of
- // the dexpreopt boot classpath.
- PreoptBootClassPathDexFiles: defaultBootImage.dexPathsDeps.Paths(),
- PreoptBootClassPathDexLocations: defaultBootImage.dexLocationsDeps,
+ PreoptBootClassPathDexFiles: bootImage.dexPathsDeps.Paths(),
+ PreoptBootClassPathDexLocations: bootImage.dexLocationsDeps,
PreoptExtractedApk: false,
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 1d363c9..5714531 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -220,15 +220,18 @@
return
}
- // Always create the default boot image first, to get a unique profile rule for all images.
- d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx))
- if !skipDexpreoptArtBootJars(ctx) {
- // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
- d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
- }
+ // Default boot image is either the framework one, or the JIT-zygote one.
+ // The boot image that is created first is used to get a unique profile rule for all images.
if global.GenerateApexImage {
- // Create boot images for the JIT-zygote experiment.
- d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
+ d.defaultBootImage = buildBootImage(ctx, apexBootImageConfig(ctx))
+ d.otherImages = append(d.otherImages, buildBootImage(ctx, frameworkBootImageConfig(ctx)))
+ } else {
+ d.defaultBootImage = buildBootImage(ctx, frameworkBootImageConfig(ctx))
+ }
+
+ // Create the ART boot image.
+ if !skipDexpreoptArtBootJars(ctx) {
+ d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
}
dumpOatRules(ctx, d.defaultBootImage)
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 91e0dfb..d578b67 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -234,7 +234,7 @@
return *genBootImageConfigs(ctx)[artBootImageName]
}
-func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
+func frameworkBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkBootImageName]
}
@@ -242,6 +242,14 @@
return *genBootImageConfigs(ctx)[apexBootImageName]
}
+func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
+ if dexpreoptGlobalConfig(ctx).UseApexImage {
+ return apexBootImageConfig(ctx)
+ } else {
+ return frameworkBootImageConfig(ctx)
+ }
+}
+
func defaultBootclasspath(ctx android.PathContext) []string {
return ctx.Config().OnceStringSlice(defaultBootclasspathKey, func() []string {
global := dexpreoptGlobalConfig(ctx)