JobSchedulerInternal.java revision 1d99c391ecd30c27be2e8f61aa9ec64546d15d4b
1/* 2 * Copyright (C) 2016 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 com.android.server.job; 18 19import android.app.job.JobInfo; 20 21import java.util.List; 22 23/** 24 * JobScheduler local system service interface. 25 * {@hide} Only for use within the system server. 26 */ 27public interface JobSchedulerInternal { 28 29 // Bookkeeping about app standby bucket scheduling 30 31 /** 32 * The current bucket heartbeat ordinal 33 */ 34 long currentHeartbeat(); 35 36 /** 37 * Heartbeat ordinal at which the given standby bucket's jobs next become runnable 38 */ 39 long nextHeartbeatForBucket(int bucket); 40 41 /** 42 * Returns a list of pending jobs scheduled by the system service. 43 */ 44 List<JobInfo> getSystemScheduledPendingJobs(); 45 46 /** 47 * Cancel the jobs for a given uid (e.g. when app data is cleared) 48 */ 49 void cancelJobsForUid(int uid, String reason); 50 51 /** 52 * These are for activity manager to communicate to use what is currently performing backups. 53 */ 54 void addBackingUpUid(int uid); 55 void removeBackingUpUid(int uid); 56 void clearAllBackingUpUids(); 57 58 JobStorePersistStats getPersistStats(); 59 60 /** 61 * Stats about the first load after boot and the most recent save. 62 * STOPSHIP Remove it and the relevant code once b/64536115 is fixed. 63 */ 64 public class JobStorePersistStats { 65 public int countAllJobsLoaded = -1; 66 public int countSystemServerJobsLoaded = -1; 67 public int countSystemSyncManagerJobsLoaded = -1; 68 69 public int countAllJobsSaved = -1; 70 public int countSystemServerJobsSaved = -1; 71 public int countSystemSyncManagerJobsSaved = -1; 72 73 public JobStorePersistStats() { 74 } 75 76 public JobStorePersistStats(JobStorePersistStats source) { 77 countAllJobsLoaded = source.countAllJobsLoaded; 78 countSystemServerJobsLoaded = source.countSystemServerJobsLoaded; 79 countSystemSyncManagerJobsLoaded = source.countSystemSyncManagerJobsLoaded; 80 81 countAllJobsSaved = source.countAllJobsSaved; 82 countSystemServerJobsSaved = source.countSystemServerJobsSaved; 83 countSystemSyncManagerJobsSaved = source.countSystemSyncManagerJobsSaved; 84 } 85 86 @Override 87 public String toString() { 88 return "FirstLoad: " 89 + countAllJobsLoaded + "/" 90 + countSystemServerJobsLoaded + "/" 91 + countSystemSyncManagerJobsLoaded 92 + " LastSave: " 93 + countAllJobsSaved + "/" 94 + countSystemServerJobsSaved + "/" 95 + countSystemSyncManagerJobsSaved; 96 } 97 } 98} 99