1/*
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.am;
20
21import "frameworks/base/core/proto/android/app/activitymanager.proto";
22import "frameworks/base/core/proto/android/app/enums.proto";
23import "frameworks/base/core/proto/android/app/notification.proto";
24import "frameworks/base/core/proto/android/app/profilerinfo.proto";
25import "frameworks/base/core/proto/android/content/component_name.proto";
26import "frameworks/base/core/proto/android/content/configuration.proto";
27import "frameworks/base/core/proto/android/content/intent.proto";
28import "frameworks/base/core/proto/android/content/package_item_info.proto";
29import "frameworks/base/core/proto/android/graphics/rect.proto";
30import "frameworks/base/core/proto/android/internal/processstats.proto";
31import "frameworks/base/core/proto/android/os/looper.proto";
32import "frameworks/base/core/proto/android/os/powermanager.proto";
33import "frameworks/base/core/proto/android/server/intentresolver.proto";
34import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
35import "frameworks/base/core/proto/android/util/common.proto";
36import "frameworks/base/libs/incident/proto/android/privacy.proto";
37
38option java_multiple_files = true;
39
40message ActivityManagerServiceProto {
41    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
42
43    optional ActivityManagerServiceDumpActivitiesProto activities = 1;
44
45    optional ActivityManagerServiceDumpBroadcastsProto broadcasts = 2;
46
47    optional ActivityManagerServiceDumpServicesProto services = 3;
48
49    optional ActivityManagerServiceDumpProcessesProto processes = 4;
50}
51
52// "dumpsys activity --proto activities"
53message ActivityManagerServiceDumpActivitiesProto {
54    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
55
56    optional ActivityStackSupervisorProto activity_stack_supervisor = 1;
57}
58
59message ActivityStackSupervisorProto {
60    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
61
62    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
63    repeated ActivityDisplayProto displays = 2;
64    optional KeyguardControllerProto keyguard_controller = 3;
65    optional int32 focused_stack_id = 4;
66    optional .com.android.server.wm.IdentifierProto resumed_activity = 5;
67    // Whether or not the home activity is the recents activity. This is needed for the CTS tests to
68    // know what activity types to check for when invoking splitscreen multi-window.
69    optional bool is_home_recents_component = 6;
70}
71
72/* represents ActivityStackSupervisor.ActivityDisplay */
73message ActivityDisplayProto {
74    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
75
76    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
77    optional int32 id = 2;
78    repeated ActivityStackProto stacks = 3;
79}
80
81message ActivityStackProto {
82    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
83
84    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
85    optional int32 id = 2;
86    repeated TaskRecordProto tasks = 3;
87    optional .com.android.server.wm.IdentifierProto resumed_activity = 4;
88    optional int32 display_id = 5;
89    optional bool fullscreen = 6;
90    optional .android.graphics.RectProto bounds = 7;
91}
92
93message TaskRecordProto {
94    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
95
96    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
97    optional int32 id = 2;
98    repeated ActivityRecordProto activities = 3;
99    optional int32 stack_id = 4;
100    optional .android.graphics.RectProto last_non_fullscreen_bounds = 5;
101    optional string real_activity = 6;
102    optional string orig_activity = 7;
103    optional int32 activity_type = 8;
104    optional int32 resize_mode = 9;
105    optional bool fullscreen = 10;
106    optional .android.graphics.RectProto bounds = 11;
107    optional int32 min_width = 12;
108    optional int32 min_height = 13;
109}
110
111message ActivityRecordProto {
112    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
113
114    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
115    optional .com.android.server.wm.IdentifierProto identifier = 2;
116    optional string state = 3;
117    optional bool visible = 4;
118    optional bool front_of_task = 5;
119    optional int32 proc_id = 6;
120    optional bool translucent = 7;
121}
122
123message KeyguardControllerProto {
124    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
125
126    optional bool keyguard_showing = 1;
127    optional bool keyguard_occluded = 2;
128}
129
130// "dumpsys activity --proto broadcasts"
131message ActivityManagerServiceDumpBroadcastsProto {
132    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
133
134    repeated ReceiverListProto receiver_list = 1;
135
136    optional .com.android.server.IntentResolverProto receiver_resolver = 2;
137
138    repeated BroadcastQueueProto broadcast_queue = 3;
139
140    repeated StickyBroadcastProto sticky_broadcasts = 4;
141
142    message MainHandler {
143        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
144
145        optional string handler = 1;
146        optional .android.os.LooperProto looper = 2;
147    }
148    optional MainHandler handler = 5;
149}
150
151message ReceiverListProto {
152    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
153
154    optional ProcessRecordProto app = 1;
155    optional int32 pid = 2;
156    optional int32 uid = 3;
157    optional int32 user = 4;
158    optional BroadcastRecordProto current = 5;
159    optional bool linked_to_death = 6;
160    repeated BroadcastFilterProto filters = 7;
161    optional string hex_hash = 8; // used to find this ReceiverList object in IntentResolver
162}
163
164message ProcessRecordProto {
165    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
166
167    optional int32 pid = 1;
168    optional string process_name = 2;
169    optional int32 uid = 3;
170    optional int32 user_id = 4;
171    optional int32 app_id = 5;
172    optional int32 isolated_app_id = 6;
173    optional bool persistent = 7;
174}
175
176message BroadcastRecordProto {
177    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
178
179    optional int32 user_id = 1;
180    optional string intent_action = 2;
181}
182
183message BroadcastFilterProto {
184    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
185
186    optional .android.content.IntentFilterProto intent_filter = 1;
187    optional string required_permission = 2;
188    optional string hex_hash = 3; // used to find the BroadcastFilter object in IntentResolver
189    optional int32 owning_user_id = 4;
190}
191
192message BroadcastQueueProto {
193    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
194
195    optional string queue_name = 1;
196    repeated BroadcastRecordProto parallel_broadcasts = 2;
197    repeated BroadcastRecordProto ordered_broadcasts = 3;
198    optional BroadcastRecordProto pending_broadcast = 4;
199    repeated BroadcastRecordProto historical_broadcasts = 5;
200
201    message BroadcastSummary {
202        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
203
204        optional .android.content.IntentProto intent = 1;
205        optional int64 enqueue_clock_time_ms = 2;
206        optional int64 dispatch_clock_time_ms = 3;
207        optional int64 finish_clock_time_ms = 4;
208    }
209    repeated BroadcastSummary historical_broadcasts_summary = 6;
210}
211
212message MemInfoDumpProto {
213    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
214
215    optional int64 uptime_duration_ms = 1;
216    optional int64 elapsed_realtime_ms = 2;
217
218    message ProcessMemory {
219        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
220
221        optional int32 pid = 1;
222        optional string process_name = 2;
223
224        message MemoryInfo {
225            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
226
227            optional string name = 1;
228            // The proportional set size for the heap.
229            optional int32 total_pss_kb = 2;
230            // The proportional set size that is swappable for the heap.
231            optional int32 clean_pss_kb = 3;
232            // The private dirty pages used by the heap.
233            optional int32 shared_dirty_kb = 4;
234            // The shared dirty pages used by the heap.
235            optional int32 private_dirty_kb = 5;
236            // The shared clean pages used by the heap.
237            optional int32 shared_clean_kb = 6;
238            // The private clean pages used by the heap.
239            optional int32 private_clean_kb = 7;
240            oneof dirty_swap {
241                // The dirty the pages that have been swapped out.
242                int32 dirty_swap_kb = 8;
243                // The dirty the pages that have been swapped out, proportional.
244                int32 dirty_swap_pss_kb = 9;
245            }
246        }
247        message HeapInfo {
248            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
249
250            optional MemoryInfo mem_info = 1;
251            optional int32 heap_size_kb = 2;
252            optional int32 heap_alloc_kb = 3;
253            optional int32 heap_free_kb = 4;
254        }
255        optional HeapInfo native_heap = 3;
256        optional HeapInfo dalvik_heap = 4;
257        repeated MemoryInfo other_heaps = 5;
258        optional MemoryInfo unknown_heap = 6;
259        // Summation of native_heap, dalvik_heap, and other_heaps.
260        optional HeapInfo total_heap = 7;
261
262        repeated MemoryInfo dalvik_details = 8;
263
264        message AppSummary {
265            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
266
267            optional int32 java_heap_pss_kb = 1;
268            optional int32 native_heap_pss_kb = 2;
269            optional int32 code_pss_kb = 3;
270            optional int32 stack_pss_kb = 4;
271            optional int32 graphics_pss_kb = 5;
272            optional int32 private_other_pss_kb = 6;
273            optional int32 system_pss_kb = 7;
274
275            oneof total_swap {
276                int32 total_swap_pss = 8;
277                int32 total_swap_kb = 9;
278            }
279        }
280        optional AppSummary app_summary = 9;
281    }
282    repeated ProcessMemory native_processes = 3;
283
284    message AppData {
285        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
286
287        optional ProcessMemory process_memory = 1;
288
289        message ObjectStats {
290            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
291
292            optional int32 view_instance_count = 1;
293            optional int32 view_root_instance_count = 2;
294            optional int32 app_context_instance_count = 3;
295            optional int32 activity_instance_count = 4;
296            optional int32 global_asset_count = 5;
297            optional int32 global_asset_manager_count = 6;
298            optional int32 local_binder_object_count = 7;
299            optional int32 proxy_binder_object_count = 8;
300            optional int64 parcel_memory_kb = 9;
301            optional int32 parcel_count = 10;
302            optional int32 binder_object_death_count = 11;
303            optional int32 open_ssl_socket_count = 12;
304            optional int32 webview_instance_count = 13;
305        }
306        optional ObjectStats objects = 2;
307
308        message SqlStats {
309            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
310
311            optional int32 memory_used_kb = 1;
312            optional int32 pagecache_overflow_kb = 2;
313            optional int32 malloc_size_kb = 3;
314
315            message Database {
316                option (.android.msg_privacy).dest = DEST_AUTOMATIC;
317
318                optional string name = 1;
319                optional int32 page_size = 2;
320                optional int32 db_size = 3;
321                // Number of lookaside slots:
322                // http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html
323                optional int32 lookaside_b = 4;
324                // Statement cache stats: hits/misses/cachesize
325                optional string cache = 5;
326            }
327            repeated Database databases = 4;
328        }
329        optional SqlStats sql = 3;
330
331        optional string asset_allocations = 4;
332        optional string unreachable_memory = 5;
333    }
334    repeated AppData app_processes = 4;
335
336    message MemItem {
337        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
338
339        optional string tag = 1;
340        optional string label = 2;
341        optional int32 id = 3;
342        optional bool is_proc = 4;
343        optional bool has_activities = 5;
344        optional int64 pss_kb = 6;
345        optional int64 swap_pss_kb = 7;
346        repeated MemItem sub_items = 8;
347    }
348    repeated MemItem total_pss_by_process = 5;
349    repeated MemItem total_pss_by_oom_adjustment = 6;
350    repeated MemItem total_pss_by_category = 7;
351
352    optional int64 total_ram_kb = 8;
353    optional .com.android.internal.app.procstats.ProcessStatsProto.MemoryFactor status = 9;
354    // Total free RAM = cached_pss_kb + cached_kernel_kb + free_kb.
355    optional int64 cached_pss_kb = 10;
356    optional int64 cached_kernel_kb = 11;
357    optional int64 free_kb = 12;
358    // Total used RAM = used_pss_kb + used_kernel_kb.
359    optional int64 used_pss_kb = 13;
360    optional int64 used_kernel_kb = 14;
361
362    optional int64 lost_ram_kb = 15;
363
364    optional int64 total_zram_kb = 16;
365    optional int64 zram_physical_used_in_swap_kb = 17;
366    optional int64 total_zram_swap_kb = 18;
367
368    optional int64 ksm_sharing_kb = 19;
369    optional int64 ksm_shared_kb = 20;
370    optional int64 ksm_unshared_kb = 21;
371    optional int64 ksm_volatile_kb = 22;
372
373    // The approximate per-application memory class of the current device. This
374    // gives developers an idea of how hard a memory limit you should impose on
375    // their application to let the overall system work best. The value is in
376    // megabytes; the baseline Android memory class is 16 (which happens to be the
377    // Java heap limit of those devices); some devices with more memory may have
378    // 24 or even higher numbers.
379    optional int32 tuning_mb = 23;
380    // The approximate per-application memory class of the current device when an
381    // application is running with a large heap. This is the space available for
382    // memory-intensive applications; most applications should not need this
383    // amount of memory, and should instead stay with the tuning_mb limit. The
384    // value is in megabytes. This may be the same size as tuning_mb on memory
385    // constrained devices, or it may be significantly larger on devices with a
386    // large amount of available RAM.
387    // This is the size of the application's Dalvik heap if it has specified
388    // 'android:largeHeap="true"' in its manifest.
389    optional int32 tuning_large_mb = 24;
390
391    optional int64 oom_kb = 25;
392
393    // The maximum pss size in kb that we consider a process acceptable to restore
394    // from its cached state for running in the background when RAM is low.
395    optional int64 restore_limit_kb = 26;
396
397    optional bool is_low_ram_device = 27;
398    optional bool is_high_end_gfx = 28;
399}
400
401message StickyBroadcastProto {
402    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
403
404    optional int32 user = 1;
405
406    message StickyAction {
407        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
408
409        optional string name = 1;
410        repeated .android.content.IntentProto intents = 2;
411    }
412    repeated StickyAction actions = 2;
413}
414
415// "dumpsys activity --proto service"
416message ActivityManagerServiceDumpServicesProto {
417    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
418
419    optional ActiveServicesProto active_services = 1;
420}
421
422message ActiveServicesProto {
423    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
424
425    message ServicesByUser {
426        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
427
428        optional int32 user_id = 1;
429        repeated ServiceRecordProto service_records = 2;
430    }
431    repeated ServicesByUser services_by_users = 1;
432}
433
434// corresponds to ActivityManagerService.GrantUri Java class
435message GrantUriProto {
436    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
437
438    optional int32 source_user_id = 1;
439    optional string uri = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
440}
441
442message NeededUriGrantsProto {
443    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
444
445    optional string target_package = 1;
446    optional int32 target_uid = 2;
447    optional int32 flags = 3;
448
449    repeated GrantUriProto grants = 4;
450}
451
452message UriPermissionOwnerProto {
453    option (.android.msg_privacy).dest = DEST_EXPLICIT;
454
455    optional string owner = 1;
456    repeated GrantUriProto read_perms = 2;
457    repeated GrantUriProto write_perms = 3;
458}
459
460message ServiceRecordProto {
461    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
462
463    optional string short_name = 1;
464    optional bool is_running = 2; // false if the application service is null
465    optional int32 pid = 3;
466    optional .android.content.IntentProto intent = 4;
467    optional string package_name = 5;
468    optional string process_name = 6;
469    optional string permission = 7;
470
471    message AppInfo {
472        option (.android.msg_privacy).dest = DEST_EXPLICIT;
473
474        optional string base_dir = 1;
475        optional string res_dir = 2;
476        optional string data_dir = 3;
477    }
478    optional AppInfo appinfo = 8;
479    optional ProcessRecordProto app = 9;
480    optional ProcessRecordProto isolated_proc = 10;
481    optional bool whitelist_manager = 11;
482    optional bool delayed = 12;
483
484    message Foreground {
485        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
486
487        optional int32 id = 1;
488        optional .android.app.NotificationProto notification = 2;
489    }
490    optional Foreground foreground = 13;
491
492    optional .android.util.Duration create_real_time = 14;
493    optional .android.util.Duration starting_bg_timeout = 15;
494    optional .android.util.Duration last_activity_time = 16;
495    optional .android.util.Duration restart_time = 17;
496    optional bool created_from_fg = 18;
497
498    // variables used to track states related to service start
499    message Start {
500        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
501
502        optional bool start_requested = 1;
503        optional bool delayed_stop = 2;
504        optional bool stop_if_killed = 3;
505        optional bool call_start = 4;
506        optional int32 last_start_id = 5;
507    }
508    optional Start start = 19;
509
510    message ExecuteNesting {
511        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
512
513        optional int32 execute_nesting = 1;
514        optional bool execute_fg = 2;
515        optional .android.util.Duration executing_start = 3;
516    }
517    optional ExecuteNesting execute = 20;
518
519    optional .android.util.Duration destory_time = 21;
520
521    message Crash {
522        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
523
524        optional int32 restart_count = 1;
525        optional .android.util.Duration restart_delay = 2;
526        optional .android.util.Duration next_restart_time = 3;
527        optional int32 crash_count = 4;
528    }
529    optional Crash crash = 22;
530
531    message StartItem {
532        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
533
534        optional int32 id = 1;
535        optional .android.util.Duration duration = 2;
536        optional int32 delivery_count = 3;
537        optional int32 done_executing_count = 4;
538        optional .android.content.IntentProto intent = 5;
539        optional NeededUriGrantsProto needed_grants = 6;
540        optional UriPermissionOwnerProto uri_permissions = 7;
541    }
542    repeated StartItem delivered_starts = 23;
543    repeated StartItem pending_starts = 24;
544
545    repeated IntentBindRecordProto bindings = 25;
546    repeated ConnectionRecordProto connections = 26;
547
548    // Next Tag: 27
549}
550
551message ConnectionRecordProto {
552    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
553
554    // used to find same record, e.g. AppBindRecord has the hex_hash
555    optional string hex_hash = 1; // cross reference the object and avoid double logging.
556    optional int32 user_id = 2;
557
558    enum Flag {
559        AUTO_CREATE = 0;
560        DEBUG_UNBIND = 1;
561        NOT_FG = 2;
562        IMPORTANT_BG = 3;
563        ABOVE_CLIENT = 4;
564        ALLOW_OOM_MANAGEMENT = 5;
565        WAIVE_PRIORITY = 6;
566        IMPORTANT = 7;
567        ADJUST_WITH_ACTIVITY = 8;
568        FG_SERVICE_WHILE_AWAKE = 9;
569        FG_SERVICE = 10;
570        TREAT_LIKE_ACTIVITY = 11;
571        VISIBLE = 12;
572        SHOWING_UI = 13;
573        NOT_VISIBLE = 14;
574        DEAD = 15;
575    }
576    repeated Flag flags = 3;
577    optional string service_name = 4;
578}
579
580message AppBindRecordProto {
581    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
582
583    optional string service_name = 1;
584    optional string client_proc_name = 2;
585    repeated string connections = 3; // hex_hash of ConnectionRecordProto
586}
587
588message IntentBindRecordProto {
589    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
590
591    optional .android.content.IntentProto intent = 1;
592    optional string binder = 2;
593    optional bool auto_create = 3; // value of BIND_AUTO_CREATE flag.
594    optional bool requested = 4;
595    optional bool received = 5;
596    optional bool has_bound = 6;
597    optional bool do_rebind = 7;
598
599    repeated AppBindRecordProto apps = 8;
600}
601
602// TODO: "dumpsys activity --proto processes"
603message ActivityManagerServiceDumpProcessesProto {
604    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
605
606    repeated ProcessRecordProto procs = 1;
607    repeated ProcessRecordProto isolated_procs = 2;
608    repeated ActiveInstrumentationProto active_instrumentations = 3;
609    repeated UidRecordProto active_uids = 4;
610    repeated UidRecordProto validate_uids = 5;
611
612    // Process LRU list (sorted by oom_adj)
613    message LruProcesses {
614        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
615
616        optional int32 size = 1;
617        optional int32 non_act_at = 2;
618        optional int32 non_svc_at = 3;
619        repeated ProcessOomProto list = 4;
620    }
621    optional LruProcesses lru_procs = 6;
622    repeated ProcessRecordProto pids_self_locked = 7;
623    // Foreground Processes
624    repeated ImportanceTokenProto important_procs = 8;
625    // Persisent processes that are starting
626    repeated ProcessRecordProto persistent_starting_procs = 9;
627    // Processes that are being removed
628    repeated ProcessRecordProto removed_procs = 10;
629    // Processes that are on old until the system is ready
630    repeated ProcessRecordProto on_hold_procs = 11;
631    // Processes that are waiting to GC
632    repeated ProcessToGcProto gc_procs = 12;
633    optional AppErrorsProto app_errors = 13;
634    optional UserControllerProto user_controller = 14;
635    optional ProcessRecordProto home_proc = 15;
636    optional ProcessRecordProto previous_proc = 16;
637    optional int64 previous_proc_visible_time_ms = 17;
638    optional ProcessRecordProto heavy_weight_proc = 18;
639    optional .android.content.ConfigurationProto global_configuration = 19;
640    // ActivityStackSupervisorProto dumps these values as well, still here?
641    // repeated ActivityDisplayProto displays = 20;
642
643    optional bool config_will_change = 21;
644
645    message ScreenCompatPackage {
646        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
647
648        optional string package = 1;
649        optional int32 mode = 2;
650    }
651    repeated ScreenCompatPackage screen_compat_packages = 22;
652
653    message UidObserverRegistrationProto {
654        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
655
656        optional int32 uid = 1;
657        optional string package = 2;
658        repeated .android.app.UidObserverFlag flags = 3;
659        optional int32 cut_point = 4; // only available when UID_OBSERVER_PROCSTATE is on
660
661        message ProcState {
662            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
663
664            optional int32 uid = 1;
665            optional int32 state = 2;
666        }
667        repeated ProcState last_proc_states = 5;
668    }
669    repeated UidObserverRegistrationProto uid_observers = 23;
670    repeated int32 device_idle_whitelist = 24;
671    repeated int32 device_idle_temp_whitelist = 25;
672
673    message PendingTempWhitelist {
674        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
675
676        optional int32 target_uid = 1;
677        optional int64 duration_ms = 2;
678        optional string tag = 3;
679    }
680    repeated PendingTempWhitelist pending_temp_whitelist = 26;
681
682    message SleepStatus {
683        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
684
685        optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 1;
686        repeated string sleep_tokens = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
687        optional bool sleeping = 3;
688        optional bool shutting_down = 4;
689        optional bool test_pss_mode = 5;
690    }
691    optional SleepStatus sleep_status = 27;
692
693    message Voice {
694        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
695
696        optional string session = 1;
697        optional .android.os.PowerManagerProto.WakeLock wakelock = 2;
698    }
699    optional Voice running_voice = 28;
700
701    optional VrControllerProto vr_controller = 29;
702
703    message DebugApp {
704        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
705
706        optional string debug_app = 1;
707        optional string orig_debug_app = 2;
708        optional bool debug_transient = 3;
709        optional bool orig_wait_for_debugger = 4;
710    }
711    optional DebugApp debug = 30;
712    optional AppTimeTrackerProto current_tracker = 31;
713
714    message MemWatchProcess {
715        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
716
717        message Process {
718            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
719
720            optional string name = 1;
721
722            message MemStats {
723                option (.android.msg_privacy).dest = DEST_AUTOMATIC;
724
725                optional int32 uid = 1;
726                optional string size = 2;
727                optional string report_to = 3;
728            }
729            repeated MemStats mem_stats = 2;
730        }
731        repeated Process procs = 1;
732
733        message Dump {
734            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
735
736            optional string proc_name = 1;
737            optional string file = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
738            optional int32 pid = 3;
739            optional int32 uid = 4;
740        }
741        optional Dump dump = 2;
742    }
743    optional MemWatchProcess mem_watch_processes = 32;
744    optional string track_allocation_app = 33;
745
746    message Profile {
747        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
748
749        optional string app_name = 1;
750        optional ProcessRecordProto proc = 2;
751        optional .android.app.ProfilerInfoProto info = 3;
752        optional int32 type = 4;
753    }
754    optional Profile profile = 34;
755    optional string native_debugging_app = 35;
756    optional bool always_finish_activities = 36;
757
758    message Controller {
759        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
760
761        optional string controller = 1;
762        optional bool is_a_monkey = 2;
763    }
764    optional Controller controller = 37;
765
766    optional int32 total_persistent_procs = 38;
767    optional bool processes_ready = 39;
768    optional bool system_ready = 40;
769    optional bool booted = 41;
770    optional int32 factory_test = 42;
771    optional bool booting = 43;
772    optional bool call_finish_booting = 44;
773    optional bool boot_animation_complete = 45;
774    optional int64 last_power_check_uptime_ms = 46;
775    optional .android.os.PowerManagerProto.WakeLock going_to_sleep = 47;
776    optional .android.os.PowerManagerProto.WakeLock launching_activity = 48;
777    optional int32 adj_seq = 49;
778    optional int32 lru_seq = 50;
779    optional int32 num_non_cached_procs = 51;
780    optional int32 num_cached_hidden_procs = 52;
781    optional int32 num_service_procs = 53;
782    optional int32 new_num_service_procs = 54;
783    optional bool allow_lower_mem_level = 55;
784    optional int32 last_memory_level = 56;
785    optional int32 last_num_processes = 57;
786    optional .android.util.Duration last_idle_time = 58;
787    optional int64 low_ram_since_last_idle_ms = 59;
788}
789
790message ActiveInstrumentationProto {
791    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
792
793    optional .android.content.ComponentNameProto class = 1;
794    optional bool finished = 2;
795    repeated ProcessRecordProto running_processes = 3;
796    repeated string target_processes = 4;
797    optional .android.content.pm.ApplicationInfoProto target_info = 5;
798    optional string profile_file = 6;
799    optional string watcher = 7;
800    optional string ui_automation_connection = 8;
801    optional string arguments = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
802}
803
804// Proto definition of com.android.server.am.UidRecord.java
805message UidRecordProto {
806    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
807
808    optional int32 uid = 1;
809    optional .android.app.ProcessStateEnum current = 2;
810    optional bool ephemeral = 3;
811    optional bool fg_services = 4;
812    optional bool whilelist = 5;
813    optional .android.util.Duration last_background_time = 6;
814    optional bool idle = 7;
815
816    enum Change {
817        CHANGE_GONE = 0;
818        CHANGE_IDLE = 1;
819        CHANGE_ACTIVE = 2;
820        CHANGE_CACHED = 3;
821        CHANGE_UNCACHED = 4;
822    }
823    repeated Change last_reported_changes = 8;
824    optional int32 num_procs = 9;
825
826    message ProcStateSequence {
827        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
828
829        optional int64 cururent = 1;
830        optional int64 last_network_updated = 2;
831        optional int64 last_dispatched = 3;
832    }
833    optional ProcStateSequence network_state_update = 10;
834
835    // Next Tag: 11
836}
837
838// proto of class ImportanceToken in ActivityManagerService
839message ImportanceTokenProto {
840    option (.android.msg_privacy).dest = DEST_EXPLICIT;
841
842    optional int32 pid = 1;
843    optional string token = 2;
844    optional string reason = 3;
845}
846
847// proto of class VrController.java
848message VrControllerProto {
849    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
850
851    enum VrMode {
852        FLAG_NON_VR_MODE = 0;
853        FLAG_VR_MODE = 1;
854        FLAG_PERSISTENT_VR_MODE = 2;
855    }
856    repeated VrMode vr_mode = 1;
857    optional int32 render_thread_id = 2;
858}
859
860message ProcessOomProto {
861    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
862
863    optional bool persistent = 1;
864    optional int32 num = 2;
865    optional string oom_adj = 3;
866
867    // Activity manager's version of Process enum, see ProcessList.java
868    enum SchedGroup {
869        SCHED_GROUP_UNKNOWN = -1;
870        SCHED_GROUP_BACKGROUND = 0;
871        SCHED_GROUP_DEFAULT = 1;
872        SCHED_GROUP_TOP_APP = 2;
873        SCHED_GROUP_TOP_APP_BOUND = 3;
874    }
875    optional SchedGroup sched_group = 4 [ default = SCHED_GROUP_UNKNOWN];
876
877    oneof Foreground {
878        bool activities = 5;
879        bool services = 6;
880    }
881
882    optional .android.app.ProcessStateEnum state = 7;
883    optional int32 trim_memory_level = 8;
884    optional ProcessRecordProto proc = 9;
885    optional string adj_type = 10;
886
887    oneof AdjTarget {
888        .android.content.ComponentNameProto adj_target_component_name = 11;
889        string adj_target_object = 12;
890    }
891
892    oneof AdjSource {
893        ProcessRecordProto adj_source_proc = 13;
894        string adj_source_object = 14;
895    }
896
897    message Detail {
898        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
899
900        optional int32 max_adj = 1;
901        optional int32 cur_raw_adj = 2;
902        optional int32 set_raw_adj = 3;
903        optional int32 cur_adj = 4;
904        optional int32 set_adj = 5;
905        optional .android.app.ProcessStateEnum current_state = 7;
906        optional .android.app.ProcessStateEnum set_state = 8;
907        optional string last_pss = 9;
908        optional string last_swap_pss = 10;
909        optional string last_cached_pss = 11;
910        optional bool cached = 12;
911        optional bool empty = 13;
912        optional bool has_above_client = 14;
913
914        // only make sense if process is a service
915        message CpuRunTime {
916            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
917
918            optional int64 over_ms = 1;
919            optional int64 used_ms = 2;
920            optional float ultilization = 3; // ratio of cpu time usage
921        }
922        optional CpuRunTime service_run_time = 15;
923    }
924    optional Detail detail = 15;
925}
926
927message ProcessToGcProto {
928    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
929
930    optional ProcessRecordProto proc = 1;
931    optional bool report_low_memory = 2;
932    optional int64 now_uptime_ms = 3;
933    optional int64 last_gced_ms = 4;
934    optional int64 last_low_memory_ms = 5;
935}
936
937// sync with com.android.server.am.AppErrors.java
938message AppErrorsProto {
939    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
940
941    optional int64 now_uptime_ms = 1;
942
943    message ProcessCrashTime {
944        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
945
946        optional string process_name = 1;
947
948        message Entry {
949            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
950
951            optional int32 uid = 1;
952            optional int64 last_crashed_at_ms = 2;
953        }
954        repeated Entry entries = 2;
955    }
956    repeated ProcessCrashTime process_crash_times = 2;
957
958    message BadProcess {
959        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
960
961        optional string process_name = 1;
962
963        message Entry {
964            option (.android.msg_privacy).dest = DEST_AUTOMATIC;
965
966            optional int32 uid = 1;
967            optional int64 crashed_at_ms = 2;
968            optional string short_msg = 3;
969            optional string long_msg = 4 [ (.android.privacy).dest = DEST_EXPLICIT ];
970            optional string stack = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
971        }
972        repeated Entry entries = 2;
973    }
974    repeated BadProcess bad_processes = 3;
975}
976
977// sync with com.android.server.am.UserState.java
978message UserStateProto {
979    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
980
981    enum State {
982        STATE_BOOTING = 0;
983        STATE_RUNNING_LOCKED = 1;
984        STATE_RUNNING_UNLOCKING = 2;
985        STATE_RUNNING_UNLOCKED = 3;
986        STATE_STOPPING = 4;
987        STATE_SHUTDOWN = 5;
988    }
989    optional State state = 1;
990    optional bool switching = 2;
991}
992
993// sync with com.android.server.am.UserController.java
994message UserControllerProto {
995    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
996
997    message User {
998        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
999
1000        optional int32 id = 1;
1001        optional UserStateProto state = 2;
1002    }
1003    repeated User started_users = 1;
1004    repeated int32 started_user_array = 2;
1005    repeated int32 user_lru = 3;
1006
1007    message UserProfile {
1008        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
1009
1010        optional int32 user = 1;
1011        optional int32 profile = 2;
1012    }
1013    repeated UserProfile user_profile_group_ids = 4;
1014}
1015
1016// sync with com.android.server.am.AppTimeTracker.java
1017message AppTimeTrackerProto {
1018    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
1019
1020    optional string receiver = 1;
1021    optional int64 total_duration_ms = 2;
1022
1023    message PackageTime {
1024        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
1025
1026        optional string package = 1;
1027        optional int64 duration_ms = 2;
1028    }
1029    repeated PackageTime package_times = 3;
1030
1031    optional .android.util.Duration started_time = 4;
1032    optional string started_package = 5;
1033}
1034