OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.offlinepages; |
| 6 |
| 7 import android.annotation.TargetApi; |
| 8 import android.app.job.JobParameters; |
| 9 import android.app.job.JobService; |
| 10 import android.os.Build; |
| 11 |
| 12 /** |
| 13 * The background scheduler job service for handling background request in 5.1+. |
| 14 */ |
| 15 @TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1) |
| 16 public class BackgroundSchedulerJobService extends JobService { |
| 17 @Override |
| 18 public boolean onStartJob(JobParameters params) { |
| 19 // TODO(fgorski): Implement and expose in metadata. |
| 20 // Perhaps initialize application context. |
| 21 // Perhaps ensure one job runs at a time only. |
| 22 // Kick off background processing of downloads here. |
| 23 // Processing will happen on a separate thread, and we'll inform OS when
done. |
| 24 return true; |
| 25 } |
| 26 |
| 27 @Override |
| 28 public boolean onStopJob(JobParameters params) { |
| 29 // TODO(fgorski): Implement and expose in metadata. |
| 30 // Issue a cancel signal to request coordinator. |
| 31 // This is where synchronization might be necessary. |
| 32 // If we didn't stop ourselves, that likely means there is more work to
do. |
| 33 return true; |
| 34 } |
| 35 } |
OLD | NEW |