blob: 3bd1bb08fd0cbd2a3d86a196a45f1be362bd6edd [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";
Howard Ro0546d542018-08-30 16:23:44 -070032import "frameworks/base/proto/src/stats_enums.proto";
Chenjie Yu159e4f82018-08-29 11:49:11 -070033import "frameworks/base/core/proto/android/service/procstats.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080034
Yao Chend54f9dd2017-10-17 17:37:48 +000035/**
Stefan Lafonae2df012017-11-14 09:17:21 -080036 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000037 * raw stats log events from the Android system, also known as "atoms."
38 *
39 * This field contains a single oneof with all of the available messages.
40 * The stats-log-api-gen tool runs as part of the Android build and
41 * generates the android.util.StatsLog class, which contains the constants
42 * and methods that Android uses to log.
43 *
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * Instead, statsd on Android constructs these messages synthetically,
46 * in the format defined here and in stats_log.proto.
47 */
Stefan Lafonae2df012017-11-14 09:17:21 -080048message Atom {
49 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070050 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070051 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
52 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070053 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070054 BleScanResultReceived ble_scan_result_received = 4;
55 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080056 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070057 SyncStateChanged sync_state_changed = 7;
58 ScheduledJobStateChanged scheduled_job_state_changed = 8;
59 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070060 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080061 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
62 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
63 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070064 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
65 MemoryFactorStateChanged memory_factor_state_changed = 15;
66 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
67 CachedKillReported cached_kill_reported = 17;
68 ProcessMemoryStatReported process_memory_stat_reported = 18;
69 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080070 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
71 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
72 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070073 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080074 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070075 CameraStateChanged camera_state_changed = 25;
76 FlashlightStateChanged flashlight_state_changed = 26;
77 UidProcessStateChanged uid_process_state_changed = 27;
78 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
79 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070080 BatteryLevelChanged battery_level_changed = 30;
81 ChargingStateChanged charging_state_changed = 31;
82 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080083 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070084 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
85 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070086 WifiLockStateChanged wifi_lock_state_changed = 37;
87 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
88 WifiScanStateChanged wifi_scan_state_changed = 39;
89 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070090 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070091 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070092 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090093 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070094 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080095 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080096 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080097 AppStartOccurred app_start_occurred = 48;
98 AppStartCanceled app_start_canceled = 49;
99 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800100 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800101 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800102 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkStateChanged lmk_state_changed = 54;
104 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800105 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800106 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800107 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800108 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800109 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800110 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800111 KeyguardStateChanged keyguard_state_changed = 62;
112 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
113 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800114 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800115 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800116 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
117 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700118 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700119 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800120 SpeakerImpedanceReported speaker_impedance_reported = 71;
121 HardwareFailed hardware_failed = 72;
122 PhysicalDropDetected physical_drop_detected = 73;
123 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800124 MobileConnectionStateChanged mobile_connection_state_changed = 75;
125 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700126 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800127 AppCrashOccurred app_crash_occurred = 78;
128 ANROccurred anr_occurred = 79;
129 WTFOccurred wtf_occurred = 80;
130 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700131 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700132 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700133 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700134 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700135 ThermalThrottlingStateChanged thermal_throttling = 86;
Yao Chend54f9dd2017-10-17 17:37:48 +0000136 }
David Chenc8a43242017-10-17 16:23:28 -0700137
David Chen6e3e6cb2018-01-03 16:14:06 -0800138 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100139 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700140 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800141 WifiBytesTransfer wifi_bytes_transfer = 10000;
142 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
143 MobileBytesTransfer mobile_bytes_transfer = 10002;
144 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800145 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800147 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800148 CpuTimePerFreq cpu_time_per_freq = 10008;
149 CpuTimePerUid cpu_time_per_uid = 10009;
150 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800151 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800152 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800153 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800154 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800155 SystemElapsedRealtime system_elapsed_realtime = 10014;
156 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800157 CpuActiveTime cpu_active_time = 10016;
158 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000159 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800160 RemainingBatteryCapacity remaining_battery_capacity = 10019;
161 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800162 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100163 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100164 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100165 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000166 DiskStats disk_stats = 10025;
167 DirectoryUsage directory_usage = 10026;
168 AppSize app_size = 10027;
169 CategorySize category_size = 10028;
Chenjie Yu159e4f82018-08-29 11:49:11 -0700170 android.service.procstats.ProcessStatsSectionProto proc_stats = 10029;
David Chenc8a43242017-10-17 16:23:28 -0700171 }
yroa1fe77c2018-02-26 14:22:54 -0800172
173 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
174 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700175}
176
Yao Chend54f9dd2017-10-17 17:37:48 +0000177/**
Yangster-mac20877162017-12-22 17:19:39 -0800178 * This proto represents a node of an attribution chain.
179 * Note: All attribution chains are represented as a repeated field of type
180 * AttributionNode. It is understood that in such arrays, the order is that
181 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000182 */
Yangster-mac20877162017-12-22 17:19:39 -0800183message AttributionNode {
184 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800185 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800186
Yangster-mac20877162017-12-22 17:19:39 -0800187 // The (optional) string tag for an element in the attribution chain. If the
188 // element has no tag, it is encoded as an empty string.
189 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700190}
191
Yangster-mac48b3d622018-08-18 12:38:11 -0700192message KeyValuePair {
193 optional int32 key = 1;
194 oneof value {
195 int64 value_int = 2;
196 string value_str = 3;
197 float value_float = 4;
198 }
199}
200
201message KeyValuePairsAtom {
202 optional int32 uid = 1;
203 repeated KeyValuePair pairs = 2;
204}
205
Yao Chend54f9dd2017-10-17 17:37:48 +0000206/*
207 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800208 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000209 *
210 * RULES:
211 * - The field ids for each atom must start at 1, and count upwards by 1.
212 * Skipping field ids is not allowed.
213 * - These form an API, so renaming, renumbering or removing fields is
214 * not allowed between android releases. (This is not currently enforced,
215 * but there will be a tool to enforce this restriction).
216 * - The types must be built-in protocol buffer types, namely, no sub-messages
217 * are allowed (yet). The bytes type is also not allowed.
218 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800219 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000220 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800221 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000222 * - A field that is a uid should be a string field, tagged with the [xxx]
223 * annotation. The generated code on android will be represented by UIDs,
224 * and those UIDs will be translated in xxx to those strings.
225 *
226 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700227 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000228 * - If there is a UID, it goes first. Think in an object-oriented fashion.
229 * *****************************************************************************
230 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700231
Yao Chend54f9dd2017-10-17 17:37:48 +0000232/**
Yangster-mace16189a2018-08-26 12:20:16 -0700233 * Logs when the Thermal service HAL notifies the throttling start/stop events.
234 *
235 * Logged from:
236 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
237 */
238message ThermalThrottlingStateChanged {
239 optional android.os.TemperatureTypeEnum sensor_type = 1;
240
241 enum State {
242 UNKNOWN = 0;
243 START = 1;
244 STOP = 2;
245 }
246
247 optional State state = 2;
248
249 optional float temperature = 3;
250}
251
252/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000253 * Logs when the screen state changes.
254 *
255 * Logged from:
256 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
257 */
258message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800259 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800260 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700261}
Yao Chend54f9dd2017-10-17 17:37:48 +0000262
263/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700264 * Logs that the process state of the uid, as determined by ActivityManager
265 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000266 *
267 * Logged from:
268 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
269 */
Bookatzc1a050a2017-10-10 15:49:28 -0700270message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700271 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000272
Bookatzdb026a22018-01-10 19:01:56 -0800273 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800274 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000275}
276
277/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700278 * Logs process state change of a process, as per the activity manager.
279 *
280 * Logged from:
281 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
282 */
283message ProcessStateChanged {
284 optional int32 uid = 1;
285 optional string process_name = 2;
286 optional string package_name = 3;
287 // TODO: remove this when validation is done
288 optional int64 version = 5;
289 // The state, from frameworks/base/core/proto/android/app/enums.proto.
290 optional android.app.ProcessStateEnum state = 4;
291}
292
293/**
294 * Logs when ActivityManagerService sleep state is changed.
295 *
296 * Logged from:
297 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
298 */
299message ActivityManagerSleepStateChanged {
300 // TODO: import frameworks proto
301 enum State {
302 UNKNOWN = 0;
303 ASLEEP = 1;
304 AWAKE = 2;
305 }
306 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
307}
308
309/**
310 * Logs when system memory state changes.
311 *
312 * Logged from:
313 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
314 */
315message MemoryFactorStateChanged {
316 // TODO: import frameworks proto
317 enum State {
318 MEMORY_UNKNOWN = 0;
319 NORMAL = 1; // normal.
320 MODERATE = 2; // moderate memory pressure.
321 LOW = 3; // low memory.
322 CRITICAL = 4; // critical memory.
323
324 }
325 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
326}
327
328/**
329 * Logs when app is using too much cpu, according to ActivityManagerService.
330 *
331 * Logged from:
332 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
333 */
334message ExcessiveCpuUsageReported {
335 optional int32 uid = 1;
336 optional string process_name = 2;
337 optional string package_name = 3;
338 // package version. TODO: remove this when validation is done
339 optional int64 version = 4;
340}
341
342/**
343 * Logs when a cached process is killed, along with its pss.
344 *
345 * Logged from:
346 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
347 */
348message CachedKillReported {
349 optional int32 uid = 1;
350 optional string process_name = 2;
351 optional string package_name = 3;
352 // TODO: remove this when validation is done
353 optional int64 version = 5;
354 optional int64 pss = 4;
355}
356
357/**
358 * Logs when memory stats of a process is reported.
359 *
360 * Logged from:
361 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
362 */
363message ProcessMemoryStatReported {
364 optional int32 uid = 1;
365 optional string process_name = 2;
366 optional string package_name = 3;
367 //TODO: remove this when validation is done
368 optional int64 version = 9;
369 optional int64 pss = 4;
370 optional int64 uss = 5;
371 optional int64 rss = 6;
372 enum Type {
373 ADD_PSS_INTERNAL_SINGLE = 0;
374 ADD_PSS_INTERNAL_ALL_MEM = 1;
375 ADD_PSS_INTERNAL_ALL_POLL = 2;
376 ADD_PSS_EXTERNAL = 3;
377 ADD_PSS_EXTERNAL_SLOW = 4;
378 }
379 optional Type type = 7;
380 optional int64 duration = 8;
381}
382
383/**
Bookatzc1a050a2017-10-10 15:49:28 -0700384 * Logs that a process started, finished, crashed, or ANRed.
385 *
386 * Logged from:
387 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
388 */
389message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700390 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700391
David Chen0b5c90c2018-01-25 16:51:49 -0800392 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800393 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700394
Bookatzddccf0a2017-11-28 16:48:14 -0800395 // What lifecycle state the process changed to.
396 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800397 enum State {
398 FINISHED = 0;
399 STARTED = 1;
400 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800401 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800402 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700403}
404
Bookatzc1a050a2017-10-10 15:49:28 -0700405/**
406 * Logs when the ble scan state changes.
407 *
408 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700409 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700410 */
411message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800412 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700413
414 enum State {
415 OFF = 0;
416 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700417 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
418 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700419 }
420 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700421
Bookatze5ec0b42018-03-26 13:34:56 -0700422 // Does the scan have a filter.
423 optional bool is_filtered = 3;
424 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
425 optional bool is_first_match = 4;
426 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
427 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700428}
429
430/**
431 * Logs reporting of a ble scan finding results.
432 *
433 * Logged from:
434 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
435 */
436// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
437message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800438 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700439
440 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800441 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700442}
443
444/**
445 * Logs when a sensor state changes.
446 *
447 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700448 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700449 */
450message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800451 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700452
Bookatzc1a050a2017-10-10 15:49:28 -0700453 // The id (int) of the sensor.
454 optional int32 sensor_id = 2;
455
456 enum State {
457 OFF = 0;
458 ON = 1;
459 }
460 optional State state = 3;
461}
462
463
464/**
465 * Logs when GPS state changes.
466 *
467 * Logged from:
468 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
469 */
470message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800471 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700472
473 enum State {
474 OFF = 0;
475 ON = 1;
476 }
477 optional State state = 2;
478}
479
480
481/**
482 * Logs when a sync manager sync state changes.
483 *
484 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700485 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700486 */
487message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800488 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700489
David Chen0b5c90c2018-01-25 16:51:49 -0800490 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800491 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700492
493 enum State {
494 OFF = 0;
495 ON = 1;
496 }
497 optional State state = 3;
498}
499
Yangster-mac96353002018-09-05 11:18:55 -0700500/*
501 * Deferred job stats.
502 *
503 * Logged from:
504 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
505*/
506message DeferredJobStatsReported {
507 repeated AttributionNode attribution_node = 1;
508
509 // Number of jobs deferred.
510 optional int32 num_jobs_deferred = 2;
511
512 // Time since the last job runs.
513 optional int64 time_since_last_job_millis = 3;
514}
515
Bookatzc1a050a2017-10-10 15:49:28 -0700516/**
517 * Logs when a job scheduler job state changes.
518 *
519 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700520 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700521 */
522message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800523 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700524
525 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800526 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700527
528 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800529 FINISHED = 0;
530 STARTED = 1;
531 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700532 }
533 optional State state = 3;
534
Tej Singh33a412b2018-03-16 18:43:59 -0700535 // The reason a job has stopped.
536 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700537 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700538 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700539}
540
541/**
542 * Logs when the audio state changes.
543 *
544 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700545 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700546 */
547message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800548 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700549
550 enum State {
551 OFF = 0;
552 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700553 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
554 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700555 }
556 optional State state = 2;
557}
558
559/**
560 * Logs when the video codec state changes.
561 *
562 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700563 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700564 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800565message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800566 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700567
568 enum State {
569 OFF = 0;
570 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700571 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
572 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700573 }
574 optional State state = 2;
575}
576
577/**
578 * Logs when the flashlight state changes.
579 *
580 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700581 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700582 */
583message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800584 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700585
586 enum State {
587 OFF = 0;
588 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700589 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
590 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700591 }
592 optional State state = 2;
593}
594
595/**
596 * Logs when the camera state changes.
597 *
598 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700599 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700600 */
601message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800602 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700603
604 enum State {
605 OFF = 0;
606 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700607 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
608 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700609 }
610 optional State state = 2;
611}
612
613/**
614 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000615 *
616 * Logged from:
617 * TODO
618 */
Bookatzd6746242017-10-24 18:39:35 -0700619message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800620 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000621
Bookatz1a1b0462018-01-12 11:47:03 -0800622 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
623 // From frameworks/base/core/proto/android/os/enums.proto.
624 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700625
626 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
627 optional string tag = 3;
628
629 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800630 RELEASE = 0;
631 ACQUIRE = 1;
632 CHANGE_RELEASE = 2;
633 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700634 }
635 optional State state = 4;
636}
637
638/**
Bookatzc1a050a2017-10-10 15:49:28 -0700639 * Logs when a partial wakelock is considered 'long' (over 1 min).
640 *
641 * Logged from:
642 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
643 */
644message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800645 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700646
Yao Chend54f9dd2017-10-17 17:37:48 +0000647 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
648 optional string tag = 2;
649
Bookatzc1a050a2017-10-10 15:49:28 -0700650 // TODO: I have no idea what this is.
651 optional string history_tag = 3;
652
653 enum State {
654 OFF = 0;
655 ON = 1;
656 }
657 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000658}
659
Bookatzc1a050a2017-10-10 15:49:28 -0700660/**
661 * Logs Battery Saver state change.
662 *
663 * Logged from:
664 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
665 */
666message BatterySaverModeStateChanged {
667 enum State {
668 OFF = 0;
669 ON = 1;
670 }
671 optional State state = 1;
672}
673
674/**
675 * Logs Doze mode state change.
676 *
677 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800678 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700679 */
680message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800681 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800682}
683
684
685/**
686 * Logs state change of Doze mode including maintenance windows.
687 *
688 * Logged from:
689 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
690 */
691message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800692 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700693}
694
695/**
696 * Logs screen brightness level.
697 *
698 * Logged from:
699 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
700 */
701message ScreenBrightnessChanged {
702 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
703 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700704}
705
706/**
707 * Logs battery level (percent full, from 0 to 100).
708 *
709 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700710 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700711 */
712message BatteryLevelChanged {
713 // Battery level. Should be in [0, 100].
714 optional int32 battery_level = 1;
715}
716
717/**
718 * Logs change in charging status of the device.
719 *
720 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700721 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700722 */
723message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800724 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
725 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700726}
727
728/**
729 * Logs whether the device is plugged in, and what power source it is using.
730 *
731 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700732 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700733 */
734message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800735 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
736 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700737}
738
Bookatz8c6571b2017-10-24 15:04:41 -0700739/**
740 * Logs when an app's wakeup alarm fires.
741 *
742 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700743 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700744 */
745message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800746 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800747
748 // Name of the wakeup alarm.
749 optional string tag = 2;
750}
751
752/**
753 * Logs when an an app causes the mobile radio to change state.
754 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
755 *
756 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700757 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800758 */
759message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800760 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800761
Bookatz1a1b0462018-01-12 11:47:03 -0800762 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
763 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800764}
765
766/**
767 * Logs when an an app causes the wifi radio to change state.
768 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
769 *
770 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700771 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800772 */
773message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800774 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800775
Bookatz1a1b0462018-01-12 11:47:03 -0800776 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
777 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700778}
779
780/**
781 * Logs kernel wakeup reasons and aborts.
782 *
783 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700784 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700785 */
786message KernelWakeupReported {
787 // Name of the kernel wakeup reason (or abort).
788 optional string wakeup_reason_name = 1;
789
790 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800791 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700792}
793
794/**
795 * Logs wifi locks held by an app.
796 *
797 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700798 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700799 */
800message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800801 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700802
803 enum State {
804 OFF = 0;
805 ON = 1;
806 }
807 optional State state = 2;
808}
809
810/**
811 * Logs wifi signal strength changes.
812 *
813 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700814 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700815 */
816message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800817 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
818 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700819}
820
821/**
822 * Logs wifi scans performed by an app.
823 *
824 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700825 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700826 */
827message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800828 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700829
830 enum State {
831 OFF = 0;
832 ON = 1;
833 }
834 optional State state = 2;
835}
836
837/**
Tej Singh4503e102018-01-04 14:35:01 -0800838 * Logs wifi multicast locks held by an app
839 *
840 * Logged from:
841 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
842 */
843message WifiMulticastLockStateChanged {
844 repeated AttributionNode attribution_node = 1;
845
846 enum State {
847 OFF = 0;
848 ON = 1;
849 }
850 optional State state = 2;
851}
852
853/**
Tej Singh1ea42892018-01-19 09:27:00 -0800854 * Logs shutdown reason and duration on next boot.
855 *
856 * Logged from:
857 * frameworks/base/core/java/com/android/server/BootReceiver.java
858 */
859message ShutdownSequenceReported {
860 // True if shutdown is for a reboot. Default: false if we do not know.
861 optional bool reboot = 1;
862
863 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
864 optional string reason = 2;
865
866 // Beginning of shutdown time in ms using wall clock time since unix epoch.
867 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800868 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800869
870 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800871 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800872}
873
Tej Singh6483ea42018-01-25 17:45:49 -0800874
875/**
876 * Logs boot reason and duration.
877 *
878 * Logged from:
879 * system/core/bootstat/bootstat.cpp
880 */
881message BootSequenceReported {
882 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
883 // Default: "<EMPTY>" if not available.
884 optional string bootloader_reason = 1;
885
886 // Reason for system boot. Eg. bootloader, reboot,userrequested
887 // Default: "<EMPTY>" if not available.
888 optional string system_reason = 2;
889
890 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800891 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800892
893 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800894 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800895
896 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800897 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800898
899 // Time since last boot in ms. Default: 0 if not available.
900 optional int64 time_since_last_boot = 6;
901}
902
Tej Singhc477d9c2018-02-05 18:31:39 -0800903
904/**
905 * Logs call state and disconnect cause (if applicable).
906 *
907 * Logged from:
908 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
909 */
910message CallStateChanged {
911 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
912 // From frameworks/base/core/proto/android/telecomm/enums.proto.
913 optional android.telecom.CallStateEnum call_state = 1;
914
915 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
916 // This value is only applicable when the call_state is DISCONNECTED, and
917 // should always be UNKNOWN if the call_state is not DISCONNECTED.
918 // From frameworks/base/core/proto/android/telecomm/enums.proto.
919 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
920
921 // True if the call is self-managed, which are apps that use the
922 // telecom infrastructure to make their own calls.
923 optional bool self_managed = 3;
924
925 // True if call is external. External calls are calls on connected Wear
926 // devices but show up in Telecom so the user can pull them onto the device.
927 optional bool external_call = 4;
928}
929
Tej Singh1ea42892018-01-19 09:27:00 -0800930/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800931 * Logs keyguard state. The keyguard is the lock screen.
932 *
933 * Logged from:
934 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
935 */
936message KeyguardStateChanged {
937 enum State {
938 UNKNOWN = 0;
939 // The keyguard is hidden when the phone is unlocked.
940 HIDDEN = 1;
941 // The keyguard is shown when the phone is locked (screen turns off).
942 SHOWN= 2;
943 // The keyguard is occluded when something is overlaying the keyguard.
944 // Eg. Opening the camera while on the lock screen.
945 OCCLUDED = 3;
946 }
947 optional State state = 1;
948}
949
950/**
951 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
952 * prompts the user to enter a password (pattern, pin, etc).
953 *
954 * Logged from:
955 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
956 */
957
958message KeyguardBouncerStateChanged {
959 enum State {
960 UNKNOWN = 0;
961 // Bouncer is hidden, either as a result of successfully entering the
962 // password, screen timing out, or user going back to lock screen.
963 HIDDEN = 1;
964 // This is when the user is being prompted to enter the password.
965 SHOWN = 2;
966 }
967 optional State state = 1;
968}
969
970/**
971 * Logs the result of entering a password into the keyguard bouncer.
972 *
973 * Logged from:
974 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
975 */
976message KeyguardBouncerPasswordEntered {
977 enum BouncerResult {
978 UNKNOWN = 0;
979 // The password entered was incorrect.
980 FAILURE = 1;
981 // The password entered was correct.
982 SUCCESS = 2;
983 }
984 optional BouncerResult result = 1;
985}
986
Tej Singha883b372018-02-15 11:30:01 -0800987/*
988 * Logs changes to the configuration of the device. The configuration is defined
989 * in frameworks/base/core/java/android/content/res/Configuration.java
990 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
991 * Please go there to interpret the possible values each field can be.
992 *
993 * Logged from:
994 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
995 */
996message ResourceConfigurationChanged {
997 // Bit mask of color capabilities of the screen.
998 // Contains information about the color gamut and hdr mode of the screen.
999 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1000 optional int32 colorMode = 1;
1001
1002 // The target screen density being rendered to.
1003 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1004 optional int32 densityDpi = 2;
1005
1006 // Current user preference for the scaling factor for fonts,
1007 // relative to the base density scaling.
1008 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1009 optional float fontScale = 3;
1010
1011 // Flag indicating whether the hard keyboard is hidden.
1012 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1013 optional int32 hardKeyboardHidden = 4;
1014
1015 // The type of keyboard attached to the device.
1016 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1017 optional int32 keyboard = 5;
1018
1019 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1020 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1021 optional int32 keyboardHideen = 6;
1022
1023 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1024 // 0 if undefined.
1025 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1026 optional int32 mcc = 7;
1027
1028 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1029 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1030 // MNC_ZERO symbol defined in Configuration.java.
1031 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1032 optional int32 mnc = 8;
1033
1034 // The kind of navigation available on the device.
1035 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1036 optional int32 navigation = 9;
1037
1038 // Flag indicating whether the navigation is available.
1039 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1040 optional int32 navigationHidden = 10;
1041
1042 // Overall orientation of the screen.
1043 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1044 optional int32 orientation = 11;
1045
1046 // The current height of the available screen space, in dp units.
1047 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1048 optional int32 screenHeightDp = 12;
1049
1050 // Bit mask of overall layout of the screen.
1051 // Contains information about screen size, whether the screen is wider/taller
1052 // than normal, whether the screen layout is right-tl-left or left-to-right,
1053 // and whether the screen has a rounded shape.
1054 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1055 optional int32 screenLayout = 13;
1056
1057 // Current width of the available screen space, in dp units.
1058 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1059 optional int32 screenWidthDp = 14;
1060
1061 // The smallest screen size an application will see in normal operation.
1062 // This is the smallest value of both screenWidthDp and screenHeightDp
1063 // in portrait and landscape.
1064 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1065 optional int32 smallestScreenWidthDp = 15;
1066
1067 // The type of touch screen attached to the device.
1068 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1069 optional int32 touchscreen = 16;
1070
1071 // Bit mask of the ui mode.
1072 // Contains information about the overall ui mode of the device.
1073 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1074 // Also contains information about whether the device is in night mode.
1075 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1076 optional int32 uiMode = 17;
1077}
1078
Tej Singheee317b2018-03-07 19:28:05 -08001079
1080/**
1081 * Logs changes in the connection state of the mobile radio.
1082 *
1083 * Logged from:
1084 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1085 */
1086message MobileConnectionStateChanged {
1087 // States are from the state machine DataConnection.java.
1088 enum State {
1089 UNKNOWN = 0;
1090 // The connection is inactive, or disconnected.
1091 INACTIVE = 1;
1092 // The connection is being activated, or connecting.
1093 ACTIVATING = 2;
1094 // The connection is active, or connected.
1095 ACTIVE = 3;
1096 // The connection is disconnecting.
1097 DISCONNECTING = 4;
1098 // The connection is disconnecting after creating a connection.
1099 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1100 }
1101 optional State state = 1;
1102 // For multi-sim phones, this distinguishes between the sim cards.
1103 optional int32 sim_slot_index = 2;
1104 // Used to identify the connection. Starts at 0 and increments by 1 for
1105 // every new network created. Resets whenever the device reboots.
1106 optional int32 data_connection_id = 3;
1107 // A bitmask for the capabilities of this connection.
1108 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1109 // Default value (if we have no information): 0
1110 optional int64 capabilities = 4;
1111 // If this connection has internet.
1112 // This just checks if the DEFAULT bit of capabilities is set.
1113 optional bool has_internet = 5;
1114}
1115
1116/**
1117 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1118 *
1119 * Logged from:
1120 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1121 */
1122message MobileRadioTechnologyChanged {
1123 optional android.telephony.NetworkTypeEnum state = 1;
1124 // For multi-sim phones, this distinguishes between the sim cards.
1125 optional int32 sim_slot_index = 2;
1126}
1127
Andrew Chantb56388b2018-03-22 21:07:33 -07001128/**
1129 * Logs the VID and PID of any connected USB devices.
1130 *
1131 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1132 *
1133 * Logged by Vendor.
1134 */
1135message UsbDeviceAttached {
1136 optional int32 vid = 1;
1137 optional int32 pid = 2;
1138 optional bool has_audio = 3;
1139 optional bool has_hid = 4;
1140 optional bool has_storage = 5;
1141}
1142
Tej Singheee317b2018-03-07 19:28:05 -08001143
Tej Singhdd7bd352018-02-09 19:33:15 -08001144/**
Tej Singh5d991e12018-03-09 19:48:11 -08001145 * Logs when Bluetooth is enabled and disabled.
1146 *
1147 * Logged from:
1148 * services/core/java/com/android/server/BluetoothManagerService.java
1149 */
1150message BluetoothEnabledStateChanged {
1151 repeated AttributionNode attribution_node = 1;
1152 // Whether or not bluetooth is enabled on the device.
1153 enum State {
1154 UNKNOWN = 0;
1155 ENABLED = 1;
1156 DISABLED = 2;
1157 }
1158 optional State state = 2;
1159 // The reason for being enabled/disabled.
1160 // Eg. Airplane mode, crash, application request.
1161 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1162 // If the reason is an application request, this will be the package name.
1163 optional string pkgName = 4;
1164}
1165
1166/**
1167 * Logs when a Bluetooth device connects and disconnects.
1168 *
1169 * Logged from:
1170 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1171 */
1172message BluetoothConnectionStateChanged {
1173 // The state of the connection.
1174 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1175 optional android.bluetooth.ConnectionStateEnum state = 1;
1176 // An identifier that can be used to match connect and disconnect events.
1177 // Currently is last two bytes of a hash of a device level ID and
1178 // the mac address of the bluetooth device that is connected.
1179 optional int32 obfuscated_id = 2;
1180 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1181 // From android.bluetooth.BluetoothAdapter.java
1182 optional int32 bt_profile = 3;
1183}
1184
1185/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001186 * Logs when something is plugged into or removed from the USB-C connector.
1187 *
1188 * Logged from:
1189 * Vendor USB HAL.
1190 */
1191message UsbConnectorStateChanged {
1192 enum State {
1193 DISCONNECTED = 0;
1194 CONNECTED = 1;
1195 }
1196 optional State state = 1;
1197}
1198
1199/**
1200 * Logs the reported speaker impedance.
1201 *
1202 * Logged from:
1203 * Vendor audio implementation.
1204 */
1205message SpeakerImpedanceReported {
1206 optional int32 speaker_location = 1;
1207 optional int32 impedance = 2;
1208}
1209
1210/**
1211 * Logs the report of a failed hardware.
1212 *
1213 * Logged from:
1214 * Vendor HALs.
1215 *
1216 */
1217message HardwareFailed {
1218 enum HardwareType {
1219 HARDWARE_FAILED_UNKNOWN = 0;
1220 HARDWARE_FAILED_MICROPHONE = 1;
1221 HARDWARE_FAILED_CODEC = 2;
1222 HARDWARE_FAILED_SPEAKER = 3;
1223 HARDWARE_FAILED_FINGERPRINT = 4;
1224 }
1225 optional HardwareType hardware_type = 1;
1226
1227 /* hardware_location allows vendors to differentiate between multiple instances of
1228 * the same hardware_type. The specific locations are vendor defined integers,
1229 * referring to board-specific numbering schemes.
1230 */
1231 optional int32 hardware_location = 2;
1232
1233 /* failure_code is specific to the HardwareType of the failed hardware.
1234 * It should use the enum values defined below.
1235 */
1236 enum MicrophoneFailureCode {
1237 MICROPHONE_FAILURE_COMPLETE = 0;
1238 }
1239 enum CodecFailureCode {
1240 CODEC_FAILURE_COMPLETE = 0;
1241 }
1242 enum SpeakerFailureCode {
1243 SPEAKER_FAILURE_COMPLETE = 0;
1244 SPEAKER_FAILURE_HIGH_Z = 1;
1245 SPEAKER_FAILURE_SHORT = 2;
1246 }
1247 enum FingerprintFailureCode {
1248 FINGERPRINT_FAILURE_COMPLETE = 0;
1249 FINGERPRINT_SENSOR_BROKEN = 1;
1250 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1251 }
1252 optional int32 failure_code = 3;
1253}
1254
1255/**
1256 * Log an event when the device has been physically dropped.
1257 * Reported from the /vendor partition.
1258 */
1259message PhysicalDropDetected {
1260 // Confidence that the event was actually a drop, 0 -> 100
1261 optional int32 confidence_pctg = 1;
1262 // Peak acceleration of the drop, in 1/1000s of a g.
1263 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001264 // Duration of freefall in ms
1265 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001266}
1267
1268/**
1269 * Log bucketed battery charge cycles.
1270 *
1271 * Each bucket represents cycles of the battery past
1272 * a given charge point. For example, bucket 1 is the
1273 * lowest 1/8th of the battery, and bucket 8 is 100%.
1274 *
1275 * Logged from:
1276 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1277 */
1278message ChargeCyclesReported {
1279 optional int32 cycle_bucket_1 = 1;
1280 optional int32 cycle_bucket_2 = 2;
1281 optional int32 cycle_bucket_3 = 3;
1282 optional int32 cycle_bucket_4 = 4;
1283 optional int32 cycle_bucket_5 = 5;
1284 optional int32 cycle_bucket_6 = 6;
1285 optional int32 cycle_bucket_7 = 7;
1286 optional int32 cycle_bucket_8 = 8;
1287}
1288
1289/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001290 * Logs the duration of a davey (jank of >=700ms) when it occurs
1291 *
1292 * Logged from:
1293 * frameworks/base/libs/hwui/JankTracker.cpp
1294 */
1295message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001296 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001297 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001298
Tej Singhbb8554a2018-01-26 11:59:14 -08001299 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001300 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001301}
1302
1303/**
Bookatze5885242017-10-24 20:10:31 -07001304 * Logs phone signal strength changes.
1305 *
1306 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001307 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001308 */
1309message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001310 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1311 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001312}
1313
1314/**
1315 * Logs that a setting was updated.
1316 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001317 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001318 * The tag and is_default allow resetting of settings to default values based on the specified
1319 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1320 */
1321message SettingChanged {
1322 // The name of the setting.
1323 optional string setting = 1;
1324
1325 // The change being imposed on this setting. May represent a number, eg "3".
1326 optional string value = 2;
1327
1328 // The new value of this setting. For most settings, this is same as value. For some settings,
1329 // value is +X or -X where X represents an element in a set. For example, if the previous value
1330 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1331 // The +/- feature is currently only used for location_providers_allowed.
1332 optional string new_value = 3;
1333
1334 // The previous value of this setting.
1335 optional string prev_value = 4;
1336
1337 // The tag used with the is_default for resetting sets of settings. This is generally null.
1338 optional string tag = 5;
1339
Bookatz90867622018-01-31 15:05:57 -08001340 // True if this setting with tag should be resettable.
1341 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001342
David Chenbd789912018-03-16 17:19:55 -07001343 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001344 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001345
1346 enum ChangeReason {
1347 UPDATED = 1; // Updated can be an insertion or an update.
1348 DELETED = 2;
1349 }
1350 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001351}
Chenjie Yub3dda412017-10-24 13:41:59 -07001352
Chenjie Yu05013b32017-11-21 10:21:41 -08001353/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001354 * Logs activity going to foreground or background
1355 *
1356 * Logged from:
1357 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1358 */
1359message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001360 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001361 optional string pkg_name = 2;
1362 optional string class_name = 3;
1363
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001364 enum State {
1365 BACKGROUND = 0;
1366 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001367 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001368 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001369}
David Chenc8a43242017-10-17 16:23:28 -07001370
1371/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001372 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001373 * Logged from:
1374 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1375 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001376message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001377 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001378
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001379 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001380
1381 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001382 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001383 optional string process_name = 3;
1384
1385 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001386 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001387
1388 optional string package_name = 5;
1389
1390 enum InstantApp {
1391 UNAVAILABLE = 0;
1392 FALSE = 1;
1393 TRUE = 2;
1394 }
1395 optional InstantApp is_instant_app = 6;
1396
1397 enum ForegroundState {
1398 UNKNOWN = 0;
1399 BACKGROUND = 1;
1400 FOREGROUND = 2;
1401 }
1402 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001403}
David Chen9e3808c2017-11-20 17:25:34 -08001404
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001405/**
1406 * Logs when a WTF (What a Terrible Failure) happened.
1407 * Logged from:
1408 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1409 */
1410message WTFOccurred {
1411 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001412
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001413 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001414
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001415 // The name of the process.
1416 // system_server if it is not by an app
1417 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001418
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001419 // The pid if available. -1 means not available.
1420 optional sint32 pid = 4;
1421}
1422
1423/**
1424 * Logs when system server reports low memory.
1425 * Logged from:
1426 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1427 */
1428message LowMemReported {
1429}
1430
1431/**
1432 * Logs when an app ANR (App Not Responding) occurs.
1433 * Logged from:
1434 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1435 */
1436message ANROccurred {
1437 optional int32 uid = 1 [(is_uid) = true];
1438
1439 optional string process_name = 2;
1440
1441 optional string short_component_name = 3;
1442
1443 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001444
1445 enum InstantApp {
1446 UNAVAILABLE = 0;
1447 FALSE = 1;
1448 TRUE = 2;
1449 }
1450 optional InstantApp is_instant_app = 5;
1451
1452 enum ForegroundState {
1453 UNKNOWN = 0;
1454 BACKGROUND = 1;
1455 FOREGROUND = 2;
1456 }
1457 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001458}
1459
Bookatza7020bd2018-08-28 16:29:35 -07001460/**
1461 * Logs when the vibrator state changes.
1462 * Logged from:
1463 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1464 */
1465message VibratorStateChanged {
1466 repeated AttributionNode attribution_node = 1;
1467
1468 enum State {
1469 OFF = 0;
1470 ON = 1;
1471 }
1472 optional State state = 2;
1473
1474 // Duration (in milliseconds) requested to keep the vibrator on.
1475 // Only applicable for State == ON.
1476 optional int64 duration_millis = 3;
1477}
1478
David Chen0a368b22017-12-06 16:28:16 -08001479/*
1480 * Allows other apps to push events into statsd.
1481 * Logged from:
1482 * frameworks/base/core/java/android/util/StatsLog.java
1483 */
David Chen0b5c90c2018-01-25 16:51:49 -08001484message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001485 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001486 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001487
1488 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1489 optional int32 label = 2;
1490
1491 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1492 // predicates for the metrics).
1493 enum State {
1494 UNKNOWN = 0;
1495 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1496 STOP = 2;
1497 START = 3;
1498 }
1499 optional State state = 3;
1500}
1501
David Chen9e3808c2017-11-20 17:25:34 -08001502/**
Bookatz7948c872018-09-04 12:58:33 -07001503 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1504 * For example, this could be due to the user manually changing the time.
1505 *
1506 * Logged from:
1507 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1508 */
1509message WallClockTimeShifted {
1510 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1511 optional int64 wall_clock_timestamp_millis = 1;
1512}
1513
1514/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001515 * Logs when statsd detects an anomaly.
1516 *
1517 * Logged from:
1518 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1519 */
1520message AnomalyDetected {
1521 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001522 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001523
Yangster-mac94e197c2018-01-02 16:03:03 -08001524 // Id of the config whose anomaly detection alert fired.
1525 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001526
Yangster-mac94e197c2018-01-02 16:03:03 -08001527 // Id of the alert (i.e. name of the anomaly that was detected).
1528 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001529}
1530
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001531message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001532 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001533 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001534
1535 // The app package name.
1536 optional string pkg_name = 2;
1537
1538 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001539 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001540 WARM = 1;
1541 HOT = 2;
1542 COLD = 3;
1543 }
1544 // The transition type.
1545 optional TransitionType type = 3;
1546
1547 // The activity name.
1548 optional string activity_name = 4;
1549
1550 // The name of the calling app. Empty if not set.
1551 optional string calling_pkg_name = 5;
1552
1553 // Whether the app is an instant app.
1554 optional bool is_instant_app = 6;
1555
1556 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001557 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001558
Bookatz80d11a02018-01-16 10:46:35 -08001559 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001560
David Chen0b5c90c2018-01-25 16:51:49 -08001561 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001562 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001563 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001564 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001565 optional int32 bind_application_delay_millis = 11;
1566 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001567
1568 // Empty if not set.
1569 optional string launch_token = 13;
1570
Calin Juravle759fbda2018-02-20 19:52:30 +00001571 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001572 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001573
1574 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001575 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001576}
1577
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001578message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001579 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001580 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001581
1582 // The app package name.
1583 optional string pkg_name = 2;
1584
1585 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001586 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001587 WARM = 1;
1588 HOT = 2;
1589 COLD = 3;
1590 }
1591 // The transition type.
1592 optional TransitionType type = 3;
1593
1594 // The activity name.
1595 optional string activity_name = 4;
1596}
1597
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001598message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001599 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001600 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001601
1602 // The app package name.
1603 optional string pkg_name = 2;
1604
1605 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001606 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001607 WITH_BUNDLE = 1;
1608 WITHOUT_BUNDLE = 2;
1609 }
1610 // The transition type.
1611 optional TransitionType type = 3;
1612
1613 // The activity name.
1614 optional string activity_name = 4;
1615
1616 optional bool transition_process_running = 5;
1617
1618 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001619 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001620}
1621
Bookatz8fcd09a2017-12-18 13:01:10 -08001622/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001623 * Logs a picture-in-picture action
1624 * Logged from:
1625 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1626 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1627 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1628 */
1629message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001630 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001631 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001632
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001633 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001634
Chenjie Yu52cacc62017-12-08 18:11:45 -08001635 enum State {
1636 ENTERED = 1;
1637 EXPANDED_TO_FULL_SCREEN = 2;
1638 MINIMIZED = 3;
1639 DISMISSED = 4;
1640 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001641 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001642}
1643
1644/**
Chenjie Yue8904192017-12-08 19:12:57 -08001645 * Logs overlay action
1646 * Logged from:
1647 * services/core/java/com/android/server/wm/Session.java
1648 */
1649message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001650 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001651
1652 optional string package_name = 2;
1653
1654 optional bool using_alert_window = 3;
1655
1656 enum State {
1657 ENTERED = 1;
1658 EXITED = 2;
1659 }
1660 optional State state = 4;
1661}
1662
Chenjie Yuccfe6452018-01-30 11:33:21 -08001663/*
1664 * Logs foreground service starts and stops.
1665 * Note that this is not when a service starts or stops, but when it is
1666 * considered foreground.
1667 * Logged from
1668 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1669 */
1670message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001671 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001672 // package_name + "/" + class_name
1673 optional string short_name = 2;
1674
1675 enum State {
1676 ENTER = 1;
1677 EXIT = 2;
1678 }
1679 optional State state = 3;
1680}
1681
Chenjie Yue8904192017-12-08 19:12:57 -08001682/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001683 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1684 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1685 * attributed back to the parent (host) uid. One example is Chrome.
1686 *
1687 * Logged from:
1688 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1689 */
1690message IsolatedUidChanged {
1691 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001692 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001693 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001694 optional int32 parent_uid = 1;
1695
1696 optional int32 isolated_uid = 2;
1697
1698 // We expect an isolated uid to be removed before if it's used for another parent uid.
1699 enum Event {
1700 REMOVED = 0;
1701 CREATED = 1;
1702 }
1703 optional Event event = 3;
1704}
1705
1706/*
1707 * Logs the reception of an incoming network packet causing the main system to wake up for
1708 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1709 * and processed by WakeupController.cpp.
1710 */
1711message PacketWakeupOccurred {
1712 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1713 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001714 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001715 // The interface name on which the packet was received.
1716 optional string iface = 2;
1717 // The ethertype value of the packet.
1718 optional int32 ethertype = 3;
1719 // String representation of the destination MAC address of the packet.
1720 optional string destination_hardware_address = 4;
1721 // String representation of the source address of the packet if this was an IP packet.
1722 optional string source_ip = 5;
1723 // String representation of the destination address of the packet if this was an IP packet.
1724 optional string destination_ip = 6;
1725 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1726 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1727 // families.
1728 optional int32 ip_next_header = 7;
1729 // The source port if this was a TCP or UDP packet.
1730 optional int32 source_port = 8;
1731 // The destination port if this was a TCP or UDP packet.
1732 optional int32 destination_port = 9;
1733}
1734
1735/*
1736 * Logs the memory stats for an app on startup.
1737 * Logged from:
1738 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1739 */
1740message AppStartMemoryStateCaptured {
1741 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001742 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001743
1744 // The process name.
1745 optional string process_name = 2;
1746
1747 // The activity name.
1748 optional string activity_name = 3;
1749
1750 // # of page-faults
1751 optional int64 pgfault = 4;
1752
1753 // # of major page-faults
1754 optional int64 pgmajfault = 5;
1755
1756 // RSS
1757 optional int64 rss_in_bytes = 6;
1758
1759 // CACHE
1760 optional int64 cache_in_bytes = 7;
1761
1762 // SWAP
1763 optional int64 swap_in_bytes = 8;
1764}
1765
1766/*
1767 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1768 * for LMK event.
1769 * Logged from:
1770 * system/core/lmkd/lmkd.c
1771 */
1772message LmkStateChanged {
1773 enum State {
1774 UNKNOWN = 0;
1775 START = 1;
1776 STOP = 2;
1777 }
1778 optional State state = 1;
1779}
1780
1781/*
1782 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1783 * Logged from:
1784 * system/core/lmkd/lmkd.c
1785 */
1786message LmkKillOccurred {
1787 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001788 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001789
1790 // The process name.
1791 optional string process_name = 2;
1792
1793 // oom adj score.
1794 optional int32 oom_score = 3;
1795
1796 // # of page-faults
1797 optional int64 pgfault = 4;
1798
1799 // # of major page-faults
1800 optional int64 pgmajfault = 5;
1801
1802 // RSS
1803 optional int64 rss_in_bytes = 6;
1804
1805 // CACHE
1806 optional int64 cache_in_bytes = 7;
1807
1808 // SWAP
1809 optional int64 swap_in_bytes = 8;
1810}
1811
Rajeev Kumar51b54602018-03-01 12:18:26 -08001812/*
1813 * Logs when the ActivityManagerService detects that an app died.
1814 *
1815 * Logged from:
1816 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1817 */
1818message AppDied {
1819 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001820 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001821}
1822
Howard Ro21a039c2018-08-06 14:55:47 -07001823/**
1824 * An atom for generic metrics logging. Available from Android Q.
1825 */
1826message GenericAtom {
1827 // The uid of the application that sent this custom atom.
1828 optional int32 uid = 1 [(is_uid) = true];
1829
1830 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001831 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001832}
1833
Chenjie Yubbcbc602018-02-05 16:51:52 -08001834//////////////////////////////////////////////////////////////////////
1835// Pulled atoms below this line //
1836//////////////////////////////////////////////////////////////////////
1837
1838/**
David Chenc8a43242017-10-17 16:23:28 -07001839 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1840 *
1841 * Pulled from:
1842 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1843 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001844message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001845 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001846
1847 optional int64 rx_bytes = 2;
1848
1849 optional int64 rx_packets = 3;
1850
1851 optional int64 tx_bytes = 4;
1852
1853 optional int64 tx_packets = 5;
1854}
1855
1856/**
1857 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1858 *
1859 * Pulled from:
1860 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1861 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001862message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001863 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001864
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001865 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1866 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001867
1868 optional int64 rx_bytes = 3;
1869
1870 optional int64 rx_packets = 4;
1871
1872 optional int64 tx_bytes = 5;
1873
1874 optional int64 tx_packets = 6;
1875}
1876
1877/**
1878 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1879 *
1880 * Pulled from:
1881 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1882 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001883message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001884 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001885
1886 optional int64 rx_bytes = 2;
1887
1888 optional int64 rx_packets = 3;
1889
1890 optional int64 tx_bytes = 4;
1891
1892 optional int64 tx_packets = 5;
1893}
1894
1895/**
1896 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1897 *
1898 * Pulled from:
1899 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1900 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001901message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001902 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001903
Yao Chenc40a19d2018-03-15 16:48:25 -07001904 // 1 denotes foreground and 0 denotes background. This is called Set in
1905 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001906 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001907
1908 optional int64 rx_bytes = 3;
1909
1910 optional int64 rx_packets = 4;
1911
1912 optional int64 tx_bytes = 5;
1913
1914 optional int64 tx_packets = 6;
1915}
1916
1917/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001918 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1919 *
1920 * Pulled from:
1921 * StatsCompanionService
1922 */
1923message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001924 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001925
1926 optional int64 rx_bytes = 2;
1927
1928 optional int64 tx_bytes = 3;
1929}
1930
1931/**
David Chenc8a43242017-10-17 16:23:28 -07001932 * Pulls the kernel wakelock durations. This atom is adapted from
1933 * android/internal/os/KernelWakelockStats.java
1934 *
1935 * Pulled from:
1936 * StatsCompanionService using KernelWakelockReader.
1937 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001938message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001939 optional string name = 1;
1940
1941 optional int32 count = 2;
1942
1943 optional int32 version = 3;
1944
1945 optional int64 time = 4;
1946}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001947
Chenjie Yu05013b32017-11-21 10:21:41 -08001948/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001949 * Pulls low power state information. This includes platform and subsystem sleep state information,
1950 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001951 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001952 * hardware/interfaces/power/1.1/types.hal
1953 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001954message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001955 // Subsystem name
1956 optional string subsystem_name = 1;
1957 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1958 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1959 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001960 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001961 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001962 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001963 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001964}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001965
Chenjie Yu05013b32017-11-21 10:21:41 -08001966/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001967 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001968 * Pulls the time the cpu spend on the frequency index. Frequency index
1969 * starts from highest to lowest. The value should be monotonically
1970 * increasing since boot. However, if there is a cpu
1971 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001972 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001973message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001974 optional uint32 cluster = 1;
1975 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001976 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001977}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001978
Chenjie Yu05013b32017-11-21 10:21:41 -08001979/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001980 * Pulls Cpu Time Per Uid.
1981 * Note that isolated process uid time should be attributed to host uids.
1982 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001983message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001984 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001985 optional uint64 user_time_millis = 2;
1986 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001987}
1988
1989/**
1990 * Pulls Cpu Time Per Uid per frequency.
1991 * Note that isolated process uid time should be attributed to host uids.
1992 * For each uid, we order the time by descending frequencies.
1993 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001994message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001995 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001996 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001997 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001998}
Hugo Benichi884970e2017-11-14 22:42:46 +09001999
Chenjie Yu05013b32017-11-21 10:21:41 -08002000/**
2001 * Pulls Wifi Controller Activity Energy Info
2002 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002003message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002004 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002005 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002006 // stack reported state
2007 // TODO: replace this with proto enum
2008 optional int32 stack_state = 2;
2009 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002010 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002011 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002012 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002013 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002014 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002015 // product of current(mA), voltage(V) and time(ms)
2016 optional uint64 controller_energy_used = 6;
2017}
2018
2019/**
2020 * Pulls Modem Activity Energy Info
2021 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002022message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002023 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002024 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002025 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002026 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002027 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002028 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002029 /**
2030 * Tx power index
2031 * index 0 = tx_power < 0dBm
2032 * index 1 = 0dBm < tx_power < 5dBm
2033 * index 2 = 5dBm < tx_power < 15dBm
2034 * index 3 = 15dBm < tx_power < 20dBm
2035 * index 4 = tx_power > 20dBm
2036 */
2037 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002038 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002039 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002040 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002041 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002042 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002043 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002044 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002045 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002046 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002047 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002048 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002049 // product of current(mA), voltage(V) and time(ms)
2050 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002051}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002052
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002053/**
2054 * Pulls Bluetooth Activity Energy Info
2055 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2056 */
2057message BluetoothActivityInfo {
2058 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002059 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002060 // bluetooth stack state
2061 optional int32 bluetooth_stack_state = 2;
2062 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002063 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002064 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002065 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002066 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002067 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002068 // product of current(mA), voltage(V) and time(ms)
2069 optional uint64 energy_used = 6;
2070}
2071
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002072/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002073 * Logs the memory stats for a process.
2074 */
2075message ProcessMemoryState {
2076 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002077 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002078
2079 // The process name.
2080 optional string process_name = 2;
2081
2082 // oom adj score.
2083 optional int32 oom_score = 3;
2084
2085 // # of page-faults
2086 optional int64 pgfault = 4;
2087
2088 // # of major page-faults
2089 optional int64 pgmajfault = 5;
2090
Rajeev Kumar90235992018-01-29 11:06:48 -08002091 // RSS
2092 optional int64 rss_in_bytes = 6;
2093
2094 // CACHE
2095 optional int64 cache_in_bytes = 7;
2096
2097 // SWAP
2098 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002099}
2100
2101/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002102 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002103 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002104message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002105 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002106}
2107
2108/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002109 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002110 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002111message SystemUptime {
2112 // Milliseconds since the system was booted.
2113 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2114 // for external input).
2115 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002116 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002117}
2118
2119/*
2120 * Reads from /proc/uid_concurrent_active_time which has the format:
2121 * active: X (X is # cores)
2122 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2123 * [uid1]: [time-0] [time-1] [time-2] ... ...
2124 * ...
2125 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2126 * The file contains a monotonically increasing count of time for a single boot.
2127 */
2128message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002129 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002130 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002131}
2132
2133/**
2134 * Reads from /proc/uid_concurrent_policy_time which has the format:
2135 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2136 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2137 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2138 * ...
2139 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2140 * The file contains a monotonically increasing count of time for a single boot.
2141 */
2142message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002143 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002144 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002145 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002146}
2147
2148/*
2149 * Pulls free disk space, for data, system partition and temporary directory.
2150 */
2151message DiskSpace {
2152 // available bytes in data partition
2153 optional uint64 data_available_bytes = 1;
2154 // available bytes in system partition
2155 optional uint64 system_available_bytes = 2;
2156 // available bytes in download cache or temp directories
2157 optional uint64 temp_available_bytes = 3;
2158}
Tej Singhbf972d92018-01-10 20:51:13 -08002159
2160/**
2161 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002162 * Pulled from:
2163 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002164 */
2165message RemainingBatteryCapacity {
2166 optional int32 charge_uAh = 1;
2167}
2168
2169/**
2170 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002171 * Pulled from:
2172 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002173 */
2174message FullBatteryCapacity {
2175 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002176}
2177
2178/**
Tej Singhd89137e2018-03-26 14:51:40 -07002179 * Pulls the temperature of various parts of the device.
2180 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002181 *
2182 * Pulled from:
2183 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2184 */
2185message Temperature {
2186 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2187 optional android.os.TemperatureTypeEnum sensor_location = 1;
2188
2189 // The name of the temperature source. Eg. CPU0
2190 optional string sensor_name = 2;
2191
Tej Singhd89137e2018-03-26 14:51:40 -07002192 // Temperature in tenths of a degree C.
2193 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002194}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002195
2196/**
2197 * Pulls the statistics of calls to Binder.
2198 *
2199 * Binder stats are cumulative from boot unless somebody reset the data using
2200 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002201 *
2202 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002203 */
2204message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002205 optional int32 uid = 1 [(is_uid) = true];
2206 // Fully qualified class name of the API call.
2207 //
2208 // This is a system server class name.
2209 //
2210 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2211 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2212 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2213 // commonly used APIs.
2214 optional string service_class_name = 2;
2215 // Method name of the API call. It can also be a transaction code if we cannot
2216 // resolve it to a name. See Binder#getTransactionName.
2217 //
2218 // This is a system server method name.
2219 optional string service_method_name = 3;
2220 // Total number of API calls.
2221 optional int64 call_count = 4;
2222 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2223 optional bool screen_interactive = 13;
2224 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2225 // call_count will be equal to recorded_call_count.
2226 //
2227 // If recorded_call_count is different than call_count, it means data collection has been
2228 // sampled. All the fields below will be sampled in this case.
2229 optional int64 recorded_call_count = 12;
2230 // Number of exceptions thrown by the API.
2231 optional int64 recorded_exception_count = 5;
2232 // Total latency of all API calls.
2233 // Average can be computed using total_latency_micros / recorded_call_count.
2234 optional int64 recorded_total_latency_micros = 6;
2235 // Maximum latency of one API call.
2236 optional int64 recorded_max_latency_micros = 7;
2237 // Total CPU usage of all API calls.
2238 // Average can be computed using total_cpu_micros / recorded_call_count.
2239 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2240 optional int64 recorded_total_cpu_micros = 8;
2241 // Maximum CPU usage of one API call.
2242 optional int64 recorded_max_cpu_micros = 9;
2243 // Maximum parcel reply size of one API call.
2244 optional int64 recorded_max_reply_size_bytes = 10;
2245 // Maximum parcel request size of one API call.
2246 optional int64 recorded_max_request_size_bytes = 11;
2247}
2248
2249/**
2250 * Pulls the statistics of exceptions during calls to Binder.
2251 *
2252 * Binder stats are cumulative from boot unless somebody reset the data using
2253 * > adb shell dumpsys binder_calls_stats --reset
2254 */
2255message BinderCallsExceptions {
2256 // Exception class name, e.g. java.lang.IllegalArgumentException.
2257 //
2258 // This is an exception class name thrown by the system server.
2259 optional string exception_class_name = 1;
2260 // Total number of exceptions.
2261 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002262}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002263
2264message LooperStats {
2265 // Currently not collected and always set to 0.
2266 optional int32 uid = 1 [(is_uid) = true];
2267
2268 // Fully qualified class name of the handler target class.
2269 //
2270 // This field does not contain PII. This is a system server class name.
2271 optional string handler_class_name = 2;
2272
2273 // The name of the thread that runs the Looper.
2274 //
2275 // This field does not contain PII. This is a system server thread name.
2276 optional string looper_thread_name = 3;
2277
2278 // The name of the dispatched message.
2279 //
2280 // This field does not contain PII. This is a system server constant or class
2281 // name.
2282 optional string message_name = 4;
2283
2284 // Total number of successfully dispatched messages.
2285 optional int64 message_count = 5;
2286
2287 // Total number of messages that failed dispatching.
2288 optional int64 exception_count = 6;
2289
2290 // Total number of processed messages we have data recorded for. If we
2291 // collected data for all the messages, message_count will be equal to
2292 // recorded_message_count.
2293 //
2294 // If recorded_message_count is different than message_count, it means data
2295 // collection has been sampled. All the fields below will be sampled in this
2296 // case.
2297 optional int64 recorded_message_count = 7;
2298
2299 // Total latency of all processed messages.
2300 // Average can be computed using recorded_total_latency_micros /
2301 // recorded_message_count.
2302 optional int64 recorded_total_latency_micros = 8;
2303
2304 // Total CPU usage of all processed message.
2305 // Average can be computed using recorded_total_cpu_micros /
2306 // recorded_message_count. Total can be computed using
2307 // recorded_total_cpu_micros / recorded_message_count * call_count.
2308 optional int64 recorded_total_cpu_micros = 9;
2309}
Tej Singh86dc9db2018-09-06 00:39:57 +00002310
2311/**
2312 * Pulls disk information, such as write speed and latency.
2313 */
2314message DiskStats {
2315 // Time taken to open, write 512B to, and close a file.
2316 // -1 if error performing the check.
2317 optional int64 data_write_latency_millis = 1;
2318
2319 optional bool file_based_encryption = 2;
2320
2321 // Recent disk write speed in kB/s.
2322 // -1 if error querying storageed.
2323 // 0 if data is unavailable.
2324 optional int32 recent_disk_write_speed = 3;
2325}
2326
2327
2328/**
2329 * Free and total bytes of the Data, Cache, and System partition.
2330 */
2331message DirectoryUsage {
2332 enum Directory {
2333 UNKNOWN = 0;
2334 DATA = 1;
2335 CACHE = 2;
2336 SYSTEM = 3;
2337 }
2338 optional Directory directory = 1;
2339 optional int64 free_bytes = 2;
2340 optional int64 total_bytes = 3;
2341}
2342
2343
2344/**
2345 * Size of an application: apk size, data size, and cache size.
2346 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2347 * Information is only reported for apps with the primary user (user 0).
2348 * Sizes are aggregated by package name.
2349 */
2350message AppSize {
2351 // Including uids will involve modifying diskstats logic.
2352 optional string package_name = 1;
2353 // App size in bytes. -1 if unavailable.
2354 optional int64 app_size_bytes = 2;
2355 // App data size in bytes. -1 if unavailable.
2356 optional int64 app_data_size_bytes = 3;
2357 // App cache size in bytes. -1 if unavailable.
2358 optional int64 app_cache_size_bytes = 4;
2359 // Time that the cache file was produced.
2360 // Uses System.currentTimeMillis(), which is wall clock time.
2361 optional int64 cache_time_millis = 5;
2362}
2363
2364
2365/**
2366 * Size of a particular category. Eg: photos, videos.
2367 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2368 */
2369message CategorySize {
2370 enum Category {
2371 UNKNOWN = 0;
2372 APP_SIZE = 1;
2373 APP_DATA_SIZE = 2;
2374 APP_CACHE_SIZE = 3;
2375 PHOTOS = 4;
2376 VIDEOS = 5;
2377 AUDIO = 6;
2378 DOWNLOADS = 7;
2379 SYSTEM = 8;
2380 OTHER = 9;
2381 }
2382 optional Category category = 1;
2383 // Category size in bytes.
2384 optional int64 size_bytes = 2;
2385 // Time that the cache file was produced.
2386 // Uses System.currentTimeMillis(), which is wall clock time.
2387 optional int64 cache_time_millis = 3;
2388}