Restrict lazy dexopt to eng builds only
Bug: 16696554
Change-Id: I56bb63ce534842994a70df6b09843b4e3153c845
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 9554afa..5639234 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -317,6 +317,7 @@
final Context mContext;
final boolean mFactoryTest;
final boolean mOnlyCore;
+ final boolean mLazyDexOpt;
final DisplayMetrics mMetrics;
final int mDefParseFlags;
final String[] mSeparateProcesses;
@@ -1266,6 +1267,7 @@
mContext = context;
mFactoryTest = factoryTest;
mOnlyCore = onlyCore;
+ mLazyDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
mMetrics = new DisplayMetrics();
mSettings = new Settings(context);
mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID,
@@ -4451,13 +4453,12 @@
if (pkgs != null) {
// Filter out packages that aren't recently used.
//
- // The exception is first boot of a non-eng device, which
+ // The exception is first boot of a non-eng device (aka !mLazyDexOpt), which
// should do a full dexopt.
- boolean eng = "eng".equals(SystemProperties.get("ro.build.type"));
- if (eng || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
+ if (mLazyDexOpt || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) {
// TODO: add a property to control this?
long dexOptLRUThresholdInMinutes;
- if (eng) {
+ if (mLazyDexOpt) {
dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds.
} else {
dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users.
@@ -4523,6 +4524,9 @@
}
public boolean performDexOpt(String packageName, String instructionSet, boolean updateUsage) {
+ if (!mLazyDexOpt) {
+ return false;
+ }
PackageParser.Package p;
final String targetInstructionSet;
synchronized (mPackages) {