Avoid profile guided compilation for vmSafeMode
Bug: 30688277
Bug: 30733908
Test: adb shell cmd package compile -m speed-profile comb.BBClient
Change-Id: I6783c80566b6b3b67025a3d258ebbdede0c7ca2d
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 26a840d..97a0eb5 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -174,6 +174,16 @@
isProfileGuidedFilter = false;
}
+ // Disable profile guided compilation for vmSafeMode.
+ final boolean vmSafeMode = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_VM_SAFE_MODE)
+ != 0;
+ final boolean debuggable = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE)
+ != 0;
+ if (vmSafeMode) {
+ targetCompilerFilter = getNonProfileGuidedCompilerFilter(targetCompilerFilter);
+ isProfileGuidedFilter = false;
+ }
+
// If we're asked to take profile updates into account, check now.
boolean newProfile = false;
if (checkProfiles && isProfileGuidedFilter) {
@@ -185,9 +195,6 @@
}
}
- final boolean vmSafeMode = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0;
- final boolean debuggable = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
-
boolean performedDexOpt = false;
boolean successfulDexOpt = true;