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