summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2016-12-22 18:50:05 +0200
committer Calin Juravle <calin@google.com> 2017-01-10 16:54:07 -0800
commit3a2b7f7d59da9f54d9de4afbbfeebcfb4a3866f2 (patch)
treee039a618f54fc1ee2c2846ba54975e8e05f61cb5
parent95176bb18e5efeb78978f4950a18fadaf9e6d57e (diff)
Add an extra debug flag to BackgroundDexOptimizer
This makes testing/debugging the job a bit easier. Test: device boots, packages get compiled Bug: 32871170 (cherry picked from commit a50d58e22630cd651a815381639e70476991bdbf) Change-Id: I5b94a8f0b3bbf9075dcaecf028aaf79a21aaab7b
-rw-r--r--services/core/java/com/android/server/pm/BackgroundDexOptService.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/pm/BackgroundDexOptService.java b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
index 2bf5ef10ec89..601a2194e8f3 100644
--- a/services/core/java/com/android/server/pm/BackgroundDexOptService.java
+++ b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
@@ -42,12 +42,18 @@ import java.util.concurrent.TimeUnit;
* {@hide}
*/
public class BackgroundDexOptService extends JobService {
- static final String TAG = "BackgroundDexOptService";
+ private static final String TAG = "BackgroundDexOptService";
- static final long RETRY_LATENCY = 4 * AlarmManager.INTERVAL_HOUR;
+ private static final boolean DEBUG = false;
- static final int JOB_IDLE_OPTIMIZE = 800;
- static final int JOB_POST_BOOT_UPDATE = 801;
+ private static final long RETRY_LATENCY = 4 * AlarmManager.INTERVAL_HOUR;
+
+ private static final int JOB_IDLE_OPTIMIZE = 800;
+ private static final int JOB_POST_BOOT_UPDATE = 801;
+
+ private static final long IDLE_OPTIMIZATION_PERIOD = DEBUG
+ ? TimeUnit.MINUTES.toMillis(1)
+ : TimeUnit.DAYS.toMillis(1);
private static ComponentName sDexoptServiceName = new ComponentName(
"android",
@@ -86,7 +92,7 @@ public class BackgroundDexOptService extends JobService {
js.schedule(new JobInfo.Builder(JOB_IDLE_OPTIMIZE, sDexoptServiceName)
.setRequiresDeviceIdle(true)
.setRequiresCharging(true)
- .setPeriodic(TimeUnit.DAYS.toMillis(1))
+ .setPeriodic(IDLE_OPTIMIZATION_PERIOD)
.build());
if (DEBUG_DEXOPT) {
@@ -208,6 +214,7 @@ public class BackgroundDexOptService extends JobService {
private void idleOptimization(JobParameters jobParams, PackageManagerService pm,
ArraySet<String> pkgs) {
+ Log.i(TAG, "Performing idle optimizations");
// If post-boot update is still running, request that it exits early.
mExitPostBootUpdate.set(true);