1 /**
2  * Copyright 2014, 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 
17 package android.app.job;
18 
19 import android.app.job.JobWorkItem;
20 
21 /**
22  * The server side of the JobScheduler IPC protocols.  The app-side implementation
23  * invokes on this interface to indicate completion of the (asynchronous) instructions
24  * issued by the server.
25  *
26  * In all cases, the 'who' parameter is the caller's service binder, used to track
27  * which Job Service instance is reporting.
28  *
29  * {@hide}
30  */
31 interface IJobCallback {
32     /**
33      * Immediate callback to the system after sending a start signal, used to quickly detect ANR.
34      *
35      * @param jobId Unique integer used to identify this job.
36      * @param ongoing True to indicate that the client is processing the job. False if the job is
37      * complete
38      */
acknowledgeStartMessage(int jobId, boolean ongoing)39     void acknowledgeStartMessage(int jobId, boolean ongoing);
40     /**
41      * Immediate callback to the system after sending a stop signal, used to quickly detect ANR.
42      *
43      * @param jobId Unique integer used to identify this job.
44      * @param reschedule Whether or not to reschedule this job.
45      */
acknowledgeStopMessage(int jobId, boolean reschedule)46     void acknowledgeStopMessage(int jobId, boolean reschedule);
47     /*
48      * Called to deqeue next work item for the job.
49      */
dequeueWork(int jobId)50     JobWorkItem dequeueWork(int jobId);
51     /*
52      * Called to report that job has completed processing a work item.
53      */
completeWork(int jobId, int workId)54     boolean completeWork(int jobId, int workId);
55     /*
56      * Tell the job manager that the client is done with its execution, so that it can go on to
57      * the next one and stop attributing wakelock time to us etc.
58      *
59      * @param jobId Unique integer used to identify this job.
60      * @param reschedule Whether or not to reschedule this job.
61      */
jobFinished(int jobId, boolean reschedule)62     void jobFinished(int jobId, boolean reschedule);
63 }
64