Merge "Add a system property support to disable background dexopt job"

This commit is contained in:
TreeHugger Robot
2017-07-18 20:11:59 +00:00
committed by Android (Google) Code Review

View File

@@ -99,6 +99,10 @@ public class BackgroundDexOptService extends JobService {
getDowngradeUnusedAppsThresholdInMillis();
public static void schedule(Context context) {
if (isBackgroundDexoptDisabled()) {
return;
}
JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
// Schedule a one-off job which scans installed packages and updates
@@ -477,4 +481,9 @@ public class BackgroundDexOptService extends JobService {
}
return TimeUnit.DAYS.toMillis(Long.parseLong(sysPropValue));
}
private static boolean isBackgroundDexoptDisabled() {
return SystemProperties.getBoolean("pm.dexopt.disable_bg_dexopt" /* key */,
false /* default */);
}
}