New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 726860 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

BackgroundTaskScheduler delegate for JobScheduler always overwrites jobs

Project Member Reported by fgor...@chromium.org, May 26 2017

Issue description

Based on documentation of job scheduler
https://developer.android.com/reference/android/app/job/JobScheduler.html#schedule(android.app.job.JobInfo)

this code:
https://cs.chromium.org/chromium/src/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java?type=cs&q=shouldUpdateCurrent+package:%5Echromium$&l=144

if (taskInfo.shouldUpdateCurrent()) {
    jobScheduler.cancel(taskInfo.getTaskId());
}

int result = jobScheduler.schedule(jobInfo);

in schedule implementation of the delegate

is wrong (as it does not prevent the update to current task).

Tommy let me know if you would like to see it merged to M-60. This affects everything from M58
 
Per comment from Tommy, we should update documentation in the area of return value from the schedule() call, when overwrite didn't happen.

We want to return true as long as the task is scheduled after the call (old or new)
Project Member

Comment 2 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c33f7598aadfe913c6b4718e3b879ded0444140a

commit c33f7598aadfe913c6b4718e3b879ded0444140a
Author: fgorski <fgorski@chromium.org>
Date: Fri May 26 23:25:19 2017

[Android] Reimplementing BTSJobSerivce delegate to not overwrite tasks

Change includes looking through all scheduled jobs and not
scheduling a task if there is already a pending job with matching ID

We cannot use getPendingJob as it is not available until API v24.

BUG=726860

Review-Url: https://codereview.chromium.org/2906063004
Cr-Commit-Position: refs/heads/master@{#475183}

[modify] https://crrev.com/c33f7598aadfe913c6b4718e3b879ded0444140a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerJobService.java

Components: Internals>BackgroundTaskScheduler

Sign in to add a comment