From eabd24d1d16a22af52dc04cf4ae8001165ccdb8e Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Wed, 26 Oct 2022 23:23:27 +0100 Subject: [PATCH] Let DEXOPT_IDLE_BACKGROUND_JOB select dalvik.vm.background-dex2oat-* system properties in ART Service. This code path isn't accessible, but this is done for the sake of completeness in case that changes. Test: adb root adb shell setprop dalvik.vm.background-dex2oat-threads 3 then make a call to DexOptHelper.performDexOpt with appropriate flags and dalvik.vm.useartservice=true, and check that dex2oat is called with -j3. Bug: 251903639 Change-Id: I8580b8974aada31969e93197ff8be09a045c3354 --- .../core/java/com/android/server/pm/dex/DexoptOptions.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/pm/dex/DexoptOptions.java b/services/core/java/com/android/server/pm/dex/DexoptOptions.java index 310c0e8c68fe8..bdf1cc5a042f8 100644 --- a/services/core/java/com/android/server/pm/dex/DexoptOptions.java +++ b/services/core/java/com/android/server/pm/dex/DexoptOptions.java @@ -300,9 +300,9 @@ public final class DexoptOptions { if ((mFlags & DEXOPT_BOOT_COMPLETE) != 0) { if ((mFlags & DEXOPT_FOR_RESTORE) != 0) { priority = ArtFlags.PRIORITY_INTERACTIVE_FAST; + } else if ((mFlags & DEXOPT_IDLE_BACKGROUND_JOB) != 0) { + priority = ArtFlags.PRIORITY_BACKGROUND; } else { - // TODO(b/251903639): Repurpose DEXOPT_IDLE_BACKGROUND_JOB to choose new - // dalvik.vm.background-dex2oat-* properties. priority = ArtFlags.PRIORITY_INTERACTIVE; } } else { @@ -317,9 +317,6 @@ public final class DexoptOptions { // We don't require it to be set either. It's safe when switching between old and new // code paths since the only effect is that some packages may be unnecessarily compiled // without user profiles. - // - // - DEXOPT_IDLE_BACKGROUND_JOB: Its only effect is to allow the debug variant dex2oatd to - // be used, but ART Service never uses that (cf. Artd::GetDex2Oat in artd.cc). return new DexoptParams.Builder(convertToArtServiceDexoptReason(mCompilationReason), flags) .setCompilerFilter(mCompilerFilter)