blob: 27b44423c1eb06a9343e39e35f1674325823501d [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";
Joe Onorato62c220b2017-11-18 20:32:56 -080033
Yao Chend54f9dd2017-10-17 17:37:48 +000034/**
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * raw stats log events from the Android system, also known as "atoms."
37 *
38 * This field contains a single oneof with all of the available messages.
39 * The stats-log-api-gen tool runs as part of the Android build and
40 * generates the android.util.StatsLog class, which contains the constants
41 * and methods that Android uses to log.
42 *
Stefan Lafonae2df012017-11-14 09:17:21 -080043 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000044 * Instead, statsd on Android constructs these messages synthetically,
45 * in the format defined here and in stats_log.proto.
46 */
Stefan Lafonae2df012017-11-14 09:17:21 -080047message Atom {
48 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070049 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070050 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
51 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070052 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070053 BleScanResultReceived ble_scan_result_received = 4;
54 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080055 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070056 SyncStateChanged sync_state_changed = 7;
57 ScheduledJobStateChanged scheduled_job_state_changed = 8;
58 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070059 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080060 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
61 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
62 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070063 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
64 MemoryFactorStateChanged memory_factor_state_changed = 15;
65 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
66 CachedKillReported cached_kill_reported = 17;
67 ProcessMemoryStatReported process_memory_stat_reported = 18;
68 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080069 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
70 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
71 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070072 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080073 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070074 CameraStateChanged camera_state_changed = 25;
75 FlashlightStateChanged flashlight_state_changed = 26;
76 UidProcessStateChanged uid_process_state_changed = 27;
77 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
78 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070079 BatteryLevelChanged battery_level_changed = 30;
80 ChargingStateChanged charging_state_changed = 31;
81 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080082 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070083 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
84 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070085 WifiLockStateChanged wifi_lock_state_changed = 37;
86 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
87 WifiScanStateChanged wifi_scan_state_changed = 39;
88 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070089 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070090 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070091 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090092 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080093 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080094 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080095 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080096 AppStartOccurred app_start_occurred = 48;
97 AppStartCanceled app_start_canceled = 49;
98 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080099 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800100 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800101 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800102 LmkStateChanged lmk_state_changed = 54;
103 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800104 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800105 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800106 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800107 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800108 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800109 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800110 KeyguardStateChanged keyguard_state_changed = 62;
111 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
112 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800113 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800114 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800115 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
116 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700117 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700118 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800119 SpeakerImpedanceReported speaker_impedance_reported = 71;
120 HardwareFailed hardware_failed = 72;
121 PhysicalDropDetected physical_drop_detected = 73;
122 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800123 MobileConnectionStateChanged mobile_connection_state_changed = 75;
124 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700125 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800126 AppCrashOccurred app_crash_occurred = 78;
127 ANROccurred anr_occurred = 79;
128 WTFOccurred wtf_occurred = 80;
129 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700130 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700131 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700132 VibratorStateChanged vibrator_state_changed = 84;
Yao Chend54f9dd2017-10-17 17:37:48 +0000133 }
David Chenc8a43242017-10-17 16:23:28 -0700134
David Chen6e3e6cb2018-01-03 16:14:06 -0800135 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100136 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700137 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800138 WifiBytesTransfer wifi_bytes_transfer = 10000;
139 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
140 MobileBytesTransfer mobile_bytes_transfer = 10002;
141 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800142 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800143 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800144 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800145 CpuTimePerFreq cpu_time_per_freq = 10008;
146 CpuTimePerUid cpu_time_per_uid = 10009;
147 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800148 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800149 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800150 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800151 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800152 SystemElapsedRealtime system_elapsed_realtime = 10014;
153 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800154 CpuActiveTime cpu_active_time = 10016;
155 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000156 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800157 RemainingBatteryCapacity remaining_battery_capacity = 10019;
158 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800159 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100160 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100161 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100162 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000163 DiskStats disk_stats = 10025;
164 DirectoryUsage directory_usage = 10026;
165 AppSize app_size = 10027;
166 CategorySize category_size = 10028;
David Chenc8a43242017-10-17 16:23:28 -0700167 }
yroa1fe77c2018-02-26 14:22:54 -0800168
169 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
170 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700171}
172
Yao Chend54f9dd2017-10-17 17:37:48 +0000173/**
Yangster-mac20877162017-12-22 17:19:39 -0800174 * This proto represents a node of an attribution chain.
175 * Note: All attribution chains are represented as a repeated field of type
176 * AttributionNode. It is understood that in such arrays, the order is that
177 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 */
Yangster-mac20877162017-12-22 17:19:39 -0800179message AttributionNode {
180 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800181 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800182
Yangster-mac20877162017-12-22 17:19:39 -0800183 // The (optional) string tag for an element in the attribution chain. If the
184 // element has no tag, it is encoded as an empty string.
185 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700186}
187
Yangster-mac48b3d622018-08-18 12:38:11 -0700188message KeyValuePair {
189 optional int32 key = 1;
190 oneof value {
191 int64 value_int = 2;
192 string value_str = 3;
193 float value_float = 4;
194 }
195}
196
197message KeyValuePairsAtom {
198 optional int32 uid = 1;
199 repeated KeyValuePair pairs = 2;
200}
201
Yao Chend54f9dd2017-10-17 17:37:48 +0000202/*
203 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800204 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000205 *
206 * RULES:
207 * - The field ids for each atom must start at 1, and count upwards by 1.
208 * Skipping field ids is not allowed.
209 * - These form an API, so renaming, renumbering or removing fields is
210 * not allowed between android releases. (This is not currently enforced,
211 * but there will be a tool to enforce this restriction).
212 * - The types must be built-in protocol buffer types, namely, no sub-messages
213 * are allowed (yet). The bytes type is also not allowed.
214 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800215 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000216 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800217 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000218 * - A field that is a uid should be a string field, tagged with the [xxx]
219 * annotation. The generated code on android will be represented by UIDs,
220 * and those UIDs will be translated in xxx to those strings.
221 *
222 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700223 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000224 * - If there is a UID, it goes first. Think in an object-oriented fashion.
225 * *****************************************************************************
226 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700227
Yao Chend54f9dd2017-10-17 17:37:48 +0000228/**
229 * Logs when the screen state changes.
230 *
231 * Logged from:
232 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
233 */
234message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800235 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800236 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700237}
Yao Chend54f9dd2017-10-17 17:37:48 +0000238
239/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700240 * Logs that the process state of the uid, as determined by ActivityManager
241 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000242 *
243 * Logged from:
244 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
245 */
Bookatzc1a050a2017-10-10 15:49:28 -0700246message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700247 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000248
Bookatzdb026a22018-01-10 19:01:56 -0800249 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800250 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000251}
252
253/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700254 * Logs process state change of a process, as per the activity manager.
255 *
256 * Logged from:
257 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
258 */
259message ProcessStateChanged {
260 optional int32 uid = 1;
261 optional string process_name = 2;
262 optional string package_name = 3;
263 // TODO: remove this when validation is done
264 optional int64 version = 5;
265 // The state, from frameworks/base/core/proto/android/app/enums.proto.
266 optional android.app.ProcessStateEnum state = 4;
267}
268
269/**
270 * Logs when ActivityManagerService sleep state is changed.
271 *
272 * Logged from:
273 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
274 */
275message ActivityManagerSleepStateChanged {
276 // TODO: import frameworks proto
277 enum State {
278 UNKNOWN = 0;
279 ASLEEP = 1;
280 AWAKE = 2;
281 }
282 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
283}
284
285/**
286 * Logs when system memory state changes.
287 *
288 * Logged from:
289 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
290 */
291message MemoryFactorStateChanged {
292 // TODO: import frameworks proto
293 enum State {
294 MEMORY_UNKNOWN = 0;
295 NORMAL = 1; // normal.
296 MODERATE = 2; // moderate memory pressure.
297 LOW = 3; // low memory.
298 CRITICAL = 4; // critical memory.
299
300 }
301 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
302}
303
304/**
305 * Logs when app is using too much cpu, according to ActivityManagerService.
306 *
307 * Logged from:
308 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
309 */
310message ExcessiveCpuUsageReported {
311 optional int32 uid = 1;
312 optional string process_name = 2;
313 optional string package_name = 3;
314 // package version. TODO: remove this when validation is done
315 optional int64 version = 4;
316}
317
318/**
319 * Logs when a cached process is killed, along with its pss.
320 *
321 * Logged from:
322 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
323 */
324message CachedKillReported {
325 optional int32 uid = 1;
326 optional string process_name = 2;
327 optional string package_name = 3;
328 // TODO: remove this when validation is done
329 optional int64 version = 5;
330 optional int64 pss = 4;
331}
332
333/**
334 * Logs when memory stats of a process is reported.
335 *
336 * Logged from:
337 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
338 */
339message ProcessMemoryStatReported {
340 optional int32 uid = 1;
341 optional string process_name = 2;
342 optional string package_name = 3;
343 //TODO: remove this when validation is done
344 optional int64 version = 9;
345 optional int64 pss = 4;
346 optional int64 uss = 5;
347 optional int64 rss = 6;
348 enum Type {
349 ADD_PSS_INTERNAL_SINGLE = 0;
350 ADD_PSS_INTERNAL_ALL_MEM = 1;
351 ADD_PSS_INTERNAL_ALL_POLL = 2;
352 ADD_PSS_EXTERNAL = 3;
353 ADD_PSS_EXTERNAL_SLOW = 4;
354 }
355 optional Type type = 7;
356 optional int64 duration = 8;
357}
358
359/**
Bookatzc1a050a2017-10-10 15:49:28 -0700360 * Logs that a process started, finished, crashed, or ANRed.
361 *
362 * Logged from:
363 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
364 */
365message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700366 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700367
David Chen0b5c90c2018-01-25 16:51:49 -0800368 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800369 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700370
Bookatzddccf0a2017-11-28 16:48:14 -0800371 // What lifecycle state the process changed to.
372 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800373 enum State {
374 FINISHED = 0;
375 STARTED = 1;
376 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800377 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800378 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700379}
380
Bookatzc1a050a2017-10-10 15:49:28 -0700381/**
382 * Logs when the ble scan state changes.
383 *
384 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700385 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700386 */
387message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800388 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700389
390 enum State {
391 OFF = 0;
392 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700393 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
394 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700395 }
396 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700397
Bookatze5ec0b42018-03-26 13:34:56 -0700398 // Does the scan have a filter.
399 optional bool is_filtered = 3;
400 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
401 optional bool is_first_match = 4;
402 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
403 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700404}
405
406/**
407 * Logs reporting of a ble scan finding results.
408 *
409 * Logged from:
410 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
411 */
412// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
413message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800414 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700415
416 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800417 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700418}
419
420/**
421 * Logs when a sensor state changes.
422 *
423 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700424 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700425 */
426message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800427 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700428
Bookatzc1a050a2017-10-10 15:49:28 -0700429 // The id (int) of the sensor.
430 optional int32 sensor_id = 2;
431
432 enum State {
433 OFF = 0;
434 ON = 1;
435 }
436 optional State state = 3;
437}
438
439
440/**
441 * Logs when GPS state changes.
442 *
443 * Logged from:
444 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
445 */
446message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800447 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700448
449 enum State {
450 OFF = 0;
451 ON = 1;
452 }
453 optional State state = 2;
454}
455
456
457/**
458 * Logs when a sync manager sync state changes.
459 *
460 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700461 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700462 */
463message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800464 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700465
David Chen0b5c90c2018-01-25 16:51:49 -0800466 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800467 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700468
469 enum State {
470 OFF = 0;
471 ON = 1;
472 }
473 optional State state = 3;
474}
475
476/**
477 * Logs when a job scheduler job state changes.
478 *
479 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700480 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700481 */
482message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800483 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700484
485 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800486 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700487
488 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800489 FINISHED = 0;
490 STARTED = 1;
491 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700492 }
493 optional State state = 3;
494
Tej Singh33a412b2018-03-16 18:43:59 -0700495 // The reason a job has stopped.
496 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700497 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700498 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700499}
500
501/**
502 * Logs when the audio state changes.
503 *
504 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700505 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700506 */
507message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800508 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700509
510 enum State {
511 OFF = 0;
512 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700513 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
514 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700515 }
516 optional State state = 2;
517}
518
519/**
520 * Logs when the video codec state changes.
521 *
522 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700523 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700524 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800525message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800526 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700527
528 enum State {
529 OFF = 0;
530 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700531 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
532 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700533 }
534 optional State state = 2;
535}
536
537/**
538 * Logs when the flashlight state changes.
539 *
540 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700541 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700542 */
543message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800544 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700545
546 enum State {
547 OFF = 0;
548 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700549 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
550 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700551 }
552 optional State state = 2;
553}
554
555/**
556 * Logs when the camera state changes.
557 *
558 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700559 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700560 */
561message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800562 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700563
564 enum State {
565 OFF = 0;
566 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700567 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
568 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700569 }
570 optional State state = 2;
571}
572
573/**
574 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000575 *
576 * Logged from:
577 * TODO
578 */
Bookatzd6746242017-10-24 18:39:35 -0700579message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800580 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000581
Bookatz1a1b0462018-01-12 11:47:03 -0800582 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
583 // From frameworks/base/core/proto/android/os/enums.proto.
584 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700585
586 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
587 optional string tag = 3;
588
589 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800590 RELEASE = 0;
591 ACQUIRE = 1;
592 CHANGE_RELEASE = 2;
593 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700594 }
595 optional State state = 4;
596}
597
598/**
Bookatzc1a050a2017-10-10 15:49:28 -0700599 * Logs when a partial wakelock is considered 'long' (over 1 min).
600 *
601 * Logged from:
602 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
603 */
604message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800605 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700606
Yao Chend54f9dd2017-10-17 17:37:48 +0000607 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
608 optional string tag = 2;
609
Bookatzc1a050a2017-10-10 15:49:28 -0700610 // TODO: I have no idea what this is.
611 optional string history_tag = 3;
612
613 enum State {
614 OFF = 0;
615 ON = 1;
616 }
617 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000618}
619
Bookatzc1a050a2017-10-10 15:49:28 -0700620/**
621 * Logs Battery Saver state change.
622 *
623 * Logged from:
624 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
625 */
626message BatterySaverModeStateChanged {
627 enum State {
628 OFF = 0;
629 ON = 1;
630 }
631 optional State state = 1;
632}
633
634/**
635 * Logs Doze mode state change.
636 *
637 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800638 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700639 */
640message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800641 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800642}
643
644
645/**
646 * Logs state change of Doze mode including maintenance windows.
647 *
648 * Logged from:
649 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
650 */
651message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800652 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700653}
654
655/**
656 * Logs screen brightness level.
657 *
658 * Logged from:
659 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
660 */
661message ScreenBrightnessChanged {
662 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
663 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700664}
665
666/**
667 * Logs battery level (percent full, from 0 to 100).
668 *
669 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700670 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700671 */
672message BatteryLevelChanged {
673 // Battery level. Should be in [0, 100].
674 optional int32 battery_level = 1;
675}
676
677/**
678 * Logs change in charging status of the device.
679 *
680 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700681 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700682 */
683message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800684 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
685 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700686}
687
688/**
689 * Logs whether the device is plugged in, and what power source it is using.
690 *
691 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700692 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700693 */
694message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800695 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
696 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700697}
698
Bookatz8c6571b2017-10-24 15:04:41 -0700699/**
700 * Logs when an app's wakeup alarm fires.
701 *
702 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700703 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700704 */
705message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800706 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800707
708 // Name of the wakeup alarm.
709 optional string tag = 2;
710}
711
712/**
713 * Logs when an an app causes the mobile radio to change state.
714 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
715 *
716 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700717 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800718 */
719message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800720 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800721
Bookatz1a1b0462018-01-12 11:47:03 -0800722 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
723 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800724}
725
726/**
727 * Logs when an an app causes the wifi radio to change state.
728 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
729 *
730 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700731 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800732 */
733message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800734 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800735
Bookatz1a1b0462018-01-12 11:47:03 -0800736 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
737 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700738}
739
740/**
741 * Logs kernel wakeup reasons and aborts.
742 *
743 * Logged from:
744 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
745 */
746message KernelWakeupReported {
747 // Name of the kernel wakeup reason (or abort).
748 optional string wakeup_reason_name = 1;
749
750 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800751 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700752}
753
754/**
755 * Logs wifi locks held by an app.
756 *
757 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700758 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700759 */
760message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800761 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700762
763 enum State {
764 OFF = 0;
765 ON = 1;
766 }
767 optional State state = 2;
768}
769
770/**
771 * Logs wifi signal strength changes.
772 *
773 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700774 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700775 */
776message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800777 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
778 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700779}
780
781/**
782 * Logs wifi scans performed by an app.
783 *
784 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700785 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700786 */
787message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800788 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700789
790 enum State {
791 OFF = 0;
792 ON = 1;
793 }
794 optional State state = 2;
795}
796
797/**
Tej Singh4503e102018-01-04 14:35:01 -0800798 * Logs wifi multicast locks held by an app
799 *
800 * Logged from:
801 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
802 */
803message WifiMulticastLockStateChanged {
804 repeated AttributionNode attribution_node = 1;
805
806 enum State {
807 OFF = 0;
808 ON = 1;
809 }
810 optional State state = 2;
811}
812
813/**
Tej Singh1ea42892018-01-19 09:27:00 -0800814 * Logs shutdown reason and duration on next boot.
815 *
816 * Logged from:
817 * frameworks/base/core/java/com/android/server/BootReceiver.java
818 */
819message ShutdownSequenceReported {
820 // True if shutdown is for a reboot. Default: false if we do not know.
821 optional bool reboot = 1;
822
823 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
824 optional string reason = 2;
825
826 // Beginning of shutdown time in ms using wall clock time since unix epoch.
827 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800828 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800829
830 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800831 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800832}
833
Tej Singh6483ea42018-01-25 17:45:49 -0800834
835/**
836 * Logs boot reason and duration.
837 *
838 * Logged from:
839 * system/core/bootstat/bootstat.cpp
840 */
841message BootSequenceReported {
842 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
843 // Default: "<EMPTY>" if not available.
844 optional string bootloader_reason = 1;
845
846 // Reason for system boot. Eg. bootloader, reboot,userrequested
847 // Default: "<EMPTY>" if not available.
848 optional string system_reason = 2;
849
850 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800851 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800852
853 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800854 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800855
856 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800857 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800858
859 // Time since last boot in ms. Default: 0 if not available.
860 optional int64 time_since_last_boot = 6;
861}
862
Tej Singhc477d9c2018-02-05 18:31:39 -0800863
864/**
865 * Logs call state and disconnect cause (if applicable).
866 *
867 * Logged from:
868 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
869 */
870message CallStateChanged {
871 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
872 // From frameworks/base/core/proto/android/telecomm/enums.proto.
873 optional android.telecom.CallStateEnum call_state = 1;
874
875 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
876 // This value is only applicable when the call_state is DISCONNECTED, and
877 // should always be UNKNOWN if the call_state is not DISCONNECTED.
878 // From frameworks/base/core/proto/android/telecomm/enums.proto.
879 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
880
881 // True if the call is self-managed, which are apps that use the
882 // telecom infrastructure to make their own calls.
883 optional bool self_managed = 3;
884
885 // True if call is external. External calls are calls on connected Wear
886 // devices but show up in Telecom so the user can pull them onto the device.
887 optional bool external_call = 4;
888}
889
Tej Singh1ea42892018-01-19 09:27:00 -0800890/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800891 * Logs keyguard state. The keyguard is the lock screen.
892 *
893 * Logged from:
894 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
895 */
896message KeyguardStateChanged {
897 enum State {
898 UNKNOWN = 0;
899 // The keyguard is hidden when the phone is unlocked.
900 HIDDEN = 1;
901 // The keyguard is shown when the phone is locked (screen turns off).
902 SHOWN= 2;
903 // The keyguard is occluded when something is overlaying the keyguard.
904 // Eg. Opening the camera while on the lock screen.
905 OCCLUDED = 3;
906 }
907 optional State state = 1;
908}
909
910/**
911 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
912 * prompts the user to enter a password (pattern, pin, etc).
913 *
914 * Logged from:
915 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
916 */
917
918message KeyguardBouncerStateChanged {
919 enum State {
920 UNKNOWN = 0;
921 // Bouncer is hidden, either as a result of successfully entering the
922 // password, screen timing out, or user going back to lock screen.
923 HIDDEN = 1;
924 // This is when the user is being prompted to enter the password.
925 SHOWN = 2;
926 }
927 optional State state = 1;
928}
929
930/**
931 * Logs the result of entering a password into the keyguard bouncer.
932 *
933 * Logged from:
934 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
935 */
936message KeyguardBouncerPasswordEntered {
937 enum BouncerResult {
938 UNKNOWN = 0;
939 // The password entered was incorrect.
940 FAILURE = 1;
941 // The password entered was correct.
942 SUCCESS = 2;
943 }
944 optional BouncerResult result = 1;
945}
946
Tej Singha883b372018-02-15 11:30:01 -0800947/*
948 * Logs changes to the configuration of the device. The configuration is defined
949 * in frameworks/base/core/java/android/content/res/Configuration.java
950 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
951 * Please go there to interpret the possible values each field can be.
952 *
953 * Logged from:
954 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
955 */
956message ResourceConfigurationChanged {
957 // Bit mask of color capabilities of the screen.
958 // Contains information about the color gamut and hdr mode of the screen.
959 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
960 optional int32 colorMode = 1;
961
962 // The target screen density being rendered to.
963 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
964 optional int32 densityDpi = 2;
965
966 // Current user preference for the scaling factor for fonts,
967 // relative to the base density scaling.
968 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
969 optional float fontScale = 3;
970
971 // Flag indicating whether the hard keyboard is hidden.
972 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
973 optional int32 hardKeyboardHidden = 4;
974
975 // The type of keyboard attached to the device.
976 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
977 optional int32 keyboard = 5;
978
979 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
980 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
981 optional int32 keyboardHideen = 6;
982
983 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
984 // 0 if undefined.
985 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
986 optional int32 mcc = 7;
987
988 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
989 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
990 // MNC_ZERO symbol defined in Configuration.java.
991 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
992 optional int32 mnc = 8;
993
994 // The kind of navigation available on the device.
995 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
996 optional int32 navigation = 9;
997
998 // Flag indicating whether the navigation is available.
999 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1000 optional int32 navigationHidden = 10;
1001
1002 // Overall orientation of the screen.
1003 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1004 optional int32 orientation = 11;
1005
1006 // The current height of the available screen space, in dp units.
1007 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1008 optional int32 screenHeightDp = 12;
1009
1010 // Bit mask of overall layout of the screen.
1011 // Contains information about screen size, whether the screen is wider/taller
1012 // than normal, whether the screen layout is right-tl-left or left-to-right,
1013 // and whether the screen has a rounded shape.
1014 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1015 optional int32 screenLayout = 13;
1016
1017 // Current width of the available screen space, in dp units.
1018 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1019 optional int32 screenWidthDp = 14;
1020
1021 // The smallest screen size an application will see in normal operation.
1022 // This is the smallest value of both screenWidthDp and screenHeightDp
1023 // in portrait and landscape.
1024 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1025 optional int32 smallestScreenWidthDp = 15;
1026
1027 // The type of touch screen attached to the device.
1028 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1029 optional int32 touchscreen = 16;
1030
1031 // Bit mask of the ui mode.
1032 // Contains information about the overall ui mode of the device.
1033 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1034 // Also contains information about whether the device is in night mode.
1035 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1036 optional int32 uiMode = 17;
1037}
1038
Tej Singheee317b2018-03-07 19:28:05 -08001039
1040/**
1041 * Logs changes in the connection state of the mobile radio.
1042 *
1043 * Logged from:
1044 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1045 */
1046message MobileConnectionStateChanged {
1047 // States are from the state machine DataConnection.java.
1048 enum State {
1049 UNKNOWN = 0;
1050 // The connection is inactive, or disconnected.
1051 INACTIVE = 1;
1052 // The connection is being activated, or connecting.
1053 ACTIVATING = 2;
1054 // The connection is active, or connected.
1055 ACTIVE = 3;
1056 // The connection is disconnecting.
1057 DISCONNECTING = 4;
1058 // The connection is disconnecting after creating a connection.
1059 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1060 }
1061 optional State state = 1;
1062 // For multi-sim phones, this distinguishes between the sim cards.
1063 optional int32 sim_slot_index = 2;
1064 // Used to identify the connection. Starts at 0 and increments by 1 for
1065 // every new network created. Resets whenever the device reboots.
1066 optional int32 data_connection_id = 3;
1067 // A bitmask for the capabilities of this connection.
1068 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1069 // Default value (if we have no information): 0
1070 optional int64 capabilities = 4;
1071 // If this connection has internet.
1072 // This just checks if the DEFAULT bit of capabilities is set.
1073 optional bool has_internet = 5;
1074}
1075
1076/**
1077 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1078 *
1079 * Logged from:
1080 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1081 */
1082message MobileRadioTechnologyChanged {
1083 optional android.telephony.NetworkTypeEnum state = 1;
1084 // For multi-sim phones, this distinguishes between the sim cards.
1085 optional int32 sim_slot_index = 2;
1086}
1087
Andrew Chantb56388b2018-03-22 21:07:33 -07001088/**
1089 * Logs the VID and PID of any connected USB devices.
1090 *
1091 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1092 *
1093 * Logged by Vendor.
1094 */
1095message UsbDeviceAttached {
1096 optional int32 vid = 1;
1097 optional int32 pid = 2;
1098 optional bool has_audio = 3;
1099 optional bool has_hid = 4;
1100 optional bool has_storage = 5;
1101}
1102
Tej Singheee317b2018-03-07 19:28:05 -08001103
Tej Singhdd7bd352018-02-09 19:33:15 -08001104/**
Tej Singh5d991e12018-03-09 19:48:11 -08001105 * Logs when Bluetooth is enabled and disabled.
1106 *
1107 * Logged from:
1108 * services/core/java/com/android/server/BluetoothManagerService.java
1109 */
1110message BluetoothEnabledStateChanged {
1111 repeated AttributionNode attribution_node = 1;
1112 // Whether or not bluetooth is enabled on the device.
1113 enum State {
1114 UNKNOWN = 0;
1115 ENABLED = 1;
1116 DISABLED = 2;
1117 }
1118 optional State state = 2;
1119 // The reason for being enabled/disabled.
1120 // Eg. Airplane mode, crash, application request.
1121 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1122 // If the reason is an application request, this will be the package name.
1123 optional string pkgName = 4;
1124}
1125
1126/**
1127 * Logs when a Bluetooth device connects and disconnects.
1128 *
1129 * Logged from:
1130 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1131 */
1132message BluetoothConnectionStateChanged {
1133 // The state of the connection.
1134 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1135 optional android.bluetooth.ConnectionStateEnum state = 1;
1136 // An identifier that can be used to match connect and disconnect events.
1137 // Currently is last two bytes of a hash of a device level ID and
1138 // the mac address of the bluetooth device that is connected.
1139 optional int32 obfuscated_id = 2;
1140 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1141 // From android.bluetooth.BluetoothAdapter.java
1142 optional int32 bt_profile = 3;
1143}
1144
1145/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001146 * Logs when something is plugged into or removed from the USB-C connector.
1147 *
1148 * Logged from:
1149 * Vendor USB HAL.
1150 */
1151message UsbConnectorStateChanged {
1152 enum State {
1153 DISCONNECTED = 0;
1154 CONNECTED = 1;
1155 }
1156 optional State state = 1;
1157}
1158
1159/**
1160 * Logs the reported speaker impedance.
1161 *
1162 * Logged from:
1163 * Vendor audio implementation.
1164 */
1165message SpeakerImpedanceReported {
1166 optional int32 speaker_location = 1;
1167 optional int32 impedance = 2;
1168}
1169
1170/**
1171 * Logs the report of a failed hardware.
1172 *
1173 * Logged from:
1174 * Vendor HALs.
1175 *
1176 */
1177message HardwareFailed {
1178 enum HardwareType {
1179 HARDWARE_FAILED_UNKNOWN = 0;
1180 HARDWARE_FAILED_MICROPHONE = 1;
1181 HARDWARE_FAILED_CODEC = 2;
1182 HARDWARE_FAILED_SPEAKER = 3;
1183 HARDWARE_FAILED_FINGERPRINT = 4;
1184 }
1185 optional HardwareType hardware_type = 1;
1186
1187 /* hardware_location allows vendors to differentiate between multiple instances of
1188 * the same hardware_type. The specific locations are vendor defined integers,
1189 * referring to board-specific numbering schemes.
1190 */
1191 optional int32 hardware_location = 2;
1192
1193 /* failure_code is specific to the HardwareType of the failed hardware.
1194 * It should use the enum values defined below.
1195 */
1196 enum MicrophoneFailureCode {
1197 MICROPHONE_FAILURE_COMPLETE = 0;
1198 }
1199 enum CodecFailureCode {
1200 CODEC_FAILURE_COMPLETE = 0;
1201 }
1202 enum SpeakerFailureCode {
1203 SPEAKER_FAILURE_COMPLETE = 0;
1204 SPEAKER_FAILURE_HIGH_Z = 1;
1205 SPEAKER_FAILURE_SHORT = 2;
1206 }
1207 enum FingerprintFailureCode {
1208 FINGERPRINT_FAILURE_COMPLETE = 0;
1209 FINGERPRINT_SENSOR_BROKEN = 1;
1210 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1211 }
1212 optional int32 failure_code = 3;
1213}
1214
1215/**
1216 * Log an event when the device has been physically dropped.
1217 * Reported from the /vendor partition.
1218 */
1219message PhysicalDropDetected {
1220 // Confidence that the event was actually a drop, 0 -> 100
1221 optional int32 confidence_pctg = 1;
1222 // Peak acceleration of the drop, in 1/1000s of a g.
1223 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001224 // Duration of freefall in ms
1225 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001226}
1227
1228/**
1229 * Log bucketed battery charge cycles.
1230 *
1231 * Each bucket represents cycles of the battery past
1232 * a given charge point. For example, bucket 1 is the
1233 * lowest 1/8th of the battery, and bucket 8 is 100%.
1234 *
1235 * Logged from:
1236 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1237 */
1238message ChargeCyclesReported {
1239 optional int32 cycle_bucket_1 = 1;
1240 optional int32 cycle_bucket_2 = 2;
1241 optional int32 cycle_bucket_3 = 3;
1242 optional int32 cycle_bucket_4 = 4;
1243 optional int32 cycle_bucket_5 = 5;
1244 optional int32 cycle_bucket_6 = 6;
1245 optional int32 cycle_bucket_7 = 7;
1246 optional int32 cycle_bucket_8 = 8;
1247}
1248
1249/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001250 * Logs the duration of a davey (jank of >=700ms) when it occurs
1251 *
1252 * Logged from:
1253 * frameworks/base/libs/hwui/JankTracker.cpp
1254 */
1255message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001256 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001257 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001258
Tej Singhbb8554a2018-01-26 11:59:14 -08001259 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001260 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001261}
1262
1263/**
Bookatze5885242017-10-24 20:10:31 -07001264 * Logs phone signal strength changes.
1265 *
1266 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001267 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001268 */
1269message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001270 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1271 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001272}
1273
1274/**
1275 * Logs that a setting was updated.
1276 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001277 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001278 * The tag and is_default allow resetting of settings to default values based on the specified
1279 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1280 */
1281message SettingChanged {
1282 // The name of the setting.
1283 optional string setting = 1;
1284
1285 // The change being imposed on this setting. May represent a number, eg "3".
1286 optional string value = 2;
1287
1288 // The new value of this setting. For most settings, this is same as value. For some settings,
1289 // value is +X or -X where X represents an element in a set. For example, if the previous value
1290 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1291 // The +/- feature is currently only used for location_providers_allowed.
1292 optional string new_value = 3;
1293
1294 // The previous value of this setting.
1295 optional string prev_value = 4;
1296
1297 // The tag used with the is_default for resetting sets of settings. This is generally null.
1298 optional string tag = 5;
1299
Bookatz90867622018-01-31 15:05:57 -08001300 // True if this setting with tag should be resettable.
1301 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001302
David Chenbd789912018-03-16 17:19:55 -07001303 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001304 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001305
1306 enum ChangeReason {
1307 UPDATED = 1; // Updated can be an insertion or an update.
1308 DELETED = 2;
1309 }
1310 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001311}
Chenjie Yub3dda412017-10-24 13:41:59 -07001312
Chenjie Yu05013b32017-11-21 10:21:41 -08001313/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001314 * Logs activity going to foreground or background
1315 *
1316 * Logged from:
1317 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1318 */
1319message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001320 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001321 optional string pkg_name = 2;
1322 optional string class_name = 3;
1323
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001324 enum State {
1325 BACKGROUND = 0;
1326 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001327 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001328 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001329}
David Chenc8a43242017-10-17 16:23:28 -07001330
1331/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001332 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001333 * Logged from:
1334 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1335 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001336message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001337 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001338
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001339 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001340
1341 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001342 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001343 optional string process_name = 3;
1344
1345 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001346 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001347
1348 optional string package_name = 5;
1349
1350 enum InstantApp {
1351 UNAVAILABLE = 0;
1352 FALSE = 1;
1353 TRUE = 2;
1354 }
1355 optional InstantApp is_instant_app = 6;
1356
1357 enum ForegroundState {
1358 UNKNOWN = 0;
1359 BACKGROUND = 1;
1360 FOREGROUND = 2;
1361 }
1362 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001363}
David Chen9e3808c2017-11-20 17:25:34 -08001364
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001365/**
1366 * Logs when a WTF (What a Terrible Failure) happened.
1367 * Logged from:
1368 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1369 */
1370message WTFOccurred {
1371 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001372
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001373 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001374
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001375 // The name of the process.
1376 // system_server if it is not by an app
1377 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001378
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001379 // The pid if available. -1 means not available.
1380 optional sint32 pid = 4;
1381}
1382
1383/**
1384 * Logs when system server reports low memory.
1385 * Logged from:
1386 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1387 */
1388message LowMemReported {
1389}
1390
1391/**
1392 * Logs when an app ANR (App Not Responding) occurs.
1393 * Logged from:
1394 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1395 */
1396message ANROccurred {
1397 optional int32 uid = 1 [(is_uid) = true];
1398
1399 optional string process_name = 2;
1400
1401 optional string short_component_name = 3;
1402
1403 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001404
1405 enum InstantApp {
1406 UNAVAILABLE = 0;
1407 FALSE = 1;
1408 TRUE = 2;
1409 }
1410 optional InstantApp is_instant_app = 5;
1411
1412 enum ForegroundState {
1413 UNKNOWN = 0;
1414 BACKGROUND = 1;
1415 FOREGROUND = 2;
1416 }
1417 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001418}
1419
Bookatza7020bd2018-08-28 16:29:35 -07001420/**
1421 * Logs when the vibrator state changes.
1422 * Logged from:
1423 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1424 */
1425message VibratorStateChanged {
1426 repeated AttributionNode attribution_node = 1;
1427
1428 enum State {
1429 OFF = 0;
1430 ON = 1;
1431 }
1432 optional State state = 2;
1433
1434 // Duration (in milliseconds) requested to keep the vibrator on.
1435 // Only applicable for State == ON.
1436 optional int64 duration_millis = 3;
1437}
1438
David Chen0a368b22017-12-06 16:28:16 -08001439/*
1440 * Allows other apps to push events into statsd.
1441 * Logged from:
1442 * frameworks/base/core/java/android/util/StatsLog.java
1443 */
David Chen0b5c90c2018-01-25 16:51:49 -08001444message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001445 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001446 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001447
1448 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1449 optional int32 label = 2;
1450
1451 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1452 // predicates for the metrics).
1453 enum State {
1454 UNKNOWN = 0;
1455 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1456 STOP = 2;
1457 START = 3;
1458 }
1459 optional State state = 3;
1460}
1461
David Chen9e3808c2017-11-20 17:25:34 -08001462/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001463 * Logs when statsd detects an anomaly.
1464 *
1465 * Logged from:
1466 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1467 */
1468message AnomalyDetected {
1469 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001470 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001471
Yangster-mac94e197c2018-01-02 16:03:03 -08001472 // Id of the config whose anomaly detection alert fired.
1473 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001474
Yangster-mac94e197c2018-01-02 16:03:03 -08001475 // Id of the alert (i.e. name of the anomaly that was detected).
1476 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001477}
1478
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001479message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001480 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001481 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001482
1483 // The app package name.
1484 optional string pkg_name = 2;
1485
1486 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001487 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001488 WARM = 1;
1489 HOT = 2;
1490 COLD = 3;
1491 }
1492 // The transition type.
1493 optional TransitionType type = 3;
1494
1495 // The activity name.
1496 optional string activity_name = 4;
1497
1498 // The name of the calling app. Empty if not set.
1499 optional string calling_pkg_name = 5;
1500
1501 // Whether the app is an instant app.
1502 optional bool is_instant_app = 6;
1503
1504 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001505 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001506
Bookatz80d11a02018-01-16 10:46:35 -08001507 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001508
David Chen0b5c90c2018-01-25 16:51:49 -08001509 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001510 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001511 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001512 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001513 optional int32 bind_application_delay_millis = 11;
1514 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001515
1516 // Empty if not set.
1517 optional string launch_token = 13;
1518
Calin Juravle759fbda2018-02-20 19:52:30 +00001519 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001520 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001521
1522 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001523 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001524}
1525
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001526message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001527 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001528 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001529
1530 // The app package name.
1531 optional string pkg_name = 2;
1532
1533 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001534 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001535 WARM = 1;
1536 HOT = 2;
1537 COLD = 3;
1538 }
1539 // The transition type.
1540 optional TransitionType type = 3;
1541
1542 // The activity name.
1543 optional string activity_name = 4;
1544}
1545
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001546message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001547 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001548 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001549
1550 // The app package name.
1551 optional string pkg_name = 2;
1552
1553 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001554 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001555 WITH_BUNDLE = 1;
1556 WITHOUT_BUNDLE = 2;
1557 }
1558 // The transition type.
1559 optional TransitionType type = 3;
1560
1561 // The activity name.
1562 optional string activity_name = 4;
1563
1564 optional bool transition_process_running = 5;
1565
1566 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001567 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001568}
1569
Bookatz8fcd09a2017-12-18 13:01:10 -08001570/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001571 * Logs a picture-in-picture action
1572 * Logged from:
1573 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1574 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1575 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1576 */
1577message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001578 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001579 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001580
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001581 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001582
Chenjie Yu52cacc62017-12-08 18:11:45 -08001583 enum State {
1584 ENTERED = 1;
1585 EXPANDED_TO_FULL_SCREEN = 2;
1586 MINIMIZED = 3;
1587 DISMISSED = 4;
1588 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001589 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001590}
1591
1592/**
Chenjie Yue8904192017-12-08 19:12:57 -08001593 * Logs overlay action
1594 * Logged from:
1595 * services/core/java/com/android/server/wm/Session.java
1596 */
1597message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001598 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001599
1600 optional string package_name = 2;
1601
1602 optional bool using_alert_window = 3;
1603
1604 enum State {
1605 ENTERED = 1;
1606 EXITED = 2;
1607 }
1608 optional State state = 4;
1609}
1610
Chenjie Yuccfe6452018-01-30 11:33:21 -08001611/*
1612 * Logs foreground service starts and stops.
1613 * Note that this is not when a service starts or stops, but when it is
1614 * considered foreground.
1615 * Logged from
1616 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1617 */
1618message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001619 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001620 // package_name + "/" + class_name
1621 optional string short_name = 2;
1622
1623 enum State {
1624 ENTER = 1;
1625 EXIT = 2;
1626 }
1627 optional State state = 3;
1628}
1629
Chenjie Yue8904192017-12-08 19:12:57 -08001630/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001631 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1632 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1633 * attributed back to the parent (host) uid. One example is Chrome.
1634 *
1635 * Logged from:
1636 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1637 */
1638message IsolatedUidChanged {
1639 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001640 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001641 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001642 optional int32 parent_uid = 1;
1643
1644 optional int32 isolated_uid = 2;
1645
1646 // We expect an isolated uid to be removed before if it's used for another parent uid.
1647 enum Event {
1648 REMOVED = 0;
1649 CREATED = 1;
1650 }
1651 optional Event event = 3;
1652}
1653
1654/*
1655 * Logs the reception of an incoming network packet causing the main system to wake up for
1656 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1657 * and processed by WakeupController.cpp.
1658 */
1659message PacketWakeupOccurred {
1660 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1661 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001662 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001663 // The interface name on which the packet was received.
1664 optional string iface = 2;
1665 // The ethertype value of the packet.
1666 optional int32 ethertype = 3;
1667 // String representation of the destination MAC address of the packet.
1668 optional string destination_hardware_address = 4;
1669 // String representation of the source address of the packet if this was an IP packet.
1670 optional string source_ip = 5;
1671 // String representation of the destination address of the packet if this was an IP packet.
1672 optional string destination_ip = 6;
1673 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1674 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1675 // families.
1676 optional int32 ip_next_header = 7;
1677 // The source port if this was a TCP or UDP packet.
1678 optional int32 source_port = 8;
1679 // The destination port if this was a TCP or UDP packet.
1680 optional int32 destination_port = 9;
1681}
1682
1683/*
1684 * Logs the memory stats for an app on startup.
1685 * Logged from:
1686 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1687 */
1688message AppStartMemoryStateCaptured {
1689 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001690 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001691
1692 // The process name.
1693 optional string process_name = 2;
1694
1695 // The activity name.
1696 optional string activity_name = 3;
1697
1698 // # of page-faults
1699 optional int64 pgfault = 4;
1700
1701 // # of major page-faults
1702 optional int64 pgmajfault = 5;
1703
1704 // RSS
1705 optional int64 rss_in_bytes = 6;
1706
1707 // CACHE
1708 optional int64 cache_in_bytes = 7;
1709
1710 // SWAP
1711 optional int64 swap_in_bytes = 8;
1712}
1713
1714/*
1715 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1716 * for LMK event.
1717 * Logged from:
1718 * system/core/lmkd/lmkd.c
1719 */
1720message LmkStateChanged {
1721 enum State {
1722 UNKNOWN = 0;
1723 START = 1;
1724 STOP = 2;
1725 }
1726 optional State state = 1;
1727}
1728
1729/*
1730 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1731 * Logged from:
1732 * system/core/lmkd/lmkd.c
1733 */
1734message LmkKillOccurred {
1735 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001736 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001737
1738 // The process name.
1739 optional string process_name = 2;
1740
1741 // oom adj score.
1742 optional int32 oom_score = 3;
1743
1744 // # of page-faults
1745 optional int64 pgfault = 4;
1746
1747 // # of major page-faults
1748 optional int64 pgmajfault = 5;
1749
1750 // RSS
1751 optional int64 rss_in_bytes = 6;
1752
1753 // CACHE
1754 optional int64 cache_in_bytes = 7;
1755
1756 // SWAP
1757 optional int64 swap_in_bytes = 8;
1758}
1759
Rajeev Kumar51b54602018-03-01 12:18:26 -08001760/*
1761 * Logs when the ActivityManagerService detects that an app died.
1762 *
1763 * Logged from:
1764 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1765 */
1766message AppDied {
1767 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001768 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001769}
1770
Howard Ro21a039c2018-08-06 14:55:47 -07001771/**
1772 * An atom for generic metrics logging. Available from Android Q.
1773 */
1774message GenericAtom {
1775 // The uid of the application that sent this custom atom.
1776 optional int32 uid = 1 [(is_uid) = true];
1777
1778 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001779 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001780}
1781
Chenjie Yubbcbc602018-02-05 16:51:52 -08001782//////////////////////////////////////////////////////////////////////
1783// Pulled atoms below this line //
1784//////////////////////////////////////////////////////////////////////
1785
1786/**
David Chenc8a43242017-10-17 16:23:28 -07001787 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1788 *
1789 * Pulled from:
1790 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1791 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001792message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001793 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001794
1795 optional int64 rx_bytes = 2;
1796
1797 optional int64 rx_packets = 3;
1798
1799 optional int64 tx_bytes = 4;
1800
1801 optional int64 tx_packets = 5;
1802}
1803
1804/**
1805 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1806 *
1807 * Pulled from:
1808 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1809 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001810message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001811 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001812
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001813 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1814 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001815
1816 optional int64 rx_bytes = 3;
1817
1818 optional int64 rx_packets = 4;
1819
1820 optional int64 tx_bytes = 5;
1821
1822 optional int64 tx_packets = 6;
1823}
1824
1825/**
1826 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1827 *
1828 * Pulled from:
1829 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1830 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001831message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001832 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001833
1834 optional int64 rx_bytes = 2;
1835
1836 optional int64 rx_packets = 3;
1837
1838 optional int64 tx_bytes = 4;
1839
1840 optional int64 tx_packets = 5;
1841}
1842
1843/**
1844 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1845 *
1846 * Pulled from:
1847 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1848 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001849message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001850 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001851
Yao Chenc40a19d2018-03-15 16:48:25 -07001852 // 1 denotes foreground and 0 denotes background. This is called Set in
1853 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001854 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001855
1856 optional int64 rx_bytes = 3;
1857
1858 optional int64 rx_packets = 4;
1859
1860 optional int64 tx_bytes = 5;
1861
1862 optional int64 tx_packets = 6;
1863}
1864
1865/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001866 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1867 *
1868 * Pulled from:
1869 * StatsCompanionService
1870 */
1871message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001872 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001873
1874 optional int64 rx_bytes = 2;
1875
1876 optional int64 tx_bytes = 3;
1877}
1878
1879/**
David Chenc8a43242017-10-17 16:23:28 -07001880 * Pulls the kernel wakelock durations. This atom is adapted from
1881 * android/internal/os/KernelWakelockStats.java
1882 *
1883 * Pulled from:
1884 * StatsCompanionService using KernelWakelockReader.
1885 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001886message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001887 optional string name = 1;
1888
1889 optional int32 count = 2;
1890
1891 optional int32 version = 3;
1892
1893 optional int64 time = 4;
1894}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001895
Chenjie Yu05013b32017-11-21 10:21:41 -08001896/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001897 * Pulls low power state information. This includes platform and subsystem sleep state information,
1898 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001899 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001900 * hardware/interfaces/power/1.1/types.hal
1901 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001902message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001903 // Subsystem name
1904 optional string subsystem_name = 1;
1905 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1906 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1907 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001908 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001909 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001910 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001911 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001912}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001913
Chenjie Yu05013b32017-11-21 10:21:41 -08001914/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001915 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001916 * Pulls the time the cpu spend on the frequency index. Frequency index
1917 * starts from highest to lowest. The value should be monotonically
1918 * increasing since boot. However, if there is a cpu
1919 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001920 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001921message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001922 optional uint32 cluster = 1;
1923 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001924 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001925}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001926
Chenjie Yu05013b32017-11-21 10:21:41 -08001927/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001928 * Pulls Cpu Time Per Uid.
1929 * Note that isolated process uid time should be attributed to host uids.
1930 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001931message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001932 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001933 optional uint64 user_time_millis = 2;
1934 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001935}
1936
1937/**
1938 * Pulls Cpu Time Per Uid per frequency.
1939 * Note that isolated process uid time should be attributed to host uids.
1940 * For each uid, we order the time by descending frequencies.
1941 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001942message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001943 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001944 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001945 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001946}
Hugo Benichi884970e2017-11-14 22:42:46 +09001947
Chenjie Yu05013b32017-11-21 10:21:41 -08001948/**
1949 * Pulls Wifi Controller Activity Energy Info
1950 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001951message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001952 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001953 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001954 // stack reported state
1955 // TODO: replace this with proto enum
1956 optional int32 stack_state = 2;
1957 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001958 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001959 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001960 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001961 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001962 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001963 // product of current(mA), voltage(V) and time(ms)
1964 optional uint64 controller_energy_used = 6;
1965}
1966
1967/**
1968 * Pulls Modem Activity Energy Info
1969 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001970message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001971 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001972 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001973 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001974 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001975 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001976 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001977 /**
1978 * Tx power index
1979 * index 0 = tx_power < 0dBm
1980 * index 1 = 0dBm < tx_power < 5dBm
1981 * index 2 = 5dBm < tx_power < 15dBm
1982 * index 3 = 15dBm < tx_power < 20dBm
1983 * index 4 = tx_power > 20dBm
1984 */
1985 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001986 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001987 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001988 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001989 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001990 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001991 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001992 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001993 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001994 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001995 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001996 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001997 // product of current(mA), voltage(V) and time(ms)
1998 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001999}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002000
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002001/**
2002 * Pulls Bluetooth Activity Energy Info
2003 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2004 */
2005message BluetoothActivityInfo {
2006 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002007 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002008 // bluetooth stack state
2009 optional int32 bluetooth_stack_state = 2;
2010 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002011 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002012 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002013 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002014 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002015 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002016 // product of current(mA), voltage(V) and time(ms)
2017 optional uint64 energy_used = 6;
2018}
2019
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002020/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002021 * Logs the memory stats for a process.
2022 */
2023message ProcessMemoryState {
2024 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002025 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002026
2027 // The process name.
2028 optional string process_name = 2;
2029
2030 // oom adj score.
2031 optional int32 oom_score = 3;
2032
2033 // # of page-faults
2034 optional int64 pgfault = 4;
2035
2036 // # of major page-faults
2037 optional int64 pgmajfault = 5;
2038
Rajeev Kumar90235992018-01-29 11:06:48 -08002039 // RSS
2040 optional int64 rss_in_bytes = 6;
2041
2042 // CACHE
2043 optional int64 cache_in_bytes = 7;
2044
2045 // SWAP
2046 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002047}
2048
2049/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002050 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002051 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002052message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002053 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002054}
2055
2056/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002057 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002058 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002059message SystemUptime {
2060 // Milliseconds since the system was booted.
2061 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2062 // for external input).
2063 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002064 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002065}
2066
2067/*
2068 * Reads from /proc/uid_concurrent_active_time which has the format:
2069 * active: X (X is # cores)
2070 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2071 * [uid1]: [time-0] [time-1] [time-2] ... ...
2072 * ...
2073 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2074 * The file contains a monotonically increasing count of time for a single boot.
2075 */
2076message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002077 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002078 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002079}
2080
2081/**
2082 * Reads from /proc/uid_concurrent_policy_time which has the format:
2083 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2084 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2085 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2086 * ...
2087 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2088 * The file contains a monotonically increasing count of time for a single boot.
2089 */
2090message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002091 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002092 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002093 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002094}
2095
2096/*
2097 * Pulls free disk space, for data, system partition and temporary directory.
2098 */
2099message DiskSpace {
2100 // available bytes in data partition
2101 optional uint64 data_available_bytes = 1;
2102 // available bytes in system partition
2103 optional uint64 system_available_bytes = 2;
2104 // available bytes in download cache or temp directories
2105 optional uint64 temp_available_bytes = 3;
2106}
Tej Singhbf972d92018-01-10 20:51:13 -08002107
2108/**
2109 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002110 * Pulled from:
2111 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002112 */
2113message RemainingBatteryCapacity {
2114 optional int32 charge_uAh = 1;
2115}
2116
2117/**
2118 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002119 * Pulled from:
2120 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002121 */
2122message FullBatteryCapacity {
2123 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002124}
2125
2126/**
Tej Singhd89137e2018-03-26 14:51:40 -07002127 * Pulls the temperature of various parts of the device.
2128 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002129 *
2130 * Pulled from:
2131 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2132 */
2133message Temperature {
2134 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2135 optional android.os.TemperatureTypeEnum sensor_location = 1;
2136
2137 // The name of the temperature source. Eg. CPU0
2138 optional string sensor_name = 2;
2139
Tej Singhd89137e2018-03-26 14:51:40 -07002140 // Temperature in tenths of a degree C.
2141 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002142}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002143
2144/**
2145 * Pulls the statistics of calls to Binder.
2146 *
2147 * Binder stats are cumulative from boot unless somebody reset the data using
2148 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002149 *
2150 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002151 */
2152message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002153 optional int32 uid = 1 [(is_uid) = true];
2154 // Fully qualified class name of the API call.
2155 //
2156 // This is a system server class name.
2157 //
2158 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2159 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2160 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2161 // commonly used APIs.
2162 optional string service_class_name = 2;
2163 // Method name of the API call. It can also be a transaction code if we cannot
2164 // resolve it to a name. See Binder#getTransactionName.
2165 //
2166 // This is a system server method name.
2167 optional string service_method_name = 3;
2168 // Total number of API calls.
2169 optional int64 call_count = 4;
2170 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2171 optional bool screen_interactive = 13;
2172 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2173 // call_count will be equal to recorded_call_count.
2174 //
2175 // If recorded_call_count is different than call_count, it means data collection has been
2176 // sampled. All the fields below will be sampled in this case.
2177 optional int64 recorded_call_count = 12;
2178 // Number of exceptions thrown by the API.
2179 optional int64 recorded_exception_count = 5;
2180 // Total latency of all API calls.
2181 // Average can be computed using total_latency_micros / recorded_call_count.
2182 optional int64 recorded_total_latency_micros = 6;
2183 // Maximum latency of one API call.
2184 optional int64 recorded_max_latency_micros = 7;
2185 // Total CPU usage of all API calls.
2186 // Average can be computed using total_cpu_micros / recorded_call_count.
2187 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2188 optional int64 recorded_total_cpu_micros = 8;
2189 // Maximum CPU usage of one API call.
2190 optional int64 recorded_max_cpu_micros = 9;
2191 // Maximum parcel reply size of one API call.
2192 optional int64 recorded_max_reply_size_bytes = 10;
2193 // Maximum parcel request size of one API call.
2194 optional int64 recorded_max_request_size_bytes = 11;
2195}
2196
2197/**
2198 * Pulls the statistics of exceptions during calls to Binder.
2199 *
2200 * Binder stats are cumulative from boot unless somebody reset the data using
2201 * > adb shell dumpsys binder_calls_stats --reset
2202 */
2203message BinderCallsExceptions {
2204 // Exception class name, e.g. java.lang.IllegalArgumentException.
2205 //
2206 // This is an exception class name thrown by the system server.
2207 optional string exception_class_name = 1;
2208 // Total number of exceptions.
2209 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002210}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002211
2212message LooperStats {
2213 // Currently not collected and always set to 0.
2214 optional int32 uid = 1 [(is_uid) = true];
2215
2216 // Fully qualified class name of the handler target class.
2217 //
2218 // This field does not contain PII. This is a system server class name.
2219 optional string handler_class_name = 2;
2220
2221 // The name of the thread that runs the Looper.
2222 //
2223 // This field does not contain PII. This is a system server thread name.
2224 optional string looper_thread_name = 3;
2225
2226 // The name of the dispatched message.
2227 //
2228 // This field does not contain PII. This is a system server constant or class
2229 // name.
2230 optional string message_name = 4;
2231
2232 // Total number of successfully dispatched messages.
2233 optional int64 message_count = 5;
2234
2235 // Total number of messages that failed dispatching.
2236 optional int64 exception_count = 6;
2237
2238 // Total number of processed messages we have data recorded for. If we
2239 // collected data for all the messages, message_count will be equal to
2240 // recorded_message_count.
2241 //
2242 // If recorded_message_count is different than message_count, it means data
2243 // collection has been sampled. All the fields below will be sampled in this
2244 // case.
2245 optional int64 recorded_message_count = 7;
2246
2247 // Total latency of all processed messages.
2248 // Average can be computed using recorded_total_latency_micros /
2249 // recorded_message_count.
2250 optional int64 recorded_total_latency_micros = 8;
2251
2252 // Total CPU usage of all processed message.
2253 // Average can be computed using recorded_total_cpu_micros /
2254 // recorded_message_count. Total can be computed using
2255 // recorded_total_cpu_micros / recorded_message_count * call_count.
2256 optional int64 recorded_total_cpu_micros = 9;
2257}
Tej Singh86dc9db2018-09-06 00:39:57 +00002258
2259/**
2260 * Pulls disk information, such as write speed and latency.
2261 */
2262message DiskStats {
2263 // Time taken to open, write 512B to, and close a file.
2264 // -1 if error performing the check.
2265 optional int64 data_write_latency_millis = 1;
2266
2267 optional bool file_based_encryption = 2;
2268
2269 // Recent disk write speed in kB/s.
2270 // -1 if error querying storageed.
2271 // 0 if data is unavailable.
2272 optional int32 recent_disk_write_speed = 3;
2273}
2274
2275
2276/**
2277 * Free and total bytes of the Data, Cache, and System partition.
2278 */
2279message DirectoryUsage {
2280 enum Directory {
2281 UNKNOWN = 0;
2282 DATA = 1;
2283 CACHE = 2;
2284 SYSTEM = 3;
2285 }
2286 optional Directory directory = 1;
2287 optional int64 free_bytes = 2;
2288 optional int64 total_bytes = 3;
2289}
2290
2291
2292/**
2293 * Size of an application: apk size, data size, and cache size.
2294 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2295 * Information is only reported for apps with the primary user (user 0).
2296 * Sizes are aggregated by package name.
2297 */
2298message AppSize {
2299 // Including uids will involve modifying diskstats logic.
2300 optional string package_name = 1;
2301 // App size in bytes. -1 if unavailable.
2302 optional int64 app_size_bytes = 2;
2303 // App data size in bytes. -1 if unavailable.
2304 optional int64 app_data_size_bytes = 3;
2305 // App cache size in bytes. -1 if unavailable.
2306 optional int64 app_cache_size_bytes = 4;
2307 // Time that the cache file was produced.
2308 // Uses System.currentTimeMillis(), which is wall clock time.
2309 optional int64 cache_time_millis = 5;
2310}
2311
2312
2313/**
2314 * Size of a particular category. Eg: photos, videos.
2315 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2316 */
2317message CategorySize {
2318 enum Category {
2319 UNKNOWN = 0;
2320 APP_SIZE = 1;
2321 APP_DATA_SIZE = 2;
2322 APP_CACHE_SIZE = 3;
2323 PHOTOS = 4;
2324 VIDEOS = 5;
2325 AUDIO = 6;
2326 DOWNLOADS = 7;
2327 SYSTEM = 8;
2328 OTHER = 9;
2329 }
2330 optional Category category = 1;
2331 // Category size in bytes.
2332 optional int64 size_bytes = 2;
2333 // Time that the cache file was produced.
2334 // Uses System.currentTimeMillis(), which is wall clock time.
2335 optional int64 cache_time_millis = 3;
2336}