blob: ceea81fe70aaba8f02fe2327c55432e008b586de [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
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";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080032
Yao Chend54f9dd2017-10-17 17:37:48 +000033/**
Stefan Lafonae2df012017-11-14 09:17:21 -080034 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000035 * raw stats log events from the Android system, also known as "atoms."
36 *
37 * This field contains a single oneof with all of the available messages.
38 * The stats-log-api-gen tool runs as part of the Android build and
39 * generates the android.util.StatsLog class, which contains the constants
40 * and methods that Android uses to log.
41 *
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * Instead, statsd on Android constructs these messages synthetically,
44 * in the format defined here and in stats_log.proto.
45 */
Stefan Lafonae2df012017-11-14 09:17:21 -080046message Atom {
47 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070048 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070049 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
50 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070051 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070052 BleScanResultReceived ble_scan_result_received = 4;
53 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080054 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070055 SyncStateChanged sync_state_changed = 7;
56 ScheduledJobStateChanged scheduled_job_state_changed = 8;
57 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070058 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080059 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070062 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
63 MemoryFactorStateChanged memory_factor_state_changed = 15;
64 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
65 CachedKillReported cached_kill_reported = 17;
66 ProcessMemoryStatReported process_memory_stat_reported = 18;
67 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080068 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
69 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
70 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070071 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080072 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070073 CameraStateChanged camera_state_changed = 25;
74 FlashlightStateChanged flashlight_state_changed = 26;
75 UidProcessStateChanged uid_process_state_changed = 27;
76 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
77 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070078 BatteryLevelChanged battery_level_changed = 30;
79 ChargingStateChanged charging_state_changed = 31;
80 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080081 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070082 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
83 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070084 WifiLockStateChanged wifi_lock_state_changed = 37;
85 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
86 WifiScanStateChanged wifi_scan_state_changed = 39;
87 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070088 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070089 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070090 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090091 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080092 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080093 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080094 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080095 AppStartOccurred app_start_occurred = 48;
96 AppStartCanceled app_start_canceled = 49;
97 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080098 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080099 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800100 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkStateChanged lmk_state_changed = 54;
102 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800103 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800104 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800105 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800106 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800107 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800108 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800109 KeyguardStateChanged keyguard_state_changed = 62;
110 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
111 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800112 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800113 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800114 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
115 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700116 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700117 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800118 SpeakerImpedanceReported speaker_impedance_reported = 71;
119 HardwareFailed hardware_failed = 72;
120 PhysicalDropDetected physical_drop_detected = 73;
121 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800122 MobileConnectionStateChanged mobile_connection_state_changed = 75;
123 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700124 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800125 AppCrashOccurred app_crash_occurred = 78;
126 ANROccurred anr_occurred = 79;
127 WTFOccurred wtf_occurred = 80;
128 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700129 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700130 KeyValuePairsAtom key_value_pairs_atom = 83;
Yao Chend54f9dd2017-10-17 17:37:48 +0000131 }
David Chenc8a43242017-10-17 16:23:28 -0700132
David Chen6e3e6cb2018-01-03 16:14:06 -0800133 // Pulled events will start at field 10000.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100134 // Next: 10024
David Chenc8a43242017-10-17 16:23:28 -0700135 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 WifiBytesTransfer wifi_bytes_transfer = 10000;
137 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
138 MobileBytesTransfer mobile_bytes_transfer = 10002;
139 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800140 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800141 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800142 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800143 CpuTimePerFreq cpu_time_per_freq = 10008;
144 CpuTimePerUid cpu_time_per_uid = 10009;
145 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800146 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800147 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800148 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800149 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800150 SystemElapsedRealtime system_elapsed_realtime = 10014;
151 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800152 CpuActiveTime cpu_active_time = 10016;
153 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh6188aa32018-08-29 00:21:07 +0000154 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800155 RemainingBatteryCapacity remaining_battery_capacity = 10019;
156 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800157 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100158 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100159 BinderCallsExceptions binder_calls_exceptions = 10023;
David Chenc8a43242017-10-17 16:23:28 -0700160 }
yroa1fe77c2018-02-26 14:22:54 -0800161
162 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
163 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700164}
165
Yao Chend54f9dd2017-10-17 17:37:48 +0000166/**
Yangster-mac20877162017-12-22 17:19:39 -0800167 * This proto represents a node of an attribution chain.
168 * Note: All attribution chains are represented as a repeated field of type
169 * AttributionNode. It is understood that in such arrays, the order is that
170 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 */
Yangster-mac20877162017-12-22 17:19:39 -0800172message AttributionNode {
173 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800174 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800175
Yangster-mac20877162017-12-22 17:19:39 -0800176 // The (optional) string tag for an element in the attribution chain. If the
177 // element has no tag, it is encoded as an empty string.
178 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700179}
180
Yangster-mac48b3d622018-08-18 12:38:11 -0700181message KeyValuePair {
182 optional int32 key = 1;
183 oneof value {
184 int64 value_int = 2;
185 string value_str = 3;
186 float value_float = 4;
187 }
188}
189
190message KeyValuePairsAtom {
191 optional int32 uid = 1;
192 repeated KeyValuePair pairs = 2;
193}
194
Yao Chend54f9dd2017-10-17 17:37:48 +0000195/*
196 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800197 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000198 *
199 * RULES:
200 * - The field ids for each atom must start at 1, and count upwards by 1.
201 * Skipping field ids is not allowed.
202 * - These form an API, so renaming, renumbering or removing fields is
203 * not allowed between android releases. (This is not currently enforced,
204 * but there will be a tool to enforce this restriction).
205 * - The types must be built-in protocol buffer types, namely, no sub-messages
206 * are allowed (yet). The bytes type is also not allowed.
207 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800208 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000209 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800210 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000211 * - A field that is a uid should be a string field, tagged with the [xxx]
212 * annotation. The generated code on android will be represented by UIDs,
213 * and those UIDs will be translated in xxx to those strings.
214 *
215 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700216 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000217 * - If there is a UID, it goes first. Think in an object-oriented fashion.
218 * *****************************************************************************
219 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700220
Yao Chend54f9dd2017-10-17 17:37:48 +0000221/**
222 * Logs when the screen state changes.
223 *
224 * Logged from:
225 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
226 */
227message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800228 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800229 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700230}
Yao Chend54f9dd2017-10-17 17:37:48 +0000231
232/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700233 * Logs that the process state of the uid, as determined by ActivityManager
234 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000235 *
236 * Logged from:
237 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
238 */
Bookatzc1a050a2017-10-10 15:49:28 -0700239message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700240 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000241
Bookatzdb026a22018-01-10 19:01:56 -0800242 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800243 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000244}
245
246/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700247 * Logs process state change of a process, as per the activity manager.
248 *
249 * Logged from:
250 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
251 */
252message ProcessStateChanged {
253 optional int32 uid = 1;
254 optional string process_name = 2;
255 optional string package_name = 3;
256 // TODO: remove this when validation is done
257 optional int64 version = 5;
258 // The state, from frameworks/base/core/proto/android/app/enums.proto.
259 optional android.app.ProcessStateEnum state = 4;
260}
261
262/**
263 * Logs when ActivityManagerService sleep state is changed.
264 *
265 * Logged from:
266 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
267 */
268message ActivityManagerSleepStateChanged {
269 // TODO: import frameworks proto
270 enum State {
271 UNKNOWN = 0;
272 ASLEEP = 1;
273 AWAKE = 2;
274 }
275 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
276}
277
278/**
279 * Logs when system memory state changes.
280 *
281 * Logged from:
282 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
283 */
284message MemoryFactorStateChanged {
285 // TODO: import frameworks proto
286 enum State {
287 MEMORY_UNKNOWN = 0;
288 NORMAL = 1; // normal.
289 MODERATE = 2; // moderate memory pressure.
290 LOW = 3; // low memory.
291 CRITICAL = 4; // critical memory.
292
293 }
294 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
295}
296
297/**
298 * Logs when app is using too much cpu, according to ActivityManagerService.
299 *
300 * Logged from:
301 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
302 */
303message ExcessiveCpuUsageReported {
304 optional int32 uid = 1;
305 optional string process_name = 2;
306 optional string package_name = 3;
307 // package version. TODO: remove this when validation is done
308 optional int64 version = 4;
309}
310
311/**
312 * Logs when a cached process is killed, along with its pss.
313 *
314 * Logged from:
315 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
316 */
317message CachedKillReported {
318 optional int32 uid = 1;
319 optional string process_name = 2;
320 optional string package_name = 3;
321 // TODO: remove this when validation is done
322 optional int64 version = 5;
323 optional int64 pss = 4;
324}
325
326/**
327 * Logs when memory stats of a process is reported.
328 *
329 * Logged from:
330 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
331 */
332message ProcessMemoryStatReported {
333 optional int32 uid = 1;
334 optional string process_name = 2;
335 optional string package_name = 3;
336 //TODO: remove this when validation is done
337 optional int64 version = 9;
338 optional int64 pss = 4;
339 optional int64 uss = 5;
340 optional int64 rss = 6;
341 enum Type {
342 ADD_PSS_INTERNAL_SINGLE = 0;
343 ADD_PSS_INTERNAL_ALL_MEM = 1;
344 ADD_PSS_INTERNAL_ALL_POLL = 2;
345 ADD_PSS_EXTERNAL = 3;
346 ADD_PSS_EXTERNAL_SLOW = 4;
347 }
348 optional Type type = 7;
349 optional int64 duration = 8;
350}
351
352/**
Bookatzc1a050a2017-10-10 15:49:28 -0700353 * Logs that a process started, finished, crashed, or ANRed.
354 *
355 * Logged from:
356 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
357 */
358message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700359 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700360
David Chen0b5c90c2018-01-25 16:51:49 -0800361 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800362 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700363
Bookatzddccf0a2017-11-28 16:48:14 -0800364 // What lifecycle state the process changed to.
365 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800366 enum State {
367 FINISHED = 0;
368 STARTED = 1;
369 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800370 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800371 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700372}
373
Bookatzc1a050a2017-10-10 15:49:28 -0700374/**
375 * Logs when the ble scan state changes.
376 *
377 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700378 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700379 */
380message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800381 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700382
383 enum State {
384 OFF = 0;
385 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700386 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
387 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700388 }
389 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700390
Bookatze5ec0b42018-03-26 13:34:56 -0700391 // Does the scan have a filter.
392 optional bool is_filtered = 3;
393 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
394 optional bool is_first_match = 4;
395 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
396 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700397}
398
399/**
400 * Logs reporting of a ble scan finding results.
401 *
402 * Logged from:
403 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
404 */
405// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
406message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800407 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700408
409 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800410 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700411}
412
413/**
414 * Logs when a sensor state changes.
415 *
416 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700417 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700418 */
419message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800420 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700421
Bookatzc1a050a2017-10-10 15:49:28 -0700422 // The id (int) of the sensor.
423 optional int32 sensor_id = 2;
424
425 enum State {
426 OFF = 0;
427 ON = 1;
428 }
429 optional State state = 3;
430}
431
432
433/**
434 * Logs when GPS state changes.
435 *
436 * Logged from:
437 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
438 */
439message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800440 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700441
442 enum State {
443 OFF = 0;
444 ON = 1;
445 }
446 optional State state = 2;
447}
448
449
450/**
451 * Logs when a sync manager sync state changes.
452 *
453 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700454 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700455 */
456message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800457 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700458
David Chen0b5c90c2018-01-25 16:51:49 -0800459 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800460 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700461
462 enum State {
463 OFF = 0;
464 ON = 1;
465 }
466 optional State state = 3;
467}
468
469/**
470 * Logs when a job scheduler job state changes.
471 *
472 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700473 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
475message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800476 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
478 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800479 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700480
481 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800482 FINISHED = 0;
483 STARTED = 1;
484 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700485 }
486 optional State state = 3;
487
Tej Singh33a412b2018-03-16 18:43:59 -0700488 // The reason a job has stopped.
489 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700490 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700491 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700492}
493
494/**
495 * Logs when the audio state changes.
496 *
497 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700498 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700499 */
500message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800501 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700502
503 enum State {
504 OFF = 0;
505 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700506 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
507 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700508 }
509 optional State state = 2;
510}
511
512/**
513 * Logs when the video codec state changes.
514 *
515 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700516 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700517 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800518message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800519 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700520
521 enum State {
522 OFF = 0;
523 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700524 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
525 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700526 }
527 optional State state = 2;
528}
529
530/**
531 * Logs when the flashlight state changes.
532 *
533 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700534 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700535 */
536message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800537 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700538
539 enum State {
540 OFF = 0;
541 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700542 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
543 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700544 }
545 optional State state = 2;
546}
547
548/**
549 * Logs when the camera state changes.
550 *
551 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700552 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700553 */
554message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800555 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700556
557 enum State {
558 OFF = 0;
559 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700560 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
561 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700562 }
563 optional State state = 2;
564}
565
566/**
567 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000568 *
569 * Logged from:
570 * TODO
571 */
Bookatzd6746242017-10-24 18:39:35 -0700572message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800573 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000574
Bookatz1a1b0462018-01-12 11:47:03 -0800575 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
576 // From frameworks/base/core/proto/android/os/enums.proto.
577 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700578
579 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
580 optional string tag = 3;
581
582 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800583 RELEASE = 0;
584 ACQUIRE = 1;
585 CHANGE_RELEASE = 2;
586 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700587 }
588 optional State state = 4;
589}
590
591/**
Bookatzc1a050a2017-10-10 15:49:28 -0700592 * Logs when a partial wakelock is considered 'long' (over 1 min).
593 *
594 * Logged from:
595 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
596 */
597message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800598 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700599
Yao Chend54f9dd2017-10-17 17:37:48 +0000600 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
601 optional string tag = 2;
602
Bookatzc1a050a2017-10-10 15:49:28 -0700603 // TODO: I have no idea what this is.
604 optional string history_tag = 3;
605
606 enum State {
607 OFF = 0;
608 ON = 1;
609 }
610 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000611}
612
Bookatzc1a050a2017-10-10 15:49:28 -0700613/**
614 * Logs Battery Saver state change.
615 *
616 * Logged from:
617 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
618 */
619message BatterySaverModeStateChanged {
620 enum State {
621 OFF = 0;
622 ON = 1;
623 }
624 optional State state = 1;
625}
626
627/**
628 * Logs Doze mode state change.
629 *
630 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800631 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700632 */
633message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800634 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800635}
636
637
638/**
639 * Logs state change of Doze mode including maintenance windows.
640 *
641 * Logged from:
642 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
643 */
644message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800645 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700646}
647
648/**
649 * Logs screen brightness level.
650 *
651 * Logged from:
652 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
653 */
654message ScreenBrightnessChanged {
655 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
656 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700657}
658
659/**
660 * Logs battery level (percent full, from 0 to 100).
661 *
662 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700663 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700664 */
665message BatteryLevelChanged {
666 // Battery level. Should be in [0, 100].
667 optional int32 battery_level = 1;
668}
669
670/**
671 * Logs change in charging status of the device.
672 *
673 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700674 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700675 */
676message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800677 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
678 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700679}
680
681/**
682 * Logs whether the device is plugged in, and what power source it is using.
683 *
684 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700685 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700686 */
687message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800688 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
689 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700690}
691
Bookatz8c6571b2017-10-24 15:04:41 -0700692/**
693 * Logs when an app's wakeup alarm fires.
694 *
695 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700696 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700697 */
698message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800699 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800700
701 // Name of the wakeup alarm.
702 optional string tag = 2;
703}
704
705/**
706 * Logs when an an app causes the mobile radio to change state.
707 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
708 *
709 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700710 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800711 */
712message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800713 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800714
Bookatz1a1b0462018-01-12 11:47:03 -0800715 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
716 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800717}
718
719/**
720 * Logs when an an app causes the wifi radio to change state.
721 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
722 *
723 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700724 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800725 */
726message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800727 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800728
Bookatz1a1b0462018-01-12 11:47:03 -0800729 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
730 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700731}
732
733/**
734 * Logs kernel wakeup reasons and aborts.
735 *
736 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700737 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700738 */
739message KernelWakeupReported {
740 // Name of the kernel wakeup reason (or abort).
741 optional string wakeup_reason_name = 1;
742
743 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800744 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700745}
746
747/**
748 * Logs wifi locks held by an app.
749 *
750 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700751 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700752 */
753message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800754 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700755
756 enum State {
757 OFF = 0;
758 ON = 1;
759 }
760 optional State state = 2;
761}
762
763/**
764 * Logs wifi signal strength changes.
765 *
766 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700767 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700768 */
769message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800770 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
771 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700772}
773
774/**
775 * Logs wifi scans performed by an app.
776 *
777 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700778 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700779 */
780message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800781 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700782
783 enum State {
784 OFF = 0;
785 ON = 1;
786 }
787 optional State state = 2;
788}
789
790/**
Tej Singh4503e102018-01-04 14:35:01 -0800791 * Logs wifi multicast locks held by an app
792 *
793 * Logged from:
794 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
795 */
796message WifiMulticastLockStateChanged {
797 repeated AttributionNode attribution_node = 1;
798
799 enum State {
800 OFF = 0;
801 ON = 1;
802 }
803 optional State state = 2;
804}
805
806/**
Tej Singh1ea42892018-01-19 09:27:00 -0800807 * Logs shutdown reason and duration on next boot.
808 *
809 * Logged from:
810 * frameworks/base/core/java/com/android/server/BootReceiver.java
811 */
812message ShutdownSequenceReported {
813 // True if shutdown is for a reboot. Default: false if we do not know.
814 optional bool reboot = 1;
815
816 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
817 optional string reason = 2;
818
819 // Beginning of shutdown time in ms using wall clock time since unix epoch.
820 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800821 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800822
823 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800824 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800825}
826
Tej Singh6483ea42018-01-25 17:45:49 -0800827
828/**
829 * Logs boot reason and duration.
830 *
831 * Logged from:
832 * system/core/bootstat/bootstat.cpp
833 */
834message BootSequenceReported {
835 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
836 // Default: "<EMPTY>" if not available.
837 optional string bootloader_reason = 1;
838
839 // Reason for system boot. Eg. bootloader, reboot,userrequested
840 // Default: "<EMPTY>" if not available.
841 optional string system_reason = 2;
842
843 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800844 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800845
846 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800847 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800848
849 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800850 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800851
852 // Time since last boot in ms. Default: 0 if not available.
853 optional int64 time_since_last_boot = 6;
854}
855
Tej Singhc477d9c2018-02-05 18:31:39 -0800856
857/**
858 * Logs call state and disconnect cause (if applicable).
859 *
860 * Logged from:
861 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
862 */
863message CallStateChanged {
864 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
865 // From frameworks/base/core/proto/android/telecomm/enums.proto.
866 optional android.telecom.CallStateEnum call_state = 1;
867
868 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
869 // This value is only applicable when the call_state is DISCONNECTED, and
870 // should always be UNKNOWN if the call_state is not DISCONNECTED.
871 // From frameworks/base/core/proto/android/telecomm/enums.proto.
872 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
873
874 // True if the call is self-managed, which are apps that use the
875 // telecom infrastructure to make their own calls.
876 optional bool self_managed = 3;
877
878 // True if call is external. External calls are calls on connected Wear
879 // devices but show up in Telecom so the user can pull them onto the device.
880 optional bool external_call = 4;
881}
882
Tej Singh1ea42892018-01-19 09:27:00 -0800883/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800884 * Logs keyguard state. The keyguard is the lock screen.
885 *
886 * Logged from:
887 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
888 */
889message KeyguardStateChanged {
890 enum State {
891 UNKNOWN = 0;
892 // The keyguard is hidden when the phone is unlocked.
893 HIDDEN = 1;
894 // The keyguard is shown when the phone is locked (screen turns off).
895 SHOWN= 2;
896 // The keyguard is occluded when something is overlaying the keyguard.
897 // Eg. Opening the camera while on the lock screen.
898 OCCLUDED = 3;
899 }
900 optional State state = 1;
901}
902
903/**
904 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
905 * prompts the user to enter a password (pattern, pin, etc).
906 *
907 * Logged from:
908 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
909 */
910
911message KeyguardBouncerStateChanged {
912 enum State {
913 UNKNOWN = 0;
914 // Bouncer is hidden, either as a result of successfully entering the
915 // password, screen timing out, or user going back to lock screen.
916 HIDDEN = 1;
917 // This is when the user is being prompted to enter the password.
918 SHOWN = 2;
919 }
920 optional State state = 1;
921}
922
923/**
924 * Logs the result of entering a password into the keyguard bouncer.
925 *
926 * Logged from:
927 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
928 */
929message KeyguardBouncerPasswordEntered {
930 enum BouncerResult {
931 UNKNOWN = 0;
932 // The password entered was incorrect.
933 FAILURE = 1;
934 // The password entered was correct.
935 SUCCESS = 2;
936 }
937 optional BouncerResult result = 1;
938}
939
Tej Singha883b372018-02-15 11:30:01 -0800940/*
941 * Logs changes to the configuration of the device. The configuration is defined
942 * in frameworks/base/core/java/android/content/res/Configuration.java
943 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
944 * Please go there to interpret the possible values each field can be.
945 *
946 * Logged from:
947 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
948 */
949message ResourceConfigurationChanged {
950 // Bit mask of color capabilities of the screen.
951 // Contains information about the color gamut and hdr mode of the screen.
952 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
953 optional int32 colorMode = 1;
954
955 // The target screen density being rendered to.
956 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
957 optional int32 densityDpi = 2;
958
959 // Current user preference for the scaling factor for fonts,
960 // relative to the base density scaling.
961 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
962 optional float fontScale = 3;
963
964 // Flag indicating whether the hard keyboard is hidden.
965 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
966 optional int32 hardKeyboardHidden = 4;
967
968 // The type of keyboard attached to the device.
969 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
970 optional int32 keyboard = 5;
971
972 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
973 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
974 optional int32 keyboardHideen = 6;
975
976 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
977 // 0 if undefined.
978 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
979 optional int32 mcc = 7;
980
981 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
982 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
983 // MNC_ZERO symbol defined in Configuration.java.
984 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
985 optional int32 mnc = 8;
986
987 // The kind of navigation available on the device.
988 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
989 optional int32 navigation = 9;
990
991 // Flag indicating whether the navigation is available.
992 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
993 optional int32 navigationHidden = 10;
994
995 // Overall orientation of the screen.
996 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
997 optional int32 orientation = 11;
998
999 // The current height of the available screen space, in dp units.
1000 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1001 optional int32 screenHeightDp = 12;
1002
1003 // Bit mask of overall layout of the screen.
1004 // Contains information about screen size, whether the screen is wider/taller
1005 // than normal, whether the screen layout is right-tl-left or left-to-right,
1006 // and whether the screen has a rounded shape.
1007 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1008 optional int32 screenLayout = 13;
1009
1010 // Current width of the available screen space, in dp units.
1011 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1012 optional int32 screenWidthDp = 14;
1013
1014 // The smallest screen size an application will see in normal operation.
1015 // This is the smallest value of both screenWidthDp and screenHeightDp
1016 // in portrait and landscape.
1017 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1018 optional int32 smallestScreenWidthDp = 15;
1019
1020 // The type of touch screen attached to the device.
1021 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1022 optional int32 touchscreen = 16;
1023
1024 // Bit mask of the ui mode.
1025 // Contains information about the overall ui mode of the device.
1026 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1027 // Also contains information about whether the device is in night mode.
1028 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1029 optional int32 uiMode = 17;
1030}
1031
Tej Singheee317b2018-03-07 19:28:05 -08001032
1033/**
1034 * Logs changes in the connection state of the mobile radio.
1035 *
1036 * Logged from:
1037 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1038 */
1039message MobileConnectionStateChanged {
1040 // States are from the state machine DataConnection.java.
1041 enum State {
1042 UNKNOWN = 0;
1043 // The connection is inactive, or disconnected.
1044 INACTIVE = 1;
1045 // The connection is being activated, or connecting.
1046 ACTIVATING = 2;
1047 // The connection is active, or connected.
1048 ACTIVE = 3;
1049 // The connection is disconnecting.
1050 DISCONNECTING = 4;
1051 // The connection is disconnecting after creating a connection.
1052 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1053 }
1054 optional State state = 1;
1055 // For multi-sim phones, this distinguishes between the sim cards.
1056 optional int32 sim_slot_index = 2;
1057 // Used to identify the connection. Starts at 0 and increments by 1 for
1058 // every new network created. Resets whenever the device reboots.
1059 optional int32 data_connection_id = 3;
1060 // A bitmask for the capabilities of this connection.
1061 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1062 // Default value (if we have no information): 0
1063 optional int64 capabilities = 4;
1064 // If this connection has internet.
1065 // This just checks if the DEFAULT bit of capabilities is set.
1066 optional bool has_internet = 5;
1067}
1068
1069/**
1070 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1071 *
1072 * Logged from:
1073 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1074 */
1075message MobileRadioTechnologyChanged {
1076 optional android.telephony.NetworkTypeEnum state = 1;
1077 // For multi-sim phones, this distinguishes between the sim cards.
1078 optional int32 sim_slot_index = 2;
1079}
1080
Andrew Chantb56388b2018-03-22 21:07:33 -07001081/**
1082 * Logs the VID and PID of any connected USB devices.
1083 *
1084 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1085 *
1086 * Logged by Vendor.
1087 */
1088message UsbDeviceAttached {
1089 optional int32 vid = 1;
1090 optional int32 pid = 2;
1091 optional bool has_audio = 3;
1092 optional bool has_hid = 4;
1093 optional bool has_storage = 5;
1094}
1095
Tej Singheee317b2018-03-07 19:28:05 -08001096
Tej Singhdd7bd352018-02-09 19:33:15 -08001097/**
Tej Singh5d991e12018-03-09 19:48:11 -08001098 * Logs when Bluetooth is enabled and disabled.
1099 *
1100 * Logged from:
1101 * services/core/java/com/android/server/BluetoothManagerService.java
1102 */
1103message BluetoothEnabledStateChanged {
1104 repeated AttributionNode attribution_node = 1;
1105 // Whether or not bluetooth is enabled on the device.
1106 enum State {
1107 UNKNOWN = 0;
1108 ENABLED = 1;
1109 DISABLED = 2;
1110 }
1111 optional State state = 2;
1112 // The reason for being enabled/disabled.
1113 // Eg. Airplane mode, crash, application request.
1114 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1115 // If the reason is an application request, this will be the package name.
1116 optional string pkgName = 4;
1117}
1118
1119/**
1120 * Logs when a Bluetooth device connects and disconnects.
1121 *
1122 * Logged from:
1123 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1124 */
1125message BluetoothConnectionStateChanged {
1126 // The state of the connection.
1127 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1128 optional android.bluetooth.ConnectionStateEnum state = 1;
1129 // An identifier that can be used to match connect and disconnect events.
1130 // Currently is last two bytes of a hash of a device level ID and
1131 // the mac address of the bluetooth device that is connected.
1132 optional int32 obfuscated_id = 2;
1133 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1134 // From android.bluetooth.BluetoothAdapter.java
1135 optional int32 bt_profile = 3;
1136}
1137
1138/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001139 * Logs when something is plugged into or removed from the USB-C connector.
1140 *
1141 * Logged from:
1142 * Vendor USB HAL.
1143 */
1144message UsbConnectorStateChanged {
1145 enum State {
1146 DISCONNECTED = 0;
1147 CONNECTED = 1;
1148 }
1149 optional State state = 1;
1150}
1151
1152/**
1153 * Logs the reported speaker impedance.
1154 *
1155 * Logged from:
1156 * Vendor audio implementation.
1157 */
1158message SpeakerImpedanceReported {
1159 optional int32 speaker_location = 1;
1160 optional int32 impedance = 2;
1161}
1162
1163/**
1164 * Logs the report of a failed hardware.
1165 *
1166 * Logged from:
1167 * Vendor HALs.
1168 *
1169 */
1170message HardwareFailed {
1171 enum HardwareType {
1172 HARDWARE_FAILED_UNKNOWN = 0;
1173 HARDWARE_FAILED_MICROPHONE = 1;
1174 HARDWARE_FAILED_CODEC = 2;
1175 HARDWARE_FAILED_SPEAKER = 3;
1176 HARDWARE_FAILED_FINGERPRINT = 4;
1177 }
1178 optional HardwareType hardware_type = 1;
1179
1180 /* hardware_location allows vendors to differentiate between multiple instances of
1181 * the same hardware_type. The specific locations are vendor defined integers,
1182 * referring to board-specific numbering schemes.
1183 */
1184 optional int32 hardware_location = 2;
1185
1186 /* failure_code is specific to the HardwareType of the failed hardware.
1187 * It should use the enum values defined below.
1188 */
1189 enum MicrophoneFailureCode {
1190 MICROPHONE_FAILURE_COMPLETE = 0;
1191 }
1192 enum CodecFailureCode {
1193 CODEC_FAILURE_COMPLETE = 0;
1194 }
1195 enum SpeakerFailureCode {
1196 SPEAKER_FAILURE_COMPLETE = 0;
1197 SPEAKER_FAILURE_HIGH_Z = 1;
1198 SPEAKER_FAILURE_SHORT = 2;
1199 }
1200 enum FingerprintFailureCode {
1201 FINGERPRINT_FAILURE_COMPLETE = 0;
1202 FINGERPRINT_SENSOR_BROKEN = 1;
1203 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1204 }
1205 optional int32 failure_code = 3;
1206}
1207
1208/**
1209 * Log an event when the device has been physically dropped.
1210 * Reported from the /vendor partition.
1211 */
1212message PhysicalDropDetected {
1213 // Confidence that the event was actually a drop, 0 -> 100
1214 optional int32 confidence_pctg = 1;
1215 // Peak acceleration of the drop, in 1/1000s of a g.
1216 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001217 // Duration of freefall in ms
1218 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001219}
1220
1221/**
1222 * Log bucketed battery charge cycles.
1223 *
1224 * Each bucket represents cycles of the battery past
1225 * a given charge point. For example, bucket 1 is the
1226 * lowest 1/8th of the battery, and bucket 8 is 100%.
1227 *
1228 * Logged from:
1229 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1230 */
1231message ChargeCyclesReported {
1232 optional int32 cycle_bucket_1 = 1;
1233 optional int32 cycle_bucket_2 = 2;
1234 optional int32 cycle_bucket_3 = 3;
1235 optional int32 cycle_bucket_4 = 4;
1236 optional int32 cycle_bucket_5 = 5;
1237 optional int32 cycle_bucket_6 = 6;
1238 optional int32 cycle_bucket_7 = 7;
1239 optional int32 cycle_bucket_8 = 8;
1240}
1241
1242/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001243 * Logs the duration of a davey (jank of >=700ms) when it occurs
1244 *
1245 * Logged from:
1246 * frameworks/base/libs/hwui/JankTracker.cpp
1247 */
1248message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001249 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001250 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001251
Tej Singhbb8554a2018-01-26 11:59:14 -08001252 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001253 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001254}
1255
1256/**
Bookatze5885242017-10-24 20:10:31 -07001257 * Logs phone signal strength changes.
1258 *
1259 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001260 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001261 */
1262message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001263 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1264 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001265}
1266
1267/**
1268 * Logs that a setting was updated.
1269 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001270 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001271 * The tag and is_default allow resetting of settings to default values based on the specified
1272 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1273 */
1274message SettingChanged {
1275 // The name of the setting.
1276 optional string setting = 1;
1277
1278 // The change being imposed on this setting. May represent a number, eg "3".
1279 optional string value = 2;
1280
1281 // The new value of this setting. For most settings, this is same as value. For some settings,
1282 // value is +X or -X where X represents an element in a set. For example, if the previous value
1283 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1284 // The +/- feature is currently only used for location_providers_allowed.
1285 optional string new_value = 3;
1286
1287 // The previous value of this setting.
1288 optional string prev_value = 4;
1289
1290 // The tag used with the is_default for resetting sets of settings. This is generally null.
1291 optional string tag = 5;
1292
Bookatz90867622018-01-31 15:05:57 -08001293 // True if this setting with tag should be resettable.
1294 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001295
David Chenbd789912018-03-16 17:19:55 -07001296 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001297 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001298
1299 enum ChangeReason {
1300 UPDATED = 1; // Updated can be an insertion or an update.
1301 DELETED = 2;
1302 }
1303 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001304}
Chenjie Yub3dda412017-10-24 13:41:59 -07001305
Chenjie Yu05013b32017-11-21 10:21:41 -08001306/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001307 * Logs activity going to foreground or background
1308 *
1309 * Logged from:
1310 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1311 */
1312message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001313 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001314 optional string pkg_name = 2;
1315 optional string class_name = 3;
1316
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001317 enum State {
1318 BACKGROUND = 0;
1319 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001320 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001321 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001322}
David Chenc8a43242017-10-17 16:23:28 -07001323
1324/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001325 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001326 * Logged from:
1327 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1328 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001329message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001330 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001331
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001332 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001333
1334 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001335 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001336 optional string process_name = 3;
1337
1338 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001339 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001340
1341 optional string package_name = 5;
1342
1343 enum InstantApp {
1344 UNAVAILABLE = 0;
1345 FALSE = 1;
1346 TRUE = 2;
1347 }
1348 optional InstantApp is_instant_app = 6;
1349
1350 enum ForegroundState {
1351 UNKNOWN = 0;
1352 BACKGROUND = 1;
1353 FOREGROUND = 2;
1354 }
1355 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001356}
David Chen9e3808c2017-11-20 17:25:34 -08001357
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001358/**
1359 * Logs when a WTF (What a Terrible Failure) happened.
1360 * Logged from:
1361 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1362 */
1363message WTFOccurred {
1364 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001365
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001366 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001367
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001368 // The name of the process.
1369 // system_server if it is not by an app
1370 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001371
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001372 // The pid if available. -1 means not available.
1373 optional sint32 pid = 4;
1374}
1375
1376/**
1377 * Logs when system server reports low memory.
1378 * Logged from:
1379 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1380 */
1381message LowMemReported {
1382}
1383
1384/**
1385 * Logs when an app ANR (App Not Responding) occurs.
1386 * Logged from:
1387 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1388 */
1389message ANROccurred {
1390 optional int32 uid = 1 [(is_uid) = true];
1391
1392 optional string process_name = 2;
1393
1394 optional string short_component_name = 3;
1395
1396 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001397
1398 enum InstantApp {
1399 UNAVAILABLE = 0;
1400 FALSE = 1;
1401 TRUE = 2;
1402 }
1403 optional InstantApp is_instant_app = 5;
1404
1405 enum ForegroundState {
1406 UNKNOWN = 0;
1407 BACKGROUND = 1;
1408 FOREGROUND = 2;
1409 }
1410 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001411}
1412
David Chen0a368b22017-12-06 16:28:16 -08001413/*
1414 * Allows other apps to push events into statsd.
1415 * Logged from:
1416 * frameworks/base/core/java/android/util/StatsLog.java
1417 */
David Chen0b5c90c2018-01-25 16:51:49 -08001418message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001419 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001420 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001421
1422 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1423 optional int32 label = 2;
1424
1425 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1426 // predicates for the metrics).
1427 enum State {
1428 UNKNOWN = 0;
1429 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1430 STOP = 2;
1431 START = 3;
1432 }
1433 optional State state = 3;
1434}
1435
David Chen9e3808c2017-11-20 17:25:34 -08001436/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001437 * Logs when statsd detects an anomaly.
1438 *
1439 * Logged from:
1440 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1441 */
1442message AnomalyDetected {
1443 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001444 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001445
Yangster-mac94e197c2018-01-02 16:03:03 -08001446 // Id of the config whose anomaly detection alert fired.
1447 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001448
Yangster-mac94e197c2018-01-02 16:03:03 -08001449 // Id of the alert (i.e. name of the anomaly that was detected).
1450 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001451}
1452
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001453message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001454 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001455 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001456
1457 // The app package name.
1458 optional string pkg_name = 2;
1459
1460 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001461 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001462 WARM = 1;
1463 HOT = 2;
1464 COLD = 3;
1465 }
1466 // The transition type.
1467 optional TransitionType type = 3;
1468
1469 // The activity name.
1470 optional string activity_name = 4;
1471
1472 // The name of the calling app. Empty if not set.
1473 optional string calling_pkg_name = 5;
1474
1475 // Whether the app is an instant app.
1476 optional bool is_instant_app = 6;
1477
1478 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001479 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001480
Bookatz80d11a02018-01-16 10:46:35 -08001481 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001482
David Chen0b5c90c2018-01-25 16:51:49 -08001483 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001484 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001485 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001486 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001487 optional int32 bind_application_delay_millis = 11;
1488 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001489
1490 // Empty if not set.
1491 optional string launch_token = 13;
1492
Calin Juravle759fbda2018-02-20 19:52:30 +00001493 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001494 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001495
1496 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001497 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001498}
1499
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001500message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001501 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001502 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001503
1504 // The app package name.
1505 optional string pkg_name = 2;
1506
1507 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001508 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001509 WARM = 1;
1510 HOT = 2;
1511 COLD = 3;
1512 }
1513 // The transition type.
1514 optional TransitionType type = 3;
1515
1516 // The activity name.
1517 optional string activity_name = 4;
1518}
1519
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001520message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001521 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001522 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001523
1524 // The app package name.
1525 optional string pkg_name = 2;
1526
1527 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001528 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001529 WITH_BUNDLE = 1;
1530 WITHOUT_BUNDLE = 2;
1531 }
1532 // The transition type.
1533 optional TransitionType type = 3;
1534
1535 // The activity name.
1536 optional string activity_name = 4;
1537
1538 optional bool transition_process_running = 5;
1539
1540 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001541 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001542}
1543
Bookatz8fcd09a2017-12-18 13:01:10 -08001544/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001545 * Logs a picture-in-picture action
1546 * Logged from:
1547 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1548 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1549 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1550 */
1551message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001552 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001553 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001554
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001555 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001556
Chenjie Yu52cacc62017-12-08 18:11:45 -08001557 enum State {
1558 ENTERED = 1;
1559 EXPANDED_TO_FULL_SCREEN = 2;
1560 MINIMIZED = 3;
1561 DISMISSED = 4;
1562 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001563 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001564}
1565
1566/**
Chenjie Yue8904192017-12-08 19:12:57 -08001567 * Logs overlay action
1568 * Logged from:
1569 * services/core/java/com/android/server/wm/Session.java
1570 */
1571message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001572 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001573
1574 optional string package_name = 2;
1575
1576 optional bool using_alert_window = 3;
1577
1578 enum State {
1579 ENTERED = 1;
1580 EXITED = 2;
1581 }
1582 optional State state = 4;
1583}
1584
Chenjie Yuccfe6452018-01-30 11:33:21 -08001585/*
1586 * Logs foreground service starts and stops.
1587 * Note that this is not when a service starts or stops, but when it is
1588 * considered foreground.
1589 * Logged from
1590 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1591 */
1592message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001593 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001594 // package_name + "/" + class_name
1595 optional string short_name = 2;
1596
1597 enum State {
1598 ENTER = 1;
1599 EXIT = 2;
1600 }
1601 optional State state = 3;
1602}
1603
Chenjie Yue8904192017-12-08 19:12:57 -08001604/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001605 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1606 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1607 * attributed back to the parent (host) uid. One example is Chrome.
1608 *
1609 * Logged from:
1610 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1611 */
1612message IsolatedUidChanged {
1613 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001614 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001615 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001616 optional int32 parent_uid = 1;
1617
1618 optional int32 isolated_uid = 2;
1619
1620 // We expect an isolated uid to be removed before if it's used for another parent uid.
1621 enum Event {
1622 REMOVED = 0;
1623 CREATED = 1;
1624 }
1625 optional Event event = 3;
1626}
1627
1628/*
1629 * Logs the reception of an incoming network packet causing the main system to wake up for
1630 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1631 * and processed by WakeupController.cpp.
1632 */
1633message PacketWakeupOccurred {
1634 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1635 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001636 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001637 // The interface name on which the packet was received.
1638 optional string iface = 2;
1639 // The ethertype value of the packet.
1640 optional int32 ethertype = 3;
1641 // String representation of the destination MAC address of the packet.
1642 optional string destination_hardware_address = 4;
1643 // String representation of the source address of the packet if this was an IP packet.
1644 optional string source_ip = 5;
1645 // String representation of the destination address of the packet if this was an IP packet.
1646 optional string destination_ip = 6;
1647 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1648 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1649 // families.
1650 optional int32 ip_next_header = 7;
1651 // The source port if this was a TCP or UDP packet.
1652 optional int32 source_port = 8;
1653 // The destination port if this was a TCP or UDP packet.
1654 optional int32 destination_port = 9;
1655}
1656
1657/*
1658 * Logs the memory stats for an app on startup.
1659 * Logged from:
1660 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1661 */
1662message AppStartMemoryStateCaptured {
1663 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001664 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001665
1666 // The process name.
1667 optional string process_name = 2;
1668
1669 // The activity name.
1670 optional string activity_name = 3;
1671
1672 // # of page-faults
1673 optional int64 pgfault = 4;
1674
1675 // # of major page-faults
1676 optional int64 pgmajfault = 5;
1677
1678 // RSS
1679 optional int64 rss_in_bytes = 6;
1680
1681 // CACHE
1682 optional int64 cache_in_bytes = 7;
1683
1684 // SWAP
1685 optional int64 swap_in_bytes = 8;
1686}
1687
1688/*
1689 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1690 * for LMK event.
1691 * Logged from:
1692 * system/core/lmkd/lmkd.c
1693 */
1694message LmkStateChanged {
1695 enum State {
1696 UNKNOWN = 0;
1697 START = 1;
1698 STOP = 2;
1699 }
1700 optional State state = 1;
1701}
1702
1703/*
1704 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1705 * Logged from:
1706 * system/core/lmkd/lmkd.c
1707 */
1708message LmkKillOccurred {
1709 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001710 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001711
1712 // The process name.
1713 optional string process_name = 2;
1714
1715 // oom adj score.
1716 optional int32 oom_score = 3;
1717
1718 // # of page-faults
1719 optional int64 pgfault = 4;
1720
1721 // # of major page-faults
1722 optional int64 pgmajfault = 5;
1723
1724 // RSS
1725 optional int64 rss_in_bytes = 6;
1726
1727 // CACHE
1728 optional int64 cache_in_bytes = 7;
1729
1730 // SWAP
1731 optional int64 swap_in_bytes = 8;
1732}
1733
Rajeev Kumar51b54602018-03-01 12:18:26 -08001734/*
1735 * Logs when the ActivityManagerService detects that an app died.
1736 *
1737 * Logged from:
1738 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1739 */
1740message AppDied {
1741 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001742 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001743}
1744
Howard Ro21a039c2018-08-06 14:55:47 -07001745/**
1746 * An atom for generic metrics logging. Available from Android Q.
1747 */
1748message GenericAtom {
1749 // The uid of the application that sent this custom atom.
1750 optional int32 uid = 1 [(is_uid) = true];
1751
1752 // An event_id indicates the type of event.
1753 optional int32 event_id = 2;
1754}
1755
Chenjie Yubbcbc602018-02-05 16:51:52 -08001756//////////////////////////////////////////////////////////////////////
1757// Pulled atoms below this line //
1758//////////////////////////////////////////////////////////////////////
1759
1760/**
David Chenc8a43242017-10-17 16:23:28 -07001761 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1762 *
1763 * Pulled from:
1764 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1765 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001766message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001767 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001768
1769 optional int64 rx_bytes = 2;
1770
1771 optional int64 rx_packets = 3;
1772
1773 optional int64 tx_bytes = 4;
1774
1775 optional int64 tx_packets = 5;
1776}
1777
1778/**
1779 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1780 *
1781 * Pulled from:
1782 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1783 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001784message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001785 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001786
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001787 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1788 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001789
1790 optional int64 rx_bytes = 3;
1791
1792 optional int64 rx_packets = 4;
1793
1794 optional int64 tx_bytes = 5;
1795
1796 optional int64 tx_packets = 6;
1797}
1798
1799/**
1800 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1801 *
1802 * Pulled from:
1803 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1804 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001805message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001806 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001807
1808 optional int64 rx_bytes = 2;
1809
1810 optional int64 rx_packets = 3;
1811
1812 optional int64 tx_bytes = 4;
1813
1814 optional int64 tx_packets = 5;
1815}
1816
1817/**
1818 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1819 *
1820 * Pulled from:
1821 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1822 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001823message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001824 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001825
Yao Chenc40a19d2018-03-15 16:48:25 -07001826 // 1 denotes foreground and 0 denotes background. This is called Set in
1827 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001828 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001829
1830 optional int64 rx_bytes = 3;
1831
1832 optional int64 rx_packets = 4;
1833
1834 optional int64 tx_bytes = 5;
1835
1836 optional int64 tx_packets = 6;
1837}
1838
1839/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001840 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1841 *
1842 * Pulled from:
1843 * StatsCompanionService
1844 */
1845message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001846 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001847
1848 optional int64 rx_bytes = 2;
1849
1850 optional int64 tx_bytes = 3;
1851}
1852
1853/**
David Chenc8a43242017-10-17 16:23:28 -07001854 * Pulls the kernel wakelock durations. This atom is adapted from
1855 * android/internal/os/KernelWakelockStats.java
1856 *
1857 * Pulled from:
1858 * StatsCompanionService using KernelWakelockReader.
1859 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001860message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001861 optional string name = 1;
1862
1863 optional int32 count = 2;
1864
1865 optional int32 version = 3;
1866
1867 optional int64 time = 4;
1868}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001869
Chenjie Yu05013b32017-11-21 10:21:41 -08001870/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001871 * Pulls low power state information. This includes platform and subsystem sleep state information,
1872 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001873 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001874 * hardware/interfaces/power/1.1/types.hal
1875 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001876message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001877 // Subsystem name
1878 optional string subsystem_name = 1;
1879 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1880 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1881 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001882 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001883 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001884 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001885 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001886}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001887
Chenjie Yu05013b32017-11-21 10:21:41 -08001888/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001889 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001890 * Pulls the time the cpu spend on the frequency index. Frequency index
1891 * starts from highest to lowest. The value should be monotonically
1892 * increasing since boot. However, if there is a cpu
1893 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001894 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001895message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001896 optional uint32 cluster = 1;
1897 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001898 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001899}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001900
Chenjie Yu05013b32017-11-21 10:21:41 -08001901/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001902 * Pulls Cpu Time Per Uid.
1903 * Note that isolated process uid time should be attributed to host uids.
1904 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001905message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001906 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001907 optional uint64 user_time_millis = 2;
1908 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001909}
1910
1911/**
1912 * Pulls Cpu Time Per Uid per frequency.
1913 * Note that isolated process uid time should be attributed to host uids.
1914 * For each uid, we order the time by descending frequencies.
1915 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001916message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001917 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001918 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001919 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001920}
Hugo Benichi884970e2017-11-14 22:42:46 +09001921
Chenjie Yu05013b32017-11-21 10:21:41 -08001922/**
1923 * Pulls Wifi Controller Activity Energy Info
1924 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001925message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001926 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001927 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001928 // stack reported state
1929 // TODO: replace this with proto enum
1930 optional int32 stack_state = 2;
1931 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001932 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001933 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001934 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001935 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001936 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001937 // product of current(mA), voltage(V) and time(ms)
1938 optional uint64 controller_energy_used = 6;
1939}
1940
1941/**
1942 * Pulls Modem Activity Energy Info
1943 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001944message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001945 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001946 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001947 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001948 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001949 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001950 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001951 /**
1952 * Tx power index
1953 * index 0 = tx_power < 0dBm
1954 * index 1 = 0dBm < tx_power < 5dBm
1955 * index 2 = 5dBm < tx_power < 15dBm
1956 * index 3 = 15dBm < tx_power < 20dBm
1957 * index 4 = tx_power > 20dBm
1958 */
1959 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001960 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001961 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001962 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001963 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001964 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001965 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001966 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001967 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001968 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001969 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001970 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001971 // product of current(mA), voltage(V) and time(ms)
1972 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001973}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001974
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001975/**
1976 * Pulls Bluetooth Activity Energy Info
1977 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1978 */
1979message BluetoothActivityInfo {
1980 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001981 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001982 // bluetooth stack state
1983 optional int32 bluetooth_stack_state = 2;
1984 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001985 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001986 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001987 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001988 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001989 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001990 // product of current(mA), voltage(V) and time(ms)
1991 optional uint64 energy_used = 6;
1992}
1993
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001994/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001995 * Logs the memory stats for a process.
1996 */
1997message ProcessMemoryState {
1998 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001999 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002000
2001 // The process name.
2002 optional string process_name = 2;
2003
2004 // oom adj score.
2005 optional int32 oom_score = 3;
2006
2007 // # of page-faults
2008 optional int64 pgfault = 4;
2009
2010 // # of major page-faults
2011 optional int64 pgmajfault = 5;
2012
Rajeev Kumar90235992018-01-29 11:06:48 -08002013 // RSS
2014 optional int64 rss_in_bytes = 6;
2015
2016 // CACHE
2017 optional int64 cache_in_bytes = 7;
2018
2019 // SWAP
2020 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002021}
2022
2023/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002024 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002025 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002026message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002027 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002028}
2029
2030/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002031 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002032 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002033message SystemUptime {
2034 // Milliseconds since the system was booted.
2035 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2036 // for external input).
2037 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002038 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002039}
2040
2041/*
2042 * Reads from /proc/uid_concurrent_active_time which has the format:
2043 * active: X (X is # cores)
2044 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2045 * [uid1]: [time-0] [time-1] [time-2] ... ...
2046 * ...
2047 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2048 * The file contains a monotonically increasing count of time for a single boot.
2049 */
2050message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002051 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002052 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002053}
2054
2055/**
2056 * Reads from /proc/uid_concurrent_policy_time which has the format:
2057 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2058 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2059 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2060 * ...
2061 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2062 * The file contains a monotonically increasing count of time for a single boot.
2063 */
2064message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002065 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002066 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002067 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002068}
2069
2070/*
2071 * Pulls free disk space, for data, system partition and temporary directory.
2072 */
2073message DiskSpace {
2074 // available bytes in data partition
2075 optional uint64 data_available_bytes = 1;
2076 // available bytes in system partition
2077 optional uint64 system_available_bytes = 2;
2078 // available bytes in download cache or temp directories
2079 optional uint64 temp_available_bytes = 3;
2080}
Tej Singhbf972d92018-01-10 20:51:13 -08002081
2082/**
2083 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002084 * Pulled from:
2085 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002086 */
2087message RemainingBatteryCapacity {
2088 optional int32 charge_uAh = 1;
2089}
2090
2091/**
2092 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002093 * Pulled from:
2094 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002095 */
2096message FullBatteryCapacity {
2097 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002098}
2099
2100/**
Tej Singhd89137e2018-03-26 14:51:40 -07002101 * Pulls the temperature of various parts of the device.
2102 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002103 *
2104 * Pulled from:
2105 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2106 */
2107message Temperature {
2108 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2109 optional android.os.TemperatureTypeEnum sensor_location = 1;
2110
2111 // The name of the temperature source. Eg. CPU0
2112 optional string sensor_name = 2;
2113
Tej Singhd89137e2018-03-26 14:51:40 -07002114 // Temperature in tenths of a degree C.
2115 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002116}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002117
2118/**
2119 * Pulls the statistics of calls to Binder.
2120 *
2121 * Binder stats are cumulative from boot unless somebody reset the data using
2122 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002123 *
2124 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002125 */
2126message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002127 optional int32 uid = 1 [(is_uid) = true];
2128 // Fully qualified class name of the API call.
2129 //
2130 // This is a system server class name.
2131 //
2132 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2133 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2134 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2135 // commonly used APIs.
2136 optional string service_class_name = 2;
2137 // Method name of the API call. It can also be a transaction code if we cannot
2138 // resolve it to a name. See Binder#getTransactionName.
2139 //
2140 // This is a system server method name.
2141 optional string service_method_name = 3;
2142 // Total number of API calls.
2143 optional int64 call_count = 4;
2144 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2145 optional bool screen_interactive = 13;
2146 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2147 // call_count will be equal to recorded_call_count.
2148 //
2149 // If recorded_call_count is different than call_count, it means data collection has been
2150 // sampled. All the fields below will be sampled in this case.
2151 optional int64 recorded_call_count = 12;
2152 // Number of exceptions thrown by the API.
2153 optional int64 recorded_exception_count = 5;
2154 // Total latency of all API calls.
2155 // Average can be computed using total_latency_micros / recorded_call_count.
2156 optional int64 recorded_total_latency_micros = 6;
2157 // Maximum latency of one API call.
2158 optional int64 recorded_max_latency_micros = 7;
2159 // Total CPU usage of all API calls.
2160 // Average can be computed using total_cpu_micros / recorded_call_count.
2161 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2162 optional int64 recorded_total_cpu_micros = 8;
2163 // Maximum CPU usage of one API call.
2164 optional int64 recorded_max_cpu_micros = 9;
2165 // Maximum parcel reply size of one API call.
2166 optional int64 recorded_max_reply_size_bytes = 10;
2167 // Maximum parcel request size of one API call.
2168 optional int64 recorded_max_request_size_bytes = 11;
2169}
2170
2171/**
2172 * Pulls the statistics of exceptions during calls to Binder.
2173 *
2174 * Binder stats are cumulative from boot unless somebody reset the data using
2175 * > adb shell dumpsys binder_calls_stats --reset
2176 */
2177message BinderCallsExceptions {
2178 // Exception class name, e.g. java.lang.IllegalArgumentException.
2179 //
2180 // This is an exception class name thrown by the system server.
2181 optional string exception_class_name = 1;
2182 // Total number of exceptions.
2183 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002184}