blob: c97eeaf30ab371eb5f84671c10f2ca03d049a452 [file] [log] [blame]
Shreyas Basargecbf5ae92016-03-08 16:13:06 +00001/*
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
Christopher Tatea732f012017-10-26 17:26:53 -070029 // 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 Basargecbf5ae92016-03-08 16:13:06 +000041 /**
42 * Returns a list of pending jobs scheduled by the system service.
43 */
44 List<JobInfo> getSystemScheduledPendingJobs();
Dianne Hackbornf9bac162017-04-20 17:17:48 -070045
46 /**
Christopher Tate1d99c392017-12-07 16:54:04 -080047 * 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 Hackbornf9bac162017-04-20 17:17:48 -070052 * 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 Onukidd4b14f2017-08-17 14:03:48 -070057
Makoto Onukie7b02982017-08-24 14:23:36 -070058 JobStorePersistStats getPersistStats();
59
Makoto Onukidd4b14f2017-08-17 14:03:48 -070060 /**
Makoto Onukie7b02982017-08-24 14:23:36 -070061 * 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 Onukidd4b14f2017-08-17 14:03:48 -070063 */
Makoto Onukie7b02982017-08-24 14:23:36 -070064 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 Basargecbf5ae92016-03-08 16:13:06 +000098}