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