1/*
2 * Copyright (C) 2016 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";
18option java_multiple_files = true;
19
20import "frameworks/base/core/proto/android/nfc/nfc_service.proto";
21import "frameworks/base/core/proto/android/os/backtrace.proto";
22import "frameworks/base/core/proto/android/os/batterytype.proto";
23import "frameworks/base/core/proto/android/os/cpufreq.proto";
24import "frameworks/base/core/proto/android/os/cpuinfo.proto";
25import "frameworks/base/core/proto/android/os/cpu_usage.proto";
26import "frameworks/base/core/proto/android/os/data.proto";
27import "frameworks/base/core/proto/android/os/header.proto";
28import "frameworks/base/core/proto/android/os/kernelwake.proto";
29import "frameworks/base/core/proto/android/os/metadata.proto";
30import "frameworks/base/core/proto/android/os/pagetypeinfo.proto";
31import "frameworks/base/core/proto/android/os/procrank.proto";
32import "frameworks/base/core/proto/android/os/ps.proto";
33import "frameworks/base/core/proto/android/os/statsdata.proto";
34import "frameworks/base/core/proto/android/os/system_properties.proto";
35import "frameworks/base/core/proto/android/providers/settings.proto";
36import "frameworks/base/core/proto/android/server/activitymanagerservice.proto";
37import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto";
38import "frameworks/base/core/proto/android/server/bluetooth_manager_service.proto";
39import "frameworks/base/core/proto/android/server/fingerprint.proto";
40import "frameworks/base/core/proto/android/server/jobscheduler.proto";
41import "frameworks/base/core/proto/android/server/location/context_hub.proto";
42import "frameworks/base/core/proto/android/server/powermanagerservice.proto";
43import "frameworks/base/core/proto/android/server/rolemanagerservice.proto";
44import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
45import "frameworks/base/core/proto/android/service/appwidget.proto";
46import "frameworks/base/core/proto/android/service/battery.proto";
47import "frameworks/base/core/proto/android/service/batterystats.proto";
48import "frameworks/base/core/proto/android/service/diskstats.proto";
49import "frameworks/base/core/proto/android/service/dropbox.proto";
50import "frameworks/base/core/proto/android/service/graphicsstats.proto";
51import "frameworks/base/core/proto/android/service/netstats.proto";
52import "frameworks/base/core/proto/android/service/notification.proto";
53import "frameworks/base/core/proto/android/service/package.proto";
54import "frameworks/base/core/proto/android/service/print.proto";
55import "frameworks/base/core/proto/android/service/procstats.proto";
56import "frameworks/base/core/proto/android/service/restricted_image.proto";
57import "frameworks/base/core/proto/android/service/sensor_service.proto";
58import "frameworks/base/core/proto/android/service/usb.proto";
59import "frameworks/base/core/proto/android/util/event_log_tags.proto";
60import "frameworks/base/core/proto/android/util/log.proto";
61import "frameworks/base/core/proto/android/util/textdump.proto";
62import "frameworks/base/core/proto/android/privacy.proto";
63import "frameworks/base/core/proto/android/section.proto";
64import "frameworks/base/proto/src/ipconnectivity.proto";
65
66package android.os;
67
68// Privacy tag can be marked to override UNSET messages so generic
69// message type can be handled case by case, e.g. GZippedFileProto.
70message IncidentProto {
71    reserved 1001;
72
73    // Incident header from callers
74    repeated IncidentHeaderProto header = 1;
75    // Internal metadata of incidentd
76    optional IncidentMetadata metadata = 2;
77
78    // Device information
79    optional SystemPropertiesProto system_properties = 1000 [
80        (section).type = SECTION_COMMAND,
81        (section).args = "getprop"
82    ];
83
84    optional string kernel_version = 1002 [
85        (section).type = SECTION_FILE,
86        (section).args = "/proc/version",
87        (privacy).dest = DEST_AUTOMATIC
88    ];
89
90    // Device Logs
91    optional android.util.EventLogTagMapProto event_log_tag_map = 1100 [
92        (section).type = SECTION_FILE,
93        (section).args = "/system/etc/event-log-tags"
94    ];
95
96    optional android.util.LogProto main_logs = 1101 [
97        (section).type = SECTION_LOG,
98        (section).args = "main"
99    ];
100
101    optional android.util.LogProto radio_logs = 1102 [
102        (section).type = SECTION_LOG,
103        (section).args = "radio"
104    ];
105
106    optional android.util.LogProto events_logs = 1103 [
107        (section).type = SECTION_LOG,
108        (section).args = "events"
109    ];
110
111    optional android.util.LogProto system_logs = 1104 [
112        (section).type = SECTION_LOG,
113        (section).args = "system"
114    ];
115
116    optional android.util.LogProto crash_logs = 1105 [
117        (section).type = SECTION_LOG,
118        (section).args = "crash"
119    ];
120
121    optional android.util.LogProto stats_logs = 1106 [
122        (section).type = SECTION_LOG,
123        (section).args = "stats"
124    ];
125
126    optional android.util.LogProto security_logs = 1107 [
127        (section).type = SECTION_LOG,
128        (section).args = "security"
129    ];
130
131    optional android.util.LogProto kernel_logs = 1108 [
132        (section).type = SECTION_LOG,
133        (section).args = "kernel"
134    ];
135
136    // Last logcat sections.
137    // Note that kernel logs is not persisted since it's contained in last kmsg.
138    optional android.util.LogProto last_main_logs = 1109 [
139        (section).type = SECTION_LOG,
140        (section).args = "main -L"
141    ];
142
143    optional android.util.LogProto last_radio_logs = 1110 [
144        (section).type = SECTION_LOG,
145        (section).args = "radio -L"
146    ];
147
148    optional android.util.LogProto last_events_logs = 1111 [
149        (section).type = SECTION_LOG,
150        (section).args = "events -L"
151    ];
152
153    optional android.util.LogProto last_system_logs = 1112 [
154        (section).type = SECTION_LOG,
155        (section).args = "system -L"
156    ];
157
158    optional android.util.LogProto last_crash_logs = 1113 [
159        (section).type = SECTION_LOG,
160        (section).args = "crash -L"
161    ];
162
163    optional android.util.LogProto last_stats_logs = 1114 [
164        (section).type = SECTION_LOG,
165        (section).args = "stats -L"
166    ];
167
168    // security logs is only available with "Device Owner" mode
169    optional android.util.LogProto last_security_logs = 1115 [
170        (section).type = SECTION_LOG,
171        (section).args = "security -L"
172    ];
173
174    optional android.util.PersistedLogProto persisted_logs = 1116 [
175        (section).type = SECTION_COMMAND,
176        (section).args = "/system/bin/sh /system/bin/incident-helper-cmd -l run persisted_logs --limit 10MB"
177    ];
178
179    // Stack dumps
180    optional android.os.BackTraceProto native_traces = 1200 [
181        (section).type = SECTION_TOMBSTONE,
182        (section).args = "native"
183    ];
184
185    optional android.os.BackTraceProto hal_traces = 1201 [
186        (section).type = SECTION_TOMBSTONE,
187        (section).args = "hal"
188    ];
189
190    optional android.os.BackTraceProto java_traces = 1202 [
191        (section).type = SECTION_TOMBSTONE,
192        (section).args = "java"
193    ];
194
195    // Linux services
196    optional ProcrankProto procrank = 2000 [
197        // Disable procrank for reasons below:
198        // 1. incidentd can't execute `procrank` because it don't have DAC perms
199        //    since it is running as its own uid, no root access.
200        // 2. the same information is able to be accessed by meminfo dumpsys.
201        // 3. leave this one here to show case of how to disable a section
202        //    (no removal allowed if you are familiar with PROTOBUF).
203        (section).type = SECTION_NONE,
204        (section).args = "procrank"
205    ];
206
207    optional PageTypeInfoProto page_type_info = 2001 [
208        (section).type = SECTION_FILE,
209        (section).args = "/proc/pagetypeinfo"
210    ];
211
212    optional KernelWakeSourcesProto kernel_wake_sources = 2002 [
213        (section).type = SECTION_FILE,
214        (section).args = "/d/wakeup_sources"
215    ];
216
217    optional CpuInfoProto cpu_info = 2003 [
218        (section).type = SECTION_COMMAND,
219        (section).args = "top -b -n 1 -H -s 6 -o pid,tid,user,pr,ni,%cpu,s,virt,res,pcy,cmd,name"
220    ];
221
222    optional CpuFreqProto cpu_freq = 2004 [
223        (section).type = SECTION_FILE,
224        (section).args = "/sys/devices/system/cpu/cpufreq/all_time_in_state"
225    ];
226
227    optional PsProto processes_and_threads = 2005 [
228        (section).type = SECTION_COMMAND,
229        (section).args = "ps -A -T -Z -O pri,nice,rtprio,sched,pcy,time"
230    ];
231
232    optional BatteryTypeProto battery_type = 2006 [
233        (section).type = SECTION_FILE,
234        (section).args = "/sys/class/power_supply/bms/battery_type"
235    ];
236
237    optional GZippedFileProto last_kmsg = 2007 [
238        (section).type = SECTION_GZIP,
239        (section).args = "/sys/fs/pstore/console-ramoops /sys/fs/pstore/console-ramoops-0 /proc/last_kmsg",
240        (privacy).dest = DEST_EXPLICIT
241    ];
242
243    // System Services
244    optional com.android.server.biometrics.fingerprint.FingerprintServiceDumpProto fingerprint = 3000 [
245        (section).type = SECTION_DUMPSYS,
246        (section).args = "fingerprint --proto --incident"
247    ];
248
249    optional android.service.NetworkStatsServiceDumpProto netstats = 3001 [
250        (section).type = SECTION_DUMPSYS,
251        (section).args = "netstats --proto"
252    ];
253
254    optional android.providers.settings.SettingsServiceDumpProto settings = 3002 [
255        (section).type = SECTION_DUMPSYS,
256        (section).args = "settings --proto"
257    ];
258
259    optional android.service.appwidget.AppWidgetServiceDumpProto appwidget = 3003;
260    optional android.service.notification.NotificationServiceDumpProto notification = 3004 [
261        (section).type = SECTION_DUMPSYS,
262        (section).args = "notification --proto"
263    ];
264
265    optional android.service.batterystats.BatteryStatsServiceDumpProto batterystats = 3005 [
266        (section).type = SECTION_DUMPSYS,
267        (section).args = "batterystats --proto"
268    ];
269
270    optional android.service.battery.BatteryServiceDumpProto battery = 3006 [
271        (section).type = SECTION_DUMPSYS,
272        (section).args = "battery --proto"
273    ];
274
275    optional android.service.diskstats.DiskStatsServiceDumpProto diskstats = 3007 [
276        (section).type = SECTION_DUMPSYS,
277        (section).args = "diskstats --proto"
278    ];
279
280    optional android.service.pm.PackageServiceDumpProto package = 3008 [
281        (section).type = SECTION_DUMPSYS,
282        (section).args = "package --proto"
283    ];
284
285    optional com.android.server.power.PowerManagerServiceDumpProto power = 3009 [
286        (section).type = SECTION_DUMPSYS,
287        (section).args = "power --proto"
288    ];
289
290    optional android.service.print.PrintServiceDumpProto print = 3010 [
291        (section).type = SECTION_DUMPSYS,
292        (section).args = "print --proto"
293    ];
294
295    optional android.service.procstats.ProcessStatsServiceDumpProto procstats = 3011 [
296        (section).type = SECTION_DUMPSYS,
297        (section).args = "procstats --proto"
298    ];
299
300    optional com.android.server.am.ActivityManagerServiceDumpActivitiesProto activities = 3012 [
301        (section).type = SECTION_DUMPSYS,
302        (section).args = "activity --proto activities"
303    ];
304
305    optional com.android.server.am.ActivityManagerServiceDumpBroadcastsProto broadcasts = 3013 [
306        (section).type = SECTION_DUMPSYS,
307        (section).args = "activity --proto broadcasts"
308    ];
309
310    optional com.android.server.am.ActivityManagerServiceDumpServicesProto amservices = 3014 [
311        (section).type = SECTION_DUMPSYS,
312        (section).args = "activity --proto service"
313    ];
314
315    optional com.android.server.am.ActivityManagerServiceDumpProcessesProto amprocesses = 3015 [
316        (section).type = SECTION_DUMPSYS,
317        (section).args = "activity --proto processes"
318    ];
319
320    optional com.android.server.AlarmManagerServiceDumpProto alarm = 3016 [
321        (section).type = SECTION_DUMPSYS,
322        (section).args = "alarm --proto"
323    ];
324
325    optional com.android.server.wm.WindowManagerServiceDumpProto window = 3017 [
326        (section).type = SECTION_DUMPSYS,
327        (section).args = "window --proto"
328    ];
329
330    optional com.android.server.am.MemInfoDumpProto meminfo = 3018 [
331        (section).type = SECTION_DUMPSYS,
332        (section).args = "meminfo -a --proto"
333    ];
334
335    optional android.service.GraphicsStatsServiceDumpProto graphicsstats = 3019 [
336        (section).type = SECTION_DUMPSYS,
337        (section).args = "graphicsstats --proto"
338    ];
339
340    optional com.android.server.job.JobSchedulerServiceDumpProto jobscheduler = 3020 [
341        (section).type = SECTION_DUMPSYS,
342        (section).args = "jobscheduler --proto"
343    ];
344
345    optional android.service.usb.UsbServiceDumpProto usb = 3021 [
346        (section).type = SECTION_DUMPSYS,
347        (section).args = "usb --proto"
348    ];
349
350    // The history can be large and may cause issues in consumers, so put the
351    // history in a separate section to compensate.
352    optional android.service.batterystats.BatteryStatsServiceDumpHistoryProto battery_history = 3022 [
353        (section).type = SECTION_DUMPSYS,
354        (section).args = "batterystats --proto --history",
355        (section).userdebug_and_eng_only = true
356    ];
357
358    optional android.os.StatsDataDumpProto stats_data = 3023 [
359        (section).type = SECTION_DUMPSYS,
360        (section).args = "stats --proto",
361        (section).userdebug_and_eng_only = true
362    ];
363
364    optional com.android.server.role.RoleManagerServiceDumpProto role = 3024 [
365        (section).type = SECTION_DUMPSYS,
366        (section).args = "role --proto"
367    ];
368
369    optional android.service.restricted_image.RestrictedImagesDumpProto restricted_images = 3025 [
370        (section).type = SECTION_DUMPSYS,
371        (section).userdebug_and_eng_only = true,
372        (section).args = "incidentcompanion --restricted_image"
373    ];
374
375    // System trace as a serialized protobuf.
376    optional bytes system_trace = 3026 [
377        (section).type = SECTION_FILE,
378        (section).args = "/data/misc/perfetto-traces/incident-trace",
379        (privacy).dest = DEST_AUTOMATIC
380    ];
381
382    // Dropbox entries split by tags.
383    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_data_app_crash = 3027 [
384        (section).type = SECTION_DUMPSYS,
385        (section).args = "dropbox --proto data_app_crash"
386    ];
387
388    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_data_app_anr = 3028 [
389        (section).type = SECTION_DUMPSYS,
390        (section).args = "dropbox --proto data_app_anr"
391    ];
392
393    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_data_app_native_crash = 3029 [
394        (section).type = SECTION_DUMPSYS,
395        (section).args = "dropbox --proto data_app_native_crash"
396    ];
397
398    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_data_app_strictmode = 3030 [
399        (section).type = SECTION_DUMPSYS,
400        (section).args = "dropbox --proto data_app_strictmode"
401    ];
402
403    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_data_app_wtf = 3031 [
404        (section).type = SECTION_DUMPSYS,
405        (section).args = "dropbox --proto data_app_wtf"
406    ];
407
408    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_app_crash = 3032 [
409        (section).type = SECTION_DUMPSYS,
410        (section).args = "dropbox --proto system_app_crash"
411    ];
412
413    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_app_anr = 3033 [
414        (section).type = SECTION_DUMPSYS,
415        (section).args = "dropbox --proto system_app_anr"
416    ];
417
418    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_app_native_crash = 3034 [
419        (section).type = SECTION_DUMPSYS,
420        (section).args = "dropbox --proto system_app_native_crash"
421    ];
422
423    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_app_strictmode = 3035 [
424        (section).type = SECTION_DUMPSYS,
425        (section).args = "dropbox --proto system_app_strictmode"
426    ];
427
428    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_app_wtf = 3036 [
429        (section).type = SECTION_DUMPSYS,
430        (section).args = "dropbox --proto system_app_wtf"
431    ];
432
433    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_crash = 3037 [
434        (section).type = SECTION_DUMPSYS,
435        (section).args = "dropbox --proto system_server_crash"
436    ];
437
438    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_anr = 3038 [
439        (section).type = SECTION_DUMPSYS,
440        (section).args = "dropbox --proto system_server_anr"
441    ];
442
443    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_native_crash = 3039 [
444        (section).type = SECTION_DUMPSYS,
445        (section).args = "dropbox --proto system_server_native_crash"
446    ];
447
448    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_lowmem= 3040 [
449        (section).type = SECTION_DUMPSYS,
450        (section).args = "dropbox --proto system_server_lowmem"
451    ];
452
453    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_strictmode = 3041 [
454        (section).type = SECTION_DUMPSYS,
455        (section).args = "dropbox --proto system_server_strictmode"
456    ];
457
458    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_watchdog = 3042 [
459        (section).type = SECTION_DUMPSYS,
460        (section).args = "dropbox --proto system_server_watchdog"
461    ];
462
463    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_server_wtf = 3043 [
464        (section).type = SECTION_DUMPSYS,
465        (section).args = "dropbox --proto system_server_wtf"
466    ];
467
468    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_recovery_log = 3044 [
469        (section).type = SECTION_DUMPSYS,
470        (section).args = "dropbox --proto SYSTEM_RECOVERY_LOG"
471    ];
472
473    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_system_tombstone = 3045 [
474        (section).type = SECTION_DUMPSYS,
475        (section).args = "dropbox --proto SYSTEM_TOMBSTONE"
476    ];
477
478    optional android.service.dropbox.DropBoxManagerServiceDumpProto dropbox_subsystem_restart = 3046 [
479        (section).type = SECTION_DUMPSYS,
480        (section).args = "dropbox --proto SubsystemRestart"
481    ];
482
483    optional CpuUsageProto process_cpu_usage = 3047 [
484        (section).type = SECTION_DUMPSYS,
485        (section).args = "cpuinfo --proto"
486    ];
487
488    optional .clearcut.connectivity.IpConnectivityLog ip_connectivity_metrics = 3049 [
489        (section).type = SECTION_DUMPSYS,
490        (section).args = "connmetrics --proto"
491    ];
492
493    optional com.android.server.BluetoothManagerServiceDumpProto bluetooth_manager = 3050 [
494        (section).type = SECTION_DUMPSYS,
495        (section).args = "bluetooth_manager --proto"
496    ];
497
498    optional com.android.server.location.ContextHubServiceProto context_hub = 3051 [
499        (section).type = SECTION_DUMPSYS,
500        (section).args = "contexthub --proto"
501    ];
502
503    optional com.android.nfc.NfcServiceDumpProto nfc_service  = 3052 [
504        (section).type = SECTION_DUMPSYS,
505        (section).args = "nfc --proto"
506    ];
507
508    optional android.service.SensorServiceProto sensor_service = 3053 [
509        (section).type = SECTION_DUMPSYS,
510        (section).args = "sensorservice --proto"
511    ];
512
513    // Dumps in text format (on userdebug and eng builds only): 4000 ~ 4999
514    optional android.util.TextDumpProto textdump_wifi = 4000 [
515        (section).type = SECTION_TEXT_DUMPSYS,
516        (section).args = "wifi"
517    ];
518
519    optional android.util.TextDumpProto textdump_bluetooth = 4001 [
520        (section).type = SECTION_TEXT_DUMPSYS,
521        (section).args = "bluetooth_manager"
522    ];
523
524    // Reserved for OEMs.
525    extensions 50000 to 100000;
526}
527