1 /*
2  * Copyright 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package androidx.work.impl;
17 
18 import android.support.annotation.NonNull;
19 import android.support.annotation.RestrictTo;
20 
21 import androidx.work.impl.model.WorkSpec;
22 
23 /**
24  * An interface for classes responsible for scheduling background work.
25  *
26  * @hide
27  */
28 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
29 public interface Scheduler {
30 
31     /**
32      * The maximum number of {@link WorkSpec}s that can be scheduled at a given point in time.
33      * @hide
34      */
35     int MAX_SCHEDULER_LIMIT = 100;
36 
37     /**
38      * Schedule the given {@link WorkSpec}s for background execution.  The Scheduler does NOT need
39      * to check if there are any dependencies.
40      *
41      * @param workSpecs The array of {@link WorkSpec}s to schedule
42      * @hide
43      */
schedule(WorkSpec... workSpecs)44     void schedule(WorkSpec... workSpecs);
45 
46     /**
47      * Cancel the work identified by the given {@link WorkSpec} id.
48      *
49      * @param workSpecId The id of the work to stopWork
50      * @hide
51      */
cancel(@onNull String workSpecId)52     void cancel(@NonNull String workSpecId);
53 }
54