Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerDelegate.java

Issue 2714463002: [android] Add JobScheduler-based BackgroundTaskScheduler. (Closed)
Patch Set: FindBugs wants the real Pi, but I won't give it. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerDelegate.java
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerDelegate.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..87538f9ad4a0c2d698e79f704391b3af45ac946f
--- /dev/null
+++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerDelegate.java
@@ -0,0 +1,33 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.components.background_task_scheduler;
+
+import android.content.Context;
+
+/**
+ * The internal representation of a {@link BackgroundTaskScheduler} to make it possible to use
+ * system APIs ({@link android.app.job.JobScheduler} on newer platforms and GCM
+ * ({@link com.google.android.gms.gcm.GcmNetworkManager}) on older platforms.
+ */
+interface BackgroundTaskSchedulerDelegate {
+ /**
+ * Schedules a background task. See {@link TaskInfo} for information on what types of tasks that
+ * can be scheduled.
+ *
+ * @param context the current context.
+ * @param taskInfo the information about the task to be scheduled.
+ * @return true if the schedule operation succeeded, and false otherwise.
+ * @see TaskInfo
+ */
+ boolean schedule(Context context, TaskInfo taskInfo);
+
+ /**
+ * Cancels the task specified by the task ID.
+ *
+ * @param context the current context.
+ * @param taskId the ID of the task to cancel. See {@link TaskIds} for a list.
+ */
+ void cancel(Context context, int taskId);
+}

Powered by Google App Engine
This is Rietveld 408576698