Preopt system server jars with updatable bootclasspath.

Previously, we preopt system server jars without updatable bootclasspath
in the build system so that the artifacts can keep valid after a
mainline update. Things have been changed after then. We now re-compile
system server jars on the user's device after a mainline update
(b/189467174), so we no longer need the artifacts generated at build
time to keep valid. Therefore, we can preopt system server jars with
updatable bootclasspath to achieve better performance.

Bug: 199573699
Test: m services
Test: manual - 1. Build a system image and flash it into a device.
  2. adb root && adb shell grep "services" /proc/`adb shell pidof system_server`/maps
  3. See "/system/framework/oat/x86_64/services.{odex,vdex,art} in the
  output.
  4. adb logcat -d odrefresh:D odsign:D "*:S"
  5. See "odrefresh said artifacts are VALID" and no dex2oat invocation
  in the output.

Change-Id: I9c94a54aa15c46708067f4bc89ff05bc7af32a7b
This commit is contained in:
Jiakai Zhang
2021-09-11 03:44:06 +00:00
parent 204356f3b5
commit 02669e8a30

View File

@@ -236,8 +236,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
bootImage = artBootImageConfig(ctx)
}
// System server jars are an exception: they are dexpreopted without updatable bootclasspath.
dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp && !isSystemServerJar)
dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp)
targets := ctx.MultiTargets()
if len(targets) == 0 {