• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/os/backtrace.proto";
21import "frameworks/base/core/proto/android/os/batterytype.proto";
22import "frameworks/base/core/proto/android/os/cpufreq.proto";
23import "frameworks/base/core/proto/android/os/cpuinfo.proto";
24import "frameworks/base/core/proto/android/os/data.proto";
25import "frameworks/base/core/proto/android/os/header.proto";
26import "frameworks/base/core/proto/android/os/kernelwake.proto";
27import "frameworks/base/core/proto/android/os/metadata.proto";
28import "frameworks/base/core/proto/android/os/pagetypeinfo.proto";
29import "frameworks/base/core/proto/android/os/procrank.proto";
30import "frameworks/base/core/proto/android/os/ps.proto";
31import "frameworks/base/core/proto/android/os/statsdata.proto";
32import "frameworks/base/core/proto/android/os/system_properties.proto";
33import "frameworks/base/core/proto/android/providers/settings.proto";
34import "frameworks/base/core/proto/android/server/activitymanagerservice.proto";
35import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto";
36import "frameworks/base/core/proto/android/server/fingerprint.proto";
37import "frameworks/base/core/proto/android/server/jobscheduler.proto";
38import "frameworks/base/core/proto/android/server/powermanagerservice.proto";
39import "frameworks/base/core/proto/android/server/rolemanagerservice.proto";
40import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
41import "frameworks/base/core/proto/android/service/appwidget.proto";
42import "frameworks/base/core/proto/android/service/battery.proto";
43import "frameworks/base/core/proto/android/service/batterystats.proto";
44import "frameworks/base/core/proto/android/service/diskstats.proto";
45import "frameworks/base/core/proto/android/service/graphicsstats.proto";
46import "frameworks/base/core/proto/android/service/netstats.proto";
47import "frameworks/base/core/proto/android/service/notification.proto";
48import "frameworks/base/core/proto/android/service/package.proto";
49import "frameworks/base/core/proto/android/service/print.proto";
50import "frameworks/base/core/proto/android/service/procstats.proto";
51import "frameworks/base/core/proto/android/service/restricted_image.proto";
52import "frameworks/base/core/proto/android/service/usb.proto";
53import "frameworks/base/core/proto/android/util/event_log_tags.proto";
54import "frameworks/base/core/proto/android/util/log.proto";
55import "frameworks/base/core/proto/android/privacy.proto";
56import "frameworks/base/core/proto/android/section.proto";
57
58package android.os;
59
60// Privacy tag can be marked to override UNSET messages so generic
61// message type can be handled case by case, e.g. GZippedFileProto.
62message IncidentProto {
63    reserved 1001;
64
65    // Incident header from callers
66    repeated IncidentHeaderProto header = 1;
67    // Internal metadata of incidentd
68    optional IncidentMetadata metadata = 2;
69
70    // Device information
71    optional SystemPropertiesProto system_properties = 1000 [
72        (section).type = SECTION_COMMAND,
73        (section).args = "getprop"
74    ];
75
76    optional string kernel_version = 1002 [
77        (section).type = SECTION_FILE,
78        (section).args = "/proc/version",
79        (privacy).dest = DEST_AUTOMATIC
80    ];
81
82    // Device Logs
83    optional android.util.EventLogTagMapProto event_log_tag_map = 1100 [
84        (section).type = SECTION_FILE,
85        (section).args = "/system/etc/event-log-tags"
86    ];
87
88    optional android.util.LogProto main_logs = 1101 [
89        (section).type = SECTION_LOG,
90        (section).args = "LOG_ID_MAIN"
91    ];
92
93    optional android.util.LogProto radio_logs = 1102 [
94        (section).type = SECTION_LOG,
95        (section).args = "LOG_ID_RADIO"
96    ];
97
98    optional android.util.LogProto events_logs = 1103 [
99        (section).type = SECTION_LOG,
100        (section).args = "LOG_ID_EVENTS"
101    ];
102
103    optional android.util.LogProto system_logs = 1104 [
104        (section).type = SECTION_LOG,
105        (section).args = "LOG_ID_SYSTEM"
106    ];
107
108    optional android.util.LogProto crash_logs = 1105 [
109        (section).type = SECTION_LOG,
110        (section).args = "LOG_ID_CRASH"
111    ];
112
113    optional android.util.LogProto stats_logs = 1106 [
114        (section).type = SECTION_LOG,
115        (section).args = "LOG_ID_STATS"
116    ];
117
118    optional android.util.LogProto security_logs = 1107 [
119        (section).type = SECTION_LOG,
120        (section).args = "LOG_ID_SECURITY"
121    ];
122
123    optional android.util.LogProto kernel_logs = 1108 [
124        (section).type = SECTION_LOG,
125        (section).args = "LOG_ID_KERNEL"
126    ];
127
128    // Stack dumps
129    optional android.os.BackTraceProto native_traces = 1200 [
130        (section).type = SECTION_TOMBSTONE,
131        (section).args = "native"
132    ];
133
134    optional android.os.BackTraceProto hal_traces = 1201 [
135        (section).type = SECTION_TOMBSTONE,
136        (section).args = "hal"
137    ];
138
139    optional android.os.BackTraceProto java_traces = 1202 [
140        (section).type = SECTION_TOMBSTONE,
141        (section).args = "java"
142    ];
143
144    // Linux services
145    optional ProcrankProto procrank = 2000 [
146        // Disable procrank for reasons below:
147        // 1. incidentd can't execute `procrank` because it don't have DAC perms
148        //    since it is running as its own uid, no root access.
149        // 2. the same information is able to be accessed by meminfo dumpsys.
150        // 3. leave this one here to show case of how to disable a section
151        //    (no removal allowed if you are familiar with PROTOBUF).
152        (section).type = SECTION_NONE,
153        (section).args = "procrank"
154    ];
155
156    optional PageTypeInfoProto page_type_info = 2001 [
157        (section).type = SECTION_FILE,
158        (section).args = "/proc/pagetypeinfo"
159    ];
160
161    optional KernelWakeSourcesProto kernel_wake_sources = 2002 [
162        (section).type = SECTION_FILE,
163        (section).args = "/d/wakeup_sources"
164    ];
165
166    optional CpuInfoProto cpu_info = 2003 [
167        (section).type = SECTION_COMMAND,
168        (section).args = "top -b -n 1 -H -s 6 -o pid,tid,user,pr,ni,%cpu,s,virt,res,pcy,cmd,name"
169    ];
170
171    optional CpuFreqProto cpu_freq = 2004 [
172        (section).type = SECTION_FILE,
173        (section).args = "/sys/devices/system/cpu/cpufreq/all_time_in_state"
174    ];
175
176    optional PsProto processes_and_threads = 2005 [
177        (section).type = SECTION_COMMAND,
178        (section).args = "ps -A -T -Z -O pri,nice,rtprio,sched,pcy,time"
179    ];
180
181    optional BatteryTypeProto battery_type = 2006 [
182        (section).type = SECTION_FILE,
183        (section).args = "/sys/class/power_supply/bms/battery_type"
184    ];
185
186    optional GZippedFileProto last_kmsg = 2007 [
187        (section).type = SECTION_GZIP,
188        (section).args = "/sys/fs/pstore/console-ramoops /sys/fs/pstore/console-ramoops-0 /proc/last_kmsg",
189        (privacy).dest = DEST_EXPLICIT
190    ];
191
192    // System Services
193    optional com.android.server.biometrics.fingerprint.FingerprintServiceDumpProto fingerprint = 3000 [
194        (section).type = SECTION_DUMPSYS,
195        (section).args = "fingerprint --proto --incident"
196    ];
197
198    optional android.service.NetworkStatsServiceDumpProto netstats = 3001 [
199        (section).type = SECTION_DUMPSYS,
200        (section).args = "netstats --proto"
201    ];
202
203    optional android.providers.settings.SettingsServiceDumpProto settings = 3002 [
204        (section).type = SECTION_DUMPSYS,
205        (section).args = "settings --proto"
206    ];
207
208    optional android.service.appwidget.AppWidgetServiceDumpProto appwidget = 3003;
209    optional android.service.notification.NotificationServiceDumpProto notification = 3004 [
210        (section).type = SECTION_DUMPSYS,
211        (section).args = "notification --proto"
212    ];
213
214    optional android.service.batterystats.BatteryStatsServiceDumpProto batterystats = 3005 [
215        (section).type = SECTION_DUMPSYS,
216        (section).args = "batterystats --proto"
217    ];
218
219    optional android.service.battery.BatteryServiceDumpProto battery = 3006 [
220        (section).type = SECTION_DUMPSYS,
221        (section).args = "battery --proto"
222    ];
223
224    optional android.service.diskstats.DiskStatsServiceDumpProto diskstats = 3007 [
225        (section).type = SECTION_DUMPSYS,
226        (section).args = "diskstats --proto"
227    ];
228
229    optional android.service.pm.PackageServiceDumpProto package = 3008 [
230        (section).type = SECTION_DUMPSYS,
231        (section).args = "package --proto"
232    ];
233
234    optional com.android.server.power.PowerManagerServiceDumpProto power = 3009 [
235        (section).type = SECTION_DUMPSYS,
236        (section).args = "power --proto"
237    ];
238
239    optional android.service.print.PrintServiceDumpProto print = 3010 [
240        (section).type = SECTION_DUMPSYS,
241        (section).args = "print --proto"
242    ];
243
244    optional android.service.procstats.ProcessStatsServiceDumpProto procstats = 3011 [
245        (section).type = SECTION_DUMPSYS,
246        (section).args = "procstats --proto"
247    ];
248
249    optional com.android.server.am.ActivityManagerServiceDumpActivitiesProto activities = 3012 [
250        (section).type = SECTION_DUMPSYS,
251        (section).args = "activity --proto activities"
252    ];
253
254    optional com.android.server.am.ActivityManagerServiceDumpBroadcastsProto broadcasts = 3013 [
255        (section).type = SECTION_DUMPSYS,
256        (section).args = "activity --proto broadcasts"
257    ];
258
259    optional com.android.server.am.ActivityManagerServiceDumpServicesProto amservices = 3014 [
260        (section).type = SECTION_DUMPSYS,
261        (section).args = "activity --proto service"
262    ];
263
264    optional com.android.server.am.ActivityManagerServiceDumpProcessesProto amprocesses = 3015 [
265        (section).type = SECTION_DUMPSYS,
266        (section).args = "activity --proto processes"
267    ];
268
269    optional com.android.server.AlarmManagerServiceDumpProto alarm = 3016 [
270        (section).type = SECTION_DUMPSYS,
271        (section).args = "alarm --proto"
272    ];
273
274    optional com.android.server.wm.WindowManagerServiceDumpProto window = 3017 [
275        (section).type = SECTION_DUMPSYS,
276        (section).args = "window --proto"
277    ];
278
279    optional com.android.server.am.MemInfoDumpProto meminfo = 3018 [
280        (section).type = SECTION_DUMPSYS,
281        (section).args = "meminfo -a --proto"
282    ];
283
284    optional android.service.GraphicsStatsServiceDumpProto graphicsstats = 3019 [
285        (section).type = SECTION_DUMPSYS,
286        (section).args = "graphicsstats --proto"
287    ];
288
289    optional com.android.server.job.JobSchedulerServiceDumpProto jobscheduler = 3020 [
290        (section).type = SECTION_DUMPSYS,
291        (section).args = "jobscheduler --proto"
292    ];
293
294    optional android.service.usb.UsbServiceDumpProto usb = 3021 [
295        (section).type = SECTION_DUMPSYS,
296        (section).args = "usb --proto"
297    ];
298
299    // The history can be large and may cause issues in consumers, so put the
300    // history in a separate section to compensate.
301    optional android.service.batterystats.BatteryStatsServiceDumpHistoryProto battery_history = 3022 [
302        (section).type = SECTION_DUMPSYS,
303        (section).args = "batterystats --proto --history",
304        (section).userdebug_and_eng_only = true
305    ];
306
307    optional android.os.StatsDataDumpProto stats_data = 3023 [
308        (section).type = SECTION_DUMPSYS,
309        (section).args = "stats --proto",
310        (section).userdebug_and_eng_only = true
311    ];
312
313    optional com.android.server.role.RoleManagerServiceDumpProto role = 3024 [
314        (section).type = SECTION_DUMPSYS,
315        (section).args = "role --proto"
316    ];
317
318    optional android.service.restricted_image.RestrictedImagesDumpProto restricted_images = 3025 [
319        (section).type = SECTION_DUMPSYS,
320        (section).userdebug_and_eng_only = true,
321        (section).args = "incidentcompanion --restricted_image"
322    ];
323
324    // System trace as a serialized protobuf.
325    optional bytes system_trace = 3026 [
326        (section).type = SECTION_FILE,
327        (section).args = "/data/misc/perfetto-traces/incident-trace",
328        (privacy).dest = DEST_AUTOMATIC,
329        (section).userdebug_and_eng_only = true
330    ];
331
332    // Reserved for OEMs.
333    extensions 50000 to 100000;
334}
335