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

am: 2383d08b82

* commit '2383d08b8217520fe68ab616aa1da9112ab45926':
  Skip cancelling jobs with FLAG_WILL_BE_FOREGROUND.

Change-Id: I8670010ccc2c6d30ea9a8a578ad75a91030f0075
This commit is contained in:
Jeff Sharkey
2016-06-02 00:54:08 +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);
}
}