1 /** 2 * Copyright (C) 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.IUserVisibleJobObserver; 20 import android.app.job.JobInfo; 21 import android.app.job.JobSnapshot; 22 import android.app.job.JobWorkItem; 23 import android.app.job.PendingJobReasonsInfo; 24 import android.content.pm.ParceledListSlice; 25 import java.util.Map; 26 27 /** 28 * IPC interface that supports the app-facing {@link #JobScheduler} api. 29 * {@hide} 30 */ 31 interface IJobScheduler { schedule(String namespace, in JobInfo job)32 int schedule(String namespace, in JobInfo job); enqueue(String namespace, in JobInfo job, in JobWorkItem work)33 int enqueue(String namespace, in JobInfo job, in JobWorkItem work); scheduleAsPackage(String namespace, in JobInfo job, String packageName, int userId, String tag)34 int scheduleAsPackage(String namespace, in JobInfo job, String packageName, int userId, String tag); cancel(String namespace, int jobId)35 void cancel(String namespace, int jobId); cancelAll()36 void cancelAll(); cancelAllInNamespace(String namespace)37 void cancelAllInNamespace(String namespace); 38 // Returns Map<String, ParceledListSlice>, where the keys are the namespaces. getAllPendingJobs()39 Map<String, ParceledListSlice<JobInfo>> getAllPendingJobs(); getAllPendingJobsInNamespace(String namespace)40 ParceledListSlice<JobInfo> getAllPendingJobsInNamespace(String namespace); getPendingJob(String namespace, int jobId)41 JobInfo getPendingJob(String namespace, int jobId); getPendingJobReason(String namespace, int jobId)42 int getPendingJobReason(String namespace, int jobId); getPendingJobReasons(String namespace, int jobId)43 int[] getPendingJobReasons(String namespace, int jobId); getPendingJobReasonsHistory(String namespace, int jobId)44 List<PendingJobReasonsInfo> getPendingJobReasonsHistory(String namespace, int jobId); canRunUserInitiatedJobs(String packageName)45 boolean canRunUserInitiatedJobs(String packageName); hasRunUserInitiatedJobsPermission(String packageName, int userId)46 boolean hasRunUserInitiatedJobsPermission(String packageName, int userId); getStartedJobs()47 List<JobInfo> getStartedJobs(); getAllJobSnapshots()48 ParceledListSlice getAllJobSnapshots(); 49 @EnforcePermission(allOf={"MANAGE_ACTIVITY_TASKS", "INTERACT_ACROSS_USERS_FULL"}) registerUserVisibleJobObserver(in IUserVisibleJobObserver observer)50 void registerUserVisibleJobObserver(in IUserVisibleJobObserver observer); 51 @EnforcePermission(allOf={"MANAGE_ACTIVITY_TASKS", "INTERACT_ACROSS_USERS_FULL"}) unregisterUserVisibleJobObserver(in IUserVisibleJobObserver observer)52 void unregisterUserVisibleJobObserver(in IUserVisibleJobObserver observer); 53 @EnforcePermission(allOf={"MANAGE_ACTIVITY_TASKS", "INTERACT_ACROSS_USERS_FULL"}) notePendingUserRequestedAppStop(String packageName, int userId, String debugReason)54 void notePendingUserRequestedAppStop(String packageName, int userId, String debugReason); 55 } 56