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 */ 39 @UnsupportedAppUsage acknowledgeStartMessage(int jobId, boolean ongoing)40 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 */ 47 @UnsupportedAppUsage acknowledgeStopMessage(int jobId, boolean reschedule)48 void acknowledgeStopMessage(int jobId, boolean reschedule); 49 /* 50 * Called to deqeue next work item for the job. 51 */ 52 @UnsupportedAppUsage dequeueWork(int jobId)53 JobWorkItem dequeueWork(int jobId); 54 /* 55 * Called to report that job has completed processing a work item. 56 */ 57 @UnsupportedAppUsage completeWork(int jobId, int workId)58 boolean completeWork(int jobId, int workId); 59 /* 60 * 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 */ 66 @UnsupportedAppUsage jobFinished(int jobId, boolean reschedule)67 void jobFinished(int jobId, boolean reschedule); 68 } 69