Merge "Skip cancelling jobs with FLAG_WILL_BE_FOREGROUND." into nyc-dev am: 9bdf289f0a

am: cc80f0a955

* commit 'cc80f0a955812a903ddb0dd3c7e0b54cacdf30b9':
  Skip cancelling jobs with FLAG_WILL_BE_FOREGROUND.

Change-Id: I66e3af5f084adf6c03a972c37e8c870be2265092
This commit is contained in:
Jeff Sharkey
2016-06-01 23:39:24 +00:00
committed by android-build-merger

View File

@@ -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<mActiveServices.size(); i++) {
JobServiceContext jsc = mActiveServices.get(i);
final JobStatus executing = jsc.getRunningJob();
if (executing != null) {
if (executing != null
&& (executing.getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) == 0) {
jsc.cancelExecutingJob(JobParameters.REASON_DEVICE_IDLE);
}
}