blob: fcb431a044c6c66e14c1c2f773624b2b926400c1 [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 Adams0f168de2018-01-24 10:51:30 -080032import "frameworks/base/libs/incident/proto/android/privacy.proto";
Kweku Adams85f2fbc2017-12-18 12:04:12 -080033
Makoto Onukif731c422019-01-22 13:23:31 -080034// Next tag: 21
Kweku Adams85f2fbc2017-12-18 12:04:12 -080035message JobSchedulerServiceDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -080036 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
37
Kweku Adams85f2fbc2017-12-18 12:04:12 -080038 optional ConstantsProto settings = 1;
39
Makoto Onukib5d5e972018-02-20 14:44:20 -080040 optional int32 current_heartbeat = 14;
41 repeated int32 next_heartbeat = 15;
42 optional int64 last_heartbeat_time_millis = 16;
43 optional int64 next_heartbeat_time_millis = 17;
Makoto Onuki0525b982018-05-02 14:46:59 -070044 optional bool in_parole = 18;
Wei Wang8c0c3c12018-11-14 14:56:52 -080045 optional bool in_thermal = 19;
Makoto Onukib5d5e972018-02-20 14:44:20 -080046
Kweku Adams85f2fbc2017-12-18 12:04:12 -080047 repeated int32 started_users = 2;
48
49 message RegisteredJob {
Kweku Adams0f168de2018-01-24 10:51:30 -080050 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
51
Kweku Adams85f2fbc2017-12-18 12:04:12 -080052 optional JobStatusShortInfoProto info = 1;
53 optional JobStatusDumpProto dump = 2;
54
55 // A job is ready to be executed if:
56 // is_job_ready && is_user_started && !is_job_pending &&
57 // !is_job_currently_active && !is_uid_backing_up &&
58 // is_component_present.
59 optional bool is_job_ready = 3;
60 optional bool is_user_started = 4;
61 optional bool is_job_pending = 5;
62 optional bool is_job_currently_active = 6;
63 optional bool is_uid_backing_up = 7;
64 optional bool is_component_present = 8;
Makoto Onukib5d5e972018-02-20 14:44:20 -080065
66 optional int64 last_run_heartbeat = 9;
Kweku Adams85f2fbc2017-12-18 12:04:12 -080067 }
68 repeated RegisteredJob registered_jobs = 3;
69
70 repeated StateControllerProto controllers = 4;
71
72 // Which uids are currently in the foreground.
73 message PriorityOverride {
Kweku Adams0f168de2018-01-24 10:51:30 -080074 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
75
Kweku Adams85f2fbc2017-12-18 12:04:12 -080076 optional int32 uid = 1;
77 // Use sint32 instead of an enum since priorities can technically be
78 // negative.
79 optional sint32 override_value = 2;
80 }
81 repeated PriorityOverride priority_overrides = 5;
82
83 // UIDs that are currently performing backups, so their jobs won't be
84 // allowed to run.
85 repeated int32 backing_up_uids = 6;
86
87 optional JobPackageHistoryProto history = 7;
88 optional JobPackageTrackerDumpProto package_tracker = 8;
89
90 message PendingJob {
Kweku Adams0f168de2018-01-24 10:51:30 -080091 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
92
Kweku Adams85f2fbc2017-12-18 12:04:12 -080093 optional JobStatusShortInfoProto info = 1;
94 optional JobStatusDumpProto dump = 2;
95 optional sint32 evaluated_priority = 3;
96 // How long this job has been pending.
97 optional int64 enqueued_duration_ms = 4;
98 }
99 repeated PendingJob pending_jobs = 9;
100
101 // From a service that has currently active or pending jobs.
102 message ActiveJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800103 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
104
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800105 message InactiveJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800106 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
107
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800108 optional int64 time_since_stopped_ms = 1;
109 // This is not always provided.
110 optional string stopped_reason = 2;
111 }
112 message RunningJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800113 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
114
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800115 optional JobStatusShortInfoProto info = 1;
116 // How long this job has been running for.
117 optional int64 running_duration_ms = 2;
118 optional int64 time_until_timeout_ms = 3;
119
120 optional JobStatusDumpProto dump = 4;
121
122 optional sint32 evaluated_priority = 5;
123
124 optional int64 time_since_made_active_ms = 6;
125 // How long this job has been pending.
126 optional int64 pending_duration_ms = 7;
127 }
128 oneof job {
129 InactiveJob inactive = 1;
130 RunningJob running = 2;
131 }
132 }
133 repeated ActiveJob active_jobs = 10;
134
135 // True when JobScheduler is allowed to run third party apps.
136 optional bool is_ready_to_rock = 11;
137 // What was last reported to DeviceIdleController about whether the device
138 // is active.
139 optional bool reported_active = 12;
140 // The current limit on the number of concurrent JobServiceContext entries
141 // we want to keep actively running a job.
142 optional int32 max_active_jobs = 13;
Makoto Onukif731c422019-01-22 13:23:31 -0800143
144 // Dump from JobConcurrencyManager.
145 optional JobConcurrencyManagerProto concurrency_manager = 20;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800146}
147
148// A com.android.server.job.JobSchedulerService.Constants object.
Makoto Onukif731c422019-01-22 13:23:31 -0800149// Next tag: 29
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800150message ConstantsProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800151 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
152
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800153 // Minimum # of idle jobs that must be ready in order to force the JMS to
154 // schedule things early.
155 optional int32 min_idle_count = 1;
156 // Minimum # of charging jobs that must be ready in order to force the JMS
157 // to schedule things early.
158 optional int32 min_charging_count = 2;
159 // Minimum # of "battery not low" jobs that must be ready in order to force
160 // the JMS to schedule things early.
161 optional int32 min_battery_not_low_count = 3;
162 // Minimum # of "storage not low" jobs that must be ready in order to force
163 // the JMS to schedule things early.
164 optional int32 min_storage_not_low_count = 4;
165 // Minimum # of connectivity jobs that must be ready in order to force the
166 // JMS to schedule things early. 1 == Run connectivity jobs as soon as
167 // ready.
168 optional int32 min_connectivity_count = 5;
169 // Minimum # of content trigger jobs that must be ready in order to force
170 // the JMS to schedule things early.
171 optional int32 min_content_count = 6;
172 // Minimum # of jobs (with no particular constraints) for which the JMS will
173 // be happy running some work early. This (and thus the other min counts)
174 // is now set to 1, to prevent any batching at this level. Since we now do
175 // batching through doze, that is a much better mechanism.
176 optional int32 min_ready_jobs_count = 7;
177 // This is the job execution factor that is considered to be heavy use of
178 // the system.
179 optional double heavy_use_factor = 8;
180 // This is the job execution factor that is considered to be moderate use of
181 // the system.
182 optional double moderate_use_factor = 9;
183 // The number of MAX_JOB_CONTEXTS_COUNT we reserve for the foreground app.
184 optional int32 fg_job_count = 10;
185 // The maximum number of background jobs we allow when the system is in a
186 // normal memory state.
187 optional int32 bg_normal_job_count = 11;
188 // The maximum number of background jobs we allow when the system is in a
189 // moderate memory state.
190 optional int32 bg_moderate_job_count = 12;
191 // The maximum number of background jobs we allow when the system is in a
192 // low memory state.
193 optional int32 bg_low_job_count = 13;
194 // The maximum number of background jobs we allow when the system is in a
195 // critical memory state.
196 optional int32 bg_critical_job_count = 14;
197 // The maximum number of times we allow a job to have itself rescheduled
198 // before giving up on it, for standard jobs.
199 optional int32 max_standard_reschedule_count = 15;
200 // The maximum number of times we allow a job to have itself rescheduled
201 // before giving up on it, for jobs that are executing work.
202 optional int32 max_work_reschedule_count = 16;
203 // The minimum backoff time to allow for linear backoff.
204 optional int64 min_linear_backoff_time_ms = 17;
205 // The minimum backoff time to allow for exponential backoff.
206 optional int64 min_exp_backoff_time_ms = 18;
207 // How often we recalculate runnability based on apps' standby bucket
208 // assignment. This should be prime relative to common time interval lengths
209 // such as a quarter-hour or day, so that the heartbeat drifts relative to
210 // wall-clock milestones.
211 optional int64 standby_heartbeat_time_ms = 19;
212 // Mapping: standby bucket -> number of heartbeats between each sweep of
213 // that bucket's jobs.
214 // Bucket assignments as recorded in the JobStatus objects are normalized to
215 // be indices into this array, rather than the raw constants used by
216 // AppIdleHistory.
217 repeated int32 standby_beats = 20;
Jeff Sharkeyac2e8ef2018-02-22 16:06:44 -0700218 // The fraction of a job's running window that must pass before we
219 // consider running it when the network is congested.
220 optional double conn_congestion_delay_frac = 21;
221 // The fraction of a prefetch job's running window that must pass before
222 // we consider matching it against a metered network.
223 optional double conn_prefetch_relax_frac = 22;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800224 // Whether to use heartbeats or rolling window for quota management. True
225 // will use heartbeats, false will use a rolling window.
226 optional bool use_heartbeats = 23;
227
Kweku Adamsbffea5a2018-12-13 22:13:28 -0800228 message TimeController {
229 // Whether or not TimeController should skip setting wakeup alarms for jobs that aren't
230 // ready now.
231 optional bool skip_not_ready_jobs = 1;
232 }
233 optional TimeController time_controller = 25;
234
Kweku Adams4836f9d2018-11-12 17:04:17 -0800235 message QuotaController {
236 // How much time each app will have to run jobs within their standby bucket window.
237 optional int64 allowed_time_per_period_ms = 1;
238 // How much time the package should have before transitioning from out-of-quota to in-quota.
239 // This should not affect processing if the package is already in-quota.
240 optional int64 in_quota_buffer_ms = 2;
241 // The quota window size of the particular standby bucket. Apps in this standby bucket are
242 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
243 // WINDOW_SIZE_MS.
244 optional int64 active_window_size_ms = 3;
245 // The quota window size of the particular standby bucket. Apps in this standby bucket are
246 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
247 // WINDOW_SIZE_MS.
248 optional int64 working_window_size_ms = 4;
249 // The quota window size of the particular standby bucket. Apps in this standby bucket are
250 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
251 // WINDOW_SIZE_MS.
252 optional int64 frequent_window_size_ms = 5;
253 // The quota window size of the particular standby bucket. Apps in this standby bucket are
254 // expected to run only {@link QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS} within the past
255 // WINDOW_SIZE_MS.
256 optional int64 rare_window_size_ms = 6;
Kweku Adams045fb5722018-12-11 14:29:10 -0800257 // The maximum amount of time an app can have its jobs running within a 24 hour window.
258 optional int64 max_execution_time_ms = 7;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800259 }
260 optional QuotaController quota_controller = 24;
Kweku Adamsbffea5a2018-12-13 22:13:28 -0800261
Makoto Onukif731c422019-01-22 13:23:31 -0800262 // Max number of jobs, when screen is ON.
263 optional MaxJobCountsPerMemoryTrimLevelProto max_job_counts_screen_on = 26;
264
265 // Max number of jobs, when screen is OFF.
266 optional MaxJobCountsPerMemoryTrimLevelProto max_job_counts_screen_off = 27;
267
268 // In this time after screen turns on, we increase job concurrency.
269 optional int32 screen_off_job_concurrency_increase_delay_ms = 28;
270}
271
272// Next tag: 4
273message MaxJobCountsProto {
274 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
275
276 // Total number of jobs to run simultaneously.
277 optional int32 total_jobs = 1;
278
279 // Max number of BG (== owned by non-TOP apps) jobs to run simultaneously.
280 optional int32 max_bg = 2;
281
282 // We try to run at least this many BG (== owned by non-TOP apps) jobs, when there are any
283 // pending, rather than always running the TOTAL number of FG jobs.
284 optional int32 min_bg = 3;
285}
286
287// Next tag: 5
288message MaxJobCountsPerMemoryTrimLevelProto {
289 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
290
291 optional MaxJobCountsProto normal = 1;
292 optional MaxJobCountsProto moderate = 2;
293 optional MaxJobCountsProto low = 3;
294 optional MaxJobCountsProto critical = 4;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800295}
296
297message StateControllerProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800298 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
299
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800300 message BackgroundJobsController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800301 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
302
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800303 optional com.android.server.ForceAppStandbyTrackerProto force_app_standby_tracker = 1;
304
305 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800306 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
307
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800308 optional JobStatusShortInfoProto info = 1;
309 optional int32 source_uid = 2;
310 optional string source_package_name = 3;
311 optional bool is_in_foreground = 4;
312 optional bool is_whitelisted = 5;
313 optional bool can_run_any_in_background = 6;
314 // If the constraints are satisfied, then the controller will mark
315 // the job as RUNNABLE, otherwise, it will be WAITING.
316 optional bool are_constraints_satisfied = 7;
317 }
318 repeated TrackedJob tracked_jobs = 2;
319 }
320 message BatteryController {
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 bool is_on_stable_power = 1;
324 optional bool is_battery_not_low = 2;
325
326 // Whether or not the controller is monitoring battery changes.
327 optional bool is_monitoring = 3;
328 // Only valid if is_monitoring is true.
329 optional int32 last_broadcast_sequence_number = 4;
330
331 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800332 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
333
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800334 optional JobStatusShortInfoProto info = 1;
335 optional int32 source_uid = 2;
336 }
337 repeated TrackedJob tracked_jobs = 5;
338 }
339 message ConnectivityController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800340 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
341
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800342 optional bool is_connected = 1;
343
344 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800345 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
346
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800347 optional JobStatusShortInfoProto info = 1;
348 optional int32 source_uid = 2;
349 optional .android.net.NetworkRequestProto required_network = 3;
350 }
351 repeated TrackedJob tracked_jobs = 2;
352 }
353 message ContentObserverController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800354 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
355
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800356 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800357 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
358
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800359 optional JobStatusShortInfoProto info = 1;
360 optional int32 source_uid = 2;
361 }
362 repeated TrackedJob tracked_jobs = 1;
363
364 message Observer {
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 int32 user_id = 1;
368
369 message TriggerContentData {
Kweku Adams0f168de2018-01-24 10:51:30 -0800370 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
371
372 optional string uri = 1 [
373 (.android.privacy).dest = DEST_EXPLICIT
374 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800375 optional int32 flags = 2;
376
377 // A
378 // com.android.server.job.controllers.ContentObserverController.JobInstance
379 // object.
380 message JobInstance {
Kweku Adams0f168de2018-01-24 10:51:30 -0800381 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
382
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800383 optional JobStatusShortInfoProto info = 1;
384 optional int32 source_uid = 2;
385
386 optional int64 trigger_content_update_delay_ms = 3;
387 optional int64 trigger_content_max_delay_ms = 4;
388
Kweku Adams0f168de2018-01-24 10:51:30 -0800389 repeated string changed_authorities = 5 [
390 (.android.privacy).dest = DEST_EXPLICIT
391 ];
392 repeated string changed_uris = 6 [
393 (.android.privacy).dest = DEST_EXPLICIT
394 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800395 }
396 repeated JobInstance jobs = 3;
397 }
398 repeated TriggerContentData triggers = 2;
399 }
400 repeated Observer observers = 2;
401 }
402 message DeviceIdleJobsController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800403 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
404
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800405 // True when in device idle mode.
406 optional bool is_device_idle_mode = 1;
407
408 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800409 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
410
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800411 optional JobStatusShortInfoProto info = 1;
412 optional int32 source_uid = 2;
413 optional string source_package_name = 3;
414 // If the constraints are satisfied, then the controller will mark
415 // the job as RUNNABLE, otherwise, it will be WAITING.
416 optional bool are_constraints_satisfied = 4;
417 optional bool is_doze_whitelisted = 5;
418 // A job that is exempted from Doze when the app is temp whitelisted
419 // or in the foreground.
420 optional bool is_allowed_in_doze = 6;
421 }
422 repeated TrackedJob tracked_jobs = 2;
423 }
424 message IdleController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800425 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
426
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800427 optional bool is_idle = 1;
428
429 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800430 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
431
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800432 optional JobStatusShortInfoProto info = 1;
433 optional int32 source_uid = 2;
434 }
435 repeated TrackedJob tracked_jobs = 2;
436 }
Kweku Adams4836f9d2018-11-12 17:04:17 -0800437 message QuotaController {
438 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
439
440 optional bool is_charging = 1;
441 optional bool is_in_parole = 2;
442
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800443 // List of UIDs currently in the foreground.
444 repeated int32 foreground_uids = 3;
445
Kweku Adams4836f9d2018-11-12 17:04:17 -0800446 message TrackedJob {
447 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
448
449 optional JobStatusShortInfoProto info = 1;
450 optional int32 source_uid = 2;
451 optional JobStatusDumpProto.Bucket effective_standby_bucket = 3;
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800452 // If the job started while the app was in the TOP state.
453 optional bool is_top_started_job = 4;
454 optional bool has_quota = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800455 // The amount of time that this job has remaining in its quota. This
456 // can be negative if the job is out of quota.
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800457 optional int64 remaining_quota_ms = 6;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800458 }
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800459 repeated TrackedJob tracked_jobs = 4;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800460
461 message Package {
462 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
463
464 optional int32 user_id = 1;
465 optional string name = 2;
466 }
467
468 message TimingSession {
469 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
470
471 optional int64 start_time_elapsed = 1;
472 optional int64 end_time_elapsed = 2;
Kweku Adamscc5afbc2018-12-11 15:24:25 -0800473 // The number of background jobs that ran during this session.
474 optional int32 bg_job_count = 3;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800475 }
476
477 message Timer {
478 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
479
480 optional Package pkg = 1;
481 // True if the Timer is actively tracking jobs.
482 optional bool is_active = 2;
483 // The time this timer last became active. Only valid if is_active is true.
484 optional int64 start_time_elapsed = 3;
Kweku Adamscc5afbc2018-12-11 15:24:25 -0800485 // How many background jobs are currently running. Valid only if the device is_active
486 // is true.
487 optional int32 bg_job_count = 4;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800488 // All of the jobs that the Timer is currently tracking.
489 repeated JobStatusShortInfoProto running_jobs = 5;
490 }
491
492 message PackageStats {
493 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
494
495 optional Package pkg = 1;
496
497 optional Timer timer = 2;
498
499 repeated TimingSession saved_sessions = 3;
500 }
Kweku Adamsd6625ff2019-01-10 12:06:21 -0800501 repeated PackageStats package_stats = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800502 }
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800503 message StorageController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800504 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
505
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800506 optional bool is_storage_not_low = 1;
507 optional int32 last_broadcast_sequence_number = 2;
508
509 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800510 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
511
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800512 optional JobStatusShortInfoProto info = 1;
513 optional int32 source_uid = 2;
514 }
515 repeated TrackedJob tracked_jobs = 3;
516 }
517 message TimeController {
Kweku Adams0f168de2018-01-24 10:51:30 -0800518 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
519
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800520 optional int64 now_elapsed_realtime = 1;
521 optional int64 time_until_next_delay_alarm_ms = 2;
522 optional int64 time_until_next_deadline_alarm_ms = 3;
523
524 message TrackedJob {
Kweku Adams0f168de2018-01-24 10:51:30 -0800525 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
526
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800527 optional JobStatusShortInfoProto info = 1;
528 optional int32 source_uid = 2;
529
530 optional bool has_timing_delay_constraint = 3;
531 // Only valid if has_timing_delay_constraint is true. Can be
532 // negative if the delay is in the past.
533 optional int64 delay_time_remaining_ms = 4;
534
535 optional bool has_deadline_constraint = 5;
536 // Only valid if has_timing_delay_constraint is true. Can be
537 // negative in certain situations.
538 optional int64 time_remaining_until_deadline_ms = 6;
539 }
540 repeated TrackedJob tracked_jobs = 4;
541 }
542 oneof controller {
Kweku Adams21b8d262018-03-30 12:19:58 -0700543 BackgroundJobsController background = 1;
544 BatteryController battery = 2;
545 ConnectivityController connectivity = 3;
546 ContentObserverController content_observer = 4;
547 DeviceIdleJobsController device_idle = 5;
548 IdleController idle = 6;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800549 QuotaController quota = 9;
Kweku Adams21b8d262018-03-30 12:19:58 -0700550 StorageController storage = 7;
551 TimeController time = 8;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800552 // Next tag: 10
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800553 }
554}
555
556// A com.android.server.job.JobPackageTracker.DataSet object.
557message DataSetProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800558 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
559
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800560 optional int64 start_clock_time_ms = 1;
561 // How much time has elapsed since the DataSet was instantiated.
562 optional int64 elapsed_time_ms = 2;
563 optional int64 period_ms = 3;
564
565 // Represents a com.android.server.job.JobPackageTracker.PackageEntry
566 // object, but with some extra data.
567 message PackageEntryProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800568 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
569
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800570 optional int32 uid = 1;
571 optional string package_name = 2;
572
573 message State {
Kweku Adams0f168de2018-01-24 10:51:30 -0800574 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
575
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800576 optional int64 duration_ms = 1;
577 optional int32 count = 2;
578 }
579 optional State pending_state = 3;
580 optional State active_state = 4;
581 optional State active_top_state = 5;
582
583 // True if the PackageEntry is currently pending or has been pending in
584 // the past.
585 optional bool pending = 6;
586 // True if the PackageEntry is currently active or has been active in
587 // the past.
588 optional bool active = 7;
589 // True if the PackageEntry is currently active top or has been active
590 // top in the past.
591 optional bool active_top = 8;
592
593 message StopReasonCount {
Kweku Adams0f168de2018-01-24 10:51:30 -0800594 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
595
Tej Singh33a412b2018-03-16 18:43:59 -0700596 optional .android.app.job.StopReasonEnum reason = 1;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800597 optional int32 count = 2;
598 }
599 repeated StopReasonCount stop_reasons = 9;
600 }
601 repeated PackageEntryProto package_entries = 4;
602
603 optional int32 max_concurrency = 5;
604 optional int32 max_foreground_concurrency = 6;
605}
606
607// Dump from com.android.server.job.GrantedUriPermissions.
608message GrantedUriPermissionsDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800609 option (.android.msg_privacy).dest = DEST_EXPLICIT;
610
611 optional int32 flags = 1 [ (.android.privacy).dest = DEST_AUTOMATIC ];
612 optional int32 source_user_id = 2 [
613 (.android.privacy).dest = DEST_AUTOMATIC
614 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800615 optional string tag = 3;
616 optional string permission_owner = 4;
617 repeated string uris = 5;
618}
619
620message JobPackageTrackerDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800621 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
622
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800623 repeated DataSetProto historical_stats = 1;
624 optional DataSetProto current_stats = 2;
625}
626
627message JobPackageHistoryProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800628 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
629
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800630 enum Event {
631 UNKNOWN = 0;
632 START_JOB = 1;
633 STOP_JOB = 2;
634 START_PERIODIC_JOB = 3;
635 STOP_PERIODIC_JOB = 4;
636 }
637 message HistoryEvent {
Kweku Adams0f168de2018-01-24 10:51:30 -0800638 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
639
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800640 optional Event event = 1;
641 optional int64 time_since_event_ms = 2;
642 optional int32 uid = 3;
643 // Job IDs can technically be negative.
644 optional int32 job_id = 4;
Yi Jin2921dd02018-03-23 14:10:31 -0700645 optional string tag = 5;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800646 // Only valid for STOP_JOB or STOP_PERIODIC_JOB Events.
Tej Singh33a412b2018-03-16 18:43:59 -0700647 optional .android.app.job.StopReasonEnum stop_reason = 6;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800648 }
649 repeated HistoryEvent history_event = 1;
650}
651
652message JobStatusShortInfoProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800653 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
654
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800655 optional int32 calling_uid = 1;
656 // Job IDs can technically be negative.
657 optional int32 job_id = 2;
Yi Jine5e2a752018-03-28 18:31:07 -0700658 optional string battery_name = 3;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800659}
660
661// Dump from a com.android.server.job.controllers.JobStatus object.
662message JobStatusDumpProto {
Kweku Adams0f168de2018-01-24 10:51:30 -0800663 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
664
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800665 // The UID that scheduled the job.
666 optional int32 calling_uid = 1;
Yi Jin2921dd02018-03-23 14:10:31 -0700667 optional string tag = 2;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800668
669 // The UID for which the job is being run.
670 optional int32 source_uid = 3;
671 optional int32 source_user_id = 4;
672 // The package for which the job is being run.
673 optional string source_package_name = 5;
674
675 // Custom dump of android.app.job.JobInfo object.
676 message JobInfo {
Kweku Adams0f168de2018-01-24 10:51:30 -0800677 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
678
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800679 optional .android.content.ComponentNameProto service = 1;
680
681 optional bool is_periodic = 2;
682 // Only valid if is_periodic is true.
683 optional int64 period_interval_ms = 3;
684 // Only valid if is_periodic is true.
685 optional int64 period_flex_ms = 4;
686
687 optional bool is_persisted = 5;
688 optional sint32 priority = 6;
689 optional int32 flags = 7;
690
691 optional bool requires_charging = 8;
692 optional bool requires_battery_not_low = 9;
693 optional bool requires_device_idle = 10;
694
695 message TriggerContentUri {
Kweku Adams0f168de2018-01-24 10:51:30 -0800696 optional int32 flags = 1 [
697 (.android.privacy).dest = DEST_AUTOMATIC
698 ];
699 optional string uri = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800700 }
701 repeated TriggerContentUri trigger_content_uris = 11;
702 optional int64 trigger_content_update_delay_ms = 12;
703 optional int64 trigger_content_max_delay_ms = 13;
704
705 optional .android.os.PersistableBundleProto extras = 14;
706 optional .android.os.BundleProto transient_extras = 15;
Kweku Adamscb89f622018-03-22 13:55:46 -0700707 // ClipData of information that is returned to the application at
708 // execution time, but not persisted by the system. This is provided by
709 // the app and the main purpose of providing a ClipData is to allow
710 // granting of URI permissions for data associated with the clip. The
711 // exact kind of permission grant to perform is specified in the flags
712 // field.
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800713 optional .android.content.ClipDataProto clip_data = 16;
714
715 optional GrantedUriPermissionsDumpProto granted_uri_permissions = 17;
716
717 optional .android.net.NetworkRequestProto required_network = 18;
718
719 optional int64 total_network_bytes = 19;
720
721 optional int64 min_latency_ms = 20;
722 optional int64 max_execution_delay_ms = 21;
723
724 message Backoff {
Kweku Adams0f168de2018-01-24 10:51:30 -0800725 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
726
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800727 enum Policy {
728 BACKOFF_POLICY_LINEAR = 0;
729 BACKOFF_POLICY_EXPONENTIAL = 1;
730 }
731 optional Policy policy = 1;
732 optional int64 initial_backoff_ms = 2;
733 }
734 optional Backoff backoff_policy = 22;
735
736 optional bool has_early_constraint = 23;
737 optional bool has_late_constraint = 24;
738 }
739 optional JobInfo job_info = 6;
740
741 enum Constraint {
742 CONSTRAINT_CHARGING = 1;
743 CONSTRAINT_BATTERY_NOT_LOW = 2;
744 CONSTRAINT_STORAGE_NOT_LOW = 3;
745 CONSTRAINT_TIMING_DELAY = 4;
746 CONSTRAINT_DEADLINE = 5;
747 CONSTRAINT_IDLE = 6;
748 CONSTRAINT_CONNECTIVITY = 7;
Kweku Adams21b8d262018-03-30 12:19:58 -0700749 CONSTRAINT_CONTENT_TRIGGER = 8;
750 CONSTRAINT_DEVICE_NOT_DOZING = 9;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800751 CONSTRAINT_WITHIN_QUOTA = 10;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800752 }
753 repeated Constraint required_constraints = 7;
754 repeated Constraint satisfied_constraints = 8;
755 repeated Constraint unsatisfied_constraints = 9;
756 optional bool is_doze_whitelisted = 10;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800757 optional bool is_uid_active = 26;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800758
Kweku Adams32f44762018-11-02 16:58:32 -0700759 message ImplicitConstraints {
760 // The device isn't Dozing or this job will be in the foreground. This
761 // implicit constraint must be satisfied for the job to run.
762 optional bool is_not_dozing = 1;
763 // The job is not restricted from running in the background (due to
764 // Battery Saver). This implicit constraint must be satisfied for the
765 // job to run.
766 optional bool is_not_restricted_in_bg = 2;
767 }
768 optional ImplicitConstraints implicit_constraints = 25;
769
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800770 enum TrackingController {
771 TRACKING_BATTERY = 0;
772 TRACKING_CONNECTIVITY = 1;
773 TRACKING_CONTENT = 2;
774 TRACKING_IDLE = 3;
775 TRACKING_STORAGE = 4;
776 TRACKING_TIME = 5;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800777 TRACKING_QUOTA = 6;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800778 }
779 // Controllers that are currently tracking the job.
780 repeated TrackingController tracking_controllers = 11;
781
Kweku Adams0f168de2018-01-24 10:51:30 -0800782 repeated string changed_authorities = 12 [
783 (.android.privacy).dest = DEST_EXPLICIT
784 ];
785 repeated string changed_uris = 13 [
786 (.android.privacy).dest = DEST_EXPLICIT
787 ];
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800788
789 optional .android.net.NetworkProto network = 14;
790
791 // Only the desired data from an android.app.job.JobWorkItem object.
792 message JobWorkItem {
Kweku Adams0f168de2018-01-24 10:51:30 -0800793 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
794
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800795 optional int32 work_id = 1;
796 optional int32 delivery_count = 2;
797 optional .android.content.IntentProto intent = 3;
798 optional GrantedUriPermissionsDumpProto uri_grants = 4;
799 }
800 repeated JobWorkItem pending_work = 15;
801 repeated JobWorkItem executing_work = 16;
802
803 enum Bucket {
804 ACTIVE = 0;
805 WORKING_SET = 1;
806 FREQUENT = 2;
807 RARE = 3;
808 NEVER = 4;
809 }
810 optional Bucket standby_bucket = 17;
Kweku Adams4836f9d2018-11-12 17:04:17 -0800811 optional bool is_exempted_from_app_standby = 27;
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800812
813 optional int64 enqueue_duration_ms = 18;
814 // Can be negative if the earliest runtime deadline has passed.
815 optional sint64 time_until_earliest_runtime_ms = 19;
816 // Can be negative if the latest runtime deadline has passed.
817 optional sint64 time_until_latest_runtime_ms = 20;
818
819 optional int32 num_failures = 21;
820
821 optional int64 last_successful_run_time = 22;
822 optional int64 last_failed_run_time = 23;
Makoto Onuki15407842018-01-19 14:23:11 -0800823
824 optional int64 internal_flags = 24;
Kweku Adams32f44762018-11-02 16:58:32 -0700825
Kweku Adams4836f9d2018-11-12 17:04:17 -0800826 // Next tag: 28
Kweku Adams85f2fbc2017-12-18 12:04:12 -0800827}
Makoto Onukif731c422019-01-22 13:23:31 -0800828
829// Dump from com.android.server.job.JobConcurrencyManager.
830// Next tag: 7
831message JobConcurrencyManagerProto {
832 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
833
834 // Whether the device is interactive (== screen on) now or not.
835 optional bool current_interactive = 1;
836 // Similar to current_interactive, screen on or not, but it takes into account the off timeout.
837 optional bool effective_interactive = 2;
838 // How many milliseconds have passed since the last screen on. (i.e. 1000 == 1 sec ago)
839 optional int64 time_since_last_screen_on_ms = 3;
840 // How many milliseconds have passed since the last screen off. (i.e. 1000 == 1 sec ago)
841 optional int64 time_since_last_screen_off_ms = 4;
842 // Current max number of jobs.
843 optional JobCountTrackerProto job_count_tracker = 5;
844 // Current memory trim level.
845 optional int32 memory_trim_level = 6;
846}
847
848// Dump from com.android.server.job.JobConcurrencyManager.JobCountTracker.
849// Next tag: 8
850message JobCountTrackerProto {
851 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
852
853 // Number of total jos that can run simultaneously.
854 optional int32 config_num_max_total_jobs = 1;
855 // Number of background jos that can run simultaneously.
856 optional int32 config_num_max_bg_jobs = 2;
857 // Out of total jobs, this many background jobs should be guaranteed to be executed, even if
858 // there are the config_num_max_total_jobs count of foreground jobs pending.
859 optional int32 config_num_min_bg_jobs = 3;
860
861 // Number of running foreground jobs.
862 optional int32 num_running_fg_jobs = 4;
863 // Number of running background jobs.
864 optional int32 num_running_bg_jobs = 5;
865
866 // Number of pending foreground jobs.
867 optional int32 num_pending_fg_jobs = 6;
868 // Number of pending background jobs.
869 optional int32 num_pending_bg_jobs = 7;
870}