blob: 630b61420bfb6ec8b1ee869c6559f69db74b5f2e [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Howard Ro0546d542018-08-30 16:23:44 -070032import "frameworks/base/proto/src/stats_enums.proto";
Chenjie Yu159e4f82018-08-29 11:49:11 -070033import "frameworks/base/core/proto/android/service/procstats.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080034
Yao Chend54f9dd2017-10-17 17:37:48 +000035/**
Stefan Lafonae2df012017-11-14 09:17:21 -080036 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000037 * raw stats log events from the Android system, also known as "atoms."
38 *
39 * This field contains a single oneof with all of the available messages.
40 * The stats-log-api-gen tool runs as part of the Android build and
41 * generates the android.util.StatsLog class, which contains the constants
42 * and methods that Android uses to log.
43 *
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * Instead, statsd on Android constructs these messages synthetically,
46 * in the format defined here and in stats_log.proto.
47 */
Stefan Lafonae2df012017-11-14 09:17:21 -080048message Atom {
49 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070050 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070051 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
52 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070053 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070054 BleScanResultReceived ble_scan_result_received = 4;
55 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080056 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070057 SyncStateChanged sync_state_changed = 7;
58 ScheduledJobStateChanged scheduled_job_state_changed = 8;
59 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070060 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080061 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
62 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
63 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070064 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
65 MemoryFactorStateChanged memory_factor_state_changed = 15;
66 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
67 CachedKillReported cached_kill_reported = 17;
68 ProcessMemoryStatReported process_memory_stat_reported = 18;
69 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080070 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
71 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
72 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070073 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080074 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070075 CameraStateChanged camera_state_changed = 25;
76 FlashlightStateChanged flashlight_state_changed = 26;
77 UidProcessStateChanged uid_process_state_changed = 27;
78 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
79 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070080 BatteryLevelChanged battery_level_changed = 30;
81 ChargingStateChanged charging_state_changed = 31;
82 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080083 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070084 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
85 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070086 WifiLockStateChanged wifi_lock_state_changed = 37;
87 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
88 WifiScanStateChanged wifi_scan_state_changed = 39;
89 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070090 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070091 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070092 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090093 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080094 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080095 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080096 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080097 AppStartOccurred app_start_occurred = 48;
98 AppStartCanceled app_start_canceled = 49;
99 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800100 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800101 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800102 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkStateChanged lmk_state_changed = 54;
104 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800105 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800106 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800107 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800108 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800109 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800110 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800111 KeyguardStateChanged keyguard_state_changed = 62;
112 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
113 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800114 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800115 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800116 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
117 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700118 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700119 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800120 SpeakerImpedanceReported speaker_impedance_reported = 71;
121 HardwareFailed hardware_failed = 72;
122 PhysicalDropDetected physical_drop_detected = 73;
123 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800124 MobileConnectionStateChanged mobile_connection_state_changed = 75;
125 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700126 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800127 AppCrashOccurred app_crash_occurred = 78;
128 ANROccurred anr_occurred = 79;
129 WTFOccurred wtf_occurred = 80;
130 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700131 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700132 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700133 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700134 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yao Chend54f9dd2017-10-17 17:37:48 +0000135 }
David Chenc8a43242017-10-17 16:23:28 -0700136
David Chen6e3e6cb2018-01-03 16:14:06 -0800137 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100138 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700139 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800140 WifiBytesTransfer wifi_bytes_transfer = 10000;
141 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
142 MobileBytesTransfer mobile_bytes_transfer = 10002;
143 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800144 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800145 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800146 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800147 CpuTimePerFreq cpu_time_per_freq = 10008;
148 CpuTimePerUid cpu_time_per_uid = 10009;
149 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800150 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800151 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800152 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800153 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800154 SystemElapsedRealtime system_elapsed_realtime = 10014;
155 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800156 CpuActiveTime cpu_active_time = 10016;
157 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000158 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800159 RemainingBatteryCapacity remaining_battery_capacity = 10019;
160 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800161 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100162 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100163 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100164 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000165 DiskStats disk_stats = 10025;
166 DirectoryUsage directory_usage = 10026;
167 AppSize app_size = 10027;
168 CategorySize category_size = 10028;
Chenjie Yu159e4f82018-08-29 11:49:11 -0700169 android.service.procstats.ProcessStatsSectionProto proc_stats = 10029;
David Chenc8a43242017-10-17 16:23:28 -0700170 }
yroa1fe77c2018-02-26 14:22:54 -0800171
172 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
173 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700174}
175
Yao Chend54f9dd2017-10-17 17:37:48 +0000176/**
Yangster-mac20877162017-12-22 17:19:39 -0800177 * This proto represents a node of an attribution chain.
178 * Note: All attribution chains are represented as a repeated field of type
179 * AttributionNode. It is understood that in such arrays, the order is that
180 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000181 */
Yangster-mac20877162017-12-22 17:19:39 -0800182message AttributionNode {
183 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800184 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800185
Yangster-mac20877162017-12-22 17:19:39 -0800186 // The (optional) string tag for an element in the attribution chain. If the
187 // element has no tag, it is encoded as an empty string.
188 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700189}
190
Yangster-mac48b3d622018-08-18 12:38:11 -0700191message KeyValuePair {
192 optional int32 key = 1;
193 oneof value {
194 int64 value_int = 2;
195 string value_str = 3;
196 float value_float = 4;
197 }
198}
199
200message KeyValuePairsAtom {
201 optional int32 uid = 1;
202 repeated KeyValuePair pairs = 2;
203}
204
Yao Chend54f9dd2017-10-17 17:37:48 +0000205/*
206 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800207 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000208 *
209 * RULES:
210 * - The field ids for each atom must start at 1, and count upwards by 1.
211 * Skipping field ids is not allowed.
212 * - These form an API, so renaming, renumbering or removing fields is
213 * not allowed between android releases. (This is not currently enforced,
214 * but there will be a tool to enforce this restriction).
215 * - The types must be built-in protocol buffer types, namely, no sub-messages
216 * are allowed (yet). The bytes type is also not allowed.
217 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800218 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000219 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800220 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000221 * - A field that is a uid should be a string field, tagged with the [xxx]
222 * annotation. The generated code on android will be represented by UIDs,
223 * and those UIDs will be translated in xxx to those strings.
224 *
225 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700226 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000227 * - If there is a UID, it goes first. Think in an object-oriented fashion.
228 * *****************************************************************************
229 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700230
Yao Chend54f9dd2017-10-17 17:37:48 +0000231/**
232 * Logs when the screen state changes.
233 *
234 * Logged from:
235 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
236 */
237message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800238 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800239 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700240}
Yao Chend54f9dd2017-10-17 17:37:48 +0000241
242/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700243 * Logs that the process state of the uid, as determined by ActivityManager
244 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000245 *
246 * Logged from:
247 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
248 */
Bookatzc1a050a2017-10-10 15:49:28 -0700249message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700250 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000251
Bookatzdb026a22018-01-10 19:01:56 -0800252 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800253 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000254}
255
256/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700257 * Logs process state change of a process, as per the activity manager.
258 *
259 * Logged from:
260 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
261 */
262message ProcessStateChanged {
263 optional int32 uid = 1;
264 optional string process_name = 2;
265 optional string package_name = 3;
266 // TODO: remove this when validation is done
267 optional int64 version = 5;
268 // The state, from frameworks/base/core/proto/android/app/enums.proto.
269 optional android.app.ProcessStateEnum state = 4;
270}
271
272/**
273 * Logs when ActivityManagerService sleep state is changed.
274 *
275 * Logged from:
276 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
277 */
278message ActivityManagerSleepStateChanged {
279 // TODO: import frameworks proto
280 enum State {
281 UNKNOWN = 0;
282 ASLEEP = 1;
283 AWAKE = 2;
284 }
285 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
286}
287
288/**
289 * Logs when system memory state changes.
290 *
291 * Logged from:
292 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
293 */
294message MemoryFactorStateChanged {
295 // TODO: import frameworks proto
296 enum State {
297 MEMORY_UNKNOWN = 0;
298 NORMAL = 1; // normal.
299 MODERATE = 2; // moderate memory pressure.
300 LOW = 3; // low memory.
301 CRITICAL = 4; // critical memory.
302
303 }
304 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
305}
306
307/**
308 * Logs when app is using too much cpu, according to ActivityManagerService.
309 *
310 * Logged from:
311 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
312 */
313message ExcessiveCpuUsageReported {
314 optional int32 uid = 1;
315 optional string process_name = 2;
316 optional string package_name = 3;
317 // package version. TODO: remove this when validation is done
318 optional int64 version = 4;
319}
320
321/**
322 * Logs when a cached process is killed, along with its pss.
323 *
324 * Logged from:
325 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
326 */
327message CachedKillReported {
328 optional int32 uid = 1;
329 optional string process_name = 2;
330 optional string package_name = 3;
331 // TODO: remove this when validation is done
332 optional int64 version = 5;
333 optional int64 pss = 4;
334}
335
336/**
337 * Logs when memory stats of a process is reported.
338 *
339 * Logged from:
340 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
341 */
342message ProcessMemoryStatReported {
343 optional int32 uid = 1;
344 optional string process_name = 2;
345 optional string package_name = 3;
346 //TODO: remove this when validation is done
347 optional int64 version = 9;
348 optional int64 pss = 4;
349 optional int64 uss = 5;
350 optional int64 rss = 6;
351 enum Type {
352 ADD_PSS_INTERNAL_SINGLE = 0;
353 ADD_PSS_INTERNAL_ALL_MEM = 1;
354 ADD_PSS_INTERNAL_ALL_POLL = 2;
355 ADD_PSS_EXTERNAL = 3;
356 ADD_PSS_EXTERNAL_SLOW = 4;
357 }
358 optional Type type = 7;
359 optional int64 duration = 8;
360}
361
362/**
Bookatzc1a050a2017-10-10 15:49:28 -0700363 * Logs that a process started, finished, crashed, or ANRed.
364 *
365 * Logged from:
366 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
367 */
368message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700369 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700370
David Chen0b5c90c2018-01-25 16:51:49 -0800371 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800372 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700373
Bookatzddccf0a2017-11-28 16:48:14 -0800374 // What lifecycle state the process changed to.
375 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800376 enum State {
377 FINISHED = 0;
378 STARTED = 1;
379 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800380 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800381 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700382}
383
Bookatzc1a050a2017-10-10 15:49:28 -0700384/**
385 * Logs when the ble scan state changes.
386 *
387 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700388 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700389 */
390message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800391 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700392
393 enum State {
394 OFF = 0;
395 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700396 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
397 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700398 }
399 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700400
Bookatze5ec0b42018-03-26 13:34:56 -0700401 // Does the scan have a filter.
402 optional bool is_filtered = 3;
403 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
404 optional bool is_first_match = 4;
405 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
406 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700407}
408
409/**
410 * Logs reporting of a ble scan finding results.
411 *
412 * Logged from:
413 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
414 */
415// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
416message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800417 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700418
419 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800420 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700421}
422
423/**
424 * Logs when a sensor state changes.
425 *
426 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700427 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700428 */
429message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800430 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700431
Bookatzc1a050a2017-10-10 15:49:28 -0700432 // The id (int) of the sensor.
433 optional int32 sensor_id = 2;
434
435 enum State {
436 OFF = 0;
437 ON = 1;
438 }
439 optional State state = 3;
440}
441
442
443/**
444 * Logs when GPS state changes.
445 *
446 * Logged from:
447 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
448 */
449message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800450 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700451
452 enum State {
453 OFF = 0;
454 ON = 1;
455 }
456 optional State state = 2;
457}
458
459
460/**
461 * Logs when a sync manager sync state changes.
462 *
463 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700464 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700465 */
466message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800467 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700468
David Chen0b5c90c2018-01-25 16:51:49 -0800469 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800470 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700471
472 enum State {
473 OFF = 0;
474 ON = 1;
475 }
476 optional State state = 3;
477}
478
Yangster-mac96353002018-09-05 11:18:55 -0700479/*
480 * Deferred job stats.
481 *
482 * Logged from:
483 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
484*/
485message DeferredJobStatsReported {
486 repeated AttributionNode attribution_node = 1;
487
488 // Number of jobs deferred.
489 optional int32 num_jobs_deferred = 2;
490
491 // Time since the last job runs.
492 optional int64 time_since_last_job_millis = 3;
493}
494
Bookatzc1a050a2017-10-10 15:49:28 -0700495/**
496 * Logs when a job scheduler job state changes.
497 *
498 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700499 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700500 */
501message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800502 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700503
504 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800505 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700506
507 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800508 FINISHED = 0;
509 STARTED = 1;
510 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700511 }
512 optional State state = 3;
513
Tej Singh33a412b2018-03-16 18:43:59 -0700514 // The reason a job has stopped.
515 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700516 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700517 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700518}
519
520/**
521 * Logs when the audio state changes.
522 *
523 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700524 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700525 */
526message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800527 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700528
529 enum State {
530 OFF = 0;
531 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700532 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
533 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700534 }
535 optional State state = 2;
536}
537
538/**
539 * Logs when the video codec state changes.
540 *
541 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700542 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700543 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800544message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800545 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700546
547 enum State {
548 OFF = 0;
549 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700550 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
551 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700552 }
553 optional State state = 2;
554}
555
556/**
557 * Logs when the flashlight state changes.
558 *
559 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700560 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700561 */
562message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800563 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700564
565 enum State {
566 OFF = 0;
567 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700568 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
569 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700570 }
571 optional State state = 2;
572}
573
574/**
575 * Logs when the camera state changes.
576 *
577 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700578 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700579 */
580message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800581 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700582
583 enum State {
584 OFF = 0;
585 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700586 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
587 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700588 }
589 optional State state = 2;
590}
591
592/**
593 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000594 *
595 * Logged from:
596 * TODO
597 */
Bookatzd6746242017-10-24 18:39:35 -0700598message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800599 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000600
Bookatz1a1b0462018-01-12 11:47:03 -0800601 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
602 // From frameworks/base/core/proto/android/os/enums.proto.
603 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700604
605 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
606 optional string tag = 3;
607
608 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800609 RELEASE = 0;
610 ACQUIRE = 1;
611 CHANGE_RELEASE = 2;
612 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700613 }
614 optional State state = 4;
615}
616
617/**
Bookatzc1a050a2017-10-10 15:49:28 -0700618 * Logs when a partial wakelock is considered 'long' (over 1 min).
619 *
620 * Logged from:
621 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
622 */
623message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800624 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700625
Yao Chend54f9dd2017-10-17 17:37:48 +0000626 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
627 optional string tag = 2;
628
Bookatzc1a050a2017-10-10 15:49:28 -0700629 // TODO: I have no idea what this is.
630 optional string history_tag = 3;
631
632 enum State {
633 OFF = 0;
634 ON = 1;
635 }
636 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000637}
638
Bookatzc1a050a2017-10-10 15:49:28 -0700639/**
640 * Logs Battery Saver state change.
641 *
642 * Logged from:
643 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
644 */
645message BatterySaverModeStateChanged {
646 enum State {
647 OFF = 0;
648 ON = 1;
649 }
650 optional State state = 1;
651}
652
653/**
654 * Logs Doze mode state change.
655 *
656 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800657 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700658 */
659message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800660 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800661}
662
663
664/**
665 * Logs state change of Doze mode including maintenance windows.
666 *
667 * Logged from:
668 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
669 */
670message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800671 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700672}
673
674/**
675 * Logs screen brightness level.
676 *
677 * Logged from:
678 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
679 */
680message ScreenBrightnessChanged {
681 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
682 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700683}
684
685/**
686 * Logs battery level (percent full, from 0 to 100).
687 *
688 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700689 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700690 */
691message BatteryLevelChanged {
692 // Battery level. Should be in [0, 100].
693 optional int32 battery_level = 1;
694}
695
696/**
697 * Logs change in charging status of the device.
698 *
699 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700700 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700701 */
702message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800703 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
704 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700705}
706
707/**
708 * Logs whether the device is plugged in, and what power source it is using.
709 *
710 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700711 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700712 */
713message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800714 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
715 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700716}
717
Bookatz8c6571b2017-10-24 15:04:41 -0700718/**
719 * Logs when an app's wakeup alarm fires.
720 *
721 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700722 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700723 */
724message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800725 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800726
727 // Name of the wakeup alarm.
728 optional string tag = 2;
729}
730
731/**
732 * Logs when an an app causes the mobile radio to change state.
733 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
734 *
735 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700736 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800737 */
738message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800739 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800740
Bookatz1a1b0462018-01-12 11:47:03 -0800741 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
742 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800743}
744
745/**
746 * Logs when an an app causes the wifi radio to change state.
747 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
748 *
749 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700750 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800751 */
752message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800753 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800754
Bookatz1a1b0462018-01-12 11:47:03 -0800755 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
756 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700757}
758
759/**
760 * Logs kernel wakeup reasons and aborts.
761 *
762 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700763 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700764 */
765message KernelWakeupReported {
766 // Name of the kernel wakeup reason (or abort).
767 optional string wakeup_reason_name = 1;
768
769 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800770 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700771}
772
773/**
774 * Logs wifi locks held by an app.
775 *
776 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700777 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700778 */
779message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800780 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700781
782 enum State {
783 OFF = 0;
784 ON = 1;
785 }
786 optional State state = 2;
787}
788
789/**
790 * Logs wifi signal strength changes.
791 *
792 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700793 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700794 */
795message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800796 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
797 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700798}
799
800/**
801 * Logs wifi scans performed by an app.
802 *
803 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700804 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700805 */
806message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800807 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700808
809 enum State {
810 OFF = 0;
811 ON = 1;
812 }
813 optional State state = 2;
814}
815
816/**
Tej Singh4503e102018-01-04 14:35:01 -0800817 * Logs wifi multicast locks held by an app
818 *
819 * Logged from:
820 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
821 */
822message WifiMulticastLockStateChanged {
823 repeated AttributionNode attribution_node = 1;
824
825 enum State {
826 OFF = 0;
827 ON = 1;
828 }
829 optional State state = 2;
830}
831
832/**
Tej Singh1ea42892018-01-19 09:27:00 -0800833 * Logs shutdown reason and duration on next boot.
834 *
835 * Logged from:
836 * frameworks/base/core/java/com/android/server/BootReceiver.java
837 */
838message ShutdownSequenceReported {
839 // True if shutdown is for a reboot. Default: false if we do not know.
840 optional bool reboot = 1;
841
842 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
843 optional string reason = 2;
844
845 // Beginning of shutdown time in ms using wall clock time since unix epoch.
846 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800847 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800848
849 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800850 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800851}
852
Tej Singh6483ea42018-01-25 17:45:49 -0800853
854/**
855 * Logs boot reason and duration.
856 *
857 * Logged from:
858 * system/core/bootstat/bootstat.cpp
859 */
860message BootSequenceReported {
861 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
862 // Default: "<EMPTY>" if not available.
863 optional string bootloader_reason = 1;
864
865 // Reason for system boot. Eg. bootloader, reboot,userrequested
866 // Default: "<EMPTY>" if not available.
867 optional string system_reason = 2;
868
869 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800870 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800871
872 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800873 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800874
875 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800876 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800877
878 // Time since last boot in ms. Default: 0 if not available.
879 optional int64 time_since_last_boot = 6;
880}
881
Tej Singhc477d9c2018-02-05 18:31:39 -0800882
883/**
884 * Logs call state and disconnect cause (if applicable).
885 *
886 * Logged from:
887 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
888 */
889message CallStateChanged {
890 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
891 // From frameworks/base/core/proto/android/telecomm/enums.proto.
892 optional android.telecom.CallStateEnum call_state = 1;
893
894 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
895 // This value is only applicable when the call_state is DISCONNECTED, and
896 // should always be UNKNOWN if the call_state is not DISCONNECTED.
897 // From frameworks/base/core/proto/android/telecomm/enums.proto.
898 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
899
900 // True if the call is self-managed, which are apps that use the
901 // telecom infrastructure to make their own calls.
902 optional bool self_managed = 3;
903
904 // True if call is external. External calls are calls on connected Wear
905 // devices but show up in Telecom so the user can pull them onto the device.
906 optional bool external_call = 4;
907}
908
Tej Singh1ea42892018-01-19 09:27:00 -0800909/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800910 * Logs keyguard state. The keyguard is the lock screen.
911 *
912 * Logged from:
913 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
914 */
915message KeyguardStateChanged {
916 enum State {
917 UNKNOWN = 0;
918 // The keyguard is hidden when the phone is unlocked.
919 HIDDEN = 1;
920 // The keyguard is shown when the phone is locked (screen turns off).
921 SHOWN= 2;
922 // The keyguard is occluded when something is overlaying the keyguard.
923 // Eg. Opening the camera while on the lock screen.
924 OCCLUDED = 3;
925 }
926 optional State state = 1;
927}
928
929/**
930 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
931 * prompts the user to enter a password (pattern, pin, etc).
932 *
933 * Logged from:
934 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
935 */
936
937message KeyguardBouncerStateChanged {
938 enum State {
939 UNKNOWN = 0;
940 // Bouncer is hidden, either as a result of successfully entering the
941 // password, screen timing out, or user going back to lock screen.
942 HIDDEN = 1;
943 // This is when the user is being prompted to enter the password.
944 SHOWN = 2;
945 }
946 optional State state = 1;
947}
948
949/**
950 * Logs the result of entering a password into the keyguard bouncer.
951 *
952 * Logged from:
953 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
954 */
955message KeyguardBouncerPasswordEntered {
956 enum BouncerResult {
957 UNKNOWN = 0;
958 // The password entered was incorrect.
959 FAILURE = 1;
960 // The password entered was correct.
961 SUCCESS = 2;
962 }
963 optional BouncerResult result = 1;
964}
965
Tej Singha883b372018-02-15 11:30:01 -0800966/*
967 * Logs changes to the configuration of the device. The configuration is defined
968 * in frameworks/base/core/java/android/content/res/Configuration.java
969 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
970 * Please go there to interpret the possible values each field can be.
971 *
972 * Logged from:
973 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
974 */
975message ResourceConfigurationChanged {
976 // Bit mask of color capabilities of the screen.
977 // Contains information about the color gamut and hdr mode of the screen.
978 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
979 optional int32 colorMode = 1;
980
981 // The target screen density being rendered to.
982 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
983 optional int32 densityDpi = 2;
984
985 // Current user preference for the scaling factor for fonts,
986 // relative to the base density scaling.
987 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
988 optional float fontScale = 3;
989
990 // Flag indicating whether the hard keyboard is hidden.
991 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
992 optional int32 hardKeyboardHidden = 4;
993
994 // The type of keyboard attached to the device.
995 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
996 optional int32 keyboard = 5;
997
998 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
999 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1000 optional int32 keyboardHideen = 6;
1001
1002 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1003 // 0 if undefined.
1004 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1005 optional int32 mcc = 7;
1006
1007 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1008 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1009 // MNC_ZERO symbol defined in Configuration.java.
1010 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1011 optional int32 mnc = 8;
1012
1013 // The kind of navigation available on the device.
1014 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1015 optional int32 navigation = 9;
1016
1017 // Flag indicating whether the navigation is available.
1018 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1019 optional int32 navigationHidden = 10;
1020
1021 // Overall orientation of the screen.
1022 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1023 optional int32 orientation = 11;
1024
1025 // The current height of the available screen space, in dp units.
1026 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1027 optional int32 screenHeightDp = 12;
1028
1029 // Bit mask of overall layout of the screen.
1030 // Contains information about screen size, whether the screen is wider/taller
1031 // than normal, whether the screen layout is right-tl-left or left-to-right,
1032 // and whether the screen has a rounded shape.
1033 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1034 optional int32 screenLayout = 13;
1035
1036 // Current width of the available screen space, in dp units.
1037 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1038 optional int32 screenWidthDp = 14;
1039
1040 // The smallest screen size an application will see in normal operation.
1041 // This is the smallest value of both screenWidthDp and screenHeightDp
1042 // in portrait and landscape.
1043 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1044 optional int32 smallestScreenWidthDp = 15;
1045
1046 // The type of touch screen attached to the device.
1047 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1048 optional int32 touchscreen = 16;
1049
1050 // Bit mask of the ui mode.
1051 // Contains information about the overall ui mode of the device.
1052 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1053 // Also contains information about whether the device is in night mode.
1054 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1055 optional int32 uiMode = 17;
1056}
1057
Tej Singheee317b2018-03-07 19:28:05 -08001058
1059/**
1060 * Logs changes in the connection state of the mobile radio.
1061 *
1062 * Logged from:
1063 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1064 */
1065message MobileConnectionStateChanged {
1066 // States are from the state machine DataConnection.java.
1067 enum State {
1068 UNKNOWN = 0;
1069 // The connection is inactive, or disconnected.
1070 INACTIVE = 1;
1071 // The connection is being activated, or connecting.
1072 ACTIVATING = 2;
1073 // The connection is active, or connected.
1074 ACTIVE = 3;
1075 // The connection is disconnecting.
1076 DISCONNECTING = 4;
1077 // The connection is disconnecting after creating a connection.
1078 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1079 }
1080 optional State state = 1;
1081 // For multi-sim phones, this distinguishes between the sim cards.
1082 optional int32 sim_slot_index = 2;
1083 // Used to identify the connection. Starts at 0 and increments by 1 for
1084 // every new network created. Resets whenever the device reboots.
1085 optional int32 data_connection_id = 3;
1086 // A bitmask for the capabilities of this connection.
1087 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1088 // Default value (if we have no information): 0
1089 optional int64 capabilities = 4;
1090 // If this connection has internet.
1091 // This just checks if the DEFAULT bit of capabilities is set.
1092 optional bool has_internet = 5;
1093}
1094
1095/**
1096 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1097 *
1098 * Logged from:
1099 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1100 */
1101message MobileRadioTechnologyChanged {
1102 optional android.telephony.NetworkTypeEnum state = 1;
1103 // For multi-sim phones, this distinguishes between the sim cards.
1104 optional int32 sim_slot_index = 2;
1105}
1106
Andrew Chantb56388b2018-03-22 21:07:33 -07001107/**
1108 * Logs the VID and PID of any connected USB devices.
1109 *
1110 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1111 *
1112 * Logged by Vendor.
1113 */
1114message UsbDeviceAttached {
1115 optional int32 vid = 1;
1116 optional int32 pid = 2;
1117 optional bool has_audio = 3;
1118 optional bool has_hid = 4;
1119 optional bool has_storage = 5;
1120}
1121
Tej Singheee317b2018-03-07 19:28:05 -08001122
Tej Singhdd7bd352018-02-09 19:33:15 -08001123/**
Tej Singh5d991e12018-03-09 19:48:11 -08001124 * Logs when Bluetooth is enabled and disabled.
1125 *
1126 * Logged from:
1127 * services/core/java/com/android/server/BluetoothManagerService.java
1128 */
1129message BluetoothEnabledStateChanged {
1130 repeated AttributionNode attribution_node = 1;
1131 // Whether or not bluetooth is enabled on the device.
1132 enum State {
1133 UNKNOWN = 0;
1134 ENABLED = 1;
1135 DISABLED = 2;
1136 }
1137 optional State state = 2;
1138 // The reason for being enabled/disabled.
1139 // Eg. Airplane mode, crash, application request.
1140 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1141 // If the reason is an application request, this will be the package name.
1142 optional string pkgName = 4;
1143}
1144
1145/**
1146 * Logs when a Bluetooth device connects and disconnects.
1147 *
1148 * Logged from:
1149 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1150 */
1151message BluetoothConnectionStateChanged {
1152 // The state of the connection.
1153 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1154 optional android.bluetooth.ConnectionStateEnum state = 1;
1155 // An identifier that can be used to match connect and disconnect events.
1156 // Currently is last two bytes of a hash of a device level ID and
1157 // the mac address of the bluetooth device that is connected.
1158 optional int32 obfuscated_id = 2;
1159 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1160 // From android.bluetooth.BluetoothAdapter.java
1161 optional int32 bt_profile = 3;
1162}
1163
1164/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001165 * Logs when something is plugged into or removed from the USB-C connector.
1166 *
1167 * Logged from:
1168 * Vendor USB HAL.
1169 */
1170message UsbConnectorStateChanged {
1171 enum State {
1172 DISCONNECTED = 0;
1173 CONNECTED = 1;
1174 }
1175 optional State state = 1;
1176}
1177
1178/**
1179 * Logs the reported speaker impedance.
1180 *
1181 * Logged from:
1182 * Vendor audio implementation.
1183 */
1184message SpeakerImpedanceReported {
1185 optional int32 speaker_location = 1;
1186 optional int32 impedance = 2;
1187}
1188
1189/**
1190 * Logs the report of a failed hardware.
1191 *
1192 * Logged from:
1193 * Vendor HALs.
1194 *
1195 */
1196message HardwareFailed {
1197 enum HardwareType {
1198 HARDWARE_FAILED_UNKNOWN = 0;
1199 HARDWARE_FAILED_MICROPHONE = 1;
1200 HARDWARE_FAILED_CODEC = 2;
1201 HARDWARE_FAILED_SPEAKER = 3;
1202 HARDWARE_FAILED_FINGERPRINT = 4;
1203 }
1204 optional HardwareType hardware_type = 1;
1205
1206 /* hardware_location allows vendors to differentiate between multiple instances of
1207 * the same hardware_type. The specific locations are vendor defined integers,
1208 * referring to board-specific numbering schemes.
1209 */
1210 optional int32 hardware_location = 2;
1211
1212 /* failure_code is specific to the HardwareType of the failed hardware.
1213 * It should use the enum values defined below.
1214 */
1215 enum MicrophoneFailureCode {
1216 MICROPHONE_FAILURE_COMPLETE = 0;
1217 }
1218 enum CodecFailureCode {
1219 CODEC_FAILURE_COMPLETE = 0;
1220 }
1221 enum SpeakerFailureCode {
1222 SPEAKER_FAILURE_COMPLETE = 0;
1223 SPEAKER_FAILURE_HIGH_Z = 1;
1224 SPEAKER_FAILURE_SHORT = 2;
1225 }
1226 enum FingerprintFailureCode {
1227 FINGERPRINT_FAILURE_COMPLETE = 0;
1228 FINGERPRINT_SENSOR_BROKEN = 1;
1229 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1230 }
1231 optional int32 failure_code = 3;
1232}
1233
1234/**
1235 * Log an event when the device has been physically dropped.
1236 * Reported from the /vendor partition.
1237 */
1238message PhysicalDropDetected {
1239 // Confidence that the event was actually a drop, 0 -> 100
1240 optional int32 confidence_pctg = 1;
1241 // Peak acceleration of the drop, in 1/1000s of a g.
1242 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001243 // Duration of freefall in ms
1244 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001245}
1246
1247/**
1248 * Log bucketed battery charge cycles.
1249 *
1250 * Each bucket represents cycles of the battery past
1251 * a given charge point. For example, bucket 1 is the
1252 * lowest 1/8th of the battery, and bucket 8 is 100%.
1253 *
1254 * Logged from:
1255 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1256 */
1257message ChargeCyclesReported {
1258 optional int32 cycle_bucket_1 = 1;
1259 optional int32 cycle_bucket_2 = 2;
1260 optional int32 cycle_bucket_3 = 3;
1261 optional int32 cycle_bucket_4 = 4;
1262 optional int32 cycle_bucket_5 = 5;
1263 optional int32 cycle_bucket_6 = 6;
1264 optional int32 cycle_bucket_7 = 7;
1265 optional int32 cycle_bucket_8 = 8;
1266}
1267
1268/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001269 * Logs the duration of a davey (jank of >=700ms) when it occurs
1270 *
1271 * Logged from:
1272 * frameworks/base/libs/hwui/JankTracker.cpp
1273 */
1274message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001275 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001276 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001277
Tej Singhbb8554a2018-01-26 11:59:14 -08001278 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001279 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001280}
1281
1282/**
Bookatze5885242017-10-24 20:10:31 -07001283 * Logs phone signal strength changes.
1284 *
1285 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001286 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001287 */
1288message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001289 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1290 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001291}
1292
1293/**
1294 * Logs that a setting was updated.
1295 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001296 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001297 * The tag and is_default allow resetting of settings to default values based on the specified
1298 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1299 */
1300message SettingChanged {
1301 // The name of the setting.
1302 optional string setting = 1;
1303
1304 // The change being imposed on this setting. May represent a number, eg "3".
1305 optional string value = 2;
1306
1307 // The new value of this setting. For most settings, this is same as value. For some settings,
1308 // value is +X or -X where X represents an element in a set. For example, if the previous value
1309 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1310 // The +/- feature is currently only used for location_providers_allowed.
1311 optional string new_value = 3;
1312
1313 // The previous value of this setting.
1314 optional string prev_value = 4;
1315
1316 // The tag used with the is_default for resetting sets of settings. This is generally null.
1317 optional string tag = 5;
1318
Bookatz90867622018-01-31 15:05:57 -08001319 // True if this setting with tag should be resettable.
1320 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001321
David Chenbd789912018-03-16 17:19:55 -07001322 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001323 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001324
1325 enum ChangeReason {
1326 UPDATED = 1; // Updated can be an insertion or an update.
1327 DELETED = 2;
1328 }
1329 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001330}
Chenjie Yub3dda412017-10-24 13:41:59 -07001331
Chenjie Yu05013b32017-11-21 10:21:41 -08001332/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001333 * Logs activity going to foreground or background
1334 *
1335 * Logged from:
1336 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1337 */
1338message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001339 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001340 optional string pkg_name = 2;
1341 optional string class_name = 3;
1342
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001343 enum State {
1344 BACKGROUND = 0;
1345 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001346 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001347 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001348}
David Chenc8a43242017-10-17 16:23:28 -07001349
1350/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001351 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001352 * Logged from:
1353 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1354 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001355message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001356 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001357
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001358 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001359
1360 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001361 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001362 optional string process_name = 3;
1363
1364 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001365 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001366
1367 optional string package_name = 5;
1368
1369 enum InstantApp {
1370 UNAVAILABLE = 0;
1371 FALSE = 1;
1372 TRUE = 2;
1373 }
1374 optional InstantApp is_instant_app = 6;
1375
1376 enum ForegroundState {
1377 UNKNOWN = 0;
1378 BACKGROUND = 1;
1379 FOREGROUND = 2;
1380 }
1381 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001382}
David Chen9e3808c2017-11-20 17:25:34 -08001383
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001384/**
1385 * Logs when a WTF (What a Terrible Failure) happened.
1386 * Logged from:
1387 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1388 */
1389message WTFOccurred {
1390 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001391
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001392 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001393
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001394 // The name of the process.
1395 // system_server if it is not by an app
1396 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001397
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001398 // The pid if available. -1 means not available.
1399 optional sint32 pid = 4;
1400}
1401
1402/**
1403 * Logs when system server reports low memory.
1404 * Logged from:
1405 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1406 */
1407message LowMemReported {
1408}
1409
1410/**
1411 * Logs when an app ANR (App Not Responding) occurs.
1412 * Logged from:
1413 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1414 */
1415message ANROccurred {
1416 optional int32 uid = 1 [(is_uid) = true];
1417
1418 optional string process_name = 2;
1419
1420 optional string short_component_name = 3;
1421
1422 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001423
1424 enum InstantApp {
1425 UNAVAILABLE = 0;
1426 FALSE = 1;
1427 TRUE = 2;
1428 }
1429 optional InstantApp is_instant_app = 5;
1430
1431 enum ForegroundState {
1432 UNKNOWN = 0;
1433 BACKGROUND = 1;
1434 FOREGROUND = 2;
1435 }
1436 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001437}
1438
Bookatza7020bd2018-08-28 16:29:35 -07001439/**
1440 * Logs when the vibrator state changes.
1441 * Logged from:
1442 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1443 */
1444message VibratorStateChanged {
1445 repeated AttributionNode attribution_node = 1;
1446
1447 enum State {
1448 OFF = 0;
1449 ON = 1;
1450 }
1451 optional State state = 2;
1452
1453 // Duration (in milliseconds) requested to keep the vibrator on.
1454 // Only applicable for State == ON.
1455 optional int64 duration_millis = 3;
1456}
1457
David Chen0a368b22017-12-06 16:28:16 -08001458/*
1459 * Allows other apps to push events into statsd.
1460 * Logged from:
1461 * frameworks/base/core/java/android/util/StatsLog.java
1462 */
David Chen0b5c90c2018-01-25 16:51:49 -08001463message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001464 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001465 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001466
1467 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1468 optional int32 label = 2;
1469
1470 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1471 // predicates for the metrics).
1472 enum State {
1473 UNKNOWN = 0;
1474 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1475 STOP = 2;
1476 START = 3;
1477 }
1478 optional State state = 3;
1479}
1480
David Chen9e3808c2017-11-20 17:25:34 -08001481/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001482 * Logs when statsd detects an anomaly.
1483 *
1484 * Logged from:
1485 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1486 */
1487message AnomalyDetected {
1488 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001489 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001490
Yangster-mac94e197c2018-01-02 16:03:03 -08001491 // Id of the config whose anomaly detection alert fired.
1492 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001493
Yangster-mac94e197c2018-01-02 16:03:03 -08001494 // Id of the alert (i.e. name of the anomaly that was detected).
1495 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001496}
1497
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001498message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001499 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001500 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001501
1502 // The app package name.
1503 optional string pkg_name = 2;
1504
1505 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001506 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001507 WARM = 1;
1508 HOT = 2;
1509 COLD = 3;
1510 }
1511 // The transition type.
1512 optional TransitionType type = 3;
1513
1514 // The activity name.
1515 optional string activity_name = 4;
1516
1517 // The name of the calling app. Empty if not set.
1518 optional string calling_pkg_name = 5;
1519
1520 // Whether the app is an instant app.
1521 optional bool is_instant_app = 6;
1522
1523 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001524 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001525
Bookatz80d11a02018-01-16 10:46:35 -08001526 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001527
David Chen0b5c90c2018-01-25 16:51:49 -08001528 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001529 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001530 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001531 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001532 optional int32 bind_application_delay_millis = 11;
1533 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001534
1535 // Empty if not set.
1536 optional string launch_token = 13;
1537
Calin Juravle759fbda2018-02-20 19:52:30 +00001538 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001539 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001540
1541 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001542 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001543}
1544
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001545message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001546 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001547 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001548
1549 // The app package name.
1550 optional string pkg_name = 2;
1551
1552 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001553 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001554 WARM = 1;
1555 HOT = 2;
1556 COLD = 3;
1557 }
1558 // The transition type.
1559 optional TransitionType type = 3;
1560
1561 // The activity name.
1562 optional string activity_name = 4;
1563}
1564
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001565message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001566 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001567 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001568
1569 // The app package name.
1570 optional string pkg_name = 2;
1571
1572 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001573 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001574 WITH_BUNDLE = 1;
1575 WITHOUT_BUNDLE = 2;
1576 }
1577 // The transition type.
1578 optional TransitionType type = 3;
1579
1580 // The activity name.
1581 optional string activity_name = 4;
1582
1583 optional bool transition_process_running = 5;
1584
1585 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001586 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001587}
1588
Bookatz8fcd09a2017-12-18 13:01:10 -08001589/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001590 * Logs a picture-in-picture action
1591 * Logged from:
1592 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1593 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1594 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1595 */
1596message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001597 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001598 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001599
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001600 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001601
Chenjie Yu52cacc62017-12-08 18:11:45 -08001602 enum State {
1603 ENTERED = 1;
1604 EXPANDED_TO_FULL_SCREEN = 2;
1605 MINIMIZED = 3;
1606 DISMISSED = 4;
1607 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001608 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001609}
1610
1611/**
Chenjie Yue8904192017-12-08 19:12:57 -08001612 * Logs overlay action
1613 * Logged from:
1614 * services/core/java/com/android/server/wm/Session.java
1615 */
1616message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001617 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001618
1619 optional string package_name = 2;
1620
1621 optional bool using_alert_window = 3;
1622
1623 enum State {
1624 ENTERED = 1;
1625 EXITED = 2;
1626 }
1627 optional State state = 4;
1628}
1629
Chenjie Yuccfe6452018-01-30 11:33:21 -08001630/*
1631 * Logs foreground service starts and stops.
1632 * Note that this is not when a service starts or stops, but when it is
1633 * considered foreground.
1634 * Logged from
1635 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1636 */
1637message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001638 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001639 // package_name + "/" + class_name
1640 optional string short_name = 2;
1641
1642 enum State {
1643 ENTER = 1;
1644 EXIT = 2;
1645 }
1646 optional State state = 3;
1647}
1648
Chenjie Yue8904192017-12-08 19:12:57 -08001649/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001650 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1651 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1652 * attributed back to the parent (host) uid. One example is Chrome.
1653 *
1654 * Logged from:
1655 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1656 */
1657message IsolatedUidChanged {
1658 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001659 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001660 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001661 optional int32 parent_uid = 1;
1662
1663 optional int32 isolated_uid = 2;
1664
1665 // We expect an isolated uid to be removed before if it's used for another parent uid.
1666 enum Event {
1667 REMOVED = 0;
1668 CREATED = 1;
1669 }
1670 optional Event event = 3;
1671}
1672
1673/*
1674 * Logs the reception of an incoming network packet causing the main system to wake up for
1675 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1676 * and processed by WakeupController.cpp.
1677 */
1678message PacketWakeupOccurred {
1679 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1680 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001681 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001682 // The interface name on which the packet was received.
1683 optional string iface = 2;
1684 // The ethertype value of the packet.
1685 optional int32 ethertype = 3;
1686 // String representation of the destination MAC address of the packet.
1687 optional string destination_hardware_address = 4;
1688 // String representation of the source address of the packet if this was an IP packet.
1689 optional string source_ip = 5;
1690 // String representation of the destination address of the packet if this was an IP packet.
1691 optional string destination_ip = 6;
1692 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1693 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1694 // families.
1695 optional int32 ip_next_header = 7;
1696 // The source port if this was a TCP or UDP packet.
1697 optional int32 source_port = 8;
1698 // The destination port if this was a TCP or UDP packet.
1699 optional int32 destination_port = 9;
1700}
1701
1702/*
1703 * Logs the memory stats for an app on startup.
1704 * Logged from:
1705 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1706 */
1707message AppStartMemoryStateCaptured {
1708 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001709 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001710
1711 // The process name.
1712 optional string process_name = 2;
1713
1714 // The activity name.
1715 optional string activity_name = 3;
1716
1717 // # of page-faults
1718 optional int64 pgfault = 4;
1719
1720 // # of major page-faults
1721 optional int64 pgmajfault = 5;
1722
1723 // RSS
1724 optional int64 rss_in_bytes = 6;
1725
1726 // CACHE
1727 optional int64 cache_in_bytes = 7;
1728
1729 // SWAP
1730 optional int64 swap_in_bytes = 8;
1731}
1732
1733/*
1734 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1735 * for LMK event.
1736 * Logged from:
1737 * system/core/lmkd/lmkd.c
1738 */
1739message LmkStateChanged {
1740 enum State {
1741 UNKNOWN = 0;
1742 START = 1;
1743 STOP = 2;
1744 }
1745 optional State state = 1;
1746}
1747
1748/*
1749 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1750 * Logged from:
1751 * system/core/lmkd/lmkd.c
1752 */
1753message LmkKillOccurred {
1754 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001755 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001756
1757 // The process name.
1758 optional string process_name = 2;
1759
1760 // oom adj score.
1761 optional int32 oom_score = 3;
1762
1763 // # of page-faults
1764 optional int64 pgfault = 4;
1765
1766 // # of major page-faults
1767 optional int64 pgmajfault = 5;
1768
1769 // RSS
1770 optional int64 rss_in_bytes = 6;
1771
1772 // CACHE
1773 optional int64 cache_in_bytes = 7;
1774
1775 // SWAP
1776 optional int64 swap_in_bytes = 8;
1777}
1778
Rajeev Kumar51b54602018-03-01 12:18:26 -08001779/*
1780 * Logs when the ActivityManagerService detects that an app died.
1781 *
1782 * Logged from:
1783 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1784 */
1785message AppDied {
1786 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001787 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001788}
1789
Howard Ro21a039c2018-08-06 14:55:47 -07001790/**
1791 * An atom for generic metrics logging. Available from Android Q.
1792 */
1793message GenericAtom {
1794 // The uid of the application that sent this custom atom.
1795 optional int32 uid = 1 [(is_uid) = true];
1796
1797 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001798 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001799}
1800
Chenjie Yubbcbc602018-02-05 16:51:52 -08001801//////////////////////////////////////////////////////////////////////
1802// Pulled atoms below this line //
1803//////////////////////////////////////////////////////////////////////
1804
1805/**
David Chenc8a43242017-10-17 16:23:28 -07001806 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1807 *
1808 * Pulled from:
1809 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1810 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001811message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001812 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001813
1814 optional int64 rx_bytes = 2;
1815
1816 optional int64 rx_packets = 3;
1817
1818 optional int64 tx_bytes = 4;
1819
1820 optional int64 tx_packets = 5;
1821}
1822
1823/**
1824 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1825 *
1826 * Pulled from:
1827 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1828 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001829message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001830 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001831
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001832 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1833 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001834
1835 optional int64 rx_bytes = 3;
1836
1837 optional int64 rx_packets = 4;
1838
1839 optional int64 tx_bytes = 5;
1840
1841 optional int64 tx_packets = 6;
1842}
1843
1844/**
1845 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1846 *
1847 * Pulled from:
1848 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1849 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001850message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001851 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001852
1853 optional int64 rx_bytes = 2;
1854
1855 optional int64 rx_packets = 3;
1856
1857 optional int64 tx_bytes = 4;
1858
1859 optional int64 tx_packets = 5;
1860}
1861
1862/**
1863 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1864 *
1865 * Pulled from:
1866 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1867 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001868message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001869 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001870
Yao Chenc40a19d2018-03-15 16:48:25 -07001871 // 1 denotes foreground and 0 denotes background. This is called Set in
1872 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001873 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001874
1875 optional int64 rx_bytes = 3;
1876
1877 optional int64 rx_packets = 4;
1878
1879 optional int64 tx_bytes = 5;
1880
1881 optional int64 tx_packets = 6;
1882}
1883
1884/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001885 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1886 *
1887 * Pulled from:
1888 * StatsCompanionService
1889 */
1890message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001891 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001892
1893 optional int64 rx_bytes = 2;
1894
1895 optional int64 tx_bytes = 3;
1896}
1897
1898/**
David Chenc8a43242017-10-17 16:23:28 -07001899 * Pulls the kernel wakelock durations. This atom is adapted from
1900 * android/internal/os/KernelWakelockStats.java
1901 *
1902 * Pulled from:
1903 * StatsCompanionService using KernelWakelockReader.
1904 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001905message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001906 optional string name = 1;
1907
1908 optional int32 count = 2;
1909
1910 optional int32 version = 3;
1911
1912 optional int64 time = 4;
1913}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001914
Chenjie Yu05013b32017-11-21 10:21:41 -08001915/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001916 * Pulls low power state information. This includes platform and subsystem sleep state information,
1917 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001918 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001919 * hardware/interfaces/power/1.1/types.hal
1920 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001921message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001922 // Subsystem name
1923 optional string subsystem_name = 1;
1924 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1925 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1926 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001927 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001928 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001929 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001930 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001931}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001932
Chenjie Yu05013b32017-11-21 10:21:41 -08001933/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001934 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001935 * Pulls the time the cpu spend on the frequency index. Frequency index
1936 * starts from highest to lowest. The value should be monotonically
1937 * increasing since boot. However, if there is a cpu
1938 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001939 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001940message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001941 optional uint32 cluster = 1;
1942 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001943 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001944}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001945
Chenjie Yu05013b32017-11-21 10:21:41 -08001946/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001947 * Pulls Cpu Time Per Uid.
1948 * Note that isolated process uid time should be attributed to host uids.
1949 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001950message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001951 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001952 optional uint64 user_time_millis = 2;
1953 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001954}
1955
1956/**
1957 * Pulls Cpu Time Per Uid per frequency.
1958 * Note that isolated process uid time should be attributed to host uids.
1959 * For each uid, we order the time by descending frequencies.
1960 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001961message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001962 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001963 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001964 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001965}
Hugo Benichi884970e2017-11-14 22:42:46 +09001966
Chenjie Yu05013b32017-11-21 10:21:41 -08001967/**
1968 * Pulls Wifi Controller Activity Energy Info
1969 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001970message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001971 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001972 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001973 // stack reported state
1974 // TODO: replace this with proto enum
1975 optional int32 stack_state = 2;
1976 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001977 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001978 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001979 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001980 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001981 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001982 // product of current(mA), voltage(V) and time(ms)
1983 optional uint64 controller_energy_used = 6;
1984}
1985
1986/**
1987 * Pulls Modem Activity Energy Info
1988 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001989message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001990 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001991 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001992 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001993 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001994 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001995 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001996 /**
1997 * Tx power index
1998 * index 0 = tx_power < 0dBm
1999 * index 1 = 0dBm < tx_power < 5dBm
2000 * index 2 = 5dBm < tx_power < 15dBm
2001 * index 3 = 15dBm < tx_power < 20dBm
2002 * index 4 = tx_power > 20dBm
2003 */
2004 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002005 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002006 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002007 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002008 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002009 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002010 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002011 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002012 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002013 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002014 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002015 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002016 // product of current(mA), voltage(V) and time(ms)
2017 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002018}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002019
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002020/**
2021 * Pulls Bluetooth Activity Energy Info
2022 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2023 */
2024message BluetoothActivityInfo {
2025 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002026 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002027 // bluetooth stack state
2028 optional int32 bluetooth_stack_state = 2;
2029 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002030 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002031 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002032 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002033 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002034 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002035 // product of current(mA), voltage(V) and time(ms)
2036 optional uint64 energy_used = 6;
2037}
2038
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002039/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002040 * Logs the memory stats for a process.
2041 */
2042message ProcessMemoryState {
2043 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002044 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002045
2046 // The process name.
2047 optional string process_name = 2;
2048
2049 // oom adj score.
2050 optional int32 oom_score = 3;
2051
2052 // # of page-faults
2053 optional int64 pgfault = 4;
2054
2055 // # of major page-faults
2056 optional int64 pgmajfault = 5;
2057
Rajeev Kumar90235992018-01-29 11:06:48 -08002058 // RSS
2059 optional int64 rss_in_bytes = 6;
2060
2061 // CACHE
2062 optional int64 cache_in_bytes = 7;
2063
2064 // SWAP
2065 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002066}
2067
2068/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002069 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002070 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002071message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002072 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002073}
2074
2075/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002076 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002077 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002078message SystemUptime {
2079 // Milliseconds since the system was booted.
2080 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2081 // for external input).
2082 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002083 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002084}
2085
2086/*
2087 * Reads from /proc/uid_concurrent_active_time which has the format:
2088 * active: X (X is # cores)
2089 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2090 * [uid1]: [time-0] [time-1] [time-2] ... ...
2091 * ...
2092 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2093 * The file contains a monotonically increasing count of time for a single boot.
2094 */
2095message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002096 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002097 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002098}
2099
2100/**
2101 * Reads from /proc/uid_concurrent_policy_time which has the format:
2102 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2103 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2104 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2105 * ...
2106 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2107 * The file contains a monotonically increasing count of time for a single boot.
2108 */
2109message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002110 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002111 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002112 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002113}
2114
2115/*
2116 * Pulls free disk space, for data, system partition and temporary directory.
2117 */
2118message DiskSpace {
2119 // available bytes in data partition
2120 optional uint64 data_available_bytes = 1;
2121 // available bytes in system partition
2122 optional uint64 system_available_bytes = 2;
2123 // available bytes in download cache or temp directories
2124 optional uint64 temp_available_bytes = 3;
2125}
Tej Singhbf972d92018-01-10 20:51:13 -08002126
2127/**
2128 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002129 * Pulled from:
2130 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002131 */
2132message RemainingBatteryCapacity {
2133 optional int32 charge_uAh = 1;
2134}
2135
2136/**
2137 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002138 * Pulled from:
2139 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002140 */
2141message FullBatteryCapacity {
2142 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002143}
2144
2145/**
Tej Singhd89137e2018-03-26 14:51:40 -07002146 * Pulls the temperature of various parts of the device.
2147 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002148 *
2149 * Pulled from:
2150 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2151 */
2152message Temperature {
2153 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2154 optional android.os.TemperatureTypeEnum sensor_location = 1;
2155
2156 // The name of the temperature source. Eg. CPU0
2157 optional string sensor_name = 2;
2158
Tej Singhd89137e2018-03-26 14:51:40 -07002159 // Temperature in tenths of a degree C.
2160 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002161}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002162
2163/**
2164 * Pulls the statistics of calls to Binder.
2165 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002166 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2167 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002168 *
2169 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002170 */
2171message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002172 optional int32 uid = 1 [(is_uid) = true];
2173 // Fully qualified class name of the API call.
2174 //
2175 // This is a system server class name.
2176 //
2177 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2178 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2179 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2180 // commonly used APIs.
2181 optional string service_class_name = 2;
2182 // Method name of the API call. It can also be a transaction code if we cannot
2183 // resolve it to a name. See Binder#getTransactionName.
2184 //
2185 // This is a system server method name.
2186 optional string service_method_name = 3;
2187 // Total number of API calls.
2188 optional int64 call_count = 4;
2189 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2190 optional bool screen_interactive = 13;
2191 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2192 // call_count will be equal to recorded_call_count.
2193 //
2194 // If recorded_call_count is different than call_count, it means data collection has been
2195 // sampled. All the fields below will be sampled in this case.
2196 optional int64 recorded_call_count = 12;
2197 // Number of exceptions thrown by the API.
2198 optional int64 recorded_exception_count = 5;
2199 // Total latency of all API calls.
2200 // Average can be computed using total_latency_micros / recorded_call_count.
2201 optional int64 recorded_total_latency_micros = 6;
2202 // Maximum latency of one API call.
2203 optional int64 recorded_max_latency_micros = 7;
2204 // Total CPU usage of all API calls.
2205 // Average can be computed using total_cpu_micros / recorded_call_count.
2206 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2207 optional int64 recorded_total_cpu_micros = 8;
2208 // Maximum CPU usage of one API call.
2209 optional int64 recorded_max_cpu_micros = 9;
2210 // Maximum parcel reply size of one API call.
2211 optional int64 recorded_max_reply_size_bytes = 10;
2212 // Maximum parcel request size of one API call.
2213 optional int64 recorded_max_request_size_bytes = 11;
2214}
2215
2216/**
2217 * Pulls the statistics of exceptions during calls to Binder.
2218 *
2219 * Binder stats are cumulative from boot unless somebody reset the data using
2220 * > adb shell dumpsys binder_calls_stats --reset
2221 */
2222message BinderCallsExceptions {
2223 // Exception class name, e.g. java.lang.IllegalArgumentException.
2224 //
2225 // This is an exception class name thrown by the system server.
2226 optional string exception_class_name = 1;
2227 // Total number of exceptions.
2228 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002229}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002230
2231message LooperStats {
2232 // Currently not collected and always set to 0.
2233 optional int32 uid = 1 [(is_uid) = true];
2234
2235 // Fully qualified class name of the handler target class.
2236 //
2237 // This field does not contain PII. This is a system server class name.
2238 optional string handler_class_name = 2;
2239
2240 // The name of the thread that runs the Looper.
2241 //
2242 // This field does not contain PII. This is a system server thread name.
2243 optional string looper_thread_name = 3;
2244
2245 // The name of the dispatched message.
2246 //
2247 // This field does not contain PII. This is a system server constant or class
2248 // name.
2249 optional string message_name = 4;
2250
2251 // Total number of successfully dispatched messages.
2252 optional int64 message_count = 5;
2253
2254 // Total number of messages that failed dispatching.
2255 optional int64 exception_count = 6;
2256
2257 // Total number of processed messages we have data recorded for. If we
2258 // collected data for all the messages, message_count will be equal to
2259 // recorded_message_count.
2260 //
2261 // If recorded_message_count is different than message_count, it means data
2262 // collection has been sampled. All the fields below will be sampled in this
2263 // case.
2264 optional int64 recorded_message_count = 7;
2265
2266 // Total latency of all processed messages.
2267 // Average can be computed using recorded_total_latency_micros /
2268 // recorded_message_count.
2269 optional int64 recorded_total_latency_micros = 8;
2270
2271 // Total CPU usage of all processed message.
2272 // Average can be computed using recorded_total_cpu_micros /
2273 // recorded_message_count. Total can be computed using
2274 // recorded_total_cpu_micros / recorded_message_count * call_count.
2275 optional int64 recorded_total_cpu_micros = 9;
2276}
Tej Singh86dc9db2018-09-06 00:39:57 +00002277
2278/**
2279 * Pulls disk information, such as write speed and latency.
2280 */
2281message DiskStats {
2282 // Time taken to open, write 512B to, and close a file.
2283 // -1 if error performing the check.
2284 optional int64 data_write_latency_millis = 1;
2285
2286 optional bool file_based_encryption = 2;
2287
2288 // Recent disk write speed in kB/s.
2289 // -1 if error querying storageed.
2290 // 0 if data is unavailable.
2291 optional int32 recent_disk_write_speed = 3;
2292}
2293
2294
2295/**
2296 * Free and total bytes of the Data, Cache, and System partition.
2297 */
2298message DirectoryUsage {
2299 enum Directory {
2300 UNKNOWN = 0;
2301 DATA = 1;
2302 CACHE = 2;
2303 SYSTEM = 3;
2304 }
2305 optional Directory directory = 1;
2306 optional int64 free_bytes = 2;
2307 optional int64 total_bytes = 3;
2308}
2309
2310
2311/**
2312 * Size of an application: apk size, data size, and cache size.
2313 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2314 * Information is only reported for apps with the primary user (user 0).
2315 * Sizes are aggregated by package name.
2316 */
2317message AppSize {
2318 // Including uids will involve modifying diskstats logic.
2319 optional string package_name = 1;
2320 // App size in bytes. -1 if unavailable.
2321 optional int64 app_size_bytes = 2;
2322 // App data size in bytes. -1 if unavailable.
2323 optional int64 app_data_size_bytes = 3;
2324 // App cache size in bytes. -1 if unavailable.
2325 optional int64 app_cache_size_bytes = 4;
2326 // Time that the cache file was produced.
2327 // Uses System.currentTimeMillis(), which is wall clock time.
2328 optional int64 cache_time_millis = 5;
2329}
2330
2331
2332/**
2333 * Size of a particular category. Eg: photos, videos.
2334 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2335 */
2336message CategorySize {
2337 enum Category {
2338 UNKNOWN = 0;
2339 APP_SIZE = 1;
2340 APP_DATA_SIZE = 2;
2341 APP_CACHE_SIZE = 3;
2342 PHOTOS = 4;
2343 VIDEOS = 5;
2344 AUDIO = 6;
2345 DOWNLOADS = 7;
2346 SYSTEM = 8;
2347 OTHER = 9;
2348 }
2349 optional Category category = 1;
2350 // Category size in bytes.
2351 optional int64 size_bytes = 2;
2352 // Time that the cache file was produced.
2353 // Uses System.currentTimeMillis(), which is wall clock time.
2354 optional int64 cache_time_millis = 3;
2355}