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