blob: 54fbf6665c5b3d85dc9be3f00a3b26ffc711c065 [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;
Yangster-mac96353002018-09-05 11:18:55 -0700133 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yao Chend54f9dd2017-10-17 17:37:48 +0000134 }
David Chenc8a43242017-10-17 16:23:28 -0700135
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100137 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700138 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800139 WifiBytesTransfer wifi_bytes_transfer = 10000;
140 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
141 MobileBytesTransfer mobile_bytes_transfer = 10002;
142 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800143 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800144 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800145 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 CpuTimePerFreq cpu_time_per_freq = 10008;
147 CpuTimePerUid cpu_time_per_uid = 10009;
148 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800149 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800150 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800151 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800152 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800153 SystemElapsedRealtime system_elapsed_realtime = 10014;
154 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800155 CpuActiveTime cpu_active_time = 10016;
156 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000157 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800158 RemainingBatteryCapacity remaining_battery_capacity = 10019;
159 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800160 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100161 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100162 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100163 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000164 DiskStats disk_stats = 10025;
165 DirectoryUsage directory_usage = 10026;
166 AppSize app_size = 10027;
167 CategorySize category_size = 10028;
David Chenc8a43242017-10-17 16:23:28 -0700168 }
yroa1fe77c2018-02-26 14:22:54 -0800169
170 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
171 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700172}
173
Yao Chend54f9dd2017-10-17 17:37:48 +0000174/**
Yangster-mac20877162017-12-22 17:19:39 -0800175 * This proto represents a node of an attribution chain.
176 * Note: All attribution chains are represented as a repeated field of type
177 * AttributionNode. It is understood that in such arrays, the order is that
178 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000179 */
Yangster-mac20877162017-12-22 17:19:39 -0800180message AttributionNode {
181 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800182 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800183
Yangster-mac20877162017-12-22 17:19:39 -0800184 // The (optional) string tag for an element in the attribution chain. If the
185 // element has no tag, it is encoded as an empty string.
186 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700187}
188
Yangster-mac48b3d622018-08-18 12:38:11 -0700189message KeyValuePair {
190 optional int32 key = 1;
191 oneof value {
192 int64 value_int = 2;
193 string value_str = 3;
194 float value_float = 4;
195 }
196}
197
198message KeyValuePairsAtom {
199 optional int32 uid = 1;
200 repeated KeyValuePair pairs = 2;
201}
202
Yao Chend54f9dd2017-10-17 17:37:48 +0000203/*
204 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800205 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000206 *
207 * RULES:
208 * - The field ids for each atom must start at 1, and count upwards by 1.
209 * Skipping field ids is not allowed.
210 * - These form an API, so renaming, renumbering or removing fields is
211 * not allowed between android releases. (This is not currently enforced,
212 * but there will be a tool to enforce this restriction).
213 * - The types must be built-in protocol buffer types, namely, no sub-messages
214 * are allowed (yet). The bytes type is also not allowed.
215 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800216 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000217 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800218 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000219 * - A field that is a uid should be a string field, tagged with the [xxx]
220 * annotation. The generated code on android will be represented by UIDs,
221 * and those UIDs will be translated in xxx to those strings.
222 *
223 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700224 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000225 * - If there is a UID, it goes first. Think in an object-oriented fashion.
226 * *****************************************************************************
227 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700228
Yao Chend54f9dd2017-10-17 17:37:48 +0000229/**
230 * Logs when the screen state changes.
231 *
232 * Logged from:
233 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
234 */
235message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800236 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800237 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700238}
Yao Chend54f9dd2017-10-17 17:37:48 +0000239
240/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700241 * Logs that the process state of the uid, as determined by ActivityManager
242 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000243 *
244 * Logged from:
245 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
246 */
Bookatzc1a050a2017-10-10 15:49:28 -0700247message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700248 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000249
Bookatzdb026a22018-01-10 19:01:56 -0800250 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800251 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000252}
253
254/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700255 * Logs process state change of a process, as per the activity manager.
256 *
257 * Logged from:
258 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
259 */
260message ProcessStateChanged {
261 optional int32 uid = 1;
262 optional string process_name = 2;
263 optional string package_name = 3;
264 // TODO: remove this when validation is done
265 optional int64 version = 5;
266 // The state, from frameworks/base/core/proto/android/app/enums.proto.
267 optional android.app.ProcessStateEnum state = 4;
268}
269
270/**
271 * Logs when ActivityManagerService sleep state is changed.
272 *
273 * Logged from:
274 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
275 */
276message ActivityManagerSleepStateChanged {
277 // TODO: import frameworks proto
278 enum State {
279 UNKNOWN = 0;
280 ASLEEP = 1;
281 AWAKE = 2;
282 }
283 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
284}
285
286/**
287 * Logs when system memory state changes.
288 *
289 * Logged from:
290 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
291 */
292message MemoryFactorStateChanged {
293 // TODO: import frameworks proto
294 enum State {
295 MEMORY_UNKNOWN = 0;
296 NORMAL = 1; // normal.
297 MODERATE = 2; // moderate memory pressure.
298 LOW = 3; // low memory.
299 CRITICAL = 4; // critical memory.
300
301 }
302 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
303}
304
305/**
306 * Logs when app is using too much cpu, according to ActivityManagerService.
307 *
308 * Logged from:
309 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
310 */
311message ExcessiveCpuUsageReported {
312 optional int32 uid = 1;
313 optional string process_name = 2;
314 optional string package_name = 3;
315 // package version. TODO: remove this when validation is done
316 optional int64 version = 4;
317}
318
319/**
320 * Logs when a cached process is killed, along with its pss.
321 *
322 * Logged from:
323 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
324 */
325message CachedKillReported {
326 optional int32 uid = 1;
327 optional string process_name = 2;
328 optional string package_name = 3;
329 // TODO: remove this when validation is done
330 optional int64 version = 5;
331 optional int64 pss = 4;
332}
333
334/**
335 * Logs when memory stats of a process is reported.
336 *
337 * Logged from:
338 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
339 */
340message ProcessMemoryStatReported {
341 optional int32 uid = 1;
342 optional string process_name = 2;
343 optional string package_name = 3;
344 //TODO: remove this when validation is done
345 optional int64 version = 9;
346 optional int64 pss = 4;
347 optional int64 uss = 5;
348 optional int64 rss = 6;
349 enum Type {
350 ADD_PSS_INTERNAL_SINGLE = 0;
351 ADD_PSS_INTERNAL_ALL_MEM = 1;
352 ADD_PSS_INTERNAL_ALL_POLL = 2;
353 ADD_PSS_EXTERNAL = 3;
354 ADD_PSS_EXTERNAL_SLOW = 4;
355 }
356 optional Type type = 7;
357 optional int64 duration = 8;
358}
359
360/**
Bookatzc1a050a2017-10-10 15:49:28 -0700361 * Logs that a process started, finished, crashed, or ANRed.
362 *
363 * Logged from:
364 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
365 */
366message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700367 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700368
David Chen0b5c90c2018-01-25 16:51:49 -0800369 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800370 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700371
Bookatzddccf0a2017-11-28 16:48:14 -0800372 // What lifecycle state the process changed to.
373 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800374 enum State {
375 FINISHED = 0;
376 STARTED = 1;
377 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800378 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800379 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700380}
381
Bookatzc1a050a2017-10-10 15:49:28 -0700382/**
383 * Logs when the ble scan state changes.
384 *
385 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700386 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700387 */
388message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800389 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700390
391 enum State {
392 OFF = 0;
393 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700394 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
395 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700396 }
397 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700398
Bookatze5ec0b42018-03-26 13:34:56 -0700399 // Does the scan have a filter.
400 optional bool is_filtered = 3;
401 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
402 optional bool is_first_match = 4;
403 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
404 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700405}
406
407/**
408 * Logs reporting of a ble scan finding results.
409 *
410 * Logged from:
411 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
412 */
413// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
414message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800415 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700416
417 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800418 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700419}
420
421/**
422 * Logs when a sensor state changes.
423 *
424 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700425 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700426 */
427message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800428 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700429
Bookatzc1a050a2017-10-10 15:49:28 -0700430 // The id (int) of the sensor.
431 optional int32 sensor_id = 2;
432
433 enum State {
434 OFF = 0;
435 ON = 1;
436 }
437 optional State state = 3;
438}
439
440
441/**
442 * Logs when GPS state changes.
443 *
444 * Logged from:
445 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
446 */
447message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800448 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700449
450 enum State {
451 OFF = 0;
452 ON = 1;
453 }
454 optional State state = 2;
455}
456
457
458/**
459 * Logs when a sync manager sync state changes.
460 *
461 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700462 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700463 */
464message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800465 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700466
David Chen0b5c90c2018-01-25 16:51:49 -0800467 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800468 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700469
470 enum State {
471 OFF = 0;
472 ON = 1;
473 }
474 optional State state = 3;
475}
476
Yangster-mac96353002018-09-05 11:18:55 -0700477/*
478 * Deferred job stats.
479 *
480 * Logged from:
481 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
482*/
483message DeferredJobStatsReported {
484 repeated AttributionNode attribution_node = 1;
485
486 // Number of jobs deferred.
487 optional int32 num_jobs_deferred = 2;
488
489 // Time since the last job runs.
490 optional int64 time_since_last_job_millis = 3;
491}
492
Bookatzc1a050a2017-10-10 15:49:28 -0700493/**
494 * Logs when a job scheduler job state changes.
495 *
496 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700497 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700498 */
499message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800500 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700501
502 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800503 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700504
505 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800506 FINISHED = 0;
507 STARTED = 1;
508 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700509 }
510 optional State state = 3;
511
Tej Singh33a412b2018-03-16 18:43:59 -0700512 // The reason a job has stopped.
513 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700514 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700515 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700516}
517
518/**
519 * Logs when the audio state changes.
520 *
521 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700522 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700523 */
524message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800525 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700526
527 enum State {
528 OFF = 0;
529 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700530 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
531 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700532 }
533 optional State state = 2;
534}
535
536/**
537 * Logs when the video codec state changes.
538 *
539 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700540 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700541 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800542message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800543 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700544
545 enum State {
546 OFF = 0;
547 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700548 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
549 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700550 }
551 optional State state = 2;
552}
553
554/**
555 * Logs when the flashlight state changes.
556 *
557 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700558 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700559 */
560message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800561 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700562
563 enum State {
564 OFF = 0;
565 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700566 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
567 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700568 }
569 optional State state = 2;
570}
571
572/**
573 * Logs when the camera state changes.
574 *
575 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700576 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700577 */
578message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800579 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700580
581 enum State {
582 OFF = 0;
583 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700584 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
585 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700586 }
587 optional State state = 2;
588}
589
590/**
591 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000592 *
593 * Logged from:
594 * TODO
595 */
Bookatzd6746242017-10-24 18:39:35 -0700596message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800597 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000598
Bookatz1a1b0462018-01-12 11:47:03 -0800599 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
600 // From frameworks/base/core/proto/android/os/enums.proto.
601 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700602
603 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
604 optional string tag = 3;
605
606 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800607 RELEASE = 0;
608 ACQUIRE = 1;
609 CHANGE_RELEASE = 2;
610 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700611 }
612 optional State state = 4;
613}
614
615/**
Bookatzc1a050a2017-10-10 15:49:28 -0700616 * Logs when a partial wakelock is considered 'long' (over 1 min).
617 *
618 * Logged from:
619 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
620 */
621message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800622 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700623
Yao Chend54f9dd2017-10-17 17:37:48 +0000624 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
625 optional string tag = 2;
626
Bookatzc1a050a2017-10-10 15:49:28 -0700627 // TODO: I have no idea what this is.
628 optional string history_tag = 3;
629
630 enum State {
631 OFF = 0;
632 ON = 1;
633 }
634 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000635}
636
Bookatzc1a050a2017-10-10 15:49:28 -0700637/**
638 * Logs Battery Saver state change.
639 *
640 * Logged from:
641 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
642 */
643message BatterySaverModeStateChanged {
644 enum State {
645 OFF = 0;
646 ON = 1;
647 }
648 optional State state = 1;
649}
650
651/**
652 * Logs Doze mode state change.
653 *
654 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800655 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700656 */
657message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800658 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800659}
660
661
662/**
663 * Logs state change of Doze mode including maintenance windows.
664 *
665 * Logged from:
666 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
667 */
668message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800669 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700670}
671
672/**
673 * Logs screen brightness level.
674 *
675 * Logged from:
676 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
677 */
678message ScreenBrightnessChanged {
679 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
680 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700681}
682
683/**
684 * Logs battery level (percent full, from 0 to 100).
685 *
686 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700687 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700688 */
689message BatteryLevelChanged {
690 // Battery level. Should be in [0, 100].
691 optional int32 battery_level = 1;
692}
693
694/**
695 * Logs change in charging status of the device.
696 *
697 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700698 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700699 */
700message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800701 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
702 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700703}
704
705/**
706 * Logs whether the device is plugged in, and what power source it is using.
707 *
708 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700709 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700710 */
711message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800712 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
713 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700714}
715
Bookatz8c6571b2017-10-24 15:04:41 -0700716/**
717 * Logs when an app's wakeup alarm fires.
718 *
719 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700720 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700721 */
722message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800723 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800724
725 // Name of the wakeup alarm.
726 optional string tag = 2;
727}
728
729/**
730 * Logs when an an app causes the mobile radio to change state.
731 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
732 *
733 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700734 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800735 */
736message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800737 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800738
Bookatz1a1b0462018-01-12 11:47:03 -0800739 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
740 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800741}
742
743/**
744 * Logs when an an app causes the wifi radio to change state.
745 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
746 *
747 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700748 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800749 */
750message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800751 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800752
Bookatz1a1b0462018-01-12 11:47:03 -0800753 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
754 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700755}
756
757/**
758 * Logs kernel wakeup reasons and aborts.
759 *
760 * Logged from:
761 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
762 */
763message KernelWakeupReported {
764 // Name of the kernel wakeup reason (or abort).
765 optional string wakeup_reason_name = 1;
766
767 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800768 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700769}
770
771/**
772 * Logs wifi locks held by an app.
773 *
774 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700775 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700776 */
777message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800778 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700779
780 enum State {
781 OFF = 0;
782 ON = 1;
783 }
784 optional State state = 2;
785}
786
787/**
788 * Logs wifi signal strength changes.
789 *
790 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700791 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700792 */
793message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800794 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
795 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700796}
797
798/**
799 * Logs wifi scans performed by an app.
800 *
801 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700802 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700803 */
804message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800805 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700806
807 enum State {
808 OFF = 0;
809 ON = 1;
810 }
811 optional State state = 2;
812}
813
814/**
Tej Singh4503e102018-01-04 14:35:01 -0800815 * Logs wifi multicast locks held by an app
816 *
817 * Logged from:
818 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
819 */
820message WifiMulticastLockStateChanged {
821 repeated AttributionNode attribution_node = 1;
822
823 enum State {
824 OFF = 0;
825 ON = 1;
826 }
827 optional State state = 2;
828}
829
830/**
Tej Singh1ea42892018-01-19 09:27:00 -0800831 * Logs shutdown reason and duration on next boot.
832 *
833 * Logged from:
834 * frameworks/base/core/java/com/android/server/BootReceiver.java
835 */
836message ShutdownSequenceReported {
837 // True if shutdown is for a reboot. Default: false if we do not know.
838 optional bool reboot = 1;
839
840 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
841 optional string reason = 2;
842
843 // Beginning of shutdown time in ms using wall clock time since unix epoch.
844 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800845 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800846
847 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800848 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800849}
850
Tej Singh6483ea42018-01-25 17:45:49 -0800851
852/**
853 * Logs boot reason and duration.
854 *
855 * Logged from:
856 * system/core/bootstat/bootstat.cpp
857 */
858message BootSequenceReported {
859 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
860 // Default: "<EMPTY>" if not available.
861 optional string bootloader_reason = 1;
862
863 // Reason for system boot. Eg. bootloader, reboot,userrequested
864 // Default: "<EMPTY>" if not available.
865 optional string system_reason = 2;
866
867 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800868 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800869
870 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800871 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800872
873 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800874 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800875
876 // Time since last boot in ms. Default: 0 if not available.
877 optional int64 time_since_last_boot = 6;
878}
879
Tej Singhc477d9c2018-02-05 18:31:39 -0800880
881/**
882 * Logs call state and disconnect cause (if applicable).
883 *
884 * Logged from:
885 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
886 */
887message CallStateChanged {
888 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
889 // From frameworks/base/core/proto/android/telecomm/enums.proto.
890 optional android.telecom.CallStateEnum call_state = 1;
891
892 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
893 // This value is only applicable when the call_state is DISCONNECTED, and
894 // should always be UNKNOWN if the call_state is not DISCONNECTED.
895 // From frameworks/base/core/proto/android/telecomm/enums.proto.
896 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
897
898 // True if the call is self-managed, which are apps that use the
899 // telecom infrastructure to make their own calls.
900 optional bool self_managed = 3;
901
902 // True if call is external. External calls are calls on connected Wear
903 // devices but show up in Telecom so the user can pull them onto the device.
904 optional bool external_call = 4;
905}
906
Tej Singh1ea42892018-01-19 09:27:00 -0800907/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800908 * Logs keyguard state. The keyguard is the lock screen.
909 *
910 * Logged from:
911 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
912 */
913message KeyguardStateChanged {
914 enum State {
915 UNKNOWN = 0;
916 // The keyguard is hidden when the phone is unlocked.
917 HIDDEN = 1;
918 // The keyguard is shown when the phone is locked (screen turns off).
919 SHOWN= 2;
920 // The keyguard is occluded when something is overlaying the keyguard.
921 // Eg. Opening the camera while on the lock screen.
922 OCCLUDED = 3;
923 }
924 optional State state = 1;
925}
926
927/**
928 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
929 * prompts the user to enter a password (pattern, pin, etc).
930 *
931 * Logged from:
932 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
933 */
934
935message KeyguardBouncerStateChanged {
936 enum State {
937 UNKNOWN = 0;
938 // Bouncer is hidden, either as a result of successfully entering the
939 // password, screen timing out, or user going back to lock screen.
940 HIDDEN = 1;
941 // This is when the user is being prompted to enter the password.
942 SHOWN = 2;
943 }
944 optional State state = 1;
945}
946
947/**
948 * Logs the result of entering a password into the keyguard bouncer.
949 *
950 * Logged from:
951 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
952 */
953message KeyguardBouncerPasswordEntered {
954 enum BouncerResult {
955 UNKNOWN = 0;
956 // The password entered was incorrect.
957 FAILURE = 1;
958 // The password entered was correct.
959 SUCCESS = 2;
960 }
961 optional BouncerResult result = 1;
962}
963
Tej Singha883b372018-02-15 11:30:01 -0800964/*
965 * Logs changes to the configuration of the device. The configuration is defined
966 * in frameworks/base/core/java/android/content/res/Configuration.java
967 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
968 * Please go there to interpret the possible values each field can be.
969 *
970 * Logged from:
971 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
972 */
973message ResourceConfigurationChanged {
974 // Bit mask of color capabilities of the screen.
975 // Contains information about the color gamut and hdr mode of the screen.
976 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
977 optional int32 colorMode = 1;
978
979 // The target screen density being rendered to.
980 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
981 optional int32 densityDpi = 2;
982
983 // Current user preference for the scaling factor for fonts,
984 // relative to the base density scaling.
985 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
986 optional float fontScale = 3;
987
988 // Flag indicating whether the hard keyboard is hidden.
989 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
990 optional int32 hardKeyboardHidden = 4;
991
992 // The type of keyboard attached to the device.
993 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
994 optional int32 keyboard = 5;
995
996 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
997 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
998 optional int32 keyboardHideen = 6;
999
1000 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1001 // 0 if undefined.
1002 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1003 optional int32 mcc = 7;
1004
1005 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1006 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1007 // MNC_ZERO symbol defined in Configuration.java.
1008 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1009 optional int32 mnc = 8;
1010
1011 // The kind of navigation available on the device.
1012 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1013 optional int32 navigation = 9;
1014
1015 // Flag indicating whether the navigation is available.
1016 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1017 optional int32 navigationHidden = 10;
1018
1019 // Overall orientation of the screen.
1020 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1021 optional int32 orientation = 11;
1022
1023 // The current height of the available screen space, in dp units.
1024 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1025 optional int32 screenHeightDp = 12;
1026
1027 // Bit mask of overall layout of the screen.
1028 // Contains information about screen size, whether the screen is wider/taller
1029 // than normal, whether the screen layout is right-tl-left or left-to-right,
1030 // and whether the screen has a rounded shape.
1031 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1032 optional int32 screenLayout = 13;
1033
1034 // Current width of the available screen space, in dp units.
1035 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1036 optional int32 screenWidthDp = 14;
1037
1038 // The smallest screen size an application will see in normal operation.
1039 // This is the smallest value of both screenWidthDp and screenHeightDp
1040 // in portrait and landscape.
1041 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1042 optional int32 smallestScreenWidthDp = 15;
1043
1044 // The type of touch screen attached to the device.
1045 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1046 optional int32 touchscreen = 16;
1047
1048 // Bit mask of the ui mode.
1049 // Contains information about the overall ui mode of the device.
1050 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1051 // Also contains information about whether the device is in night mode.
1052 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1053 optional int32 uiMode = 17;
1054}
1055
Tej Singheee317b2018-03-07 19:28:05 -08001056
1057/**
1058 * Logs changes in the connection state of the mobile radio.
1059 *
1060 * Logged from:
1061 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1062 */
1063message MobileConnectionStateChanged {
1064 // States are from the state machine DataConnection.java.
1065 enum State {
1066 UNKNOWN = 0;
1067 // The connection is inactive, or disconnected.
1068 INACTIVE = 1;
1069 // The connection is being activated, or connecting.
1070 ACTIVATING = 2;
1071 // The connection is active, or connected.
1072 ACTIVE = 3;
1073 // The connection is disconnecting.
1074 DISCONNECTING = 4;
1075 // The connection is disconnecting after creating a connection.
1076 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1077 }
1078 optional State state = 1;
1079 // For multi-sim phones, this distinguishes between the sim cards.
1080 optional int32 sim_slot_index = 2;
1081 // Used to identify the connection. Starts at 0 and increments by 1 for
1082 // every new network created. Resets whenever the device reboots.
1083 optional int32 data_connection_id = 3;
1084 // A bitmask for the capabilities of this connection.
1085 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1086 // Default value (if we have no information): 0
1087 optional int64 capabilities = 4;
1088 // If this connection has internet.
1089 // This just checks if the DEFAULT bit of capabilities is set.
1090 optional bool has_internet = 5;
1091}
1092
1093/**
1094 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1095 *
1096 * Logged from:
1097 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1098 */
1099message MobileRadioTechnologyChanged {
1100 optional android.telephony.NetworkTypeEnum state = 1;
1101 // For multi-sim phones, this distinguishes between the sim cards.
1102 optional int32 sim_slot_index = 2;
1103}
1104
Andrew Chantb56388b2018-03-22 21:07:33 -07001105/**
1106 * Logs the VID and PID of any connected USB devices.
1107 *
1108 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1109 *
1110 * Logged by Vendor.
1111 */
1112message UsbDeviceAttached {
1113 optional int32 vid = 1;
1114 optional int32 pid = 2;
1115 optional bool has_audio = 3;
1116 optional bool has_hid = 4;
1117 optional bool has_storage = 5;
1118}
1119
Tej Singheee317b2018-03-07 19:28:05 -08001120
Tej Singhdd7bd352018-02-09 19:33:15 -08001121/**
Tej Singh5d991e12018-03-09 19:48:11 -08001122 * Logs when Bluetooth is enabled and disabled.
1123 *
1124 * Logged from:
1125 * services/core/java/com/android/server/BluetoothManagerService.java
1126 */
1127message BluetoothEnabledStateChanged {
1128 repeated AttributionNode attribution_node = 1;
1129 // Whether or not bluetooth is enabled on the device.
1130 enum State {
1131 UNKNOWN = 0;
1132 ENABLED = 1;
1133 DISABLED = 2;
1134 }
1135 optional State state = 2;
1136 // The reason for being enabled/disabled.
1137 // Eg. Airplane mode, crash, application request.
1138 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1139 // If the reason is an application request, this will be the package name.
1140 optional string pkgName = 4;
1141}
1142
1143/**
1144 * Logs when a Bluetooth device connects and disconnects.
1145 *
1146 * Logged from:
1147 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1148 */
1149message BluetoothConnectionStateChanged {
1150 // The state of the connection.
1151 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1152 optional android.bluetooth.ConnectionStateEnum state = 1;
1153 // An identifier that can be used to match connect and disconnect events.
1154 // Currently is last two bytes of a hash of a device level ID and
1155 // the mac address of the bluetooth device that is connected.
1156 optional int32 obfuscated_id = 2;
1157 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1158 // From android.bluetooth.BluetoothAdapter.java
1159 optional int32 bt_profile = 3;
1160}
1161
1162/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001163 * Logs when something is plugged into or removed from the USB-C connector.
1164 *
1165 * Logged from:
1166 * Vendor USB HAL.
1167 */
1168message UsbConnectorStateChanged {
1169 enum State {
1170 DISCONNECTED = 0;
1171 CONNECTED = 1;
1172 }
1173 optional State state = 1;
1174}
1175
1176/**
1177 * Logs the reported speaker impedance.
1178 *
1179 * Logged from:
1180 * Vendor audio implementation.
1181 */
1182message SpeakerImpedanceReported {
1183 optional int32 speaker_location = 1;
1184 optional int32 impedance = 2;
1185}
1186
1187/**
1188 * Logs the report of a failed hardware.
1189 *
1190 * Logged from:
1191 * Vendor HALs.
1192 *
1193 */
1194message HardwareFailed {
1195 enum HardwareType {
1196 HARDWARE_FAILED_UNKNOWN = 0;
1197 HARDWARE_FAILED_MICROPHONE = 1;
1198 HARDWARE_FAILED_CODEC = 2;
1199 HARDWARE_FAILED_SPEAKER = 3;
1200 HARDWARE_FAILED_FINGERPRINT = 4;
1201 }
1202 optional HardwareType hardware_type = 1;
1203
1204 /* hardware_location allows vendors to differentiate between multiple instances of
1205 * the same hardware_type. The specific locations are vendor defined integers,
1206 * referring to board-specific numbering schemes.
1207 */
1208 optional int32 hardware_location = 2;
1209
1210 /* failure_code is specific to the HardwareType of the failed hardware.
1211 * It should use the enum values defined below.
1212 */
1213 enum MicrophoneFailureCode {
1214 MICROPHONE_FAILURE_COMPLETE = 0;
1215 }
1216 enum CodecFailureCode {
1217 CODEC_FAILURE_COMPLETE = 0;
1218 }
1219 enum SpeakerFailureCode {
1220 SPEAKER_FAILURE_COMPLETE = 0;
1221 SPEAKER_FAILURE_HIGH_Z = 1;
1222 SPEAKER_FAILURE_SHORT = 2;
1223 }
1224 enum FingerprintFailureCode {
1225 FINGERPRINT_FAILURE_COMPLETE = 0;
1226 FINGERPRINT_SENSOR_BROKEN = 1;
1227 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1228 }
1229 optional int32 failure_code = 3;
1230}
1231
1232/**
1233 * Log an event when the device has been physically dropped.
1234 * Reported from the /vendor partition.
1235 */
1236message PhysicalDropDetected {
1237 // Confidence that the event was actually a drop, 0 -> 100
1238 optional int32 confidence_pctg = 1;
1239 // Peak acceleration of the drop, in 1/1000s of a g.
1240 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001241 // Duration of freefall in ms
1242 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001243}
1244
1245/**
1246 * Log bucketed battery charge cycles.
1247 *
1248 * Each bucket represents cycles of the battery past
1249 * a given charge point. For example, bucket 1 is the
1250 * lowest 1/8th of the battery, and bucket 8 is 100%.
1251 *
1252 * Logged from:
1253 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1254 */
1255message ChargeCyclesReported {
1256 optional int32 cycle_bucket_1 = 1;
1257 optional int32 cycle_bucket_2 = 2;
1258 optional int32 cycle_bucket_3 = 3;
1259 optional int32 cycle_bucket_4 = 4;
1260 optional int32 cycle_bucket_5 = 5;
1261 optional int32 cycle_bucket_6 = 6;
1262 optional int32 cycle_bucket_7 = 7;
1263 optional int32 cycle_bucket_8 = 8;
1264}
1265
1266/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001267 * Logs the duration of a davey (jank of >=700ms) when it occurs
1268 *
1269 * Logged from:
1270 * frameworks/base/libs/hwui/JankTracker.cpp
1271 */
1272message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001273 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001274 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001275
Tej Singhbb8554a2018-01-26 11:59:14 -08001276 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001277 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001278}
1279
1280/**
Bookatze5885242017-10-24 20:10:31 -07001281 * Logs phone signal strength changes.
1282 *
1283 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001284 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001285 */
1286message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001287 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1288 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001289}
1290
1291/**
1292 * Logs that a setting was updated.
1293 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001294 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001295 * The tag and is_default allow resetting of settings to default values based on the specified
1296 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1297 */
1298message SettingChanged {
1299 // The name of the setting.
1300 optional string setting = 1;
1301
1302 // The change being imposed on this setting. May represent a number, eg "3".
1303 optional string value = 2;
1304
1305 // The new value of this setting. For most settings, this is same as value. For some settings,
1306 // value is +X or -X where X represents an element in a set. For example, if the previous value
1307 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1308 // The +/- feature is currently only used for location_providers_allowed.
1309 optional string new_value = 3;
1310
1311 // The previous value of this setting.
1312 optional string prev_value = 4;
1313
1314 // The tag used with the is_default for resetting sets of settings. This is generally null.
1315 optional string tag = 5;
1316
Bookatz90867622018-01-31 15:05:57 -08001317 // True if this setting with tag should be resettable.
1318 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001319
David Chenbd789912018-03-16 17:19:55 -07001320 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001321 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001322
1323 enum ChangeReason {
1324 UPDATED = 1; // Updated can be an insertion or an update.
1325 DELETED = 2;
1326 }
1327 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001328}
Chenjie Yub3dda412017-10-24 13:41:59 -07001329
Chenjie Yu05013b32017-11-21 10:21:41 -08001330/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001331 * Logs activity going to foreground or background
1332 *
1333 * Logged from:
1334 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1335 */
1336message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001337 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001338 optional string pkg_name = 2;
1339 optional string class_name = 3;
1340
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001341 enum State {
1342 BACKGROUND = 0;
1343 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001344 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001345 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001346}
David Chenc8a43242017-10-17 16:23:28 -07001347
1348/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001349 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001350 * Logged from:
1351 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1352 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001353message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001354 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001355
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001356 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001357
1358 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001359 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001360 optional string process_name = 3;
1361
1362 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001363 optional sint32 pid = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001364
1365 optional string package_name = 5;
1366
1367 enum InstantApp {
1368 UNAVAILABLE = 0;
1369 FALSE = 1;
1370 TRUE = 2;
1371 }
1372 optional InstantApp is_instant_app = 6;
1373
1374 enum ForegroundState {
1375 UNKNOWN = 0;
1376 BACKGROUND = 1;
1377 FOREGROUND = 2;
1378 }
1379 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001380}
David Chen9e3808c2017-11-20 17:25:34 -08001381
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001382/**
1383 * Logs when a WTF (What a Terrible Failure) happened.
1384 * Logged from:
1385 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1386 */
1387message WTFOccurred {
1388 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001389
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001390 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001391
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001392 // The name of the process.
1393 // system_server if it is not by an app
1394 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001395
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001396 // The pid if available. -1 means not available.
1397 optional sint32 pid = 4;
1398}
1399
1400/**
1401 * Logs when system server reports low memory.
1402 * Logged from:
1403 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1404 */
1405message LowMemReported {
1406}
1407
1408/**
1409 * Logs when an app ANR (App Not Responding) occurs.
1410 * Logged from:
1411 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1412 */
1413message ANROccurred {
1414 optional int32 uid = 1 [(is_uid) = true];
1415
1416 optional string process_name = 2;
1417
1418 optional string short_component_name = 3;
1419
1420 optional string reason = 4;
Chenjie Yuf17bf62f2018-04-02 14:22:19 -07001421
1422 enum InstantApp {
1423 UNAVAILABLE = 0;
1424 FALSE = 1;
1425 TRUE = 2;
1426 }
1427 optional InstantApp is_instant_app = 5;
1428
1429 enum ForegroundState {
1430 UNKNOWN = 0;
1431 BACKGROUND = 1;
1432 FOREGROUND = 2;
1433 }
1434 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001435}
1436
Bookatza7020bd2018-08-28 16:29:35 -07001437/**
1438 * Logs when the vibrator state changes.
1439 * Logged from:
1440 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1441 */
1442message VibratorStateChanged {
1443 repeated AttributionNode attribution_node = 1;
1444
1445 enum State {
1446 OFF = 0;
1447 ON = 1;
1448 }
1449 optional State state = 2;
1450
1451 // Duration (in milliseconds) requested to keep the vibrator on.
1452 // Only applicable for State == ON.
1453 optional int64 duration_millis = 3;
1454}
1455
David Chen0a368b22017-12-06 16:28:16 -08001456/*
1457 * Allows other apps to push events into statsd.
1458 * Logged from:
1459 * frameworks/base/core/java/android/util/StatsLog.java
1460 */
David Chen0b5c90c2018-01-25 16:51:49 -08001461message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001462 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001463 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001464
1465 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1466 optional int32 label = 2;
1467
1468 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1469 // predicates for the metrics).
1470 enum State {
1471 UNKNOWN = 0;
1472 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1473 STOP = 2;
1474 START = 3;
1475 }
1476 optional State state = 3;
1477}
1478
David Chen9e3808c2017-11-20 17:25:34 -08001479/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001480 * Logs when statsd detects an anomaly.
1481 *
1482 * Logged from:
1483 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1484 */
1485message AnomalyDetected {
1486 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001487 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001488
Yangster-mac94e197c2018-01-02 16:03:03 -08001489 // Id of the config whose anomaly detection alert fired.
1490 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001491
Yangster-mac94e197c2018-01-02 16:03:03 -08001492 // Id of the alert (i.e. name of the anomaly that was detected).
1493 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001494}
1495
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001496message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001497 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001498 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001499
1500 // The app package name.
1501 optional string pkg_name = 2;
1502
1503 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001504 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001505 WARM = 1;
1506 HOT = 2;
1507 COLD = 3;
1508 }
1509 // The transition type.
1510 optional TransitionType type = 3;
1511
1512 // The activity name.
1513 optional string activity_name = 4;
1514
1515 // The name of the calling app. Empty if not set.
1516 optional string calling_pkg_name = 5;
1517
1518 // Whether the app is an instant app.
1519 optional bool is_instant_app = 6;
1520
1521 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001522 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001523
Bookatz80d11a02018-01-16 10:46:35 -08001524 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001525
David Chen0b5c90c2018-01-25 16:51:49 -08001526 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001527 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001528 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001529 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001530 optional int32 bind_application_delay_millis = 11;
1531 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001532
1533 // Empty if not set.
1534 optional string launch_token = 13;
1535
Calin Juravle759fbda2018-02-20 19:52:30 +00001536 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001537 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001538
1539 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001540 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001541}
1542
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001543message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001544 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001545 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001546
1547 // The app package name.
1548 optional string pkg_name = 2;
1549
1550 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001551 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001552 WARM = 1;
1553 HOT = 2;
1554 COLD = 3;
1555 }
1556 // The transition type.
1557 optional TransitionType type = 3;
1558
1559 // The activity name.
1560 optional string activity_name = 4;
1561}
1562
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001563message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001564 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001565 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001566
1567 // The app package name.
1568 optional string pkg_name = 2;
1569
1570 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001571 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001572 WITH_BUNDLE = 1;
1573 WITHOUT_BUNDLE = 2;
1574 }
1575 // The transition type.
1576 optional TransitionType type = 3;
1577
1578 // The activity name.
1579 optional string activity_name = 4;
1580
1581 optional bool transition_process_running = 5;
1582
1583 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001584 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001585}
1586
Bookatz8fcd09a2017-12-18 13:01:10 -08001587/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001588 * Logs a picture-in-picture action
1589 * Logged from:
1590 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1591 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1592 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1593 */
1594message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001595 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001596 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001597
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001598 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001599
Chenjie Yu52cacc62017-12-08 18:11:45 -08001600 enum State {
1601 ENTERED = 1;
1602 EXPANDED_TO_FULL_SCREEN = 2;
1603 MINIMIZED = 3;
1604 DISMISSED = 4;
1605 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001606 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001607}
1608
1609/**
Chenjie Yue8904192017-12-08 19:12:57 -08001610 * Logs overlay action
1611 * Logged from:
1612 * services/core/java/com/android/server/wm/Session.java
1613 */
1614message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001615 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001616
1617 optional string package_name = 2;
1618
1619 optional bool using_alert_window = 3;
1620
1621 enum State {
1622 ENTERED = 1;
1623 EXITED = 2;
1624 }
1625 optional State state = 4;
1626}
1627
Chenjie Yuccfe6452018-01-30 11:33:21 -08001628/*
1629 * Logs foreground service starts and stops.
1630 * Note that this is not when a service starts or stops, but when it is
1631 * considered foreground.
1632 * Logged from
1633 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1634 */
1635message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001636 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001637 // package_name + "/" + class_name
1638 optional string short_name = 2;
1639
1640 enum State {
1641 ENTER = 1;
1642 EXIT = 2;
1643 }
1644 optional State state = 3;
1645}
1646
Chenjie Yue8904192017-12-08 19:12:57 -08001647/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001648 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1649 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1650 * attributed back to the parent (host) uid. One example is Chrome.
1651 *
1652 * Logged from:
1653 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1654 */
1655message IsolatedUidChanged {
1656 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001657 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001658 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001659 optional int32 parent_uid = 1;
1660
1661 optional int32 isolated_uid = 2;
1662
1663 // We expect an isolated uid to be removed before if it's used for another parent uid.
1664 enum Event {
1665 REMOVED = 0;
1666 CREATED = 1;
1667 }
1668 optional Event event = 3;
1669}
1670
1671/*
1672 * Logs the reception of an incoming network packet causing the main system to wake up for
1673 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1674 * and processed by WakeupController.cpp.
1675 */
1676message PacketWakeupOccurred {
1677 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1678 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001679 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001680 // The interface name on which the packet was received.
1681 optional string iface = 2;
1682 // The ethertype value of the packet.
1683 optional int32 ethertype = 3;
1684 // String representation of the destination MAC address of the packet.
1685 optional string destination_hardware_address = 4;
1686 // String representation of the source address of the packet if this was an IP packet.
1687 optional string source_ip = 5;
1688 // String representation of the destination address of the packet if this was an IP packet.
1689 optional string destination_ip = 6;
1690 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1691 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1692 // families.
1693 optional int32 ip_next_header = 7;
1694 // The source port if this was a TCP or UDP packet.
1695 optional int32 source_port = 8;
1696 // The destination port if this was a TCP or UDP packet.
1697 optional int32 destination_port = 9;
1698}
1699
1700/*
1701 * Logs the memory stats for an app on startup.
1702 * Logged from:
1703 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1704 */
1705message AppStartMemoryStateCaptured {
1706 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001707 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001708
1709 // The process name.
1710 optional string process_name = 2;
1711
1712 // The activity name.
1713 optional string activity_name = 3;
1714
1715 // # of page-faults
1716 optional int64 pgfault = 4;
1717
1718 // # of major page-faults
1719 optional int64 pgmajfault = 5;
1720
1721 // RSS
1722 optional int64 rss_in_bytes = 6;
1723
1724 // CACHE
1725 optional int64 cache_in_bytes = 7;
1726
1727 // SWAP
1728 optional int64 swap_in_bytes = 8;
1729}
1730
1731/*
1732 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1733 * for LMK event.
1734 * Logged from:
1735 * system/core/lmkd/lmkd.c
1736 */
1737message LmkStateChanged {
1738 enum State {
1739 UNKNOWN = 0;
1740 START = 1;
1741 STOP = 2;
1742 }
1743 optional State state = 1;
1744}
1745
1746/*
1747 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1748 * Logged from:
1749 * system/core/lmkd/lmkd.c
1750 */
1751message LmkKillOccurred {
1752 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001753 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001754
1755 // The process name.
1756 optional string process_name = 2;
1757
1758 // oom adj score.
1759 optional int32 oom_score = 3;
1760
1761 // # of page-faults
1762 optional int64 pgfault = 4;
1763
1764 // # of major page-faults
1765 optional int64 pgmajfault = 5;
1766
1767 // RSS
1768 optional int64 rss_in_bytes = 6;
1769
1770 // CACHE
1771 optional int64 cache_in_bytes = 7;
1772
1773 // SWAP
1774 optional int64 swap_in_bytes = 8;
1775}
1776
Rajeev Kumar51b54602018-03-01 12:18:26 -08001777/*
1778 * Logs when the ActivityManagerService detects that an app died.
1779 *
1780 * Logged from:
1781 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1782 */
1783message AppDied {
1784 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001785 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001786}
1787
Howard Ro21a039c2018-08-06 14:55:47 -07001788/**
1789 * An atom for generic metrics logging. Available from Android Q.
1790 */
1791message GenericAtom {
1792 // The uid of the application that sent this custom atom.
1793 optional int32 uid = 1 [(is_uid) = true];
1794
1795 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001796 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001797}
1798
Chenjie Yubbcbc602018-02-05 16:51:52 -08001799//////////////////////////////////////////////////////////////////////
1800// Pulled atoms below this line //
1801//////////////////////////////////////////////////////////////////////
1802
1803/**
David Chenc8a43242017-10-17 16:23:28 -07001804 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1805 *
1806 * Pulled from:
1807 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1808 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001809message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001810 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001811
1812 optional int64 rx_bytes = 2;
1813
1814 optional int64 rx_packets = 3;
1815
1816 optional int64 tx_bytes = 4;
1817
1818 optional int64 tx_packets = 5;
1819}
1820
1821/**
1822 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1823 *
1824 * Pulled from:
1825 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1826 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001827message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001828 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001829
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001830 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1831 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001832
1833 optional int64 rx_bytes = 3;
1834
1835 optional int64 rx_packets = 4;
1836
1837 optional int64 tx_bytes = 5;
1838
1839 optional int64 tx_packets = 6;
1840}
1841
1842/**
1843 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1844 *
1845 * Pulled from:
1846 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1847 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001848message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001849 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001850
1851 optional int64 rx_bytes = 2;
1852
1853 optional int64 rx_packets = 3;
1854
1855 optional int64 tx_bytes = 4;
1856
1857 optional int64 tx_packets = 5;
1858}
1859
1860/**
1861 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1862 *
1863 * Pulled from:
1864 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1865 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001866message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001867 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001868
Yao Chenc40a19d2018-03-15 16:48:25 -07001869 // 1 denotes foreground and 0 denotes background. This is called Set in
1870 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001871 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001872
1873 optional int64 rx_bytes = 3;
1874
1875 optional int64 rx_packets = 4;
1876
1877 optional int64 tx_bytes = 5;
1878
1879 optional int64 tx_packets = 6;
1880}
1881
1882/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001883 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1884 *
1885 * Pulled from:
1886 * StatsCompanionService
1887 */
1888message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001889 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001890
1891 optional int64 rx_bytes = 2;
1892
1893 optional int64 tx_bytes = 3;
1894}
1895
1896/**
David Chenc8a43242017-10-17 16:23:28 -07001897 * Pulls the kernel wakelock durations. This atom is adapted from
1898 * android/internal/os/KernelWakelockStats.java
1899 *
1900 * Pulled from:
1901 * StatsCompanionService using KernelWakelockReader.
1902 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001903message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001904 optional string name = 1;
1905
1906 optional int32 count = 2;
1907
1908 optional int32 version = 3;
1909
1910 optional int64 time = 4;
1911}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001912
Chenjie Yu05013b32017-11-21 10:21:41 -08001913/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001914 * Pulls low power state information. This includes platform and subsystem sleep state information,
1915 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001916 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001917 * hardware/interfaces/power/1.1/types.hal
1918 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001919message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001920 // Subsystem name
1921 optional string subsystem_name = 1;
1922 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1923 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1924 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001925 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001926 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001927 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001928 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001929}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001930
Chenjie Yu05013b32017-11-21 10:21:41 -08001931/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001932 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001933 * Pulls the time the cpu spend on the frequency index. Frequency index
1934 * starts from highest to lowest. The value should be monotonically
1935 * increasing since boot. However, if there is a cpu
1936 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001937 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001938message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001939 optional uint32 cluster = 1;
1940 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001941 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001942}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001943
Chenjie Yu05013b32017-11-21 10:21:41 -08001944/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001945 * Pulls Cpu Time Per Uid.
1946 * Note that isolated process uid time should be attributed to host uids.
1947 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001948message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001949 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001950 optional uint64 user_time_millis = 2;
1951 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001952}
1953
1954/**
1955 * Pulls Cpu Time Per Uid per frequency.
1956 * Note that isolated process uid time should be attributed to host uids.
1957 * For each uid, we order the time by descending frequencies.
1958 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001959message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001960 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001961 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001962 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001963}
Hugo Benichi884970e2017-11-14 22:42:46 +09001964
Chenjie Yu05013b32017-11-21 10:21:41 -08001965/**
1966 * Pulls Wifi Controller Activity Energy Info
1967 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001968message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001969 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001970 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001971 // stack reported state
1972 // TODO: replace this with proto enum
1973 optional int32 stack_state = 2;
1974 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001975 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001976 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001977 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001978 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001979 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001980 // product of current(mA), voltage(V) and time(ms)
1981 optional uint64 controller_energy_used = 6;
1982}
1983
1984/**
1985 * Pulls Modem Activity Energy Info
1986 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001987message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001988 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001989 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001990 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001991 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001992 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001993 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001994 /**
1995 * Tx power index
1996 * index 0 = tx_power < 0dBm
1997 * index 1 = 0dBm < tx_power < 5dBm
1998 * index 2 = 5dBm < tx_power < 15dBm
1999 * index 3 = 15dBm < tx_power < 20dBm
2000 * index 4 = tx_power > 20dBm
2001 */
2002 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002003 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002004 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002005 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002006 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002007 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002008 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002009 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002010 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002011 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002012 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002013 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002014 // product of current(mA), voltage(V) and time(ms)
2015 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002016}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002017
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002018/**
2019 * Pulls Bluetooth Activity Energy Info
2020 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2021 */
2022message BluetoothActivityInfo {
2023 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002024 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002025 // bluetooth stack state
2026 optional int32 bluetooth_stack_state = 2;
2027 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002028 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002029 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002030 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002031 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002032 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002033 // product of current(mA), voltage(V) and time(ms)
2034 optional uint64 energy_used = 6;
2035}
2036
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002037/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002038 * Logs the memory stats for a process.
2039 */
2040message ProcessMemoryState {
2041 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002042 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002043
2044 // The process name.
2045 optional string process_name = 2;
2046
2047 // oom adj score.
2048 optional int32 oom_score = 3;
2049
2050 // # of page-faults
2051 optional int64 pgfault = 4;
2052
2053 // # of major page-faults
2054 optional int64 pgmajfault = 5;
2055
Rajeev Kumar90235992018-01-29 11:06:48 -08002056 // RSS
2057 optional int64 rss_in_bytes = 6;
2058
2059 // CACHE
2060 optional int64 cache_in_bytes = 7;
2061
2062 // SWAP
2063 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002064}
2065
2066/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002067 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002068 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002069message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002070 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002071}
2072
2073/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002074 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002075 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002076message SystemUptime {
2077 // Milliseconds since the system was booted.
2078 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2079 // for external input).
2080 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002081 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002082}
2083
2084/*
2085 * Reads from /proc/uid_concurrent_active_time which has the format:
2086 * active: X (X is # cores)
2087 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2088 * [uid1]: [time-0] [time-1] [time-2] ... ...
2089 * ...
2090 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2091 * The file contains a monotonically increasing count of time for a single boot.
2092 */
2093message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002094 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002095 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002096}
2097
2098/**
2099 * Reads from /proc/uid_concurrent_policy_time which has the format:
2100 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2101 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2102 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2103 * ...
2104 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2105 * The file contains a monotonically increasing count of time for a single boot.
2106 */
2107message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002108 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002109 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002110 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002111}
2112
2113/*
2114 * Pulls free disk space, for data, system partition and temporary directory.
2115 */
2116message DiskSpace {
2117 // available bytes in data partition
2118 optional uint64 data_available_bytes = 1;
2119 // available bytes in system partition
2120 optional uint64 system_available_bytes = 2;
2121 // available bytes in download cache or temp directories
2122 optional uint64 temp_available_bytes = 3;
2123}
Tej Singhbf972d92018-01-10 20:51:13 -08002124
2125/**
2126 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002127 * Pulled from:
2128 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002129 */
2130message RemainingBatteryCapacity {
2131 optional int32 charge_uAh = 1;
2132}
2133
2134/**
2135 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002136 * Pulled from:
2137 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002138 */
2139message FullBatteryCapacity {
2140 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002141}
2142
2143/**
Tej Singhd89137e2018-03-26 14:51:40 -07002144 * Pulls the temperature of various parts of the device.
2145 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002146 *
2147 * Pulled from:
2148 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2149 */
2150message Temperature {
2151 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2152 optional android.os.TemperatureTypeEnum sensor_location = 1;
2153
2154 // The name of the temperature source. Eg. CPU0
2155 optional string sensor_name = 2;
2156
Tej Singhd89137e2018-03-26 14:51:40 -07002157 // Temperature in tenths of a degree C.
2158 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002159}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002160
2161/**
2162 * Pulls the statistics of calls to Binder.
2163 *
2164 * Binder stats are cumulative from boot unless somebody reset the data using
2165 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002166 *
2167 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002168 */
2169message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002170 optional int32 uid = 1 [(is_uid) = true];
2171 // Fully qualified class name of the API call.
2172 //
2173 // This is a system server class name.
2174 //
2175 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2176 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2177 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2178 // commonly used APIs.
2179 optional string service_class_name = 2;
2180 // Method name of the API call. It can also be a transaction code if we cannot
2181 // resolve it to a name. See Binder#getTransactionName.
2182 //
2183 // This is a system server method name.
2184 optional string service_method_name = 3;
2185 // Total number of API calls.
2186 optional int64 call_count = 4;
2187 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2188 optional bool screen_interactive = 13;
2189 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2190 // call_count will be equal to recorded_call_count.
2191 //
2192 // If recorded_call_count is different than call_count, it means data collection has been
2193 // sampled. All the fields below will be sampled in this case.
2194 optional int64 recorded_call_count = 12;
2195 // Number of exceptions thrown by the API.
2196 optional int64 recorded_exception_count = 5;
2197 // Total latency of all API calls.
2198 // Average can be computed using total_latency_micros / recorded_call_count.
2199 optional int64 recorded_total_latency_micros = 6;
2200 // Maximum latency of one API call.
2201 optional int64 recorded_max_latency_micros = 7;
2202 // Total CPU usage of all API calls.
2203 // Average can be computed using total_cpu_micros / recorded_call_count.
2204 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2205 optional int64 recorded_total_cpu_micros = 8;
2206 // Maximum CPU usage of one API call.
2207 optional int64 recorded_max_cpu_micros = 9;
2208 // Maximum parcel reply size of one API call.
2209 optional int64 recorded_max_reply_size_bytes = 10;
2210 // Maximum parcel request size of one API call.
2211 optional int64 recorded_max_request_size_bytes = 11;
2212}
2213
2214/**
2215 * Pulls the statistics of exceptions during calls to Binder.
2216 *
2217 * Binder stats are cumulative from boot unless somebody reset the data using
2218 * > adb shell dumpsys binder_calls_stats --reset
2219 */
2220message BinderCallsExceptions {
2221 // Exception class name, e.g. java.lang.IllegalArgumentException.
2222 //
2223 // This is an exception class name thrown by the system server.
2224 optional string exception_class_name = 1;
2225 // Total number of exceptions.
2226 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002227}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002228
2229message LooperStats {
2230 // Currently not collected and always set to 0.
2231 optional int32 uid = 1 [(is_uid) = true];
2232
2233 // Fully qualified class name of the handler target class.
2234 //
2235 // This field does not contain PII. This is a system server class name.
2236 optional string handler_class_name = 2;
2237
2238 // The name of the thread that runs the Looper.
2239 //
2240 // This field does not contain PII. This is a system server thread name.
2241 optional string looper_thread_name = 3;
2242
2243 // The name of the dispatched message.
2244 //
2245 // This field does not contain PII. This is a system server constant or class
2246 // name.
2247 optional string message_name = 4;
2248
2249 // Total number of successfully dispatched messages.
2250 optional int64 message_count = 5;
2251
2252 // Total number of messages that failed dispatching.
2253 optional int64 exception_count = 6;
2254
2255 // Total number of processed messages we have data recorded for. If we
2256 // collected data for all the messages, message_count will be equal to
2257 // recorded_message_count.
2258 //
2259 // If recorded_message_count is different than message_count, it means data
2260 // collection has been sampled. All the fields below will be sampled in this
2261 // case.
2262 optional int64 recorded_message_count = 7;
2263
2264 // Total latency of all processed messages.
2265 // Average can be computed using recorded_total_latency_micros /
2266 // recorded_message_count.
2267 optional int64 recorded_total_latency_micros = 8;
2268
2269 // Total CPU usage of all processed message.
2270 // Average can be computed using recorded_total_cpu_micros /
2271 // recorded_message_count. Total can be computed using
2272 // recorded_total_cpu_micros / recorded_message_count * call_count.
2273 optional int64 recorded_total_cpu_micros = 9;
2274}
Tej Singh86dc9db2018-09-06 00:39:57 +00002275
2276/**
2277 * Pulls disk information, such as write speed and latency.
2278 */
2279message DiskStats {
2280 // Time taken to open, write 512B to, and close a file.
2281 // -1 if error performing the check.
2282 optional int64 data_write_latency_millis = 1;
2283
2284 optional bool file_based_encryption = 2;
2285
2286 // Recent disk write speed in kB/s.
2287 // -1 if error querying storageed.
2288 // 0 if data is unavailable.
2289 optional int32 recent_disk_write_speed = 3;
2290}
2291
2292
2293/**
2294 * Free and total bytes of the Data, Cache, and System partition.
2295 */
2296message DirectoryUsage {
2297 enum Directory {
2298 UNKNOWN = 0;
2299 DATA = 1;
2300 CACHE = 2;
2301 SYSTEM = 3;
2302 }
2303 optional Directory directory = 1;
2304 optional int64 free_bytes = 2;
2305 optional int64 total_bytes = 3;
2306}
2307
2308
2309/**
2310 * Size of an application: apk size, data size, and cache size.
2311 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2312 * Information is only reported for apps with the primary user (user 0).
2313 * Sizes are aggregated by package name.
2314 */
2315message AppSize {
2316 // Including uids will involve modifying diskstats logic.
2317 optional string package_name = 1;
2318 // App size in bytes. -1 if unavailable.
2319 optional int64 app_size_bytes = 2;
2320 // App data size in bytes. -1 if unavailable.
2321 optional int64 app_data_size_bytes = 3;
2322 // App cache size in bytes. -1 if unavailable.
2323 optional int64 app_cache_size_bytes = 4;
2324 // Time that the cache file was produced.
2325 // Uses System.currentTimeMillis(), which is wall clock time.
2326 optional int64 cache_time_millis = 5;
2327}
2328
2329
2330/**
2331 * Size of a particular category. Eg: photos, videos.
2332 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2333 */
2334message CategorySize {
2335 enum Category {
2336 UNKNOWN = 0;
2337 APP_SIZE = 1;
2338 APP_DATA_SIZE = 2;
2339 APP_CACHE_SIZE = 3;
2340 PHOTOS = 4;
2341 VIDEOS = 5;
2342 AUDIO = 6;
2343 DOWNLOADS = 7;
2344 SYSTEM = 8;
2345 OTHER = 9;
2346 }
2347 optional Category category = 1;
2348 // Category size in bytes.
2349 optional int64 size_bytes = 2;
2350 // Time that the cache file was produced.
2351 // Uses System.currentTimeMillis(), which is wall clock time.
2352 optional int64 cache_time_millis = 3;
2353}