Shreyas Basarge | cbf5ae9 | 2016-03-08 16:13:06 +0000 | [diff] [blame] | 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 | |
| 17 | package com.android.server.job; |
| 18 | |
| 19 | import android.app.job.JobInfo; |
| 20 | |
| 21 | import java.util.List; |
| 22 | |
| 23 | /** |
| 24 | * JobScheduler local system service interface. |
| 25 | * {@hide} Only for use within the system server. |
| 26 | */ |
| 27 | public interface JobSchedulerInternal { |
| 28 | |
Christopher Tate | a732f01 | 2017-10-26 17:26:53 -0700 | [diff] [blame] | 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 | |
Shreyas Basarge | cbf5ae9 | 2016-03-08 16:13:06 +0000 | [diff] [blame] | 41 | /** |
| 42 | * Returns a list of pending jobs scheduled by the system service. |
| 43 | */ |
| 44 | List<JobInfo> getSystemScheduledPendingJobs(); |
Dianne Hackborn | f9bac16 | 2017-04-20 17:17:48 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Christopher Tate | 1d99c39 | 2017-12-07 16:54:04 -0800 | [diff] [blame] | 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 | /** |
Dianne Hackborn | f9bac16 | 2017-04-20 17:17:48 -0700 | [diff] [blame] | 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(); |
Makoto Onuki | dd4b14f | 2017-08-17 14:03:48 -0700 | [diff] [blame] | 57 | |
Makoto Onuki | e7b0298 | 2017-08-24 14:23:36 -0700 | [diff] [blame] | 58 | JobStorePersistStats getPersistStats(); |
| 59 | |
Makoto Onuki | dd4b14f | 2017-08-17 14:03:48 -0700 | [diff] [blame] | 60 | /** |
Makoto Onuki | e7b0298 | 2017-08-24 14:23:36 -0700 | [diff] [blame] | 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. |
Makoto Onuki | dd4b14f | 2017-08-17 14:03:48 -0700 | [diff] [blame] | 63 | */ |
Makoto Onuki | e7b0298 | 2017-08-24 14:23:36 -0700 | [diff] [blame] | 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 | } |
Shreyas Basarge | cbf5ae9 | 2016-03-08 16:13:06 +0000 | [diff] [blame] | 98 | } |