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