blob: d281da037fdeeb4ed0d75515a85747a57269c4ef [file] [log] [blame]
Christopher Tate7060b042014-06-09 19:50:00 -07001/**
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
17package android.app.job;
18
Dianne Hackborn7da13d72017-04-04 17:17:35 -070019import android.app.job.JobWorkItem;
20
Christopher Tate7060b042014-06-09 19:50:00 -070021/**
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 */
31interface 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 */
Andrei Oneaf650e3c2019-02-25 13:15:54 +000039 @UnsupportedAppUsage
Christopher Tate7060b042014-06-09 19:50:00 -070040 void acknowledgeStartMessage(int jobId, boolean ongoing);
41 /**
42 * Immediate callback to the system after sending a stop signal, used to quickly detect ANR.
43 *
44 * @param jobId Unique integer used to identify this job.
45 * @param reschedule Whether or not to reschedule this job.
46 */
Andrei Oneaf650e3c2019-02-25 13:15:54 +000047 @UnsupportedAppUsage
Christopher Tate7060b042014-06-09 19:50:00 -070048 void acknowledgeStopMessage(int jobId, boolean reschedule);
49 /*
Dianne Hackborn7da13d72017-04-04 17:17:35 -070050 * Called to deqeue next work item for the job.
51 */
Andrei Oneaf650e3c2019-02-25 13:15:54 +000052 @UnsupportedAppUsage
Dianne Hackborn7da13d72017-04-04 17:17:35 -070053 JobWorkItem dequeueWork(int jobId);
54 /*
55 * Called to report that job has completed processing a work item.
56 */
Andrei Oneaf650e3c2019-02-25 13:15:54 +000057 @UnsupportedAppUsage
Dianne Hackborn7da13d72017-04-04 17:17:35 -070058 boolean completeWork(int jobId, int workId);
59 /*
Christopher Tate7060b042014-06-09 19:50:00 -070060 * Tell the job manager that the client is done with its execution, so that it can go on to
61 * the next one and stop attributing wakelock time to us etc.
62 *
63 * @param jobId Unique integer used to identify this job.
64 * @param reschedule Whether or not to reschedule this job.
65 */
Andrei Oneaf650e3c2019-02-25 13:15:54 +000066 @UnsupportedAppUsage
Christopher Tate7060b042014-06-09 19:50:00 -070067 void jobFinished(int jobId, boolean reschedule);
68}