blob: 0df2c833fd9df97b7386ce411ad24fbdc5252ef0 [file] [log] [blame]
Kweku Adams85f2fbc2017-12-18 12:04:12 -08001/*
2 * Copyright (C) 2017 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
17syntax = "proto2";
18
19package com.android.server.job;
20
21option java_multiple_files = true;
22
Tej Singh33a412b2018-03-16 18:43:59 -070023import "frameworks/base/core/proto/android/app/job/enums.proto";
Kweku Adams85f2fbc2017-12-18 12:04:12 -080024import "frameworks/base/core/proto/android/content/clipdata.proto";
25import "frameworks/base/core/proto/android/content/component_name.proto";
26import "frameworks/base/core/proto/android/content/intent.proto";
27import "frameworks/base/core/proto/android/net/network.proto";
28import "frameworks/base/core/proto/android/net/networkrequest.proto";
29import "frameworks/base/core/proto/android/os/bundle.proto";
30import "frameworks/base/core/proto/android/os/persistablebundle.proto";
31import "frameworks/base/core/proto/android/server/forceappstandbytracker.proto";
Kweku Adams8845d012018-12-11 20:06:45 -080032import "frameworks/base/core/proto/android/server/job/enums.proto";
Joe Onorato99598ee2019-02-11 15:55:13 +000033import "frameworks/base/core/proto/android/privacy.proto";
Kweku Adams85f2fbc2017-12-18 12:04:12 -080034
Makoto Onukif731c422019-01-22 13:23:31 -080035// Next tag: 21
Kweku Adams85f2fbc2017-12-18 12:04:12 -080036message JobSchedulerServiceDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -080037 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
38
Kweku Adams85f2fbc2017-12-18 12:04:12 -080039 optional ConstantsProto settings = 1;
40
Makoto Onukib5d5e972018-02-20 14:44:20 -080041 optional int32 current_heartbeat = 14;
42 repeated int32 next_heartbeat = 15;
43 optional int64 last_heartbeat_time_millis = 16;
44 optional int64 next_heartbeat_time_millis = 17;
Makoto Onuki0525b982018-05-02 14:46:59 -070045 optional bool in_parole = 18;
Wei Wang8c0c3c12018-11-14 14:56:52 -080046 optional bool in_thermal = 19;
Makoto Onukib5d5e972018-02-20 14:44:20 -080047
Kweku Adams85f2fbc2017-12-18 12:04:12 -080048 repeated int32 started_users = 2;
49
50 message RegisteredJob {
Kweku Adams0f168de2018-01-24 10:51:30 -080051 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
52
Kweku Adams85f2fbc2017-12-18 12:04:12 -080053 optional JobStatusShortInfoProto info = 1;
54 optional JobStatusDumpProto dump = 2;
55
56 // A job is ready to be executed if:
57 // is_job_ready && is_user_started && !is_job_pending &&
58 // !is_job_currently_active && !is_uid_backing_up &&
59 // is_component_present.
60 optional bool is_job_ready = 3;
61 optional bool is_user_started = 4;
62 optional bool is_job_pending = 5;
63 optional bool is_job_currently_active = 6;
64 optional bool is_uid_backing_up = 7;
65 optional bool is_component_present = 8;
Makoto Onukib5d5e972018-02-20 14:44:20 -080066
67 optional int64 last_run_heartbeat = 9;
Kweku Adams85f2fbc2017-12-18 12:04:12 -080068 }
69 repeated RegisteredJob registered_jobs = 3;
70
71 repeated StateControllerProto controllers = 4;
72
73 // Which uids are currently in the foreground.
74 message PriorityOverride {
Kweku Adams0f168de2018-01-24 10:51:30 -080075 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
76
Kweku Adams85f2fbc2017-12-18 12:04:12 -080077 optional int32 uid = 1;
78 // Use sint32 instead of an enum since priorities can technically be
79 // negative.
80 optional sint32 override_value = 2;
81 }
82 repeated PriorityOverride priority_overrides = 5;
83
84 // UIDs that are currently performing backups, so their jobs won't be
85 // allowed to run.
86 repeated int32 backing_up_uids = 6;
87
88 optional JobPackageHistoryProto history = 7;
89 optional JobPackageTrackerDumpProto package_tracker = 8;
90
91 message PendingJob {
Kweku Adams0f168de2018-01-24 10:51:30 -080092 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
93
Kweku Adams85f2fbc2017-12-18 12:04:12 -080094 optional JobStatusShortInfoProto info = 1;
95 optional JobStatusDumpProto dump = 2;
96 optional sint32 evaluated_priority = 3;
97 // How long this job has been pending.
98 optional int64 enqueued_duration_ms = 4;
99 }
100 repeated PendingJob pending_jobs = 9;
101
102 // From a service that has currently active or pending jobs.
103 message ActiveJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800104 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
105
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800106 message InactiveJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800107 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
108
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800109 optional int64 time_since_stopped_ms = 1;
110 // This is not always provided.
111 optional string stopped_reason = 2;
112 }
113 message RunningJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800114 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
115
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800116 optional JobStatusShortInfoProto info = 1;
117 // How long this job has been running for.
118 optional int64 running_duration_ms = 2;
119 optional int64 time_until_timeout_ms = 3;
120
121 optional JobStatusDumpProto dump = 4;
122
123 optional sint32 evaluated_priority = 5;
124
125 optional int64 time_since_made_active_ms = 6;
126 // How long this job has been pending.
127 optional int64 pending_duration_ms = 7;
128 }
129 oneof job {
130 InactiveJob inactive = 1;
131 RunningJob running = 2;
132 }
133 }
134 repeated ActiveJob active_jobs = 10;
135
136 // True when JobScheduler is allowed to run third party apps.
137 optional bool is_ready_to_rock = 11;
138 // What was last reported to DeviceIdleController about whether the device
139 // is active.
140 optional bool reported_active = 12;
141 // The current limit on the number of concurrent JobServiceContext entries
142 // we want to keep actively running a job.
143 optional int32 max_active_jobs = 13;
Makoto Onukif731c422019-01-22 13:23:31 -0800144
145 // Dump from JobConcurrencyManager.
146 optional JobConcurrencyManagerProto concurrency_manager = 20;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800147}
148
149// A com.android.server.job.JobSchedulerService.Constants object.
Makoto Onukif731c422019-01-22 13:23:31 -0800150// Next tag: 29
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800151message ConstantsProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800152 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
153
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800154 // Minimum # of idle jobs that must be ready in order to force the JMS to
155 // schedule things early.
156 optional int32 min_idle_count = 1;
157 // Minimum # of charging jobs that must be ready in order to force the JMS
158 // to schedule things early.
159 optional int32 min_charging_count = 2;
160 // Minimum # of "battery not low" jobs that must be ready in order to force
161 // the JMS to schedule things early.
162 optional int32 min_battery_not_low_count = 3;
163 // Minimum # of "storage not low" jobs that must be ready in order to force
164 // the JMS to schedule things early.
165 optional int32 min_storage_not_low_count = 4;
166 // Minimum # of connectivity jobs that must be ready in order to force the
167 // JMS to schedule things early. 1 == Run connectivity jobs as soon as
168 // ready.
169 optional int32 min_connectivity_count = 5;
170 // Minimum # of content trigger jobs that must be ready in order to force
171 // the JMS to schedule things early.
172 optional int32 min_content_count = 6;
173 // Minimum # of jobs (with no particular constraints) for which the JMS will
174 // be happy running some work early. This (and thus the other min counts)
175 // is now set to 1, to prevent any batching at this level. Since we now do
176 // batching through doze, that is a much better mechanism.
177 optional int32 min_ready_jobs_count = 7;
178 // This is the job execution factor that is considered to be heavy use of
179 // the system.
180 optional double heavy_use_factor = 8;
181 // This is the job execution factor that is considered to be moderate use of
182 // the system.
183 optional double moderate_use_factor = 9;
184 // The number of MAX_JOB_CONTEXTS_COUNT we reserve for the foreground app.
185 optional int32 fg_job_count = 10;
186 // The maximum number of background jobs we allow when the system is in a
187 // normal memory state.
188 optional int32 bg_normal_job_count = 11;
189 // The maximum number of background jobs we allow when the system is in a
190 // moderate memory state.
191 optional int32 bg_moderate_job_count = 12;
192 // The maximum number of background jobs we allow when the system is in a
193 // low memory state.
194 optional int32 bg_low_job_count = 13;
195 // The maximum number of background jobs we allow when the system is in a
196 // critical memory state.
197 optional int32 bg_critical_job_count = 14;
198 // The maximum number of times we allow a job to have itself rescheduled
199 // before giving up on it, for standard jobs.
200 optional int32 max_standard_reschedule_count = 15;
201 // The maximum number of times we allow a job to have itself rescheduled
202 // before giving up on it, for jobs that are executing work.
203 optional int32 max_work_reschedule_count = 16;
204 // The minimum backoff time to allow for linear backoff.
205 optional int64 min_linear_backoff_time_ms = 17;
206 // The minimum backoff time to allow for exponential backoff.
207 optional int64 min_exp_backoff_time_ms = 18;
208 // How often we recalculate runnability based on apps' standby bucket
209 // assignment. This should be prime relative to common time interval lengths
210 // such as a quarter-hour or day, so that the heartbeat drifts relative to
211 // wall-clock milestones.
212 optional int64 standby_heartbeat_time_ms = 19;
213 // Mapping: standby bucket -> number of heartbeats between each sweep of
214 // that bucket's jobs.
215 // Bucket assignments as recorded in the JobStatus objects are normalized to
216 // be indices into this array, rather than the raw constants used by
217 // AppIdleHistory.
218 repeated int32 standby_beats = 20;
Jeff Sharkeyac2e8ef2018-02-22 16:06:44 -0700219 // The fraction of a job's running window that must pass before we
220 // consider running it when the network is congested.
221 optional double conn_congestion_delay_frac = 21;
222 // The fraction of a prefetch job's running window that must pass before
223 // we consider matching it against a metered network.
224 optional double conn_prefetch_relax_frac = 22;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800225 // Whether to use heartbeats or rolling window for quota management. True
226 // will use heartbeats, false will use a rolling window.
227 optional bool use_heartbeats = 23;
228
Kweku Adamsbffea5a2018-12-13 22:13:28 -0800229 message TimeController {
Kweku Adams288e73b2019-01-17 13:53:24 -0800230 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
231
Kweku Adamsbffea5a2018-12-13 22:13:28 -0800232 // Whether or not TimeController should skip setting wakeup alarms for jobs that aren't
233 // ready now.
234 optional bool skip_not_ready_jobs = 1;
235 }
236 optional TimeController time_controller = 25;
237
Kweku Adams4836f9d2018-11-12 17:04:17 -0800238 message QuotaController {
Kweku Adams288e73b2019-01-17 13:53:24 -0800239 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
240
Kweku Adams4836f9d2018-11-12 17:04:17 -0800241 // How much time each app will have to run jobs within their standby bucket window.
242 optional int64 allowed_time_per_period_ms = 1;
243 // How much time the package should have before transitioning from out-of-quota to in-quota.
244 // This should not affect processing if the package is already in-quota.
245 optional int64 in_quota_buffer_ms = 2;
246 // The quota window size of the particular standby bucket. Apps in this standby bucket are
247 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
248 // WINDOW_SIZE_MS.
249 optional int64 active_window_size_ms = 3;
250 // The quota window size of the particular standby bucket. Apps in this standby bucket are
251 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
252 // WINDOW_SIZE_MS.
253 optional int64 working_window_size_ms = 4;
254 // The quota window size of the particular standby bucket. Apps in this standby bucket are
255 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
256 // WINDOW_SIZE_MS.
257 optional int64 frequent_window_size_ms = 5;
258 // The quota window size of the particular standby bucket. Apps in this standby bucket are
259 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
260 // WINDOW_SIZE_MS.
261 optional int64 rare_window_size_ms = 6;
Kweku Adams045fb5722018-12-11 14:29:10 -0800262 // The maximum amount of time an app can have its jobs running within a 24 hour window.
263 optional int64 max_execution_time_ms = 7;
Kweku Adams288e73b2019-01-17 13:53:24 -0800264 // The maximum number of jobs an app can run within this particular standby bucket's
265 // window size.
266 optional int32 max_job_count_active = 8;
267 // The maximum number of jobs an app can run within this particular standby bucket's
268 // window size.
269 optional int32 max_job_count_working = 9;
270 // The maximum number of jobs an app can run within this particular standby bucket's
271 // window size.
272 optional int32 max_job_count_frequent = 10;
273 // The maximum number of jobs an app can run within this particular standby bucket's
274 // window size.
275 optional int32 max_job_count_rare = 11;
276 // The maximum number of jobs that should be allowed to run in the past
277 // {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS}.
278 optional int32 max_job_count_per_allowed_time = 12;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800279 }
280 optional QuotaController quota_controller = 24;
Kweku Adamsbffea5a2018-12-13 22:13:28 -0800281
Makoto Onukif731c422019-01-22 13:23:31 -0800282 // Max number of jobs, when screen is ON.
283 optional MaxJobCountsPerMemoryTrimLevelProto max_job_counts_screen_on = 26;
284
285 // Max number of jobs, when screen is OFF.
286 optional MaxJobCountsPerMemoryTrimLevelProto max_job_counts_screen_off = 27;
287
288 // In this time after screen turns on, we increase job concurrency.
289 optional int32 screen_off_job_concurrency_increase_delay_ms = 28;
290}
291
292// Next tag: 4
293message MaxJobCountsProto {
294 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
295
296 // Total number of jobs to run simultaneously.
297 optional int32 total_jobs = 1;
298
299 // Max number of BG (== owned by non-TOP apps) jobs to run simultaneously.
300 optional int32 max_bg = 2;
301
302 // We try to run at least this many BG (== owned by non-TOP apps) jobs, when there are any
303 // pending, rather than always running the TOTAL number of FG jobs.
304 optional int32 min_bg = 3;
305}
306
307// Next tag: 5
308message MaxJobCountsPerMemoryTrimLevelProto {
309 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
310
311 optional MaxJobCountsProto normal = 1;
312 optional MaxJobCountsProto moderate = 2;
313 optional MaxJobCountsProto low = 3;
314 optional MaxJobCountsProto critical = 4;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800315}
316
317message StateControllerProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800318 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
319
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800320 message BackgroundJobsController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800321 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
322
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800323 optional com.android.server.ForceAppStandbyTrackerProto force_app_standby_tracker = 1;
324
325 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800326 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
327
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800328 optional JobStatusShortInfoProto info = 1;
329 optional int32 source_uid = 2;
330 optional string source_package_name = 3;
331 optional bool is_in_foreground = 4;
332 optional bool is_whitelisted = 5;
333 optional bool can_run_any_in_background = 6;
334 // If the constraints are satisfied, then the controller will mark
335 // the job as RUNNABLE, otherwise, it will be WAITING.
336 optional bool are_constraints_satisfied = 7;
337 }
338 repeated TrackedJob tracked_jobs = 2;
339 }
340 message BatteryController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800341 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
342
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800343 optional bool is_on_stable_power = 1;
344 optional bool is_battery_not_low = 2;
345
346 // Whether or not the controller is monitoring battery changes.
347 optional bool is_monitoring = 3;
348 // Only valid if is_monitoring is true.
349 optional int32 last_broadcast_sequence_number = 4;
350
351 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800352 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
353
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800354 optional JobStatusShortInfoProto info = 1;
355 optional int32 source_uid = 2;
356 }
357 repeated TrackedJob tracked_jobs = 5;
358 }
359 message ConnectivityController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800360 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
361
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800362 optional bool is_connected = 1;
363
364 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800365 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
366
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800367 optional JobStatusShortInfoProto info = 1;
368 optional int32 source_uid = 2;
369 optional .android.net.NetworkRequestProto required_network = 3;
370 }
371 repeated TrackedJob tracked_jobs = 2;
372 }
373 message ContentObserverController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800374 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
375
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800376 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800377 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
378
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800379 optional JobStatusShortInfoProto info = 1;
380 optional int32 source_uid = 2;
381 }
382 repeated TrackedJob tracked_jobs = 1;
383
384 message Observer {
Kweku Adams0f168de2018-01-24 10:51:30 -0800385 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
386
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800387 optional int32 user_id = 1;
388
389 message TriggerContentData {
Kweku Adams0f168de2018-01-24 10:51:30 -0800390 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
391
392 optional string uri = 1 [
393 (.android.privacy).dest = DEST_EXPLICIT
394 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800395 optional int32 flags = 2;
396
397 // A
398 // com.android.server.job.controllers.ContentObserverController.JobInstance
399 // object.
400 message JobInstance {
Kweku Adams0f168de2018-01-24 10:51:30 -0800401 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
402
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800403 optional JobStatusShortInfoProto info = 1;
404 optional int32 source_uid = 2;
405
406 optional int64 trigger_content_update_delay_ms = 3;
407 optional int64 trigger_content_max_delay_ms = 4;
408
Kweku Adams0f168de2018-01-24 10:51:30 -0800409 repeated string changed_authorities = 5 [
410 (.android.privacy).dest = DEST_EXPLICIT
411 ];
412 repeated string changed_uris = 6 [
413 (.android.privacy).dest = DEST_EXPLICIT
414 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800415 }
416 repeated JobInstance jobs = 3;
417 }
418 repeated TriggerContentData triggers = 2;
419 }
420 repeated Observer observers = 2;
421 }
422 message DeviceIdleJobsController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800423 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
424
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800425 // True when in device idle mode.
426 optional bool is_device_idle_mode = 1;
427
428 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800429 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
430
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800431 optional JobStatusShortInfoProto info = 1;
432 optional int32 source_uid = 2;
433 optional string source_package_name = 3;
434 // If the constraints are satisfied, then the controller will mark
435 // the job as RUNNABLE, otherwise, it will be WAITING.
436 optional bool are_constraints_satisfied = 4;
437 optional bool is_doze_whitelisted = 5;
438 // A job that is exempted from Doze when the app is temp whitelisted
439 // or in the foreground.
440 optional bool is_allowed_in_doze = 6;
441 }
442 repeated TrackedJob tracked_jobs = 2;
443 }
444 message IdleController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800445 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
446
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800447 optional bool is_idle = 1;
448
449 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800450 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
451
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800452 optional JobStatusShortInfoProto info = 1;
453 optional int32 source_uid = 2;
454 }
455 repeated TrackedJob tracked_jobs = 2;
456 }
Kweku Adams4836f9d2018-11-12 17:04:17 -0800457 message QuotaController {
458 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
459
460 optional bool is_charging = 1;
461 optional bool is_in_parole = 2;
Kweku Adams9a4fc552019-04-25 11:43:23 -0700462 optional int64 elapsed_realtime = 6;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800463
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800464 // List of UIDs currently in the foreground.
465 repeated int32 foreground_uids = 3;
466
Kweku Adams4836f9d2018-11-12 17:04:17 -0800467 message TrackedJob {
468 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
469
470 optional JobStatusShortInfoProto info = 1;
471 optional int32 source_uid = 2;
472 optional JobStatusDumpProto.Bucket effective_standby_bucket = 3;
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800473 // If the job started while the app was in the TOP state.
474 optional bool is_top_started_job = 4;
475 optional bool has_quota = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800476 // The amount of time that this job has remaining in its quota. This
477 // can be negative if the job is out of quota.
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800478 optional int64 remaining_quota_ms = 6;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800479 }
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800480 repeated TrackedJob tracked_jobs = 4;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800481
Kweku Adams9a4fc552019-04-25 11:43:23 -0700482 message AlarmListener {
483 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
484
485 // Whether the listener is waiting for an alarm or not.
486 optional bool is_waiting = 1;
487 // The time at which the alarm should go off, in the elapsed realtime timebase. Only
488 // valid if is_waiting is true.
489 optional int64 trigger_time_elapsed = 2;
490 }
491
Kweku Adams7d6a31c2019-04-16 17:05:30 -0700492 message ExecutionStats {
493 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
494
495 optional JobStatusDumpProto.Bucket standby_bucket = 1;
496
497 // The time after which this record should be considered invalid (out of date), in the
498 // elapsed realtime timebase.
499 optional int64 expiration_time_elapsed = 2;
500 optional int64 window_size_ms = 3;
501
502 /** The total amount of time the app ran in its respective bucket window size. */
503 optional int64 execution_time_in_window_ms = 4;
504 optional int32 bg_job_count_in_window = 5;
505
506 /**
507 * The total amount of time the app ran in the last
508 * {@link QuotaController#MAX_PERIOD_MS}.
509 */
510 optional int64 execution_time_in_max_period_ms = 6;
511 optional int32 bg_job_count_in_max_period = 7;
512
513 /**
514 * The time after which the sum of all the app's sessions plus
515 * ConstantsProto.QuotaController.in_quota_buffer_ms equals the quota. This is only
516 * valid if
517 * execution_time_in_window_ms >=
518 * ConstantsProto.QuotaController.allowed_time_per_period_ms
519 * or
520 * execution_time_in_max_period_ms >=
521 * ConstantsProto.QuotaController.max_execution_time_ms.
522 */
523 optional int64 quota_cutoff_time_elapsed = 8;
524
525 /**
526 * The time after which job_count_in_allowed_time should be considered invalid, in the
527 * elapsed realtime timebase.
528 */
529 optional int64 job_count_expiration_time_elapsed = 9;
530
531 /**
532 * The number of jobs that ran in at least the last
533 * ConstantsProto.QuotaController.allowed_time_per_period_ms.
534 * It may contain a few stale entries since cleanup won't happen exactly every
535 * ConstantsProto.QuotaController.allowed_time_per_period_ms.
536 */
537 optional int32 job_count_in_allowed_time = 10;
538 }
539
Kweku Adams4836f9d2018-11-12 17:04:17 -0800540 message Package {
541 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
542
543 optional int32 user_id = 1;
544 optional string name = 2;
545 }
546
547 message TimingSession {
548 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
549
550 optional int64 start_time_elapsed = 1;
551 optional int64 end_time_elapsed = 2;
Kweku Adamscc5afbc2018-12-11 15:24:25 -0800552 // The number of background jobs that ran during this session.
553 optional int32 bg_job_count = 3;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800554 }
555
556 message Timer {
557 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
558
559 optional Package pkg = 1;
560 // True if the Timer is actively tracking jobs.
561 optional bool is_active = 2;
562 // The time this timer last became active. Only valid if is_active is true.
563 optional int64 start_time_elapsed = 3;
Kweku Adamscc5afbc2018-12-11 15:24:25 -0800564 // How many background jobs are currently running. Valid only if the device is_active
565 // is true.
566 optional int32 bg_job_count = 4;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800567 // All of the jobs that the Timer is currently tracking.
568 repeated JobStatusShortInfoProto running_jobs = 5;
569 }
570
571 message PackageStats {
572 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
573
574 optional Package pkg = 1;
575
576 optional Timer timer = 2;
577
578 repeated TimingSession saved_sessions = 3;
Kweku Adams7d6a31c2019-04-16 17:05:30 -0700579
580 repeated ExecutionStats execution_stats = 4;
Kweku Adams9a4fc552019-04-25 11:43:23 -0700581
582 optional AlarmListener in_quota_alarm_listener = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800583 }
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800584 repeated PackageStats package_stats = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800585 }
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800586 message StorageController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800587 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
588
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800589 optional bool is_storage_not_low = 1;
590 optional int32 last_broadcast_sequence_number = 2;
591
592 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800593 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
594
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800595 optional JobStatusShortInfoProto info = 1;
596 optional int32 source_uid = 2;
597 }
598 repeated TrackedJob tracked_jobs = 3;
599 }
600 message TimeController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800601 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
602
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800603 optional int64 now_elapsed_realtime = 1;
604 optional int64 time_until_next_delay_alarm_ms = 2;
605 optional int64 time_until_next_deadline_alarm_ms = 3;
606
607 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800608 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
609
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800610 optional JobStatusShortInfoProto info = 1;
611 optional int32 source_uid = 2;
612
613 optional bool has_timing_delay_constraint = 3;
614 // Only valid if has_timing_delay_constraint is true. Can be
615 // negative if the delay is in the past.
616 optional int64 delay_time_remaining_ms = 4;
617
618 optional bool has_deadline_constraint = 5;
619 // Only valid if has_timing_delay_constraint is true. Can be
620 // negative in certain situations.
621 optional int64 time_remaining_until_deadline_ms = 6;
622 }
623 repeated TrackedJob tracked_jobs = 4;
624 }
625 oneof controller {
Kweku Adams21b8d262018-03-30 12:19:58 -0700626 BackgroundJobsController background = 1;
627 BatteryController battery = 2;
628 ConnectivityController connectivity = 3;
629 ContentObserverController content_observer = 4;
630 DeviceIdleJobsController device_idle = 5;
631 IdleController idle = 6;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800632 QuotaController quota = 9;
Kweku Adams21b8d262018-03-30 12:19:58 -0700633 StorageController storage = 7;
634 TimeController time = 8;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800635 // Next tag: 10
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800636 }
637}
638
639// A com.android.server.job.JobPackageTracker.DataSet object.
640message DataSetProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800641 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
642
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800643 optional int64 start_clock_time_ms = 1;
644 // How much time has elapsed since the DataSet was instantiated.
645 optional int64 elapsed_time_ms = 2;
646 optional int64 period_ms = 3;
647
648 // Represents a com.android.server.job.JobPackageTracker.PackageEntry
649 // object, but with some extra data.
650 message PackageEntryProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800651 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
652
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800653 optional int32 uid = 1;
654 optional string package_name = 2;
655
656 message State {
Kweku Adams0f168de2018-01-24 10:51:30 -0800657 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
658
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800659 optional int64 duration_ms = 1;
660 optional int32 count = 2;
661 }
662 optional State pending_state = 3;
663 optional State active_state = 4;
664 optional State active_top_state = 5;
665
666 // True if the PackageEntry is currently pending or has been pending in
667 // the past.
668 optional bool pending = 6;
669 // True if the PackageEntry is currently active or has been active in
670 // the past.
671 optional bool active = 7;
672 // True if the PackageEntry is currently active top or has been active
673 // top in the past.
674 optional bool active_top = 8;
675
676 message StopReasonCount {
Kweku Adams0f168de2018-01-24 10:51:30 -0800677 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
678
Tej Singh33a412b2018-03-16 18:43:59 -0700679 optional .android.app.job.StopReasonEnum reason = 1;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800680 optional int32 count = 2;
681 }
682 repeated StopReasonCount stop_reasons = 9;
683 }
684 repeated PackageEntryProto package_entries = 4;
685
686 optional int32 max_concurrency = 5;
687 optional int32 max_foreground_concurrency = 6;
688}
689
690// Dump from com.android.server.job.GrantedUriPermissions.
691message GrantedUriPermissionsDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800692 option (.android.msg_privacy).dest = DEST_EXPLICIT;
693
694 optional int32 flags = 1 [ (.android.privacy).dest = DEST_AUTOMATIC ];
695 optional int32 source_user_id = 2 [
696 (.android.privacy).dest = DEST_AUTOMATIC
697 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800698 optional string tag = 3;
699 optional string permission_owner = 4;
700 repeated string uris = 5;
701}
702
703message JobPackageTrackerDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800704 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
705
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800706 repeated DataSetProto historical_stats = 1;
707 optional DataSetProto current_stats = 2;
708}
709
710message JobPackageHistoryProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800711 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
712
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800713 enum Event {
714 UNKNOWN = 0;
715 START_JOB = 1;
716 STOP_JOB = 2;
717 START_PERIODIC_JOB = 3;
718 STOP_PERIODIC_JOB = 4;
719 }
720 message HistoryEvent {
Kweku Adams0f168de2018-01-24 10:51:30 -0800721 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
722
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800723 optional Event event = 1;
724 optional int64 time_since_event_ms = 2;
725 optional int32 uid = 3;
726 // Job IDs can technically be negative.
727 optional int32 job_id = 4;
Yi Jin2921dd02018-03-23 14:10:31 -0700728 optional string tag = 5;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800729 // Only valid for STOP_JOB or STOP_PERIODIC_JOB Events.
Tej Singh33a412b2018-03-16 18:43:59 -0700730 optional .android.app.job.StopReasonEnum stop_reason = 6;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800731 }
732 repeated HistoryEvent history_event = 1;
733}
734
735message JobStatusShortInfoProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800736 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
737
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800738 optional int32 calling_uid = 1;
739 // Job IDs can technically be negative.
740 optional int32 job_id = 2;
Yi Jine5e2a752018-03-28 18:31:07 -0700741 optional string battery_name = 3;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800742}
743
744// Dump from a com.android.server.job.controllers.JobStatus object.
745message JobStatusDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800746 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
747
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800748 // The UID that scheduled the job.
749 optional int32 calling_uid = 1;
Yi Jin2921dd02018-03-23 14:10:31 -0700750 optional string tag = 2;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800751
752 // The UID for which the job is being run.
753 optional int32 source_uid = 3;
754 optional int32 source_user_id = 4;
755 // The package for which the job is being run.
756 optional string source_package_name = 5;
757
758 // Custom dump of android.app.job.JobInfo object.
759 message JobInfo {
Kweku Adams0f168de2018-01-24 10:51:30 -0800760 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
761
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800762 optional .android.content.ComponentNameProto service = 1;
763
764 optional bool is_periodic = 2;
765 // Only valid if is_periodic is true.
766 optional int64 period_interval_ms = 3;
767 // Only valid if is_periodic is true.
768 optional int64 period_flex_ms = 4;
769
770 optional bool is_persisted = 5;
771 optional sint32 priority = 6;
772 optional int32 flags = 7;
773
774 optional bool requires_charging = 8;
775 optional bool requires_battery_not_low = 9;
776 optional bool requires_device_idle = 10;
777
778 message TriggerContentUri {
Kweku Adams0f168de2018-01-24 10:51:30 -0800779 optional int32 flags = 1 [
780 (.android.privacy).dest = DEST_AUTOMATIC
781 ];
782 optional string uri = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800783 }
784 repeated TriggerContentUri trigger_content_uris = 11;
785 optional int64 trigger_content_update_delay_ms = 12;
786 optional int64 trigger_content_max_delay_ms = 13;
787
788 optional .android.os.PersistableBundleProto extras = 14;
789 optional .android.os.BundleProto transient_extras = 15;
Kweku Adamscb89f622018-03-22 13:55:46 -0700790 // ClipData of information that is returned to the application at
791 // execution time, but not persisted by the system. This is provided by
792 // the app and the main purpose of providing a ClipData is to allow
793 // granting of URI permissions for data associated with the clip. The
794 // exact kind of permission grant to perform is specified in the flags
795 // field.
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800796 optional .android.content.ClipDataProto clip_data = 16;
797
798 optional GrantedUriPermissionsDumpProto granted_uri_permissions = 17;
799
800 optional .android.net.NetworkRequestProto required_network = 18;
801
802 optional int64 total_network_bytes = 19;
803
804 optional int64 min_latency_ms = 20;
805 optional int64 max_execution_delay_ms = 21;
806
807 message Backoff {
Kweku Adams0f168de2018-01-24 10:51:30 -0800808 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
809
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800810 enum Policy {
811 BACKOFF_POLICY_LINEAR = 0;
812 BACKOFF_POLICY_EXPONENTIAL = 1;
813 }
814 optional Policy policy = 1;
815 optional int64 initial_backoff_ms = 2;
816 }
817 optional Backoff backoff_policy = 22;
818
819 optional bool has_early_constraint = 23;
820 optional bool has_late_constraint = 24;
821 }
822 optional JobInfo job_info = 6;
823
Kweku Adams8845d012018-12-11 20:06:45 -0800824 repeated ConstraintEnum required_constraints = 7;
825 repeated ConstraintEnum satisfied_constraints = 8;
826 repeated ConstraintEnum unsatisfied_constraints = 9;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800827 optional bool is_doze_whitelisted = 10;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800828 optional bool is_uid_active = 26;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800829
Kweku Adams32f44762018-11-02 16:58:32 -0700830 message ImplicitConstraints {
831 // The device isn't Dozing or this job will be in the foreground. This
832 // implicit constraint must be satisfied for the job to run.
833 optional bool is_not_dozing = 1;
834 // The job is not restricted from running in the background (due to
835 // Battery Saver). This implicit constraint must be satisfied for the
836 // job to run.
837 optional bool is_not_restricted_in_bg = 2;
838 }
839 optional ImplicitConstraints implicit_constraints = 25;
840
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800841 enum TrackingController {
842 TRACKING_BATTERY = 0;
843 TRACKING_CONNECTIVITY = 1;
844 TRACKING_CONTENT = 2;
845 TRACKING_IDLE = 3;
846 TRACKING_STORAGE = 4;
847 TRACKING_TIME = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800848 TRACKING_QUOTA = 6;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800849 }
850 // Controllers that are currently tracking the job.
851 repeated TrackingController tracking_controllers = 11;
852
Kweku Adams0f168de2018-01-24 10:51:30 -0800853 repeated string changed_authorities = 12 [
854 (.android.privacy).dest = DEST_EXPLICIT
855 ];
856 repeated string changed_uris = 13 [
857 (.android.privacy).dest = DEST_EXPLICIT
858 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800859
860 optional .android.net.NetworkProto network = 14;
861
862 // Only the desired data from an android.app.job.JobWorkItem object.
863 message JobWorkItem {
Kweku Adams0f168de2018-01-24 10:51:30 -0800864 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
865
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800866 optional int32 work_id = 1;
867 optional int32 delivery_count = 2;
868 optional .android.content.IntentProto intent = 3;
869 optional GrantedUriPermissionsDumpProto uri_grants = 4;
870 }
871 repeated JobWorkItem pending_work = 15;
872 repeated JobWorkItem executing_work = 16;
873
874 enum Bucket {
875 ACTIVE = 0;
876 WORKING_SET = 1;
877 FREQUENT = 2;
878 RARE = 3;
879 NEVER = 4;
880 }
881 optional Bucket standby_bucket = 17;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800882 optional bool is_exempted_from_app_standby = 27;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800883
884 optional int64 enqueue_duration_ms = 18;
885 // Can be negative if the earliest runtime deadline has passed.
886 optional sint64 time_until_earliest_runtime_ms = 19;
887 // Can be negative if the latest runtime deadline has passed.
888 optional sint64 time_until_latest_runtime_ms = 20;
889
890 optional int32 num_failures = 21;
891
892 optional int64 last_successful_run_time = 22;
893 optional int64 last_failed_run_time = 23;
Makoto Onuki15407842018-01-19 14:23:11 -0800894
895 optional int64 internal_flags = 24;
Kweku Adams32f44762018-11-02 16:58:32 -0700896
Kweku Adams4836f9d2018-11-12 17:04:17 -0800897 // Next tag: 28
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800898}
Makoto Onukif731c422019-01-22 13:23:31 -0800899
900// Dump from com.android.server.job.JobConcurrencyManager.
901// Next tag: 7
902message JobConcurrencyManagerProto {
903 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
904
905 // Whether the device is interactive (== screen on) now or not.
906 optional bool current_interactive = 1;
907 // Similar to current_interactive, screen on or not, but it takes into account the off timeout.
908 optional bool effective_interactive = 2;
909 // How many milliseconds have passed since the last screen on. (i.e. 1000 == 1 sec ago)
910 optional int64 time_since_last_screen_on_ms = 3;
911 // How many milliseconds have passed since the last screen off. (i.e. 1000 == 1 sec ago)
912 optional int64 time_since_last_screen_off_ms = 4;
913 // Current max number of jobs.
914 optional JobCountTrackerProto job_count_tracker = 5;
915 // Current memory trim level.
916 optional int32 memory_trim_level = 6;
917}
918
919// Dump from com.android.server.job.JobConcurrencyManager.JobCountTracker.
920// Next tag: 8
921message JobCountTrackerProto {
922 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
923
924 // Number of total jos that can run simultaneously.
925 optional int32 config_num_max_total_jobs = 1;
926 // Number of background jos that can run simultaneously.
927 optional int32 config_num_max_bg_jobs = 2;
928 // Out of total jobs, this many background jobs should be guaranteed to be executed, even if
929 // there are the config_num_max_total_jobs count of foreground jobs pending.
930 optional int32 config_num_min_bg_jobs = 3;
931
932 // Number of running foreground jobs.
933 optional int32 num_running_fg_jobs = 4;
934 // Number of running background jobs.
935 optional int32 num_running_bg_jobs = 5;
936
937 // Number of pending foreground jobs.
938 optional int32 num_pending_fg_jobs = 6;
939 // Number of pending background jobs.
940 optional int32 num_pending_bg_jobs = 7;
941}