Commit d4aeff4c authored by Pete Williamson's avatar Pete Williamson Committed by Commit Bot

Catch exception thrown when calling JobScheduler.schedule

In the field we are seeing a small percentage of exceptions while trying to
schedule a task with JobScheduler.  The invalid argument exception is
complaining that we haven't registerd our scheduler component properly,
but we believe that we have.  This seems to happen on older OSs that have
been more heavily modified.  Since we have limited means of debugging these,
we'll catch the error and return failure instead.

Bug: 831911
Change-Id: I8c8c376a24744d786e87bf30a8c4ab914f13e5be
Reviewed-on: https://chromium-review.googlesource.com/1171873Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Commit-Queue: Peter Williamson <petewil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583824}
parent 24fe268f
......@@ -145,9 +145,15 @@ class BackgroundTaskSchedulerJobService implements BackgroundTaskSchedulerDelega
if (!taskInfo.shouldUpdateCurrent() && hasPendingJob(jobScheduler, taskInfo.getTaskId())) {
return true;
}
int result = jobScheduler.schedule(jobInfo);
return result == JobScheduler.RESULT_SUCCESS;
// This can fail on heavily modified android builds. Catch so we don't crash.
try {
return jobScheduler.schedule(jobInfo) == JobScheduler.RESULT_SUCCESS;
} catch (Exception e) {
// Typically we don't catch RuntimeException, but this time we do want to catch it
// because we are worried about android as modified by device manufacturers.
Log.e(TAG, "Unable to schedule with Android.", e);
return false;
}
}
@Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment