blob: 21e7203ffa886c86e339007ebeea229c9bf82fbb [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";
Fan Zhangf837b8e2018-10-23 12:38:30 -070025import "frameworks/base/core/proto/android/app/settings_enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070030import "frameworks/base/core/proto/android/service/procstats_enum.proto";
31import "frameworks/base/core/proto/android/stats/enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070032import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080033import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080034import "frameworks/base/core/proto/android/telephony/enums.proto";
35import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080036
Yao Chend54f9dd2017-10-17 17:37:48 +000037/**
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * raw stats log events from the Android system, also known as "atoms."
40 *
41 * This field contains a single oneof with all of the available messages.
42 * The stats-log-api-gen tool runs as part of the Android build and
43 * generates the android.util.StatsLog class, which contains the constants
44 * and methods that Android uses to log.
45 *
Stefan Lafonae2df012017-11-14 09:17:21 -080046 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000047 * Instead, statsd on Android constructs these messages synthetically,
48 * in the format defined here and in stats_log.proto.
49 */
Stefan Lafonae2df012017-11-14 09:17:21 -080050message Atom {
51 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070052 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070053 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
54 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070055 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070056 BleScanResultReceived ble_scan_result_received = 4;
57 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080058 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070059 SyncStateChanged sync_state_changed = 7;
60 ScheduledJobStateChanged scheduled_job_state_changed = 8;
61 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070062 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080063 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
64 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
65 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070066 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
67 MemoryFactorStateChanged memory_factor_state_changed = 15;
68 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
69 CachedKillReported cached_kill_reported = 17;
70 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070071 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080072 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
73 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
74 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070075 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080076 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070077 CameraStateChanged camera_state_changed = 25;
78 FlashlightStateChanged flashlight_state_changed = 26;
79 UidProcessStateChanged uid_process_state_changed = 27;
80 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
81 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070082 BatteryLevelChanged battery_level_changed = 30;
83 ChargingStateChanged charging_state_changed = 31;
84 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070085 InteractiveStateChanged interactive_state_changed = 33;
86 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070087 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
88 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070089 WifiLockStateChanged wifi_lock_state_changed = 37;
90 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
91 WifiScanStateChanged wifi_scan_state_changed = 39;
92 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070093 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070094 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070095 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090096 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070097 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080098 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080099 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800100 AppStartOccurred app_start_occurred = 48;
101 AppStartCanceled app_start_canceled = 49;
102 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800104 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800105 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800106 LmkStateChanged lmk_state_changed = 54;
107 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800108 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800109 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800110 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800111 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800112 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800113 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800114 KeyguardStateChanged keyguard_state_changed = 62;
115 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
116 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800117 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800118 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800119 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
120 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700121 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700122 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800123 SpeakerImpedanceReported speaker_impedance_reported = 71;
124 HardwareFailed hardware_failed = 72;
125 PhysicalDropDetected physical_drop_detected = 73;
126 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800127 MobileConnectionStateChanged mobile_connection_state_changed = 75;
128 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700129 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800130 AppCrashOccurred app_crash_occurred = 78;
131 ANROccurred anr_occurred = 79;
132 WTFOccurred wtf_occurred = 80;
133 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700134 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700135 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700136 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700137 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700138 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700139 FingerprintAcquired fingerprint_acquired = 87;
140 FingerprintAuthenticated fingerprint_authenticated = 88;
141 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700142 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700143 BatteryHealthSnapshot battery_health_snapshot = 91;
144 SlowIo slow_io = 92;
145 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700146 PhoneServiceStateChanged phone_service_state_changed = 94;
147 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100148 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700149 SettingsUIChanged settings_ui_changed = 97;
Yao Chend54f9dd2017-10-17 17:37:48 +0000150 }
David Chenc8a43242017-10-17 16:23:28 -0700151
David Chen6e3e6cb2018-01-03 16:14:06 -0800152 // Pulled events will start at field 10000.
Misha Wagner5a51e002018-10-03 15:04:09 +0100153 // Next: 10038
David Chenc8a43242017-10-17 16:23:28 -0700154 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800155 WifiBytesTransfer wifi_bytes_transfer = 10000;
156 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
157 MobileBytesTransfer mobile_bytes_transfer = 10002;
158 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800159 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800160 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800161 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800162 CpuTimePerFreq cpu_time_per_freq = 10008;
163 CpuTimePerUid cpu_time_per_uid = 10009;
164 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800165 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800166 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800167 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800168 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800169 SystemElapsedRealtime system_elapsed_realtime = 10014;
170 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800171 CpuActiveTime cpu_active_time = 10016;
172 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000173 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800174 RemainingBatteryCapacity remaining_battery_capacity = 10019;
175 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800176 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100177 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100178 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100179 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000180 DiskStats disk_stats = 10025;
181 DirectoryUsage directory_usage = 10026;
182 AppSize app_size = 10027;
183 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700184 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700185 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700186 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700187 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700188 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700189 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700190 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100191 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100192 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700193 OnDevicePowerMeasurement on_device_power_measurement = 10038;
David Chenc8a43242017-10-17 16:23:28 -0700194 }
yroa1fe77c2018-02-26 14:22:54 -0800195
Bookatz76aafcf2018-09-17 16:17:10 -0700196 // DO NOT USE field numbers above 100,000 in AOSP.
197 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
198 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700199}
200
Yao Chend54f9dd2017-10-17 17:37:48 +0000201/**
Yangster-mac20877162017-12-22 17:19:39 -0800202 * This proto represents a node of an attribution chain.
203 * Note: All attribution chains are represented as a repeated field of type
204 * AttributionNode. It is understood that in such arrays, the order is that
205 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000206 */
Yangster-mac20877162017-12-22 17:19:39 -0800207message AttributionNode {
208 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800209 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800210
Yangster-mac20877162017-12-22 17:19:39 -0800211 // The (optional) string tag for an element in the attribution chain. If the
212 // element has no tag, it is encoded as an empty string.
213 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700214}
215
Yangster-mac48b3d622018-08-18 12:38:11 -0700216message KeyValuePair {
217 optional int32 key = 1;
218 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700219 int32 value_int = 2;
220 int64 value_long = 3;
221 string value_str = 4;
222 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700223 }
224}
225
226message KeyValuePairsAtom {
227 optional int32 uid = 1;
228 repeated KeyValuePair pairs = 2;
229}
230
Yao Chend54f9dd2017-10-17 17:37:48 +0000231/*
232 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800233 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000234 *
235 * RULES:
236 * - The field ids for each atom must start at 1, and count upwards by 1.
237 * Skipping field ids is not allowed.
238 * - These form an API, so renaming, renumbering or removing fields is
239 * not allowed between android releases. (This is not currently enforced,
240 * but there will be a tool to enforce this restriction).
241 * - The types must be built-in protocol buffer types, namely, no sub-messages
242 * are allowed (yet). The bytes type is also not allowed.
243 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800244 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000245 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800246 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000247 * - A field that is a uid should be a string field, tagged with the [xxx]
248 * annotation. The generated code on android will be represented by UIDs,
249 * and those UIDs will be translated in xxx to those strings.
250 *
251 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700252 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000253 * - If there is a UID, it goes first. Think in an object-oriented fashion.
254 * *****************************************************************************
255 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700256
Yao Chend54f9dd2017-10-17 17:37:48 +0000257/**
Yangster-mace16189a2018-08-26 12:20:16 -0700258 * Logs when the Thermal service HAL notifies the throttling start/stop events.
259 *
260 * Logged from:
261 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
262 */
263message ThermalThrottlingStateChanged {
264 optional android.os.TemperatureTypeEnum sensor_type = 1;
265
266 enum State {
267 UNKNOWN = 0;
268 START = 1;
269 STOP = 2;
270 }
271
272 optional State state = 2;
273
274 optional float temperature = 3;
275}
276
277/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000278 * Logs when the screen state changes.
279 *
280 * Logged from:
281 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
282 */
283message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800284 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700285 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700286}
Yao Chend54f9dd2017-10-17 17:37:48 +0000287
288/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700289 * Logs that the process state of the uid, as determined by ActivityManager
290 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000291 *
292 * Logged from:
293 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
294 */
Bookatzc1a050a2017-10-10 15:49:28 -0700295message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700296 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000297
Bookatzdb026a22018-01-10 19:01:56 -0800298 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700299 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000300}
301
302/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700303 * Logs process state change of a process, as per the activity manager.
304 *
305 * Logged from:
306 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
307 */
308message ProcessStateChanged {
309 optional int32 uid = 1;
310 optional string process_name = 2;
311 optional string package_name = 3;
312 // TODO: remove this when validation is done
313 optional int64 version = 5;
314 // The state, from frameworks/base/core/proto/android/app/enums.proto.
315 optional android.app.ProcessStateEnum state = 4;
316}
317
318/**
319 * Logs when ActivityManagerService sleep state is changed.
320 *
321 * Logged from:
322 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
323 */
324message ActivityManagerSleepStateChanged {
325 // TODO: import frameworks proto
326 enum State {
327 UNKNOWN = 0;
328 ASLEEP = 1;
329 AWAKE = 2;
330 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700331 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700332}
333
334/**
335 * Logs when system memory state changes.
336 *
337 * Logged from:
338 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
339 */
340message MemoryFactorStateChanged {
341 // TODO: import frameworks proto
342 enum State {
343 MEMORY_UNKNOWN = 0;
344 NORMAL = 1; // normal.
345 MODERATE = 2; // moderate memory pressure.
346 LOW = 3; // low memory.
347 CRITICAL = 4; // critical memory.
348
349 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700350 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700351}
352
353/**
354 * Logs when app is using too much cpu, according to ActivityManagerService.
355 *
356 * Logged from:
357 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
358 */
359message ExcessiveCpuUsageReported {
360 optional int32 uid = 1;
361 optional string process_name = 2;
362 optional string package_name = 3;
363 // package version. TODO: remove this when validation is done
364 optional int64 version = 4;
365}
366
367/**
368 * Logs when a cached process is killed, along with its pss.
369 *
370 * Logged from:
371 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
372 */
373message CachedKillReported {
374 optional int32 uid = 1;
375 optional string process_name = 2;
376 optional string package_name = 3;
377 // TODO: remove this when validation is done
378 optional int64 version = 5;
379 optional int64 pss = 4;
380}
381
382/**
383 * Logs when memory stats of a process is reported.
384 *
385 * Logged from:
386 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
387 */
388message ProcessMemoryStatReported {
389 optional int32 uid = 1;
390 optional string process_name = 2;
391 optional string package_name = 3;
392 //TODO: remove this when validation is done
393 optional int64 version = 9;
394 optional int64 pss = 4;
395 optional int64 uss = 5;
396 optional int64 rss = 6;
397 enum Type {
398 ADD_PSS_INTERNAL_SINGLE = 0;
399 ADD_PSS_INTERNAL_ALL_MEM = 1;
400 ADD_PSS_INTERNAL_ALL_POLL = 2;
401 ADD_PSS_EXTERNAL = 3;
402 ADD_PSS_EXTERNAL_SLOW = 4;
403 }
404 optional Type type = 7;
405 optional int64 duration = 8;
406}
407
408/**
Bookatzc1a050a2017-10-10 15:49:28 -0700409 * Logs that a process started, finished, crashed, or ANRed.
410 *
411 * Logged from:
412 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
413 */
414message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700415 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700416
David Chen0b5c90c2018-01-25 16:51:49 -0800417 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800418 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700419
Bookatzddccf0a2017-11-28 16:48:14 -0800420 // What lifecycle state the process changed to.
421 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800422 enum State {
423 FINISHED = 0;
424 STARTED = 1;
425 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800426 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800427 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700428}
429
Bookatzc1a050a2017-10-10 15:49:28 -0700430/**
431 * Logs when the ble scan state changes.
432 *
433 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700434 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700435 */
436message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800437 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700438
439 enum State {
440 OFF = 0;
441 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700442 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
443 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700444 }
445 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700446
Bookatze5ec0b42018-03-26 13:34:56 -0700447 // Does the scan have a filter.
448 optional bool is_filtered = 3;
449 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
450 optional bool is_first_match = 4;
451 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
452 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700453}
454
455/**
456 * Logs reporting of a ble scan finding results.
457 *
458 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700459 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700460 */
Bookatzae6738e2018-09-13 11:38:56 -0700461// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700462message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800463 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700464
465 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800466 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700467}
468
469/**
470 * Logs when a sensor state changes.
471 *
472 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700473 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700474 */
475message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800476 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
Bookatzc1a050a2017-10-10 15:49:28 -0700478 // The id (int) of the sensor.
479 optional int32 sensor_id = 2;
480
481 enum State {
482 OFF = 0;
483 ON = 1;
484 }
485 optional State state = 3;
486}
487
488
489/**
490 * Logs when GPS state changes.
491 *
492 * Logged from:
493 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
494 */
495message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800496 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700497
498 enum State {
499 OFF = 0;
500 ON = 1;
501 }
502 optional State state = 2;
503}
504
505
506/**
507 * Logs when a sync manager sync state changes.
508 *
509 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700510 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700511 */
512message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800513 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700514
David Chen0b5c90c2018-01-25 16:51:49 -0800515 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800516 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700517
518 enum State {
519 OFF = 0;
520 ON = 1;
521 }
522 optional State state = 3;
523}
524
Yangster-mac96353002018-09-05 11:18:55 -0700525/*
526 * Deferred job stats.
527 *
528 * Logged from:
529 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
530*/
531message DeferredJobStatsReported {
532 repeated AttributionNode attribution_node = 1;
533
534 // Number of jobs deferred.
535 optional int32 num_jobs_deferred = 2;
536
537 // Time since the last job runs.
538 optional int64 time_since_last_job_millis = 3;
539}
540
Bookatzc1a050a2017-10-10 15:49:28 -0700541/**
542 * Logs when a job scheduler job state changes.
543 *
544 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700545 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700546 */
547message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800548 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700549
550 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800551 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700552
553 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800554 FINISHED = 0;
555 STARTED = 1;
556 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700557 }
558 optional State state = 3;
559
Tej Singh33a412b2018-03-16 18:43:59 -0700560 // The reason a job has stopped.
561 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700562 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700563 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700564}
565
566/**
567 * Logs when the audio state changes.
568 *
569 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700570 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700571 */
572message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800573 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700574
575 enum State {
576 OFF = 0;
577 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700578 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
579 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700580 }
581 optional State state = 2;
582}
583
584/**
585 * Logs when the video codec state changes.
586 *
587 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700588 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700589 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800590message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800591 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700592
593 enum State {
594 OFF = 0;
595 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700596 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
597 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700598 }
599 optional State state = 2;
600}
601
602/**
603 * Logs when the flashlight state changes.
604 *
605 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700606 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700607 */
608message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800609 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700610
611 enum State {
612 OFF = 0;
613 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700614 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
615 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700616 }
617 optional State state = 2;
618}
619
620/**
621 * Logs when the camera state changes.
622 *
623 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700624 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700625 */
626message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800627 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700628
629 enum State {
630 OFF = 0;
631 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700632 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
633 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700634 }
635 optional State state = 2;
636}
637
638/**
639 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000640 *
641 * Logged from:
642 * TODO
643 */
Bookatzd6746242017-10-24 18:39:35 -0700644message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800645 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000646
Bookatz1a1b0462018-01-12 11:47:03 -0800647 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
648 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700649 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700650
651 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
652 optional string tag = 3;
653
654 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800655 RELEASE = 0;
656 ACQUIRE = 1;
657 CHANGE_RELEASE = 2;
658 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700659 }
660 optional State state = 4;
661}
662
663/**
Bookatzc1a050a2017-10-10 15:49:28 -0700664 * Logs when a partial wakelock is considered 'long' (over 1 min).
665 *
666 * Logged from:
667 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
668 */
669message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800670 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700671
Yao Chend54f9dd2017-10-17 17:37:48 +0000672 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
673 optional string tag = 2;
674
Bookatzc1a050a2017-10-10 15:49:28 -0700675 // TODO: I have no idea what this is.
676 optional string history_tag = 3;
677
678 enum State {
679 OFF = 0;
680 ON = 1;
681 }
682 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000683}
684
Bookatzc1a050a2017-10-10 15:49:28 -0700685/**
Bookatza66083f2018-09-20 17:24:00 -0700686 * Logs when the device is interactive, according to the PowerManager Notifier.
687 *
688 * Logged from:
689 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
690 */
691message InteractiveStateChanged {
692 enum State {
693 OFF = 0;
694 ON = 1;
695 }
696 optional State state = 1;
697}
698
699/**
Bookatzc1a050a2017-10-10 15:49:28 -0700700 * Logs Battery Saver state change.
701 *
702 * Logged from:
703 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
704 */
705message BatterySaverModeStateChanged {
706 enum State {
707 OFF = 0;
708 ON = 1;
709 }
710 optional State state = 1;
711}
712
713/**
714 * Logs Doze mode state change.
715 *
716 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800717 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700718 */
719message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800720 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800721}
722
723
724/**
725 * Logs state change of Doze mode including maintenance windows.
726 *
727 * Logged from:
728 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
729 */
730message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800731 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700732}
733
734/**
735 * Logs screen brightness level.
736 *
737 * Logged from:
738 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
739 */
740message ScreenBrightnessChanged {
741 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
742 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700743}
744
745/**
746 * Logs battery level (percent full, from 0 to 100).
747 *
748 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700749 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700750 */
751message BatteryLevelChanged {
752 // Battery level. Should be in [0, 100].
753 optional int32 battery_level = 1;
754}
755
756/**
757 * Logs change in charging status of the device.
758 *
759 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700760 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700761 */
762message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800763 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
764 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700765}
766
767/**
768 * Logs whether the device is plugged in, and what power source it is using.
769 *
770 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700771 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700772 */
773message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800774 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
775 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700776}
777
Bookatz8c6571b2017-10-24 15:04:41 -0700778/**
779 * Logs when an app's wakeup alarm fires.
780 *
781 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700782 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700783 */
784message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800785 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800786
787 // Name of the wakeup alarm.
788 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700789
790 // Name of source package (for historical reasons, since BatteryStats tracked it).
791 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800792}
793
794/**
795 * Logs when an an app causes the mobile radio to change state.
796 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
797 *
798 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700799 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800800 */
801message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800802 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800803
Bookatz1a1b0462018-01-12 11:47:03 -0800804 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
805 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800806}
807
808/**
809 * Logs when an an app causes the wifi radio to change state.
810 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
811 *
812 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700813 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800814 */
815message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800816 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800817
Bookatz1a1b0462018-01-12 11:47:03 -0800818 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
819 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700820}
821
822/**
823 * Logs kernel wakeup reasons and aborts.
824 *
825 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700826 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700827 */
828message KernelWakeupReported {
829 // Name of the kernel wakeup reason (or abort).
830 optional string wakeup_reason_name = 1;
831
832 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800833 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700834}
835
836/**
837 * Logs wifi locks held by an app.
838 *
839 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700840 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700841 */
842message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800843 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700844
845 enum State {
846 OFF = 0;
847 ON = 1;
848 }
849 optional State state = 2;
850}
851
852/**
853 * Logs wifi signal strength changes.
854 *
855 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700856 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700857 */
858message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800859 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
860 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700861}
862
863/**
864 * Logs wifi scans performed by an app.
865 *
866 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700867 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700868 */
869message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800870 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700871
872 enum State {
873 OFF = 0;
874 ON = 1;
875 }
876 optional State state = 2;
877}
878
879/**
Tej Singh4503e102018-01-04 14:35:01 -0800880 * Logs wifi multicast locks held by an app
881 *
882 * Logged from:
883 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
884 */
885message WifiMulticastLockStateChanged {
886 repeated AttributionNode attribution_node = 1;
887
888 enum State {
889 OFF = 0;
890 ON = 1;
891 }
892 optional State state = 2;
893}
894
895/**
Tej Singh1ea42892018-01-19 09:27:00 -0800896 * Logs shutdown reason and duration on next boot.
897 *
898 * Logged from:
899 * frameworks/base/core/java/com/android/server/BootReceiver.java
900 */
901message ShutdownSequenceReported {
902 // True if shutdown is for a reboot. Default: false if we do not know.
903 optional bool reboot = 1;
904
905 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
906 optional string reason = 2;
907
908 // Beginning of shutdown time in ms using wall clock time since unix epoch.
909 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800910 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800911
912 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800913 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800914}
915
Tej Singh6483ea42018-01-25 17:45:49 -0800916
917/**
918 * Logs boot reason and duration.
919 *
920 * Logged from:
921 * system/core/bootstat/bootstat.cpp
922 */
923message BootSequenceReported {
924 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
925 // Default: "<EMPTY>" if not available.
926 optional string bootloader_reason = 1;
927
928 // Reason for system boot. Eg. bootloader, reboot,userrequested
929 // Default: "<EMPTY>" if not available.
930 optional string system_reason = 2;
931
932 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800933 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800934
935 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800936 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800937
938 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800939 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800940
941 // Time since last boot in ms. Default: 0 if not available.
942 optional int64 time_since_last_boot = 6;
943}
944
Tej Singhc477d9c2018-02-05 18:31:39 -0800945
946/**
947 * Logs call state and disconnect cause (if applicable).
948 *
949 * Logged from:
950 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
951 */
952message CallStateChanged {
953 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
954 // From frameworks/base/core/proto/android/telecomm/enums.proto.
955 optional android.telecom.CallStateEnum call_state = 1;
956
957 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
958 // This value is only applicable when the call_state is DISCONNECTED, and
959 // should always be UNKNOWN if the call_state is not DISCONNECTED.
960 // From frameworks/base/core/proto/android/telecomm/enums.proto.
961 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
962
963 // True if the call is self-managed, which are apps that use the
964 // telecom infrastructure to make their own calls.
965 optional bool self_managed = 3;
966
967 // True if call is external. External calls are calls on connected Wear
968 // devices but show up in Telecom so the user can pull them onto the device.
969 optional bool external_call = 4;
970}
971
Tej Singh1ea42892018-01-19 09:27:00 -0800972/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800973 * Logs keyguard state. The keyguard is the lock screen.
974 *
975 * Logged from:
976 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
977 */
978message KeyguardStateChanged {
979 enum State {
980 UNKNOWN = 0;
981 // The keyguard is hidden when the phone is unlocked.
982 HIDDEN = 1;
983 // The keyguard is shown when the phone is locked (screen turns off).
984 SHOWN= 2;
985 // The keyguard is occluded when something is overlaying the keyguard.
986 // Eg. Opening the camera while on the lock screen.
987 OCCLUDED = 3;
988 }
989 optional State state = 1;
990}
991
992/**
993 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
994 * prompts the user to enter a password (pattern, pin, etc).
995 *
996 * Logged from:
997 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
998 */
999
1000message KeyguardBouncerStateChanged {
1001 enum State {
1002 UNKNOWN = 0;
1003 // Bouncer is hidden, either as a result of successfully entering the
1004 // password, screen timing out, or user going back to lock screen.
1005 HIDDEN = 1;
1006 // This is when the user is being prompted to enter the password.
1007 SHOWN = 2;
1008 }
1009 optional State state = 1;
1010}
1011
1012/**
1013 * Logs the result of entering a password into the keyguard bouncer.
1014 *
1015 * Logged from:
1016 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1017 */
1018message KeyguardBouncerPasswordEntered {
1019 enum BouncerResult {
1020 UNKNOWN = 0;
1021 // The password entered was incorrect.
1022 FAILURE = 1;
1023 // The password entered was correct.
1024 SUCCESS = 2;
1025 }
1026 optional BouncerResult result = 1;
1027}
1028
Tej Singha883b372018-02-15 11:30:01 -08001029/*
1030 * Logs changes to the configuration of the device. The configuration is defined
1031 * in frameworks/base/core/java/android/content/res/Configuration.java
1032 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1033 * Please go there to interpret the possible values each field can be.
1034 *
1035 * Logged from:
1036 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1037 */
1038message ResourceConfigurationChanged {
1039 // Bit mask of color capabilities of the screen.
1040 // Contains information about the color gamut and hdr mode of the screen.
1041 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001042 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001043
1044 // The target screen density being rendered to.
1045 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001046 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001047
1048 // Current user preference for the scaling factor for fonts,
1049 // relative to the base density scaling.
1050 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001051 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001052
1053 // Flag indicating whether the hard keyboard is hidden.
1054 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001055 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001056
1057 // The type of keyboard attached to the device.
1058 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1059 optional int32 keyboard = 5;
1060
1061 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1062 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001063 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001064
1065 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1066 // 0 if undefined.
1067 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1068 optional int32 mcc = 7;
1069
1070 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1071 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1072 // MNC_ZERO symbol defined in Configuration.java.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1074 optional int32 mnc = 8;
1075
1076 // The kind of navigation available on the device.
1077 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1078 optional int32 navigation = 9;
1079
1080 // Flag indicating whether the navigation is available.
1081 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001082 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001083
1084 // Overall orientation of the screen.
1085 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1086 optional int32 orientation = 11;
1087
1088 // The current height of the available screen space, in dp units.
1089 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001090 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001091
1092 // Bit mask of overall layout of the screen.
1093 // Contains information about screen size, whether the screen is wider/taller
1094 // than normal, whether the screen layout is right-tl-left or left-to-right,
1095 // and whether the screen has a rounded shape.
1096 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001097 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001098
1099 // Current width of the available screen space, in dp units.
1100 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001101 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001102
1103 // The smallest screen size an application will see in normal operation.
1104 // This is the smallest value of both screenWidthDp and screenHeightDp
1105 // in portrait and landscape.
1106 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001107 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001108
1109 // The type of touch screen attached to the device.
1110 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1111 optional int32 touchscreen = 16;
1112
1113 // Bit mask of the ui mode.
1114 // Contains information about the overall ui mode of the device.
1115 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1116 // Also contains information about whether the device is in night mode.
1117 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001118 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001119}
1120
Tej Singheee317b2018-03-07 19:28:05 -08001121
1122/**
1123 * Logs changes in the connection state of the mobile radio.
1124 *
1125 * Logged from:
1126 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1127 */
1128message MobileConnectionStateChanged {
1129 // States are from the state machine DataConnection.java.
1130 enum State {
1131 UNKNOWN = 0;
1132 // The connection is inactive, or disconnected.
1133 INACTIVE = 1;
1134 // The connection is being activated, or connecting.
1135 ACTIVATING = 2;
1136 // The connection is active, or connected.
1137 ACTIVE = 3;
1138 // The connection is disconnecting.
1139 DISCONNECTING = 4;
1140 // The connection is disconnecting after creating a connection.
1141 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1142 }
1143 optional State state = 1;
1144 // For multi-sim phones, this distinguishes between the sim cards.
1145 optional int32 sim_slot_index = 2;
1146 // Used to identify the connection. Starts at 0 and increments by 1 for
1147 // every new network created. Resets whenever the device reboots.
1148 optional int32 data_connection_id = 3;
1149 // A bitmask for the capabilities of this connection.
1150 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1151 // Default value (if we have no information): 0
1152 optional int64 capabilities = 4;
1153 // If this connection has internet.
1154 // This just checks if the DEFAULT bit of capabilities is set.
1155 optional bool has_internet = 5;
1156}
1157
1158/**
1159 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1160 *
1161 * Logged from:
1162 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1163 */
1164message MobileRadioTechnologyChanged {
1165 optional android.telephony.NetworkTypeEnum state = 1;
1166 // For multi-sim phones, this distinguishes between the sim cards.
1167 optional int32 sim_slot_index = 2;
1168}
1169
Andrew Chantb56388b2018-03-22 21:07:33 -07001170/**
1171 * Logs the VID and PID of any connected USB devices.
1172 *
1173 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1174 *
1175 * Logged by Vendor.
1176 */
1177message UsbDeviceAttached {
1178 optional int32 vid = 1;
1179 optional int32 pid = 2;
1180 optional bool has_audio = 3;
1181 optional bool has_hid = 4;
1182 optional bool has_storage = 5;
1183}
1184
Tej Singheee317b2018-03-07 19:28:05 -08001185
Tej Singhdd7bd352018-02-09 19:33:15 -08001186/**
Tej Singh5d991e12018-03-09 19:48:11 -08001187 * Logs when Bluetooth is enabled and disabled.
1188 *
1189 * Logged from:
1190 * services/core/java/com/android/server/BluetoothManagerService.java
1191 */
1192message BluetoothEnabledStateChanged {
1193 repeated AttributionNode attribution_node = 1;
1194 // Whether or not bluetooth is enabled on the device.
1195 enum State {
1196 UNKNOWN = 0;
1197 ENABLED = 1;
1198 DISABLED = 2;
1199 }
1200 optional State state = 2;
1201 // The reason for being enabled/disabled.
1202 // Eg. Airplane mode, crash, application request.
1203 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1204 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001205 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001206}
1207
1208/**
1209 * Logs when a Bluetooth device connects and disconnects.
1210 *
1211 * Logged from:
1212 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1213 */
1214message BluetoothConnectionStateChanged {
1215 // The state of the connection.
1216 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1217 optional android.bluetooth.ConnectionStateEnum state = 1;
1218 // An identifier that can be used to match connect and disconnect events.
1219 // Currently is last two bytes of a hash of a device level ID and
1220 // the mac address of the bluetooth device that is connected.
1221 optional int32 obfuscated_id = 2;
1222 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1223 // From android.bluetooth.BluetoothAdapter.java
1224 optional int32 bt_profile = 3;
1225}
1226
1227/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001228 * Logs when something is plugged into or removed from the USB-C connector.
1229 *
1230 * Logged from:
1231 * Vendor USB HAL.
1232 */
1233message UsbConnectorStateChanged {
1234 enum State {
1235 DISCONNECTED = 0;
1236 CONNECTED = 1;
1237 }
1238 optional State state = 1;
1239}
1240
1241/**
1242 * Logs the reported speaker impedance.
1243 *
1244 * Logged from:
1245 * Vendor audio implementation.
1246 */
1247message SpeakerImpedanceReported {
1248 optional int32 speaker_location = 1;
1249 optional int32 impedance = 2;
1250}
1251
1252/**
1253 * Logs the report of a failed hardware.
1254 *
1255 * Logged from:
1256 * Vendor HALs.
1257 *
1258 */
1259message HardwareFailed {
1260 enum HardwareType {
1261 HARDWARE_FAILED_UNKNOWN = 0;
1262 HARDWARE_FAILED_MICROPHONE = 1;
1263 HARDWARE_FAILED_CODEC = 2;
1264 HARDWARE_FAILED_SPEAKER = 3;
1265 HARDWARE_FAILED_FINGERPRINT = 4;
1266 }
1267 optional HardwareType hardware_type = 1;
1268
1269 /* hardware_location allows vendors to differentiate between multiple instances of
1270 * the same hardware_type. The specific locations are vendor defined integers,
1271 * referring to board-specific numbering schemes.
1272 */
1273 optional int32 hardware_location = 2;
1274
1275 /* failure_code is specific to the HardwareType of the failed hardware.
1276 * It should use the enum values defined below.
1277 */
1278 enum MicrophoneFailureCode {
1279 MICROPHONE_FAILURE_COMPLETE = 0;
1280 }
1281 enum CodecFailureCode {
1282 CODEC_FAILURE_COMPLETE = 0;
1283 }
1284 enum SpeakerFailureCode {
1285 SPEAKER_FAILURE_COMPLETE = 0;
1286 SPEAKER_FAILURE_HIGH_Z = 1;
1287 SPEAKER_FAILURE_SHORT = 2;
1288 }
1289 enum FingerprintFailureCode {
1290 FINGERPRINT_FAILURE_COMPLETE = 0;
1291 FINGERPRINT_SENSOR_BROKEN = 1;
1292 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1293 }
1294 optional int32 failure_code = 3;
1295}
1296
1297/**
1298 * Log an event when the device has been physically dropped.
1299 * Reported from the /vendor partition.
1300 */
1301message PhysicalDropDetected {
1302 // Confidence that the event was actually a drop, 0 -> 100
1303 optional int32 confidence_pctg = 1;
1304 // Peak acceleration of the drop, in 1/1000s of a g.
1305 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001306 // Duration of freefall in ms
1307 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001308}
1309
1310/**
1311 * Log bucketed battery charge cycles.
1312 *
1313 * Each bucket represents cycles of the battery past
1314 * a given charge point. For example, bucket 1 is the
1315 * lowest 1/8th of the battery, and bucket 8 is 100%.
1316 *
1317 * Logged from:
1318 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1319 */
1320message ChargeCyclesReported {
1321 optional int32 cycle_bucket_1 = 1;
1322 optional int32 cycle_bucket_2 = 2;
1323 optional int32 cycle_bucket_3 = 3;
1324 optional int32 cycle_bucket_4 = 4;
1325 optional int32 cycle_bucket_5 = 5;
1326 optional int32 cycle_bucket_6 = 6;
1327 optional int32 cycle_bucket_7 = 7;
1328 optional int32 cycle_bucket_8 = 8;
1329}
1330
1331/**
Howard Roa46b6582018-09-18 16:45:02 -07001332 * Log battery health snapshot.
1333 *
1334 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1335 * are snapshotted periodically over 24hrs.
1336 */
1337message BatteryHealthSnapshot {
1338 enum BatterySnapshotType {
1339 UNKNOWN = 0;
1340 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1341 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1342 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1343 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1344 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1345 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1346 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1347 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1348 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1349 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1350 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1351 }
1352 optional BatterySnapshotType type = 1;
1353 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001354 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001355 // Voltage Battery Voltage, in microVolts.
1356 optional int32 voltage_micro_volt = 3;
1357 // Current Battery current, in microAmps.
1358 optional int32 current_micro_amps = 4;
1359 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1360 optional int32 open_circuit_micro_volt = 5;
1361 // Resistance Battery Resistance, in microOhms.
1362 optional int32 resistance_micro_ohm = 6;
1363 // Level Battery Level, as % of full.
1364 optional int32 level_percent = 7;
1365}
1366
1367/**
1368 * Log slow I/O operations on the primary storage.
1369 */
1370message SlowIo {
1371 // Classifications of IO Operations.
1372 enum IoOperation {
1373 UNKNOWN = 0;
1374 READ = 1;
1375 WRITE = 2;
1376 UNMAP = 3;
1377 SYNC = 4;
1378 }
1379 optional IoOperation operation = 1;
1380
1381 // The number of slow IO operations of this type over 24 hours.
1382 optional int32 count = 2;
1383}
1384
1385/**
1386 * Log battery caused shutdown with the last recorded voltage.
1387 */
1388message BatteryCausedShutdown {
1389 // The last recorded battery voltage prior to shutdown.
1390 optional int32 last_recorded_micro_volt = 1;
1391}
1392
1393/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001394 * Logs the duration of a davey (jank of >=700ms) when it occurs
1395 *
1396 * Logged from:
1397 * frameworks/base/libs/hwui/JankTracker.cpp
1398 */
1399message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001400 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001401 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001402
Tej Singhbb8554a2018-01-26 11:59:14 -08001403 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001404 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001405}
1406
1407/**
Bookatze5885242017-10-24 20:10:31 -07001408 * Logs phone signal strength changes.
1409 *
1410 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001411 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001412 */
1413message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001414 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1415 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001416}
1417
Yangster4ccebea2018-10-09 17:09:02 -07001418
1419/**
1420 * Logs when the phone state, sim state or signal strength changes
1421 *
1422 * Logged from:
1423 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1424 */
1425message PhoneServiceStateChanged {
1426 optional android.telephony.ServiceStateEnum state = 1;
1427 optional android.telephony.SimStateEnum sim_state = 2;
1428 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1429}
1430
1431/**
1432 * Logs when the phone becomes on or off.
1433 *
1434 * Logged from:
1435 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1436 */
1437message PhoneStateChanged {
1438 enum State {
1439 OFF = 0;
1440 ON = 1;
1441 }
1442 optional State state = 1;
1443}
1444
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001445message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001446 optional android.stats.launcher.LauncherAction action = 1;
1447 optional android.stats.launcher.LauncherState src_state = 2;
1448 optional android.stats.launcher.LauncherState dst_state = 3;
1449 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001450 optional bool is_swipe_up_enabled = 5;
1451}
1452
David Chenc28b2bb2017-10-24 12:52:52 -07001453/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001454 * Logs when Settings UI has changed.
1455 *
1456 * Logged from:
1457 * packages/apps/Settings
1458 */
1459message SettingsUIChanged {
1460 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001461 * Where this SettingsUIChange event comes from. For example, if
1462 * it's a PAGE_VISIBLE event, where the page is opened from.
1463 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001464 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001465
1466 /**
1467 * What the UI action is.
1468 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001469 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001470
1471 /**
1472 * Where the action is happening
1473 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001474 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001475
1476 /**
1477 * What preference changed in this event.
1478 */
1479 optional string changedPreferenceKey = 4;
1480
1481 /**
1482 * The new value of the changed preference.
1483 */
1484 optional int64 changedPreferenceIntValue = 5;
1485}
1486
1487/**
David Chenc28b2bb2017-10-24 12:52:52 -07001488 * Logs that a setting was updated.
1489 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001490 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001491 * The tag and is_default allow resetting of settings to default values based on the specified
1492 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1493 */
1494message SettingChanged {
1495 // The name of the setting.
1496 optional string setting = 1;
1497
1498 // The change being imposed on this setting. May represent a number, eg "3".
1499 optional string value = 2;
1500
1501 // The new value of this setting. For most settings, this is same as value. For some settings,
1502 // value is +X or -X where X represents an element in a set. For example, if the previous value
1503 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1504 // The +/- feature is currently only used for location_providers_allowed.
1505 optional string new_value = 3;
1506
1507 // The previous value of this setting.
1508 optional string prev_value = 4;
1509
1510 // The tag used with the is_default for resetting sets of settings. This is generally null.
1511 optional string tag = 5;
1512
Bookatz90867622018-01-31 15:05:57 -08001513 // True if this setting with tag should be resettable.
1514 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001515
David Chenbd789912018-03-16 17:19:55 -07001516 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001517 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001518
1519 enum ChangeReason {
1520 UPDATED = 1; // Updated can be an insertion or an update.
1521 DELETED = 2;
1522 }
1523 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001524}
Chenjie Yub3dda412017-10-24 13:41:59 -07001525
Chenjie Yu05013b32017-11-21 10:21:41 -08001526/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001527 * Logs activity going to foreground or background
1528 *
1529 * Logged from:
1530 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1531 */
1532message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001533 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001534 optional string pkg_name = 2;
1535 optional string class_name = 3;
1536
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001537 enum State {
1538 BACKGROUND = 0;
1539 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001540 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001541 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001542}
David Chenc8a43242017-10-17 16:23:28 -07001543
1544/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001545 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001546 * Logged from:
1547 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1548 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001549message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001550 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001551
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001552 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001553
1554 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001555 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001556 optional string process_name = 3;
1557
1558 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001559 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001560
1561 optional string package_name = 5;
1562
1563 enum InstantApp {
1564 UNAVAILABLE = 0;
1565 FALSE = 1;
1566 TRUE = 2;
1567 }
1568 optional InstantApp is_instant_app = 6;
1569
1570 enum ForegroundState {
1571 UNKNOWN = 0;
1572 BACKGROUND = 1;
1573 FOREGROUND = 2;
1574 }
1575 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001576}
David Chen9e3808c2017-11-20 17:25:34 -08001577
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001578/**
1579 * Logs when a WTF (What a Terrible Failure) happened.
1580 * Logged from:
1581 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1582 */
1583message WTFOccurred {
1584 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001585
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001586 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001587
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001588 // The name of the process.
1589 // system_server if it is not by an app
1590 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001591
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001592 // The pid if available. -1 means not available.
1593 optional sint32 pid = 4;
1594}
1595
1596/**
1597 * Logs when system server reports low memory.
1598 * Logged from:
1599 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1600 */
1601message LowMemReported {
1602}
1603
1604/**
1605 * Logs when an app ANR (App Not Responding) occurs.
1606 * Logged from:
1607 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1608 */
1609message ANROccurred {
1610 optional int32 uid = 1 [(is_uid) = true];
1611
1612 optional string process_name = 2;
1613
1614 optional string short_component_name = 3;
1615
1616 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001617
1618 enum InstantApp {
1619 UNAVAILABLE = 0;
1620 FALSE = 1;
1621 TRUE = 2;
1622 }
1623 optional InstantApp is_instant_app = 5;
1624
1625 enum ForegroundState {
1626 UNKNOWN = 0;
1627 BACKGROUND = 1;
1628 FOREGROUND = 2;
1629 }
1630 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001631}
1632
Bookatza7020bd2018-08-28 16:29:35 -07001633/**
1634 * Logs when the vibrator state changes.
1635 * Logged from:
1636 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1637 */
1638message VibratorStateChanged {
1639 repeated AttributionNode attribution_node = 1;
1640
1641 enum State {
1642 OFF = 0;
1643 ON = 1;
1644 }
1645 optional State state = 2;
1646
1647 // Duration (in milliseconds) requested to keep the vibrator on.
1648 // Only applicable for State == ON.
1649 optional int64 duration_millis = 3;
1650}
1651
David Chen0a368b22017-12-06 16:28:16 -08001652/*
1653 * Allows other apps to push events into statsd.
1654 * Logged from:
1655 * frameworks/base/core/java/android/util/StatsLog.java
1656 */
David Chen0b5c90c2018-01-25 16:51:49 -08001657message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001658 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001659 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001660
1661 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1662 optional int32 label = 2;
1663
1664 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1665 // predicates for the metrics).
1666 enum State {
1667 UNKNOWN = 0;
1668 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1669 STOP = 2;
1670 START = 3;
1671 }
1672 optional State state = 3;
1673}
1674
David Chen9e3808c2017-11-20 17:25:34 -08001675/**
Bookatz7948c872018-09-04 12:58:33 -07001676 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1677 * For example, this could be due to the user manually changing the time.
1678 *
1679 * Logged from:
1680 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1681 */
1682message WallClockTimeShifted {
1683 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1684 optional int64 wall_clock_timestamp_millis = 1;
1685}
1686
1687/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001688 * Logs when statsd detects an anomaly.
1689 *
1690 * Logged from:
1691 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1692 */
1693message AnomalyDetected {
1694 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001695 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001696
Yangster-mac94e197c2018-01-02 16:03:03 -08001697 // Id of the config whose anomaly detection alert fired.
1698 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001699
Yangster-mac94e197c2018-01-02 16:03:03 -08001700 // Id of the alert (i.e. name of the anomaly that was detected).
1701 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001702}
1703
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001704message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001705 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001706 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001707
1708 // The app package name.
1709 optional string pkg_name = 2;
1710
1711 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001712 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001713 WARM = 1;
1714 HOT = 2;
1715 COLD = 3;
1716 }
1717 // The transition type.
1718 optional TransitionType type = 3;
1719
1720 // The activity name.
1721 optional string activity_name = 4;
1722
1723 // The name of the calling app. Empty if not set.
1724 optional string calling_pkg_name = 5;
1725
1726 // Whether the app is an instant app.
1727 optional bool is_instant_app = 6;
1728
1729 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001730 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001731
Bookatz80d11a02018-01-16 10:46:35 -08001732 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001733
David Chen0b5c90c2018-01-25 16:51:49 -08001734 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001735 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001736 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001737 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001738 optional int32 bind_application_delay_millis = 11;
1739 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001740
1741 // Empty if not set.
1742 optional string launch_token = 13;
1743
Calin Juravle759fbda2018-02-20 19:52:30 +00001744 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001745 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001746
1747 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001748 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001749}
1750
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001751message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001752 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001753 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001754
1755 // The app package name.
1756 optional string pkg_name = 2;
1757
1758 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001759 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001760 WARM = 1;
1761 HOT = 2;
1762 COLD = 3;
1763 }
1764 // The transition type.
1765 optional TransitionType type = 3;
1766
1767 // The activity name.
1768 optional string activity_name = 4;
1769}
1770
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001771message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001772 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001773 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001774
1775 // The app package name.
1776 optional string pkg_name = 2;
1777
1778 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001779 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001780 WITH_BUNDLE = 1;
1781 WITHOUT_BUNDLE = 2;
1782 }
1783 // The transition type.
1784 optional TransitionType type = 3;
1785
1786 // The activity name.
1787 optional string activity_name = 4;
1788
1789 optional bool transition_process_running = 5;
1790
1791 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001792 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001793}
1794
Bookatz8fcd09a2017-12-18 13:01:10 -08001795/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001796 * Logs a picture-in-picture action
1797 * Logged from:
1798 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1799 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1800 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1801 */
1802message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001803 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001804 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001805
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001806 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001807
Chenjie Yu52cacc62017-12-08 18:11:45 -08001808 enum State {
1809 ENTERED = 1;
1810 EXPANDED_TO_FULL_SCREEN = 2;
1811 MINIMIZED = 3;
1812 DISMISSED = 4;
1813 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001814 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001815}
1816
1817/**
Chenjie Yue8904192017-12-08 19:12:57 -08001818 * Logs overlay action
1819 * Logged from:
1820 * services/core/java/com/android/server/wm/Session.java
1821 */
1822message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001823 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001824
1825 optional string package_name = 2;
1826
1827 optional bool using_alert_window = 3;
1828
1829 enum State {
1830 ENTERED = 1;
1831 EXITED = 2;
1832 }
1833 optional State state = 4;
1834}
1835
Chenjie Yuccfe6452018-01-30 11:33:21 -08001836/*
1837 * Logs foreground service starts and stops.
1838 * Note that this is not when a service starts or stops, but when it is
1839 * considered foreground.
1840 * Logged from
1841 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1842 */
1843message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001844 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001845 // package_name + "/" + class_name
1846 optional string short_name = 2;
1847
1848 enum State {
1849 ENTER = 1;
1850 EXIT = 2;
1851 }
1852 optional State state = 3;
1853}
1854
Chenjie Yue8904192017-12-08 19:12:57 -08001855/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001856 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1857 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1858 * attributed back to the parent (host) uid. One example is Chrome.
1859 *
1860 * Logged from:
1861 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1862 */
1863message IsolatedUidChanged {
1864 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001865 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001866 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001867 optional int32 parent_uid = 1;
1868
1869 optional int32 isolated_uid = 2;
1870
1871 // We expect an isolated uid to be removed before if it's used for another parent uid.
1872 enum Event {
1873 REMOVED = 0;
1874 CREATED = 1;
1875 }
1876 optional Event event = 3;
1877}
1878
1879/*
1880 * Logs the reception of an incoming network packet causing the main system to wake up for
1881 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1882 * and processed by WakeupController.cpp.
1883 */
1884message PacketWakeupOccurred {
1885 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1886 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001887 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001888 // The interface name on which the packet was received.
1889 optional string iface = 2;
1890 // The ethertype value of the packet.
1891 optional int32 ethertype = 3;
1892 // String representation of the destination MAC address of the packet.
1893 optional string destination_hardware_address = 4;
1894 // String representation of the source address of the packet if this was an IP packet.
1895 optional string source_ip = 5;
1896 // String representation of the destination address of the packet if this was an IP packet.
1897 optional string destination_ip = 6;
1898 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1899 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1900 // families.
1901 optional int32 ip_next_header = 7;
1902 // The source port if this was a TCP or UDP packet.
1903 optional int32 source_port = 8;
1904 // The destination port if this was a TCP or UDP packet.
1905 optional int32 destination_port = 9;
1906}
1907
1908/*
1909 * Logs the memory stats for an app on startup.
1910 * Logged from:
1911 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1912 */
1913message AppStartMemoryStateCaptured {
1914 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001915 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001916
1917 // The process name.
1918 optional string process_name = 2;
1919
1920 // The activity name.
1921 optional string activity_name = 3;
1922
1923 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001924 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001925
1926 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001927 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001928
1929 // RSS
1930 optional int64 rss_in_bytes = 6;
1931
1932 // CACHE
1933 optional int64 cache_in_bytes = 7;
1934
1935 // SWAP
1936 optional int64 swap_in_bytes = 8;
1937}
1938
1939/*
1940 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1941 * for LMK event.
1942 * Logged from:
1943 * system/core/lmkd/lmkd.c
1944 */
1945message LmkStateChanged {
1946 enum State {
1947 UNKNOWN = 0;
1948 START = 1;
1949 STOP = 2;
1950 }
1951 optional State state = 1;
1952}
1953
1954/*
1955 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1956 * Logged from:
1957 * system/core/lmkd/lmkd.c
1958 */
1959message LmkKillOccurred {
1960 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001961 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001962
1963 // The process name.
1964 optional string process_name = 2;
1965
1966 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001967 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001968
1969 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001970 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001971
1972 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001973 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001974
1975 // RSS
1976 optional int64 rss_in_bytes = 6;
1977
1978 // CACHE
1979 optional int64 cache_in_bytes = 7;
1980
1981 // SWAP
1982 optional int64 swap_in_bytes = 8;
1983}
1984
Rajeev Kumar51b54602018-03-01 12:18:26 -08001985/*
1986 * Logs when the ActivityManagerService detects that an app died.
1987 *
1988 * Logged from:
1989 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1990 */
1991message AppDied {
1992 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07001993 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001994}
1995
Howard Ro21a039c2018-08-06 14:55:47 -07001996/**
1997 * An atom for generic metrics logging. Available from Android Q.
1998 */
1999message GenericAtom {
2000 // The uid of the application that sent this custom atom.
2001 optional int32 uid = 1 [(is_uid) = true];
2002
2003 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002004 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002005}
2006
Tej Singhd6d6d772018-09-05 17:41:25 -07002007/**
2008 * Logs when a fingerprint acquire event occurs.
2009 *
2010 * Logged from:
2011 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2012 */
2013message FingerprintAcquired {
2014 // The associated user. Eg: 0 for owners, 10+ for others.
2015 // Defined in android/os/UserHandle.java
2016 optional int32 user = 1;
2017 // If this acquire is for a crypto fingerprint.
2018 // e.g. Secure purchases, unlock password storage.
2019 optional bool is_crypto = 2;
2020}
2021
2022/**
2023 * Logs when a fingerprint authentication event occurs.
2024 *
2025 * Logged from:
2026 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2027 */
2028message FingerprintAuthenticated {
2029 // The associated user. Eg: 0 for owners, 10+ for others.
2030 // Defined in android/os/UserHandle.java
2031 optional int32 user = 1;
2032 // If this authentication is for a crypto fingerprint.
2033 // e.g. Secure purchases, unlock password storage.
2034 optional bool is_crypto = 2;
2035 // Whether or not this authentication was successful.
2036 optional bool is_authenticated = 3;
2037}
2038
2039/**
2040 * Logs when a fingerprint error occurs.
2041 *
2042 * Logged from:
2043 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2044 */
2045message FingerprintErrorOccurred {
2046 // The associated user. Eg: 0 for owners, 10+ for others.
2047 // Defined in android/os/UserHandle.java
2048 optional int32 user = 1;
2049 // If this error is for a crypto fingerprint.
2050 // e.g. Secure purchases, unlock password storage.
2051 optional bool is_crypto = 2;
2052
2053 enum Error {
2054 UNKNOWN = 0;
2055 LOCKOUT = 1;
2056 PERMANENT_LOCKOUT = 2;
2057 }
2058 // The type of error.
2059 optional Error error = 3;
2060}
Howard Ro688ae182018-09-25 00:09:36 -07002061
2062message Notification {
2063
2064 // Type of notification event.
2065 enum Type {
2066 TYPE_UNKNOWN = 0;
2067 // Notification became visible to the user.
2068 TYPE_OPEN = 1;
2069 // Notification became hidden.
2070 TYPE_CLOSE = 2;
2071 // Notification switched to detail mode.
2072 TYPE_DETAIL = 3;
2073 // Notification was clicked.
2074 TYPE_ACTION = 4;
2075 // Notification was dismissed.
2076 TYPE_DISMISS = 5;
2077 // Notification switched to summary mode. The enum value of 14 is to
2078 // match that of metrics_constants.
2079 TYPE_COLLAPSE = 14;
2080 }
2081 optional Type type = 1;
2082
2083 // Package name associated with the notification.
2084 optional string package_name = 2;
2085
2086 // Tag associated with notification.
2087 optional string tag = 3;
2088
2089 // Application-supplied ID associated with the notification.
2090 optional int32 id = 4;
2091
2092 // Index of notification in the notification panel.
2093 optional int32 shade_index = 5;
2094
2095 // The number of notifications in the notification panel.
2096 optional int32 shade_count = 6;
2097
2098 // Importance for the notification.
2099 optional int32 importance = 7;
2100
2101 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002102 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002103
2104 // Importance for the notification channel.
2105 optional int32 channel_importance = 9;
2106
Howard Ro183c2bd2018-10-18 13:52:10 -07002107 // Application-supplied ID associated with the notifications group.
2108 optional string group_id = 10;
2109
Howard Ro688ae182018-09-25 00:09:36 -07002110 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002111 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002112
Howard Ro183c2bd2018-10-18 13:52:10 -07002113 // Reason for dismissal of a notification. This field is only meaningful for
2114 // TYPE_DISMISS events.
2115 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002116
Howard Ro183c2bd2018-10-18 13:52:10 -07002117 // The first post time of notification, stable across updates.
2118 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002119
Howard Ro183c2bd2018-10-18 13:52:10 -07002120 // The most recent interruption time, or the creation time if no updates.
2121 // Differs from update_millis because updates are filtered based on whether
2122 // they actually interrupted the user.
2123 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002124
Howard Ro183c2bd2018-10-18 13:52:10 -07002125 // The most recent update time, or the creation time if no updates.
2126 optional int64 update_millis = 15;
2127
2128 // The most recent visibility event.
2129 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002130}
2131
2132
Chenjie Yubbcbc602018-02-05 16:51:52 -08002133//////////////////////////////////////////////////////////////////////
2134// Pulled atoms below this line //
2135//////////////////////////////////////////////////////////////////////
2136
2137/**
David Chenc8a43242017-10-17 16:23:28 -07002138 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2139 *
2140 * Pulled from:
2141 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2142 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002143message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002144 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002145
2146 optional int64 rx_bytes = 2;
2147
2148 optional int64 rx_packets = 3;
2149
2150 optional int64 tx_bytes = 4;
2151
2152 optional int64 tx_packets = 5;
2153}
2154
2155/**
2156 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2157 *
2158 * Pulled from:
2159 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2160 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002161message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002162 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002163
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002164 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2165 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002166
2167 optional int64 rx_bytes = 3;
2168
2169 optional int64 rx_packets = 4;
2170
2171 optional int64 tx_bytes = 5;
2172
2173 optional int64 tx_packets = 6;
2174}
2175
2176/**
2177 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2178 *
2179 * Pulled from:
2180 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2181 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002182message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002183 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002184
2185 optional int64 rx_bytes = 2;
2186
2187 optional int64 rx_packets = 3;
2188
2189 optional int64 tx_bytes = 4;
2190
2191 optional int64 tx_packets = 5;
2192}
2193
2194/**
2195 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2196 *
2197 * Pulled from:
2198 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2199 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002200message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002201 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002202
Yao Chenc40a19d2018-03-15 16:48:25 -07002203 // 1 denotes foreground and 0 denotes background. This is called Set in
2204 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002205 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002206
2207 optional int64 rx_bytes = 3;
2208
2209 optional int64 rx_packets = 4;
2210
2211 optional int64 tx_bytes = 5;
2212
2213 optional int64 tx_packets = 6;
2214}
2215
2216/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002217 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2218 *
2219 * Pulled from:
2220 * StatsCompanionService
2221 */
2222message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002223 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002224
2225 optional int64 rx_bytes = 2;
2226
2227 optional int64 tx_bytes = 3;
2228}
2229
2230/**
David Chenc8a43242017-10-17 16:23:28 -07002231 * Pulls the kernel wakelock durations. This atom is adapted from
2232 * android/internal/os/KernelWakelockStats.java
2233 *
2234 * Pulled from:
2235 * StatsCompanionService using KernelWakelockReader.
2236 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002237message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002238 optional string name = 1;
2239
2240 optional int32 count = 2;
2241
2242 optional int32 version = 3;
2243
Yangster-maca8a30442018-10-13 23:46:34 -07002244 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002245}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002246
Chenjie Yu05013b32017-11-21 10:21:41 -08002247/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002248 * Pulls low power state information. This includes platform and subsystem sleep state information,
2249 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002250 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002251 * hardware/interfaces/power/1.1/types.hal
2252 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002253message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002254 // Subsystem name
2255 optional string subsystem_name = 1;
2256 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2257 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2258 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002259 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002260 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002261 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002262 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002263}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002264
Chenjie Yu05013b32017-11-21 10:21:41 -08002265/**
Bookatz92da2832018-11-01 18:10:03 -07002266 * Pulls on-device power measurement information.
2267 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2268 * Pulled from:
2269 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2270 */
2271message OnDevicePowerMeasurement {
2272 // Name of the subsystem (to which the rail belongs).
2273 optional string subsystem_name = 1;
2274
2275 // Rail name. The rail lies within the subsystem.
2276 optional string rail_name = 2;
2277
2278 // Time (in ms since boot) at which the rail energy value was measured.
2279 // This may differ slightly from the time that statsd logs this information.
2280 optional uint64 measurement_timestamp_millis = 3;
2281
2282 // Accumulated energy used via the rail since device boot in uWs.
2283 optional uint64 energy_microwatt_secs = 4;
2284}
2285
2286/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002287 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002288 * Pulls the time the cpu spend on the frequency index. Frequency index
2289 * starts from highest to lowest. The value should be monotonically
2290 * increasing since boot. However, if there is a cpu
2291 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002292 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002293message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002294 optional uint32 cluster = 1;
2295 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002296 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002297}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002298
Chenjie Yu05013b32017-11-21 10:21:41 -08002299/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002300 * Pulls Cpu Time Per Uid.
2301 * Note that isolated process uid time should be attributed to host uids.
2302 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002303message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002304 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002305 optional uint64 user_time_millis = 2;
2306 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002307}
2308
2309/**
2310 * Pulls Cpu Time Per Uid per frequency.
2311 * Note that isolated process uid time should be attributed to host uids.
2312 * For each uid, we order the time by descending frequencies.
2313 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002314message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002315 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002316 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002317 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002318}
Hugo Benichi884970e2017-11-14 22:42:46 +09002319
Chenjie Yu05013b32017-11-21 10:21:41 -08002320/**
2321 * Pulls Wifi Controller Activity Energy Info
2322 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002323message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002324 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002325 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002326 // stack reported state
2327 // TODO: replace this with proto enum
2328 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002329 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002330 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002331 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002332 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002333 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002334 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002335 // product of current(mA), voltage(V) and time(ms)
2336 optional uint64 controller_energy_used = 6;
2337}
2338
2339/**
2340 * Pulls Modem Activity Energy Info
2341 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002342message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002343 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002344 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002345 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002346 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002347 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002348 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002349 /**
2350 * Tx power index
2351 * index 0 = tx_power < 0dBm
2352 * index 1 = 0dBm < tx_power < 5dBm
2353 * index 2 = 5dBm < tx_power < 15dBm
2354 * index 3 = 15dBm < tx_power < 20dBm
2355 * index 4 = tx_power > 20dBm
2356 */
2357 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002358 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002359 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002360 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002361 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002362 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002363 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002364 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002365 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002366 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002367 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002368 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002369 // product of current(mA), voltage(V) and time(ms)
2370 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002371}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002372
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002373/**
2374 * Pulls Bluetooth Activity Energy Info
2375 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2376 */
2377message BluetoothActivityInfo {
2378 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002379 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002380 // bluetooth stack state
2381 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002382 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002383 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002384 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002385 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002386 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002387 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002388 // product of current(mA), voltage(V) and time(ms)
2389 optional uint64 energy_used = 6;
2390}
2391
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002392/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002393 * Logs the memory stats for a process.
2394 */
2395message ProcessMemoryState {
2396 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002397 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002398
2399 // The process name.
2400 optional string process_name = 2;
2401
2402 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002403 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002404
2405 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002406 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002407
2408 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002409 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002410
Rajeev Kumar90235992018-01-29 11:06:48 -08002411 // RSS
2412 optional int64 rss_in_bytes = 6;
2413
2414 // CACHE
2415 optional int64 cache_in_bytes = 7;
2416
2417 // SWAP
2418 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002419
2420 // RSS high watermark.
2421 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2422 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2423 optional int64 rss_high_watermark_in_bytes = 9;
Rafal Slawik272a8162018-11-01 15:12:28 +00002424
2425 // Elapsed real time when the process started.
2426 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2427 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002428}
2429
2430/*
Rafal Slawik08621582018-10-15 14:53:07 +01002431 * Logs the memory stats for a native process (from procfs).
2432 */
2433message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002434 // The uid if available. -1 means not available.
2435 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002436
Rafal Slawikbf67d072018-10-23 11:07:54 +01002437 // The process name.
2438 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002439
Rafal Slawikbf67d072018-10-23 11:07:54 +01002440 // # of page-faults
2441 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002442
Rafal Slawikbf67d072018-10-23 11:07:54 +01002443 // # of major page-faults
2444 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002445
Rafal Slawikbf67d072018-10-23 11:07:54 +01002446 // RSS
2447 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002448
Rafal Slawikbf67d072018-10-23 11:07:54 +01002449 // RSS high watermark.
2450 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
2451 optional int64 rss_high_watermark_in_bytes = 6;
2452
2453 // Elapsed real time when the process started.
2454 // Value is read from /proc/PID/stat, field 22.
2455 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002456}
2457
2458/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002459 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002460 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002461message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002462 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002463}
2464
2465/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002466 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002467 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002468message SystemUptime {
2469 // Milliseconds since the system was booted.
2470 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2471 // for external input).
2472 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002473 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002474}
2475
2476/*
2477 * Reads from /proc/uid_concurrent_active_time which has the format:
2478 * active: X (X is # cores)
2479 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2480 * [uid1]: [time-0] [time-1] [time-2] ... ...
2481 * ...
2482 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2483 * The file contains a monotonically increasing count of time for a single boot.
2484 */
2485message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002486 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002487 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002488}
2489
2490/**
2491 * Reads from /proc/uid_concurrent_policy_time which has the format:
2492 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2493 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2494 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2495 * ...
2496 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2497 * The file contains a monotonically increasing count of time for a single boot.
2498 */
2499message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002500 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002501 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002502 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002503}
2504
2505/*
2506 * Pulls free disk space, for data, system partition and temporary directory.
2507 */
2508message DiskSpace {
2509 // available bytes in data partition
2510 optional uint64 data_available_bytes = 1;
2511 // available bytes in system partition
2512 optional uint64 system_available_bytes = 2;
2513 // available bytes in download cache or temp directories
2514 optional uint64 temp_available_bytes = 3;
2515}
Tej Singhbf972d92018-01-10 20:51:13 -08002516
2517/**
2518 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002519 * Pulled from:
2520 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002521 */
2522message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002523 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002524}
2525
2526/**
2527 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002528 * Pulled from:
2529 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002530 */
2531message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002532 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002533}
2534
2535/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002536 * Pulls battery voltage.
2537 * Pulled from:
2538 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2539 */
2540message BatteryVoltage {
2541 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002542 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002543}
2544
2545/**
Tej Singhd89137e2018-03-26 14:51:40 -07002546 * Pulls the temperature of various parts of the device.
2547 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002548 *
2549 * Pulled from:
2550 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2551 */
2552message Temperature {
2553 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2554 optional android.os.TemperatureTypeEnum sensor_location = 1;
2555
2556 // The name of the temperature source. Eg. CPU0
2557 optional string sensor_name = 2;
2558
Tej Singhd89137e2018-03-26 14:51:40 -07002559 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002560 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002561}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002562
2563/**
2564 * Pulls the statistics of calls to Binder.
2565 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002566 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2567 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002568 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002569 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002570 */
2571message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002572 // UID of the process responsible for the binder transaction. It will be set if the process
2573 // executing the binder transaction attribute the transaction to another uid using
2574 // Binder.setThreadWorkSource().
2575 //
2576 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002577 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002578 // UID of the process executing the binder transaction.
2579 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002580 // Fully qualified class name of the API call.
2581 //
2582 // This is a system server class name.
2583 //
2584 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2585 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2586 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2587 // commonly used APIs.
2588 optional string service_class_name = 2;
2589 // Method name of the API call. It can also be a transaction code if we cannot
2590 // resolve it to a name. See Binder#getTransactionName.
2591 //
2592 // This is a system server method name.
2593 optional string service_method_name = 3;
2594 // Total number of API calls.
2595 optional int64 call_count = 4;
2596 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2597 optional bool screen_interactive = 13;
2598 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2599 // call_count will be equal to recorded_call_count.
2600 //
2601 // If recorded_call_count is different than call_count, it means data collection has been
2602 // sampled. All the fields below will be sampled in this case.
2603 optional int64 recorded_call_count = 12;
2604 // Number of exceptions thrown by the API.
2605 optional int64 recorded_exception_count = 5;
2606 // Total latency of all API calls.
2607 // Average can be computed using total_latency_micros / recorded_call_count.
2608 optional int64 recorded_total_latency_micros = 6;
2609 // Maximum latency of one API call.
2610 optional int64 recorded_max_latency_micros = 7;
2611 // Total CPU usage of all API calls.
2612 // Average can be computed using total_cpu_micros / recorded_call_count.
2613 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2614 optional int64 recorded_total_cpu_micros = 8;
2615 // Maximum CPU usage of one API call.
2616 optional int64 recorded_max_cpu_micros = 9;
2617 // Maximum parcel reply size of one API call.
2618 optional int64 recorded_max_reply_size_bytes = 10;
2619 // Maximum parcel request size of one API call.
2620 optional int64 recorded_max_request_size_bytes = 11;
2621}
2622
2623/**
2624 * Pulls the statistics of exceptions during calls to Binder.
2625 *
2626 * Binder stats are cumulative from boot unless somebody reset the data using
2627 * > adb shell dumpsys binder_calls_stats --reset
2628 */
2629message BinderCallsExceptions {
2630 // Exception class name, e.g. java.lang.IllegalArgumentException.
2631 //
2632 // This is an exception class name thrown by the system server.
2633 optional string exception_class_name = 1;
2634 // Total number of exceptions.
2635 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002636}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002637
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002638/**
2639 * Pulls the statistics of message dispatching on HandlerThreads.
2640 *
2641 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2642 * config on the device.
2643 *
2644 * Next tag: 11
2645 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002646message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002647 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002648 optional int32 uid = 1 [(is_uid) = true];
2649
2650 // Fully qualified class name of the handler target class.
2651 //
2652 // This field does not contain PII. This is a system server class name.
2653 optional string handler_class_name = 2;
2654
2655 // The name of the thread that runs the Looper.
2656 //
2657 // This field does not contain PII. This is a system server thread name.
2658 optional string looper_thread_name = 3;
2659
2660 // The name of the dispatched message.
2661 //
2662 // This field does not contain PII. This is a system server constant or class
2663 // name.
2664 optional string message_name = 4;
2665
2666 // Total number of successfully dispatched messages.
2667 optional int64 message_count = 5;
2668
2669 // Total number of messages that failed dispatching.
2670 optional int64 exception_count = 6;
2671
2672 // Total number of processed messages we have data recorded for. If we
2673 // collected data for all the messages, message_count will be equal to
2674 // recorded_message_count.
2675 //
2676 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002677 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002678 optional int64 recorded_message_count = 7;
2679
2680 // Total latency of all processed messages.
2681 // Average can be computed using recorded_total_latency_micros /
2682 // recorded_message_count.
2683 optional int64 recorded_total_latency_micros = 8;
2684
2685 // Total CPU usage of all processed message.
2686 // Average can be computed using recorded_total_cpu_micros /
2687 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002688 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002689 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002690
2691 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2692 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002693
2694 // Max recorded CPU usage of all processed messages.
2695 optional int64 recorded_max_cpu_micros = 11;
2696
2697 // Max recorded latency of all processed messages.
2698 optional int64 recorded_max_latency_micros = 12;
2699
2700 // Total number of messages we tracked the dispatching delay for. If we
2701 // collected data for all the messages, message_count will be equal to
2702 // recorded_delay_message_count.
2703 //
2704 // If recorded_delay_message_count is different than message_count, it means data
2705 // collection has been sampled or/and not all messages specified the target dispatch time.
2706 // The fields below will be sampled in this case.
2707 optional int64 recorded_delay_message_count = 13;
2708
2709 // Total dispatching delay of all processed messages.
2710 // Calculated as a difference between the target dispatching time (Message.when)
2711 // and the actual dispatching time.
2712 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2713 optional int64 recorded_total_delay_millis = 14;
2714
2715 // Max dispatching delay of all processed messages.
2716 // Calculated as a difference between the target dispatching time (Message.when)
2717 // and the actual dispatching time.
2718 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002719}
Tej Singh86dc9db2018-09-06 00:39:57 +00002720
2721/**
2722 * Pulls disk information, such as write speed and latency.
2723 */
2724message DiskStats {
2725 // Time taken to open, write 512B to, and close a file.
2726 // -1 if error performing the check.
2727 optional int64 data_write_latency_millis = 1;
2728
2729 optional bool file_based_encryption = 2;
2730
2731 // Recent disk write speed in kB/s.
2732 // -1 if error querying storageed.
2733 // 0 if data is unavailable.
2734 optional int32 recent_disk_write_speed = 3;
2735}
2736
2737
2738/**
2739 * Free and total bytes of the Data, Cache, and System partition.
2740 */
2741message DirectoryUsage {
2742 enum Directory {
2743 UNKNOWN = 0;
2744 DATA = 1;
2745 CACHE = 2;
2746 SYSTEM = 3;
2747 }
2748 optional Directory directory = 1;
2749 optional int64 free_bytes = 2;
2750 optional int64 total_bytes = 3;
2751}
2752
2753
2754/**
2755 * Size of an application: apk size, data size, and cache size.
2756 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2757 * Information is only reported for apps with the primary user (user 0).
2758 * Sizes are aggregated by package name.
2759 */
2760message AppSize {
2761 // Including uids will involve modifying diskstats logic.
2762 optional string package_name = 1;
2763 // App size in bytes. -1 if unavailable.
2764 optional int64 app_size_bytes = 2;
2765 // App data size in bytes. -1 if unavailable.
2766 optional int64 app_data_size_bytes = 3;
2767 // App cache size in bytes. -1 if unavailable.
2768 optional int64 app_cache_size_bytes = 4;
2769 // Time that the cache file was produced.
2770 // Uses System.currentTimeMillis(), which is wall clock time.
2771 optional int64 cache_time_millis = 5;
2772}
2773
2774
2775/**
2776 * Size of a particular category. Eg: photos, videos.
2777 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2778 */
2779message CategorySize {
2780 enum Category {
2781 UNKNOWN = 0;
2782 APP_SIZE = 1;
2783 APP_DATA_SIZE = 2;
2784 APP_CACHE_SIZE = 3;
2785 PHOTOS = 4;
2786 VIDEOS = 5;
2787 AUDIO = 6;
2788 DOWNLOADS = 7;
2789 SYSTEM = 8;
2790 OTHER = 9;
2791 }
2792 optional Category category = 1;
2793 // Category size in bytes.
2794 optional int64 size_bytes = 2;
2795 // Time that the cache file was produced.
2796 // Uses System.currentTimeMillis(), which is wall clock time.
2797 optional int64 cache_time_millis = 3;
2798}
Tej Singhd6d6d772018-09-05 17:41:25 -07002799
2800/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002801 * Pulls per uid I/O stats. The stats are cumulative since boot.
2802 *
2803 * Read/write bytes are I/O events from a storage device
2804 * Read/write chars are data requested by read/write syscalls, and can be
2805 * satisfied by caching.
2806 *
2807 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2808 */
2809message DiskIo {
2810 optional int32 uid = 1 [(is_uid) = true];
2811 optional int64 fg_chars_read = 2;
2812 optional int64 fg_chars_write = 3;
2813 optional int64 fg_bytes_read = 4;
2814 optional int64 fg_bytes_write = 5;
2815 optional int64 bg_chars_read = 6;
2816 optional int64 bg_chars_write = 7;
2817 optional int64 bg_bytes_read = 8;
2818 optional int64 bg_bytes_write = 9;
2819 optional int64 fg_fsync = 10;
2820 optional int64 bg_fsync= 11;
2821}
2822
2823
2824/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002825 * Pulls the number of fingerprints for each user.
2826 *
2827 * Pulled from StatsCompanionService, which queries FingerprintManager.
2828 */
2829message NumFingerprints {
2830 // The associated user. Eg: 0 for owners, 10+ for others.
2831 // Defined in android/os/UserHandle.java
2832 optional int32 user = 1;
2833 // Number of fingerprints registered to that user.
2834 optional int32 num_fingerprints = 2;
2835}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002836
Yangsteraf9aee72018-10-12 09:26:16 -07002837message AggStats {
2838 optional int64 min = 1;
2839
2840 optional int64 average = 2;
2841
2842 optional int64 max = 3;
2843}
2844
2845message ProcessStatsStateProto {
2846 optional android.service.procstats.ScreenState screen_state = 1;
2847
2848 optional android.service.procstats.MemoryState memory_state = 2;
2849
2850 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2851 // and not frameworks/base/core/java/android/app/ActivityManager.java
2852 optional android.service.procstats.ProcessState process_state = 3;
2853
2854 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002855 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002856
2857 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002858 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002859
2860 // # of samples taken
2861 optional int32 sample_size = 5;
2862
2863 // PSS is memory reserved for this process
2864 optional AggStats pss = 6;
2865
2866 // USS is memory shared between processes, divided evenly for accounting
2867 optional AggStats uss = 7;
2868
2869 // RSS is memory resident for this process
2870 optional AggStats rss = 8;
2871}
2872
2873// Next Tag: 7
2874message ProcessStatsProto {
2875 // Name of process.
2876 optional string process = 1;
2877
2878 // Uid of the process.
2879 optional int32 uid = 2;
2880
2881 // Information about how often kills occurred
2882 message Kill {
2883 // Count of excessive CPU kills
2884 optional int32 cpu = 1;
2885
2886 // Count of kills when cached
2887 optional int32 cached = 2;
2888
2889 // PSS stats during cached kill
2890 optional AggStats cached_pss = 3;
2891 }
2892 optional Kill kill = 3;
2893
2894 // Time and memory spent in various states.
2895 repeated ProcessStatsStateProto states = 5;
2896
2897 // Total time process has been running... screen_state, memory_state, and process_state
2898 // will not be set.
2899 optional ProcessStatsStateProto total_running_state = 6;
2900}
2901
2902message PackageServiceOperationStatsProto {
2903 // Operate enum: Started, Foreground, Bound, Executing
2904 optional android.service.procstats.ServiceOperationState operation = 1;
2905
2906 // Number of times the service was in this operation.
2907 optional int32 count = 2;
2908
2909 // Information about a state the service can be in.
2910 message StateStats {
2911 // Screen state enum.
2912 optional android.service.procstats.ScreenState screen_state = 1;
2913 // Memory state enum.
2914 optional android.service.procstats.MemoryState memory_state = 2;
2915
2916 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07002917 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002918 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002919 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002920 }
2921 repeated StateStats state_stats = 3;
2922}
2923
2924message PackageServiceStatsProto {
2925 // Name of service component.
2926 optional string service_name = 1;
2927
2928 // The operation stats.
2929 // The package_name, package_uid, package_version, service_name will not be set to save space.
2930 repeated PackageServiceOperationStatsProto operation_stats = 2;
2931}
2932
2933message PackageAssociationSourceProcessStatsProto {
2934 // Uid of the process.
2935 optional int32 process_uid = 1;
2936 // Process name.
2937 optional string process_name = 2;
2938
2939 // Total count of the times this association appeared.
2940 optional int32 total_count = 3;
2941
2942 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07002943 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002944
2945 // Total count of the times this association became actively impacting its target process.
2946 optional int32 active_count = 5;
2947
2948 // Information on one source in this association.
2949 message StateStats {
2950 // Process state enum.
2951 optional android.service.procstats.ProcessState process_state = 1;
2952 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002953 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07002954 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002955 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002956 }
2957 repeated StateStats active_state_stats = 6;
2958}
2959
2960message PackageAssociationProcessStatsProto {
2961 // Name of the target component.
2962 optional string component_name = 1;
2963 // Information on one source in this association.
2964 repeated PackageAssociationSourceProcessStatsProto sources = 2;
2965}
2966
2967
2968message ProcessStatsPackageProto {
2969 // Name of package.
2970 optional string package = 1;
2971
2972 // Uid of the package.
2973 optional int32 uid = 2;
2974
2975 // Version of the package.
2976 optional int64 version = 3;
2977
2978 // Stats for each process running with the package loaded in to it.
2979 repeated ProcessStatsProto process_stats = 4;
2980
2981 // Stats for each of the package's services.
2982 repeated PackageServiceStatsProto service_stats = 5;
2983
2984 // Stats for each association with the package.
2985 repeated PackageAssociationProcessStatsProto association_stats = 6;
2986}
2987
2988message ProcessStatsSectionProto {
2989 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002990 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07002991
2992 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002993 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07002994
2995 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002996 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002997
2998 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002999 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003000
3001 // System runtime library. e.g. "libdvm.so", "libart.so".
3002 optional string runtime = 5;
3003
3004 // whether kernel reports swapped pss.
3005 optional bool has_swapped_pss = 6;
3006
3007 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3008 enum Status {
3009 STATUS_UNKNOWN = 0;
3010 STATUS_COMPLETE = 1;
3011 STATUS_PARTIAL = 2;
3012 STATUS_SHUTDOWN = 3;
3013 STATUS_SYSPROPS = 4;
3014 }
3015 repeated Status status = 7;
3016
3017 // Stats for each process.
3018 repeated ProcessStatsProto process_stats = 8;
3019
3020 // Stats for each package.
3021 repeated ProcessStatsPackageProto package_stats = 9;
3022}
3023
Chenjie Yu12e5e672018-09-14 15:54:59 -07003024/**
3025 * Pulled from ProcessStatsService.java
3026 */
3027message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003028 optional ProcessStatsSectionProto proc_stats_section = 1;
3029}
3030
3031message PowerProfileProto {
3032 optional double cpu_suspend = 1;
3033
3034 optional double cpu_idle = 2;
3035
3036 optional double cpu_active = 3;
3037
3038 message CpuCluster {
3039 optional int32 id = 1;
3040 optional double cluster_power = 2;
3041 optional int32 cores = 3;
3042 repeated int64 speed = 4;
3043 repeated double core_power = 5;
3044 }
3045
3046 repeated CpuCluster cpu_cluster = 40;
3047
3048 optional double wifi_scan = 4;
3049
3050 optional double wifi_on = 5;
3051
3052 optional double wifi_active = 6;
3053
3054 optional double wifi_controller_idle = 7;
3055
3056 optional double wifi_controller_rx = 8;
3057
3058 optional double wifi_controller_tx = 9;
3059
3060 repeated double wifi_controller_tx_levels = 10;
3061
3062 optional double wifi_controller_operating_voltage = 11;
3063
3064 optional double bluetooth_controller_idle = 12;
3065
3066 optional double bluetooth_controller_rx = 13;
3067
3068 optional double bluetooth_controller_tx = 14;
3069
3070 optional double bluetooth_controller_operating_voltage = 15;
3071
3072 optional double modem_controller_sleep = 16;
3073
3074 optional double modem_controller_idle = 17;
3075
3076 optional double modem_controller_rx = 18;
3077
3078 repeated double modem_controller_tx = 19;
3079
3080 optional double modem_controller_operating_voltage = 20;
3081
3082 optional double gps_on = 21;
3083
3084 repeated double gps_signal_quality_based = 22;
3085
3086 optional double gps_operating_voltage = 23;
3087
3088 optional double bluetooth_on = 24;
3089
3090 optional double bluetooth_active = 25;
3091
3092 optional double bluetooth_at_cmd = 26;
3093
3094 optional double ambient_display = 27;
3095
3096 optional double screen_on = 28;
3097
3098 optional double radio_on = 29;
3099
3100 optional double radio_scanning = 30;
3101
3102 optional double radio_active = 31;
3103
3104 optional double screen_full = 32;
3105
3106 optional double audio = 33;
3107
3108 optional double video = 34;
3109
3110 optional double flashlight = 35;
3111
3112 optional double memory = 36;
3113
3114 optional double camera = 37;
3115
3116 optional double wifi_batched_scan = 38;
3117
3118 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003119}
Chenjie Yuab530202018-09-26 12:39:20 -07003120
3121/**
3122 * power_profile.xml and other constants for power model calculations.
3123 * Pulled from PowerProfile.java
3124 */
3125message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003126 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003127}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003128
3129/**
arangelovd5db50e2018-10-12 20:24:39 +01003130 * Logs when a user restriction was added or removed.
3131 *
3132 * Logged from:
3133 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3134 */
3135message UserRestrictionChanged {
3136 // The raw string of the user restriction as defined in UserManager.
3137 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3138 optional string restriction = 1;
3139 // Whether the restriction is enabled or disabled.
3140 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003141}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003142
3143/**
3144 * Pulls process user time and system time. Puller takes a snapshot of all pids
3145 * in the system and returns cpu stats for those that are working at the time.
3146 * Dead pids will be dropped. Kernel processes are excluded.
3147 * Min cool-down is 5 sec.
3148 */
3149message ProcessCpuTime {
3150 optional int32 uid = 1 [(is_uid) = true];
3151
3152 optional string process_name = 2;
3153 // Process cpu time in user space, cumulative from boot/process start
3154 optional int64 user_time_millis = 3;
3155 // Process cpu time in system space, cumulative from boot/process start
3156 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003157}
Misha Wagner5a51e002018-10-03 15:04:09 +01003158
3159/**
3160 * Pulls the CPU usage for each thread.
3161 *
3162 * Read from /proc/$PID/task/$TID/time_in_state files.
3163 *
3164 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3165 * time_in_state files not being present on some phones, have not been addressed. These should be
3166 * considered before a public release.
3167 */
3168message CpuTimePerThreadFreq {
3169 // UID that owns the process.
3170 optional int32 uid = 1 [(is_uid) = true];
3171 // ID of the process.
3172 optional uint32 process_id = 2;
3173 // ID of the thread.
3174 optional uint32 thread_id = 3;
3175 // Name of the process taken from `/proc/$PID/cmdline`.
3176 optional string process_name = 4;
3177 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3178 optional string thread_name = 5;
3179 // What frequency the CPU was running at, in KHz
3180 optional uint32 frequency_khz = 6;
3181 // Time spent in frequency in milliseconds, since thread start.
3182 optional uint32 time_millis = 7;
3183}