From 34618b586996dfbfd87a3b7f0d18f26d4d1ebb51 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 1 Jun 2016 15:51:19 -0600 Subject: [PATCH] Skip cancelling jobs with FLAG_WILL_BE_FOREGROUND. When FLAG_WILL_BE_FOREGROUND is set on a job (such as a download), we need to treat the job as if it had a foreground service running so it can continue making forward progress. We already ignore the device idle state when offering to start the job, so this just avoids the hiccup of stopping the job only to restart it a minute later. Bug: 26571724 Change-Id: I348903dd3a7dd7104b0c1bf4310e2a48655d2588 --- .../java/com/android/server/job/JobSchedulerService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java index 899aada9d4969..27b3aa2280c00 100644 --- a/services/core/java/com/android/server/job/JobSchedulerService.java +++ b/services/core/java/com/android/server/job/JobSchedulerService.java @@ -662,11 +662,13 @@ public final class JobSchedulerService extends com.android.server.SystemService public void onDeviceIdleStateChanged(boolean deviceIdle) { synchronized (mLock) { if (deviceIdle) { - // When becoming idle, make sure no jobs are actively running. + // When becoming idle, make sure no jobs are actively running, + // except those using the idle exemption flag. for (int i=0; i