blob: 97891b0929b4b09cc13963b4df749d4f6e1663e7 [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;
Bookatza7020bd2018-08-28 16:29:35 -0700131 VibratorStateChanged vibrator_state_changed = 84;
Yao Chend54f9dd2017-10-17 17:37:48 +0000132 }
David Chenc8a43242017-10-17 16:23:28 -0700133
David Chen6e3e6cb2018-01-03 16:14:06 -0800134 // Pulled events will start at field 10000.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100135 // Next: 10024
David Chenc8a43242017-10-17 16:23:28 -0700136 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800137 WifiBytesTransfer wifi_bytes_transfer = 10000;
138 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
139 MobileBytesTransfer mobile_bytes_transfer = 10002;
140 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800141 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800142 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800143 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800144 CpuTimePerFreq cpu_time_per_freq = 10008;
145 CpuTimePerUid cpu_time_per_uid = 10009;
146 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800147 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800148 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800149 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800150 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800151 SystemElapsedRealtime system_elapsed_realtime = 10014;
152 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800153 CpuActiveTime cpu_active_time = 10016;
154 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh6188aa32018-08-29 00:21:07 +0000155 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800156 RemainingBatteryCapacity remaining_battery_capacity = 10019;
157 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800158 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100159 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100160 BinderCallsExceptions binder_calls_exceptions = 10023;
David Chenc8a43242017-10-17 16:23:28 -0700161 }
yroa1fe77c2018-02-26 14:22:54 -0800162
163 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
164 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700165}
166
Yao Chend54f9dd2017-10-17 17:37:48 +0000167/**
Yangster-mac20877162017-12-22 17:19:39 -0800168 * This proto represents a node of an attribution chain.
169 * Note: All attribution chains are represented as a repeated field of type
170 * AttributionNode. It is understood that in such arrays, the order is that
171 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 */
Yangster-mac20877162017-12-22 17:19:39 -0800173message AttributionNode {
174 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800175 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800176
Yangster-mac20877162017-12-22 17:19:39 -0800177 // The (optional) string tag for an element in the attribution chain. If the
178 // element has no tag, it is encoded as an empty string.
179 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700180}
181
Yangster-mac48b3d622018-08-18 12:38:11 -0700182message KeyValuePair {
183 optional int32 key = 1;
184 oneof value {
185 int64 value_int = 2;
186 string value_str = 3;
187 float value_float = 4;
188 }
189}
190
191message KeyValuePairsAtom {
192 optional int32 uid = 1;
193 repeated KeyValuePair pairs = 2;
194}
195
Yao Chend54f9dd2017-10-17 17:37:48 +0000196/*
197 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800198 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000199 *
200 * RULES:
201 * - The field ids for each atom must start at 1, and count upwards by 1.
202 * Skipping field ids is not allowed.
203 * - These form an API, so renaming, renumbering or removing fields is
204 * not allowed between android releases. (This is not currently enforced,
205 * but there will be a tool to enforce this restriction).
206 * - The types must be built-in protocol buffer types, namely, no sub-messages
207 * are allowed (yet). The bytes type is also not allowed.
208 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800209 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000210 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800211 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000212 * - A field that is a uid should be a string field, tagged with the [xxx]
213 * annotation. The generated code on android will be represented by UIDs,
214 * and those UIDs will be translated in xxx to those strings.
215 *
216 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700217 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000218 * - If there is a UID, it goes first. Think in an object-oriented fashion.
219 * *****************************************************************************
220 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700221
Yao Chend54f9dd2017-10-17 17:37:48 +0000222/**
223 * Logs when the screen state changes.
224 *
225 * Logged from:
226 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
227 */
228message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800229 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800230 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700231}
Yao Chend54f9dd2017-10-17 17:37:48 +0000232
233/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700234 * Logs that the process state of the uid, as determined by ActivityManager
235 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000236 *
237 * Logged from:
238 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
239 */
Bookatzc1a050a2017-10-10 15:49:28 -0700240message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700241 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000242
Bookatzdb026a22018-01-10 19:01:56 -0800243 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800244 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000245}
246
247/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700248 * Logs process state change of a process, as per the activity manager.
249 *
250 * Logged from:
251 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
252 */
253message ProcessStateChanged {
254 optional int32 uid = 1;
255 optional string process_name = 2;
256 optional string package_name = 3;
257 // TODO: remove this when validation is done
258 optional int64 version = 5;
259 // The state, from frameworks/base/core/proto/android/app/enums.proto.
260 optional android.app.ProcessStateEnum state = 4;
261}
262
263/**
264 * Logs when ActivityManagerService sleep state is changed.
265 *
266 * Logged from:
267 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
268 */
269message ActivityManagerSleepStateChanged {
270 // TODO: import frameworks proto
271 enum State {
272 UNKNOWN = 0;
273 ASLEEP = 1;
274 AWAKE = 2;
275 }
276 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
277}
278
279/**
280 * Logs when system memory state changes.
281 *
282 * Logged from:
283 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
284 */
285message MemoryFactorStateChanged {
286 // TODO: import frameworks proto
287 enum State {
288 MEMORY_UNKNOWN = 0;
289 NORMAL = 1; // normal.
290 MODERATE = 2; // moderate memory pressure.
291 LOW = 3; // low memory.
292 CRITICAL = 4; // critical memory.
293
294 }
295 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
296}
297
298/**
299 * Logs when app is using too much cpu, according to ActivityManagerService.
300 *
301 * Logged from:
302 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
303 */
304message ExcessiveCpuUsageReported {
305 optional int32 uid = 1;
306 optional string process_name = 2;
307 optional string package_name = 3;
308 // package version. TODO: remove this when validation is done
309 optional int64 version = 4;
310}
311
312/**
313 * Logs when a cached process is killed, along with its pss.
314 *
315 * Logged from:
316 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
317 */
318message CachedKillReported {
319 optional int32 uid = 1;
320 optional string process_name = 2;
321 optional string package_name = 3;
322 // TODO: remove this when validation is done
323 optional int64 version = 5;
324 optional int64 pss = 4;
325}
326
327/**
328 * Logs when memory stats of a process is reported.
329 *
330 * Logged from:
331 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
332 */
333message ProcessMemoryStatReported {
334 optional int32 uid = 1;
335 optional string process_name = 2;
336 optional string package_name = 3;
337 //TODO: remove this when validation is done
338 optional int64 version = 9;
339 optional int64 pss = 4;
340 optional int64 uss = 5;
341 optional int64 rss = 6;
342 enum Type {
343 ADD_PSS_INTERNAL_SINGLE = 0;
344 ADD_PSS_INTERNAL_ALL_MEM = 1;
345 ADD_PSS_INTERNAL_ALL_POLL = 2;
346 ADD_PSS_EXTERNAL = 3;
347 ADD_PSS_EXTERNAL_SLOW = 4;
348 }
349 optional Type type = 7;
350 optional int64 duration = 8;
351}
352
353/**
Bookatzc1a050a2017-10-10 15:49:28 -0700354 * Logs that a process started, finished, crashed, or ANRed.
355 *
356 * Logged from:
357 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
358 */
359message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700360 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700361
David Chen0b5c90c2018-01-25 16:51:49 -0800362 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800363 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
Bookatzddccf0a2017-11-28 16:48:14 -0800365 // What lifecycle state the process changed to.
366 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800367 enum State {
368 FINISHED = 0;
369 STARTED = 1;
370 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800371 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800372 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700373}
374
Bookatzc1a050a2017-10-10 15:49:28 -0700375/**
376 * Logs when the ble scan state changes.
377 *
378 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700379 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700380 */
381message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800382 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700383
384 enum State {
385 OFF = 0;
386 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700387 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
388 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700389 }
390 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700391
Bookatze5ec0b42018-03-26 13:34:56 -0700392 // Does the scan have a filter.
393 optional bool is_filtered = 3;
394 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
395 optional bool is_first_match = 4;
396 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
397 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700398}
399
400/**
401 * Logs reporting of a ble scan finding results.
402 *
403 * Logged from:
404 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
405 */
406// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
407message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800408 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700409
410 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800411 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700412}
413
414/**
415 * Logs when a sensor state changes.
416 *
417 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700418 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700419 */
420message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800421 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
Bookatzc1a050a2017-10-10 15:49:28 -0700423 // The id (int) of the sensor.
424 optional int32 sensor_id = 2;
425
426 enum State {
427 OFF = 0;
428 ON = 1;
429 }
430 optional State state = 3;
431}
432
433
434/**
435 * Logs when GPS state changes.
436 *
437 * Logged from:
438 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
439 */
440message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800441 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700442
443 enum State {
444 OFF = 0;
445 ON = 1;
446 }
447 optional State state = 2;
448}
449
450
451/**
452 * Logs when a sync manager sync state changes.
453 *
454 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700455 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700456 */
457message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800458 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700459
David Chen0b5c90c2018-01-25 16:51:49 -0800460 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800461 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700462
463 enum State {
464 OFF = 0;
465 ON = 1;
466 }
467 optional State state = 3;
468}
469
470/**
471 * Logs when a job scheduler job state changes.
472 *
473 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700474 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700475 */
476message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800477 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700478
479 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800480 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700481
482 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800483 FINISHED = 0;
484 STARTED = 1;
485 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700486 }
487 optional State state = 3;
488
Tej Singh33a412b2018-03-16 18:43:59 -0700489 // The reason a job has stopped.
490 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700491 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700492 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700493}
494
495/**
496 * Logs when the audio state changes.
497 *
498 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700499 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700500 */
501message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800502 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700503
504 enum State {
505 OFF = 0;
506 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700507 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
508 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700509 }
510 optional State state = 2;
511}
512
513/**
514 * Logs when the video codec state changes.
515 *
516 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700517 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700518 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800519message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800520 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700521
522 enum State {
523 OFF = 0;
524 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700525 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
526 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700527 }
528 optional State state = 2;
529}
530
531/**
532 * Logs when the flashlight state changes.
533 *
534 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700535 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700536 */
537message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800538 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700539
540 enum State {
541 OFF = 0;
542 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700543 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
544 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700545 }
546 optional State state = 2;
547}
548
549/**
550 * Logs when the camera state changes.
551 *
552 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700553 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700554 */
555message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800556 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700557
558 enum State {
559 OFF = 0;
560 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700561 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
562 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700563 }
564 optional State state = 2;
565}
566
567/**
568 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000569 *
570 * Logged from:
571 * TODO
572 */
Bookatzd6746242017-10-24 18:39:35 -0700573message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800574 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000575
Bookatz1a1b0462018-01-12 11:47:03 -0800576 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
577 // From frameworks/base/core/proto/android/os/enums.proto.
578 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700579
580 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
581 optional string tag = 3;
582
583 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800584 RELEASE = 0;
585 ACQUIRE = 1;
586 CHANGE_RELEASE = 2;
587 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700588 }
589 optional State state = 4;
590}
591
592/**
Bookatzc1a050a2017-10-10 15:49:28 -0700593 * Logs when a partial wakelock is considered 'long' (over 1 min).
594 *
595 * Logged from:
596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
597 */
598message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800599 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700600
Yao Chend54f9dd2017-10-17 17:37:48 +0000601 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
602 optional string tag = 2;
603
Bookatzc1a050a2017-10-10 15:49:28 -0700604 // TODO: I have no idea what this is.
605 optional string history_tag = 3;
606
607 enum State {
608 OFF = 0;
609 ON = 1;
610 }
611 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000612}
613
Bookatzc1a050a2017-10-10 15:49:28 -0700614/**
615 * Logs Battery Saver state change.
616 *
617 * Logged from:
618 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
619 */
620message BatterySaverModeStateChanged {
621 enum State {
622 OFF = 0;
623 ON = 1;
624 }
625 optional State state = 1;
626}
627
628/**
629 * Logs Doze mode state change.
630 *
631 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800632 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700633 */
634message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800635 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800636}
637
638
639/**
640 * Logs state change of Doze mode including maintenance windows.
641 *
642 * Logged from:
643 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
644 */
645message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800646 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700647}
648
649/**
650 * Logs screen brightness level.
651 *
652 * Logged from:
653 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
654 */
655message ScreenBrightnessChanged {
656 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
657 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700658}
659
660/**
661 * Logs battery level (percent full, from 0 to 100).
662 *
663 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700664 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700665 */
666message BatteryLevelChanged {
667 // Battery level. Should be in [0, 100].
668 optional int32 battery_level = 1;
669}
670
671/**
672 * Logs change in charging status of the device.
673 *
674 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700675 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700676 */
677message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800678 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
679 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700680}
681
682/**
683 * Logs whether the device is plugged in, and what power source it is using.
684 *
685 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700686 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700687 */
688message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800689 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
690 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700691}
692
Bookatz8c6571b2017-10-24 15:04:41 -0700693/**
694 * Logs when an app's wakeup alarm fires.
695 *
696 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700697 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700698 */
699message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800700 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800701
702 // Name of the wakeup alarm.
703 optional string tag = 2;
704}
705
706/**
707 * Logs when an an app causes the mobile radio to change state.
708 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
709 *
710 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700711 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800712 */
713message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800714 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800715
Bookatz1a1b0462018-01-12 11:47:03 -0800716 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
717 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800718}
719
720/**
721 * Logs when an an app causes the wifi radio to change state.
722 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
723 *
724 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700725 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800726 */
727message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800728 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800729
Bookatz1a1b0462018-01-12 11:47:03 -0800730 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
731 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700732}
733
734/**
735 * Logs kernel wakeup reasons and aborts.
736 *
737 * Logged from:
738 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
739 */
740message KernelWakeupReported {
741 // Name of the kernel wakeup reason (or abort).
742 optional string wakeup_reason_name = 1;
743
744 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800745 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700746}
747
748/**
749 * Logs wifi locks held by an app.
750 *
751 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700752 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700753 */
754message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800755 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700756
757 enum State {
758 OFF = 0;
759 ON = 1;
760 }
761 optional State state = 2;
762}
763
764/**
765 * Logs wifi signal strength changes.
766 *
767 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700768 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700769 */
770message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800771 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
772 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700773}
774
775/**
776 * Logs wifi scans performed by an app.
777 *
778 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700779 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700780 */
781message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800782 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700783
784 enum State {
785 OFF = 0;
786 ON = 1;
787 }
788 optional State state = 2;
789}
790
791/**
Tej Singh4503e102018-01-04 14:35:01 -0800792 * Logs wifi multicast locks held by an app
793 *
794 * Logged from:
795 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
796 */
797message WifiMulticastLockStateChanged {
798 repeated AttributionNode attribution_node = 1;
799
800 enum State {
801 OFF = 0;
802 ON = 1;
803 }
804 optional State state = 2;
805}
806
807/**
Tej Singh1ea42892018-01-19 09:27:00 -0800808 * Logs shutdown reason and duration on next boot.
809 *
810 * Logged from:
811 * frameworks/base/core/java/com/android/server/BootReceiver.java
812 */
813message ShutdownSequenceReported {
814 // True if shutdown is for a reboot. Default: false if we do not know.
815 optional bool reboot = 1;
816
817 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
818 optional string reason = 2;
819
820 // Beginning of shutdown time in ms using wall clock time since unix epoch.
821 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800822 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800823
824 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800825 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800826}
827
Tej Singh6483ea42018-01-25 17:45:49 -0800828
829/**
830 * Logs boot reason and duration.
831 *
832 * Logged from:
833 * system/core/bootstat/bootstat.cpp
834 */
835message BootSequenceReported {
836 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
837 // Default: "<EMPTY>" if not available.
838 optional string bootloader_reason = 1;
839
840 // Reason for system boot. Eg. bootloader, reboot,userrequested
841 // Default: "<EMPTY>" if not available.
842 optional string system_reason = 2;
843
844 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800845 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800846
847 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800848 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800849
850 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800851 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800852
853 // Time since last boot in ms. Default: 0 if not available.
854 optional int64 time_since_last_boot = 6;
855}
856
Tej Singhc477d9c2018-02-05 18:31:39 -0800857
858/**
859 * Logs call state and disconnect cause (if applicable).
860 *
861 * Logged from:
862 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
863 */
864message CallStateChanged {
865 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
866 // From frameworks/base/core/proto/android/telecomm/enums.proto.
867 optional android.telecom.CallStateEnum call_state = 1;
868
869 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
870 // This value is only applicable when the call_state is DISCONNECTED, and
871 // should always be UNKNOWN if the call_state is not DISCONNECTED.
872 // From frameworks/base/core/proto/android/telecomm/enums.proto.
873 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
874
875 // True if the call is self-managed, which are apps that use the
876 // telecom infrastructure to make their own calls.
877 optional bool self_managed = 3;
878
879 // True if call is external. External calls are calls on connected Wear
880 // devices but show up in Telecom so the user can pull them onto the device.
881 optional bool external_call = 4;
882}
883
Tej Singh1ea42892018-01-19 09:27:00 -0800884/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800885 * Logs keyguard state. The keyguard is the lock screen.
886 *
887 * Logged from:
888 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
889 */
890message KeyguardStateChanged {
891 enum State {
892 UNKNOWN = 0;
893 // The keyguard is hidden when the phone is unlocked.
894 HIDDEN = 1;
895 // The keyguard is shown when the phone is locked (screen turns off).
896 SHOWN= 2;
897 // The keyguard is occluded when something is overlaying the keyguard.
898 // Eg. Opening the camera while on the lock screen.
899 OCCLUDED = 3;
900 }
901 optional State state = 1;
902}
903
904/**
905 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
906 * prompts the user to enter a password (pattern, pin, etc).
907 *
908 * Logged from:
909 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
910 */
911
912message KeyguardBouncerStateChanged {
913 enum State {
914 UNKNOWN = 0;
915 // Bouncer is hidden, either as a result of successfully entering the
916 // password, screen timing out, or user going back to lock screen.
917 HIDDEN = 1;
918 // This is when the user is being prompted to enter the password.
919 SHOWN = 2;
920 }
921 optional State state = 1;
922}
923
924/**
925 * Logs the result of entering a password into the keyguard bouncer.
926 *
927 * Logged from:
928 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
929 */
930message KeyguardBouncerPasswordEntered {
931 enum BouncerResult {
932 UNKNOWN = 0;
933 // The password entered was incorrect.
934 FAILURE = 1;
935 // The password entered was correct.
936 SUCCESS = 2;
937 }
938 optional BouncerResult result = 1;
939}
940
Tej Singha883b372018-02-15 11:30:01 -0800941/*
942 * Logs changes to the configuration of the device. The configuration is defined
943 * in frameworks/base/core/java/android/content/res/Configuration.java
944 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
945 * Please go there to interpret the possible values each field can be.
946 *
947 * Logged from:
948 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
949 */
950message ResourceConfigurationChanged {
951 // Bit mask of color capabilities of the screen.
952 // Contains information about the color gamut and hdr mode of the screen.
953 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
954 optional int32 colorMode = 1;
955
956 // The target screen density being rendered to.
957 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
958 optional int32 densityDpi = 2;
959
960 // Current user preference for the scaling factor for fonts,
961 // relative to the base density scaling.
962 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
963 optional float fontScale = 3;
964
965 // Flag indicating whether the hard keyboard is hidden.
966 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
967 optional int32 hardKeyboardHidden = 4;
968
969 // The type of keyboard attached to the device.
970 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
971 optional int32 keyboard = 5;
972
973 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
974 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
975 optional int32 keyboardHideen = 6;
976
977 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
978 // 0 if undefined.
979 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
980 optional int32 mcc = 7;
981
982 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
983 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
984 // MNC_ZERO symbol defined in Configuration.java.
985 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
986 optional int32 mnc = 8;
987
988 // The kind of navigation available on the device.
989 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
990 optional int32 navigation = 9;
991
992 // Flag indicating whether the navigation is available.
993 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
994 optional int32 navigationHidden = 10;
995
996 // Overall orientation of the screen.
997 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
998 optional int32 orientation = 11;
999
1000 // The current height of the available screen space, in dp units.
1001 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1002 optional int32 screenHeightDp = 12;
1003
1004 // Bit mask of overall layout of the screen.
1005 // Contains information about screen size, whether the screen is wider/taller
1006 // than normal, whether the screen layout is right-tl-left or left-to-right,
1007 // and whether the screen has a rounded shape.
1008 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1009 optional int32 screenLayout = 13;
1010
1011 // Current width of the available screen space, in dp units.
1012 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1013 optional int32 screenWidthDp = 14;
1014
1015 // The smallest screen size an application will see in normal operation.
1016 // This is the smallest value of both screenWidthDp and screenHeightDp
1017 // in portrait and landscape.
1018 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1019 optional int32 smallestScreenWidthDp = 15;
1020
1021 // The type of touch screen attached to the device.
1022 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1023 optional int32 touchscreen = 16;
1024
1025 // Bit mask of the ui mode.
1026 // Contains information about the overall ui mode of the device.
1027 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1028 // Also contains information about whether the device is in night mode.
1029 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1030 optional int32 uiMode = 17;
1031}
1032
Tej Singheee317b2018-03-07 19:28:05 -08001033
1034/**
1035 * Logs changes in the connection state of the mobile radio.
1036 *
1037 * Logged from:
1038 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1039 */
1040message MobileConnectionStateChanged {
1041 // States are from the state machine DataConnection.java.
1042 enum State {
1043 UNKNOWN = 0;
1044 // The connection is inactive, or disconnected.
1045 INACTIVE = 1;
1046 // The connection is being activated, or connecting.
1047 ACTIVATING = 2;
1048 // The connection is active, or connected.
1049 ACTIVE = 3;
1050 // The connection is disconnecting.
1051 DISCONNECTING = 4;
1052 // The connection is disconnecting after creating a connection.
1053 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1054 }
1055 optional State state = 1;
1056 // For multi-sim phones, this distinguishes between the sim cards.
1057 optional int32 sim_slot_index = 2;
1058 // Used to identify the connection. Starts at 0 and increments by 1 for
1059 // every new network created. Resets whenever the device reboots.
1060 optional int32 data_connection_id = 3;
1061 // A bitmask for the capabilities of this connection.
1062 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1063 // Default value (if we have no information): 0
1064 optional int64 capabilities = 4;
1065 // If this connection has internet.
1066 // This just checks if the DEFAULT bit of capabilities is set.
1067 optional bool has_internet = 5;
1068}
1069
1070/**
1071 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1072 *
1073 * Logged from:
1074 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1075 */
1076message MobileRadioTechnologyChanged {
1077 optional android.telephony.NetworkTypeEnum state = 1;
1078 // For multi-sim phones, this distinguishes between the sim cards.
1079 optional int32 sim_slot_index = 2;
1080}
1081
Andrew Chantb56388b2018-03-22 21:07:33 -07001082/**
1083 * Logs the VID and PID of any connected USB devices.
1084 *
1085 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1086 *
1087 * Logged by Vendor.
1088 */
1089message UsbDeviceAttached {
1090 optional int32 vid = 1;
1091 optional int32 pid = 2;
1092 optional bool has_audio = 3;
1093 optional bool has_hid = 4;
1094 optional bool has_storage = 5;
1095}
1096
Tej Singheee317b2018-03-07 19:28:05 -08001097
Tej Singhdd7bd352018-02-09 19:33:15 -08001098/**
Tej Singh5d991e12018-03-09 19:48:11 -08001099 * Logs when Bluetooth is enabled and disabled.
1100 *
1101 * Logged from:
1102 * services/core/java/com/android/server/BluetoothManagerService.java
1103 */
1104message BluetoothEnabledStateChanged {
1105 repeated AttributionNode attribution_node = 1;
1106 // Whether or not bluetooth is enabled on the device.
1107 enum State {
1108 UNKNOWN = 0;
1109 ENABLED = 1;
1110 DISABLED = 2;
1111 }
1112 optional State state = 2;
1113 // The reason for being enabled/disabled.
1114 // Eg. Airplane mode, crash, application request.
1115 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1116 // If the reason is an application request, this will be the package name.
1117 optional string pkgName = 4;
1118}
1119
1120/**
1121 * Logs when a Bluetooth device connects and disconnects.
1122 *
1123 * Logged from:
1124 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1125 */
1126message BluetoothConnectionStateChanged {
1127 // The state of the connection.
1128 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1129 optional android.bluetooth.ConnectionStateEnum state = 1;
1130 // An identifier that can be used to match connect and disconnect events.
1131 // Currently is last two bytes of a hash of a device level ID and
1132 // the mac address of the bluetooth device that is connected.
1133 optional int32 obfuscated_id = 2;
1134 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1135 // From android.bluetooth.BluetoothAdapter.java
1136 optional int32 bt_profile = 3;
1137}
1138
1139/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001140 * Logs when something is plugged into or removed from the USB-C connector.
1141 *
1142 * Logged from:
1143 * Vendor USB HAL.
1144 */
1145message UsbConnectorStateChanged {
1146 enum State {
1147 DISCONNECTED = 0;
1148 CONNECTED = 1;
1149 }
1150 optional State state = 1;
1151}
1152
1153/**
1154 * Logs the reported speaker impedance.
1155 *
1156 * Logged from:
1157 * Vendor audio implementation.
1158 */
1159message SpeakerImpedanceReported {
1160 optional int32 speaker_location = 1;
1161 optional int32 impedance = 2;
1162}
1163
1164/**
1165 * Logs the report of a failed hardware.
1166 *
1167 * Logged from:
1168 * Vendor HALs.
1169 *
1170 */
1171message HardwareFailed {
1172 enum HardwareType {
1173 HARDWARE_FAILED_UNKNOWN = 0;
1174 HARDWARE_FAILED_MICROPHONE = 1;
1175 HARDWARE_FAILED_CODEC = 2;
1176 HARDWARE_FAILED_SPEAKER = 3;
1177 HARDWARE_FAILED_FINGERPRINT = 4;
1178 }
1179 optional HardwareType hardware_type = 1;
1180
1181 /* hardware_location allows vendors to differentiate between multiple instances of
1182 * the same hardware_type. The specific locations are vendor defined integers,
1183 * referring to board-specific numbering schemes.
1184 */
1185 optional int32 hardware_location = 2;
1186
1187 /* failure_code is specific to the HardwareType of the failed hardware.
1188 * It should use the enum values defined below.
1189 */
1190 enum MicrophoneFailureCode {
1191 MICROPHONE_FAILURE_COMPLETE = 0;
1192 }
1193 enum CodecFailureCode {
1194 CODEC_FAILURE_COMPLETE = 0;
1195 }
1196 enum SpeakerFailureCode {
1197 SPEAKER_FAILURE_COMPLETE = 0;
1198 SPEAKER_FAILURE_HIGH_Z = 1;
1199 SPEAKER_FAILURE_SHORT = 2;
1200 }
1201 enum FingerprintFailureCode {
1202 FINGERPRINT_FAILURE_COMPLETE = 0;
1203 FINGERPRINT_SENSOR_BROKEN = 1;
1204 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1205 }
1206 optional int32 failure_code = 3;
1207}
1208
1209/**
1210 * Log an event when the device has been physically dropped.
1211 * Reported from the /vendor partition.
1212 */
1213message PhysicalDropDetected {
1214 // Confidence that the event was actually a drop, 0 -> 100
1215 optional int32 confidence_pctg = 1;
1216 // Peak acceleration of the drop, in 1/1000s of a g.
1217 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001218 // Duration of freefall in ms
1219 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001220}
1221
1222/**
1223 * Log bucketed battery charge cycles.
1224 *
1225 * Each bucket represents cycles of the battery past
1226 * a given charge point. For example, bucket 1 is the
1227 * lowest 1/8th of the battery, and bucket 8 is 100%.
1228 *
1229 * Logged from:
1230 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1231 */
1232message ChargeCyclesReported {
1233 optional int32 cycle_bucket_1 = 1;
1234 optional int32 cycle_bucket_2 = 2;
1235 optional int32 cycle_bucket_3 = 3;
1236 optional int32 cycle_bucket_4 = 4;
1237 optional int32 cycle_bucket_5 = 5;
1238 optional int32 cycle_bucket_6 = 6;
1239 optional int32 cycle_bucket_7 = 7;
1240 optional int32 cycle_bucket_8 = 8;
1241}
1242
1243/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001244 * Logs the duration of a davey (jank of >=700ms) when it occurs
1245 *
1246 * Logged from:
1247 * frameworks/base/libs/hwui/JankTracker.cpp
1248 */
1249message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001250 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001251 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001252
Tej Singhbb8554a2018-01-26 11:59:14 -08001253 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001254 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001255}
1256
1257/**
Bookatze5885242017-10-24 20:10:31 -07001258 * Logs phone signal strength changes.
1259 *
1260 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001261 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001262 */
1263message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001264 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1265 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001266}
1267
1268/**
1269 * Logs that a setting was updated.
1270 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001271 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001272 * The tag and is_default allow resetting of settings to default values based on the specified
1273 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1274 */
1275message SettingChanged {
1276 // The name of the setting.
1277 optional string setting = 1;
1278
1279 // The change being imposed on this setting. May represent a number, eg "3".
1280 optional string value = 2;
1281
1282 // The new value of this setting. For most settings, this is same as value. For some settings,
1283 // value is +X or -X where X represents an element in a set. For example, if the previous value
1284 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1285 // The +/- feature is currently only used for location_providers_allowed.
1286 optional string new_value = 3;
1287
1288 // The previous value of this setting.
1289 optional string prev_value = 4;
1290
1291 // The tag used with the is_default for resetting sets of settings. This is generally null.
1292 optional string tag = 5;
1293
Bookatz90867622018-01-31 15:05:57 -08001294 // True if this setting with tag should be resettable.
1295 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001296
David Chenbd789912018-03-16 17:19:55 -07001297 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001298 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001299
1300 enum ChangeReason {
1301 UPDATED = 1; // Updated can be an insertion or an update.
1302 DELETED = 2;
1303 }
1304 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001305}
Chenjie Yub3dda412017-10-24 13:41:59 -07001306
Chenjie Yu05013b32017-11-21 10:21:41 -08001307/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001308 * Logs activity going to foreground or background
1309 *
1310 * Logged from:
1311 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1312 */
1313message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001314 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001315 optional string pkg_name = 2;
1316 optional string class_name = 3;
1317
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001318 enum State {
1319 BACKGROUND = 0;
1320 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001321 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001322 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001323}
David Chenc8a43242017-10-17 16:23:28 -07001324
1325/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001326 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001327 * Logged from:
1328 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1329 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001330message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001331 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001332
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001333 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001334
1335 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001336 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001337 optional string process_name = 3;
1338
1339 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001340 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001341
1342 optional string package_name = 5;
1343
1344 enum InstantApp {
1345 UNAVAILABLE = 0;
1346 FALSE = 1;
1347 TRUE = 2;
1348 }
1349 optional InstantApp is_instant_app = 6;
1350
1351 enum ForegroundState {
1352 UNKNOWN = 0;
1353 BACKGROUND = 1;
1354 FOREGROUND = 2;
1355 }
1356 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001357}
David Chen9e3808c2017-11-20 17:25:34 -08001358
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001359/**
1360 * Logs when a WTF (What a Terrible Failure) happened.
1361 * Logged from:
1362 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1363 */
1364message WTFOccurred {
1365 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001366
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001367 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001368
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001369 // The name of the process.
1370 // system_server if it is not by an app
1371 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001372
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001373 // The pid if available. -1 means not available.
1374 optional sint32 pid = 4;
1375}
1376
1377/**
1378 * Logs when system server reports low memory.
1379 * Logged from:
1380 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1381 */
1382message LowMemReported {
1383}
1384
1385/**
1386 * Logs when an app ANR (App Not Responding) occurs.
1387 * Logged from:
1388 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1389 */
1390message ANROccurred {
1391 optional int32 uid = 1 [(is_uid) = true];
1392
1393 optional string process_name = 2;
1394
1395 optional string short_component_name = 3;
1396
1397 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001398
1399 enum InstantApp {
1400 UNAVAILABLE = 0;
1401 FALSE = 1;
1402 TRUE = 2;
1403 }
1404 optional InstantApp is_instant_app = 5;
1405
1406 enum ForegroundState {
1407 UNKNOWN = 0;
1408 BACKGROUND = 1;
1409 FOREGROUND = 2;
1410 }
1411 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001412}
1413
Bookatza7020bd2018-08-28 16:29:35 -07001414/**
1415 * Logs when the vibrator state changes.
1416 * Logged from:
1417 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1418 */
1419message VibratorStateChanged {
1420 repeated AttributionNode attribution_node = 1;
1421
1422 enum State {
1423 OFF = 0;
1424 ON = 1;
1425 }
1426 optional State state = 2;
1427
1428 // Duration (in milliseconds) requested to keep the vibrator on.
1429 // Only applicable for State == ON.
1430 optional int64 duration_millis = 3;
1431}
1432
David Chen0a368b22017-12-06 16:28:16 -08001433/*
1434 * Allows other apps to push events into statsd.
1435 * Logged from:
1436 * frameworks/base/core/java/android/util/StatsLog.java
1437 */
David Chen0b5c90c2018-01-25 16:51:49 -08001438message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001439 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001440 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001441
1442 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1443 optional int32 label = 2;
1444
1445 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1446 // predicates for the metrics).
1447 enum State {
1448 UNKNOWN = 0;
1449 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1450 STOP = 2;
1451 START = 3;
1452 }
1453 optional State state = 3;
1454}
1455
David Chen9e3808c2017-11-20 17:25:34 -08001456/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001457 * Logs when statsd detects an anomaly.
1458 *
1459 * Logged from:
1460 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1461 */
1462message AnomalyDetected {
1463 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001464 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001465
Yangster-mac94e197c2018-01-02 16:03:03 -08001466 // Id of the config whose anomaly detection alert fired.
1467 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001468
Yangster-mac94e197c2018-01-02 16:03:03 -08001469 // Id of the alert (i.e. name of the anomaly that was detected).
1470 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001471}
1472
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001473message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001474 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001475 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001476
1477 // The app package name.
1478 optional string pkg_name = 2;
1479
1480 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001481 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001482 WARM = 1;
1483 HOT = 2;
1484 COLD = 3;
1485 }
1486 // The transition type.
1487 optional TransitionType type = 3;
1488
1489 // The activity name.
1490 optional string activity_name = 4;
1491
1492 // The name of the calling app. Empty if not set.
1493 optional string calling_pkg_name = 5;
1494
1495 // Whether the app is an instant app.
1496 optional bool is_instant_app = 6;
1497
1498 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001499 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001500
Bookatz80d11a02018-01-16 10:46:35 -08001501 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001502
David Chen0b5c90c2018-01-25 16:51:49 -08001503 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001504 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001505 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001506 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001507 optional int32 bind_application_delay_millis = 11;
1508 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001509
1510 // Empty if not set.
1511 optional string launch_token = 13;
1512
Calin Juravle759fbda2018-02-20 19:52:30 +00001513 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001514 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001515
1516 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001517 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001518}
1519
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001520message AppStartCanceled {
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 WARM = 1;
1530 HOT = 2;
1531 COLD = 3;
1532 }
1533 // The transition type.
1534 optional TransitionType type = 3;
1535
1536 // The activity name.
1537 optional string activity_name = 4;
1538}
1539
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001540message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001541 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001542 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001543
1544 // The app package name.
1545 optional string pkg_name = 2;
1546
1547 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001548 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001549 WITH_BUNDLE = 1;
1550 WITHOUT_BUNDLE = 2;
1551 }
1552 // The transition type.
1553 optional TransitionType type = 3;
1554
1555 // The activity name.
1556 optional string activity_name = 4;
1557
1558 optional bool transition_process_running = 5;
1559
1560 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001561 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001562}
1563
Bookatz8fcd09a2017-12-18 13:01:10 -08001564/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001565 * Logs a picture-in-picture action
1566 * Logged from:
1567 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1568 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1569 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1570 */
1571message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001572 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001573 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001574
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001575 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001576
Chenjie Yu52cacc62017-12-08 18:11:45 -08001577 enum State {
1578 ENTERED = 1;
1579 EXPANDED_TO_FULL_SCREEN = 2;
1580 MINIMIZED = 3;
1581 DISMISSED = 4;
1582 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001583 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001584}
1585
1586/**
Chenjie Yue8904192017-12-08 19:12:57 -08001587 * Logs overlay action
1588 * Logged from:
1589 * services/core/java/com/android/server/wm/Session.java
1590 */
1591message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001592 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001593
1594 optional string package_name = 2;
1595
1596 optional bool using_alert_window = 3;
1597
1598 enum State {
1599 ENTERED = 1;
1600 EXITED = 2;
1601 }
1602 optional State state = 4;
1603}
1604
Chenjie Yuccfe6452018-01-30 11:33:21 -08001605/*
1606 * Logs foreground service starts and stops.
1607 * Note that this is not when a service starts or stops, but when it is
1608 * considered foreground.
1609 * Logged from
1610 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1611 */
1612message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001613 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001614 // package_name + "/" + class_name
1615 optional string short_name = 2;
1616
1617 enum State {
1618 ENTER = 1;
1619 EXIT = 2;
1620 }
1621 optional State state = 3;
1622}
1623
Chenjie Yue8904192017-12-08 19:12:57 -08001624/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001625 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1626 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1627 * attributed back to the parent (host) uid. One example is Chrome.
1628 *
1629 * Logged from:
1630 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1631 */
1632message IsolatedUidChanged {
1633 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001634 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001635 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001636 optional int32 parent_uid = 1;
1637
1638 optional int32 isolated_uid = 2;
1639
1640 // We expect an isolated uid to be removed before if it's used for another parent uid.
1641 enum Event {
1642 REMOVED = 0;
1643 CREATED = 1;
1644 }
1645 optional Event event = 3;
1646}
1647
1648/*
1649 * Logs the reception of an incoming network packet causing the main system to wake up for
1650 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1651 * and processed by WakeupController.cpp.
1652 */
1653message PacketWakeupOccurred {
1654 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1655 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001656 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001657 // The interface name on which the packet was received.
1658 optional string iface = 2;
1659 // The ethertype value of the packet.
1660 optional int32 ethertype = 3;
1661 // String representation of the destination MAC address of the packet.
1662 optional string destination_hardware_address = 4;
1663 // String representation of the source address of the packet if this was an IP packet.
1664 optional string source_ip = 5;
1665 // String representation of the destination address of the packet if this was an IP packet.
1666 optional string destination_ip = 6;
1667 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1668 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1669 // families.
1670 optional int32 ip_next_header = 7;
1671 // The source port if this was a TCP or UDP packet.
1672 optional int32 source_port = 8;
1673 // The destination port if this was a TCP or UDP packet.
1674 optional int32 destination_port = 9;
1675}
1676
1677/*
1678 * Logs the memory stats for an app on startup.
1679 * Logged from:
1680 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1681 */
1682message AppStartMemoryStateCaptured {
1683 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001684 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001685
1686 // The process name.
1687 optional string process_name = 2;
1688
1689 // The activity name.
1690 optional string activity_name = 3;
1691
1692 // # of page-faults
1693 optional int64 pgfault = 4;
1694
1695 // # of major page-faults
1696 optional int64 pgmajfault = 5;
1697
1698 // RSS
1699 optional int64 rss_in_bytes = 6;
1700
1701 // CACHE
1702 optional int64 cache_in_bytes = 7;
1703
1704 // SWAP
1705 optional int64 swap_in_bytes = 8;
1706}
1707
1708/*
1709 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1710 * for LMK event.
1711 * Logged from:
1712 * system/core/lmkd/lmkd.c
1713 */
1714message LmkStateChanged {
1715 enum State {
1716 UNKNOWN = 0;
1717 START = 1;
1718 STOP = 2;
1719 }
1720 optional State state = 1;
1721}
1722
1723/*
1724 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1725 * Logged from:
1726 * system/core/lmkd/lmkd.c
1727 */
1728message LmkKillOccurred {
1729 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001730 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001731
1732 // The process name.
1733 optional string process_name = 2;
1734
1735 // oom adj score.
1736 optional int32 oom_score = 3;
1737
1738 // # of page-faults
1739 optional int64 pgfault = 4;
1740
1741 // # of major page-faults
1742 optional int64 pgmajfault = 5;
1743
1744 // RSS
1745 optional int64 rss_in_bytes = 6;
1746
1747 // CACHE
1748 optional int64 cache_in_bytes = 7;
1749
1750 // SWAP
1751 optional int64 swap_in_bytes = 8;
1752}
1753
Rajeev Kumar51b54602018-03-01 12:18:26 -08001754/*
1755 * Logs when the ActivityManagerService detects that an app died.
1756 *
1757 * Logged from:
1758 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1759 */
1760message AppDied {
1761 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001762 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001763}
1764
Howard Ro21a039c2018-08-06 14:55:47 -07001765/**
1766 * An atom for generic metrics logging. Available from Android Q.
1767 */
1768message GenericAtom {
1769 // The uid of the application that sent this custom atom.
1770 optional int32 uid = 1 [(is_uid) = true];
1771
1772 // An event_id indicates the type of event.
1773 optional int32 event_id = 2;
1774}
1775
Chenjie Yubbcbc602018-02-05 16:51:52 -08001776//////////////////////////////////////////////////////////////////////
1777// Pulled atoms below this line //
1778//////////////////////////////////////////////////////////////////////
1779
1780/**
David Chenc8a43242017-10-17 16:23:28 -07001781 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1782 *
1783 * Pulled from:
1784 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1785 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001786message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001787 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001788
1789 optional int64 rx_bytes = 2;
1790
1791 optional int64 rx_packets = 3;
1792
1793 optional int64 tx_bytes = 4;
1794
1795 optional int64 tx_packets = 5;
1796}
1797
1798/**
1799 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1800 *
1801 * Pulled from:
1802 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1803 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001804message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001805 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001806
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001807 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1808 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001809
1810 optional int64 rx_bytes = 3;
1811
1812 optional int64 rx_packets = 4;
1813
1814 optional int64 tx_bytes = 5;
1815
1816 optional int64 tx_packets = 6;
1817}
1818
1819/**
1820 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1821 *
1822 * Pulled from:
1823 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1824 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001825message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001826 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001827
1828 optional int64 rx_bytes = 2;
1829
1830 optional int64 rx_packets = 3;
1831
1832 optional int64 tx_bytes = 4;
1833
1834 optional int64 tx_packets = 5;
1835}
1836
1837/**
1838 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1839 *
1840 * Pulled from:
1841 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1842 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001843message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001844 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001845
Yao Chenc40a19d2018-03-15 16:48:25 -07001846 // 1 denotes foreground and 0 denotes background. This is called Set in
1847 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001848 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001849
1850 optional int64 rx_bytes = 3;
1851
1852 optional int64 rx_packets = 4;
1853
1854 optional int64 tx_bytes = 5;
1855
1856 optional int64 tx_packets = 6;
1857}
1858
1859/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001860 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1861 *
1862 * Pulled from:
1863 * StatsCompanionService
1864 */
1865message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001866 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001867
1868 optional int64 rx_bytes = 2;
1869
1870 optional int64 tx_bytes = 3;
1871}
1872
1873/**
David Chenc8a43242017-10-17 16:23:28 -07001874 * Pulls the kernel wakelock durations. This atom is adapted from
1875 * android/internal/os/KernelWakelockStats.java
1876 *
1877 * Pulled from:
1878 * StatsCompanionService using KernelWakelockReader.
1879 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001880message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001881 optional string name = 1;
1882
1883 optional int32 count = 2;
1884
1885 optional int32 version = 3;
1886
1887 optional int64 time = 4;
1888}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001889
Chenjie Yu05013b32017-11-21 10:21:41 -08001890/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001891 * Pulls low power state information. This includes platform and subsystem sleep state information,
1892 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001893 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001894 * hardware/interfaces/power/1.1/types.hal
1895 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001896message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001897 // Subsystem name
1898 optional string subsystem_name = 1;
1899 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1900 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1901 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001902 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001903 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001904 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001905 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001906}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001907
Chenjie Yu05013b32017-11-21 10:21:41 -08001908/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001909 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001910 * Pulls the time the cpu spend on the frequency index. Frequency index
1911 * starts from highest to lowest. The value should be monotonically
1912 * increasing since boot. However, if there is a cpu
1913 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001914 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001915message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001916 optional uint32 cluster = 1;
1917 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001918 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001919}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001920
Chenjie Yu05013b32017-11-21 10:21:41 -08001921/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001922 * Pulls Cpu Time Per Uid.
1923 * Note that isolated process uid time should be attributed to host uids.
1924 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001925message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001926 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001927 optional uint64 user_time_millis = 2;
1928 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001929}
1930
1931/**
1932 * Pulls Cpu Time Per Uid per frequency.
1933 * Note that isolated process uid time should be attributed to host uids.
1934 * For each uid, we order the time by descending frequencies.
1935 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001936message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001937 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001938 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001939 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001940}
Hugo Benichi884970e2017-11-14 22:42:46 +09001941
Chenjie Yu05013b32017-11-21 10:21:41 -08001942/**
1943 * Pulls Wifi Controller Activity Energy Info
1944 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001945message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001946 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001947 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001948 // stack reported state
1949 // TODO: replace this with proto enum
1950 optional int32 stack_state = 2;
1951 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001952 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001953 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001954 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001955 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001956 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001957 // product of current(mA), voltage(V) and time(ms)
1958 optional uint64 controller_energy_used = 6;
1959}
1960
1961/**
1962 * Pulls Modem Activity Energy Info
1963 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001964message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001965 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001966 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001967 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001968 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001969 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001970 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001971 /**
1972 * Tx power index
1973 * index 0 = tx_power < 0dBm
1974 * index 1 = 0dBm < tx_power < 5dBm
1975 * index 2 = 5dBm < tx_power < 15dBm
1976 * index 3 = 15dBm < tx_power < 20dBm
1977 * index 4 = tx_power > 20dBm
1978 */
1979 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001980 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001981 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001982 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001983 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001984 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001985 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001986 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001987 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001988 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001989 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001990 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001991 // product of current(mA), voltage(V) and time(ms)
1992 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001993}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001994
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001995/**
1996 * Pulls Bluetooth Activity Energy Info
1997 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1998 */
1999message BluetoothActivityInfo {
2000 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002001 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002002 // bluetooth stack state
2003 optional int32 bluetooth_stack_state = 2;
2004 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002005 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002006 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002007 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002008 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002009 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002010 // product of current(mA), voltage(V) and time(ms)
2011 optional uint64 energy_used = 6;
2012}
2013
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002014/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002015 * Logs the memory stats for a process.
2016 */
2017message ProcessMemoryState {
2018 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002019 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002020
2021 // The process name.
2022 optional string process_name = 2;
2023
2024 // oom adj score.
2025 optional int32 oom_score = 3;
2026
2027 // # of page-faults
2028 optional int64 pgfault = 4;
2029
2030 // # of major page-faults
2031 optional int64 pgmajfault = 5;
2032
Rajeev Kumar90235992018-01-29 11:06:48 -08002033 // RSS
2034 optional int64 rss_in_bytes = 6;
2035
2036 // CACHE
2037 optional int64 cache_in_bytes = 7;
2038
2039 // SWAP
2040 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002041}
2042
2043/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002044 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002045 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002046message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002047 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002048}
2049
2050/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002051 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002052 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002053message SystemUptime {
2054 // Milliseconds since the system was booted.
2055 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2056 // for external input).
2057 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002058 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002059}
2060
2061/*
2062 * Reads from /proc/uid_concurrent_active_time which has the format:
2063 * active: X (X is # cores)
2064 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2065 * [uid1]: [time-0] [time-1] [time-2] ... ...
2066 * ...
2067 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2068 * The file contains a monotonically increasing count of time for a single boot.
2069 */
2070message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002071 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002072 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002073}
2074
2075/**
2076 * Reads from /proc/uid_concurrent_policy_time which has the format:
2077 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2078 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2079 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2080 * ...
2081 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2082 * The file contains a monotonically increasing count of time for a single boot.
2083 */
2084message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002085 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002086 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002087 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002088}
2089
2090/*
2091 * Pulls free disk space, for data, system partition and temporary directory.
2092 */
2093message DiskSpace {
2094 // available bytes in data partition
2095 optional uint64 data_available_bytes = 1;
2096 // available bytes in system partition
2097 optional uint64 system_available_bytes = 2;
2098 // available bytes in download cache or temp directories
2099 optional uint64 temp_available_bytes = 3;
2100}
Tej Singhbf972d92018-01-10 20:51:13 -08002101
2102/**
2103 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002104 * Pulled from:
2105 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002106 */
2107message RemainingBatteryCapacity {
2108 optional int32 charge_uAh = 1;
2109}
2110
2111/**
2112 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002113 * Pulled from:
2114 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002115 */
2116message FullBatteryCapacity {
2117 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002118}
2119
2120/**
Tej Singhd89137e2018-03-26 14:51:40 -07002121 * Pulls the temperature of various parts of the device.
2122 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002123 *
2124 * Pulled from:
2125 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2126 */
2127message Temperature {
2128 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2129 optional android.os.TemperatureTypeEnum sensor_location = 1;
2130
2131 // The name of the temperature source. Eg. CPU0
2132 optional string sensor_name = 2;
2133
Tej Singhd89137e2018-03-26 14:51:40 -07002134 // Temperature in tenths of a degree C.
2135 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002136}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002137
2138/**
2139 * Pulls the statistics of calls to Binder.
2140 *
2141 * Binder stats are cumulative from boot unless somebody reset the data using
2142 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002143 *
2144 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002145 */
2146message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002147 optional int32 uid = 1 [(is_uid) = true];
2148 // Fully qualified class name of the API call.
2149 //
2150 // This is a system server class name.
2151 //
2152 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2153 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2154 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2155 // commonly used APIs.
2156 optional string service_class_name = 2;
2157 // Method name of the API call. It can also be a transaction code if we cannot
2158 // resolve it to a name. See Binder#getTransactionName.
2159 //
2160 // This is a system server method name.
2161 optional string service_method_name = 3;
2162 // Total number of API calls.
2163 optional int64 call_count = 4;
2164 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2165 optional bool screen_interactive = 13;
2166 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2167 // call_count will be equal to recorded_call_count.
2168 //
2169 // If recorded_call_count is different than call_count, it means data collection has been
2170 // sampled. All the fields below will be sampled in this case.
2171 optional int64 recorded_call_count = 12;
2172 // Number of exceptions thrown by the API.
2173 optional int64 recorded_exception_count = 5;
2174 // Total latency of all API calls.
2175 // Average can be computed using total_latency_micros / recorded_call_count.
2176 optional int64 recorded_total_latency_micros = 6;
2177 // Maximum latency of one API call.
2178 optional int64 recorded_max_latency_micros = 7;
2179 // Total CPU usage of all API calls.
2180 // Average can be computed using total_cpu_micros / recorded_call_count.
2181 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2182 optional int64 recorded_total_cpu_micros = 8;
2183 // Maximum CPU usage of one API call.
2184 optional int64 recorded_max_cpu_micros = 9;
2185 // Maximum parcel reply size of one API call.
2186 optional int64 recorded_max_reply_size_bytes = 10;
2187 // Maximum parcel request size of one API call.
2188 optional int64 recorded_max_request_size_bytes = 11;
2189}
2190
2191/**
2192 * Pulls the statistics of exceptions during calls to Binder.
2193 *
2194 * Binder stats are cumulative from boot unless somebody reset the data using
2195 * > adb shell dumpsys binder_calls_stats --reset
2196 */
2197message BinderCallsExceptions {
2198 // Exception class name, e.g. java.lang.IllegalArgumentException.
2199 //
2200 // This is an exception class name thrown by the system server.
2201 optional string exception_class_name = 1;
2202 // Total number of exceptions.
2203 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002204}