blob: dca47f77aa4b541e221780184a3bee0d33ae35da [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;
Chenjie Yuae9dfac2018-10-25 16:06:56 -0700150 ConnectivityStateChanged connectivity_state_changed = 98;
Chenjie Yu75b3c492018-10-06 21:45:19 -0700151 // TODO: service state change is very noisy shortly after boot, as well
152 // as at other transitions - coming out of doze, device plugged in, etc.
153 // Consider removing this if it becomes a problem
154 ServiceStateChanged service_state_changed = 99;
155 ServiceLaunchReported service_launch_reported = 100;
Yao Chend54f9dd2017-10-17 17:37:48 +0000156 }
David Chenc8a43242017-10-17 16:23:28 -0700157
David Chen6e3e6cb2018-01-03 16:14:06 -0800158 // Pulled events will start at field 10000.
Misha Wagner5a51e002018-10-03 15:04:09 +0100159 // Next: 10038
David Chenc8a43242017-10-17 16:23:28 -0700160 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800161 WifiBytesTransfer wifi_bytes_transfer = 10000;
162 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
163 MobileBytesTransfer mobile_bytes_transfer = 10002;
164 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800165 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800166 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800167 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800168 CpuTimePerFreq cpu_time_per_freq = 10008;
169 CpuTimePerUid cpu_time_per_uid = 10009;
170 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800171 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800172 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800173 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800174 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800175 SystemElapsedRealtime system_elapsed_realtime = 10014;
176 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800177 CpuActiveTime cpu_active_time = 10016;
178 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000179 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800180 RemainingBatteryCapacity remaining_battery_capacity = 10019;
181 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800182 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100183 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100184 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100185 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000186 DiskStats disk_stats = 10025;
187 DirectoryUsage directory_usage = 10026;
188 AppSize app_size = 10027;
189 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700190 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700191 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700192 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700193 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700194 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700195 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700196 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100197 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100198 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
Bookatz92da2832018-11-01 18:10:03 -0700199 OnDevicePowerMeasurement on_device_power_measurement = 10038;
David Chenc8a43242017-10-17 16:23:28 -0700200 }
yroa1fe77c2018-02-26 14:22:54 -0800201
Bookatz76aafcf2018-09-17 16:17:10 -0700202 // DO NOT USE field numbers above 100,000 in AOSP.
203 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
204 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700205}
206
Yao Chend54f9dd2017-10-17 17:37:48 +0000207/**
Yangster-mac20877162017-12-22 17:19:39 -0800208 * This proto represents a node of an attribution chain.
209 * Note: All attribution chains are represented as a repeated field of type
210 * AttributionNode. It is understood that in such arrays, the order is that
211 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000212 */
Yangster-mac20877162017-12-22 17:19:39 -0800213message AttributionNode {
214 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800215 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800216
Yangster-mac20877162017-12-22 17:19:39 -0800217 // The (optional) string tag for an element in the attribution chain. If the
218 // element has no tag, it is encoded as an empty string.
219 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700220}
221
Yangster-mac48b3d622018-08-18 12:38:11 -0700222message KeyValuePair {
223 optional int32 key = 1;
224 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700225 int32 value_int = 2;
226 int64 value_long = 3;
227 string value_str = 4;
228 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700229 }
230}
231
232message KeyValuePairsAtom {
233 optional int32 uid = 1;
234 repeated KeyValuePair pairs = 2;
235}
236
Yao Chend54f9dd2017-10-17 17:37:48 +0000237/*
238 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800239 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000240 *
241 * RULES:
242 * - The field ids for each atom must start at 1, and count upwards by 1.
243 * Skipping field ids is not allowed.
244 * - These form an API, so renaming, renumbering or removing fields is
245 * not allowed between android releases. (This is not currently enforced,
246 * but there will be a tool to enforce this restriction).
247 * - The types must be built-in protocol buffer types, namely, no sub-messages
248 * are allowed (yet). The bytes type is also not allowed.
249 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800250 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000251 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800252 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000253 * - A field that is a uid should be a string field, tagged with the [xxx]
254 * annotation. The generated code on android will be represented by UIDs,
255 * and those UIDs will be translated in xxx to those strings.
256 *
257 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700258 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000259 * - If there is a UID, it goes first. Think in an object-oriented fashion.
260 * *****************************************************************************
261 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700262
Yao Chend54f9dd2017-10-17 17:37:48 +0000263/**
Yangster-mace16189a2018-08-26 12:20:16 -0700264 * Logs when the Thermal service HAL notifies the throttling start/stop events.
265 *
266 * Logged from:
267 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
268 */
269message ThermalThrottlingStateChanged {
270 optional android.os.TemperatureTypeEnum sensor_type = 1;
271
272 enum State {
273 UNKNOWN = 0;
274 START = 1;
275 STOP = 2;
276 }
277
278 optional State state = 2;
279
280 optional float temperature = 3;
281}
282
283/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000284 * Logs when the screen state changes.
285 *
286 * Logged from:
287 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
288 */
289message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800290 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700291 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700292}
Yao Chend54f9dd2017-10-17 17:37:48 +0000293
294/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700295 * Logs that the process state of the uid, as determined by ActivityManager
296 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000297 *
298 * Logged from:
299 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
300 */
Bookatzc1a050a2017-10-10 15:49:28 -0700301message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700302 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000303
Bookatzdb026a22018-01-10 19:01:56 -0800304 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700305 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000306}
307
308/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700309 * Logs process state change of a process, as per the activity manager.
310 *
311 * Logged from:
312 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
313 */
314message ProcessStateChanged {
315 optional int32 uid = 1;
316 optional string process_name = 2;
317 optional string package_name = 3;
318 // TODO: remove this when validation is done
319 optional int64 version = 5;
320 // The state, from frameworks/base/core/proto/android/app/enums.proto.
321 optional android.app.ProcessStateEnum state = 4;
322}
323
324/**
325 * Logs when ActivityManagerService sleep state is changed.
326 *
327 * Logged from:
328 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
329 */
330message ActivityManagerSleepStateChanged {
331 // TODO: import frameworks proto
332 enum State {
333 UNKNOWN = 0;
334 ASLEEP = 1;
335 AWAKE = 2;
336 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700337 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700338}
339
340/**
341 * Logs when system memory state changes.
342 *
343 * Logged from:
344 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
345 */
346message MemoryFactorStateChanged {
347 // TODO: import frameworks proto
348 enum State {
349 MEMORY_UNKNOWN = 0;
350 NORMAL = 1; // normal.
351 MODERATE = 2; // moderate memory pressure.
352 LOW = 3; // low memory.
353 CRITICAL = 4; // critical memory.
354
355 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700356 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700357}
358
359/**
360 * Logs when app is using too much cpu, according to ActivityManagerService.
361 *
362 * Logged from:
363 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
364 */
365message ExcessiveCpuUsageReported {
366 optional int32 uid = 1;
367 optional string process_name = 2;
368 optional string package_name = 3;
369 // package version. TODO: remove this when validation is done
370 optional int64 version = 4;
371}
372
373/**
374 * Logs when a cached process is killed, along with its pss.
375 *
376 * Logged from:
377 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
378 */
379message CachedKillReported {
380 optional int32 uid = 1;
381 optional string process_name = 2;
382 optional string package_name = 3;
383 // TODO: remove this when validation is done
384 optional int64 version = 5;
385 optional int64 pss = 4;
386}
387
388/**
389 * Logs when memory stats of a process is reported.
390 *
391 * Logged from:
392 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
393 */
394message ProcessMemoryStatReported {
395 optional int32 uid = 1;
396 optional string process_name = 2;
397 optional string package_name = 3;
398 //TODO: remove this when validation is done
399 optional int64 version = 9;
400 optional int64 pss = 4;
401 optional int64 uss = 5;
402 optional int64 rss = 6;
403 enum Type {
404 ADD_PSS_INTERNAL_SINGLE = 0;
405 ADD_PSS_INTERNAL_ALL_MEM = 1;
406 ADD_PSS_INTERNAL_ALL_POLL = 2;
407 ADD_PSS_EXTERNAL = 3;
408 ADD_PSS_EXTERNAL_SLOW = 4;
409 }
410 optional Type type = 7;
411 optional int64 duration = 8;
412}
413
414/**
Bookatzc1a050a2017-10-10 15:49:28 -0700415 * Logs that a process started, finished, crashed, or ANRed.
416 *
417 * Logged from:
418 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
419 */
420message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700421 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700422
David Chen0b5c90c2018-01-25 16:51:49 -0800423 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800424 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700425
Bookatzddccf0a2017-11-28 16:48:14 -0800426 // What lifecycle state the process changed to.
427 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800428 enum State {
429 FINISHED = 0;
430 STARTED = 1;
431 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800432 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800433 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700434}
435
Bookatzc1a050a2017-10-10 15:49:28 -0700436/**
437 * Logs when the ble scan state changes.
438 *
439 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700440 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700441 */
442message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800443 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700444
445 enum State {
446 OFF = 0;
447 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700448 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
449 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700450 }
451 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700452
Bookatze5ec0b42018-03-26 13:34:56 -0700453 // Does the scan have a filter.
454 optional bool is_filtered = 3;
455 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
456 optional bool is_first_match = 4;
457 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
458 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700459}
460
461/**
462 * Logs reporting of a ble scan finding results.
463 *
464 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700465 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700466 */
Bookatzae6738e2018-09-13 11:38:56 -0700467// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700468message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800469 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700470
471 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800472 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700473}
474
475/**
476 * Logs when a sensor state changes.
477 *
478 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700479 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700480 */
481message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800482 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700483
Bookatzc1a050a2017-10-10 15:49:28 -0700484 // The id (int) of the sensor.
485 optional int32 sensor_id = 2;
486
487 enum State {
488 OFF = 0;
489 ON = 1;
490 }
491 optional State state = 3;
492}
493
494
495/**
496 * Logs when GPS state changes.
497 *
498 * Logged from:
499 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
500 */
501message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800502 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700503
504 enum State {
505 OFF = 0;
506 ON = 1;
507 }
508 optional State state = 2;
509}
510
511
512/**
513 * Logs when a sync manager sync state changes.
514 *
515 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700516 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700517 */
518message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800519 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700520
David Chen0b5c90c2018-01-25 16:51:49 -0800521 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800522 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700523
524 enum State {
525 OFF = 0;
526 ON = 1;
527 }
528 optional State state = 3;
529}
530
Yangster-mac96353002018-09-05 11:18:55 -0700531/*
532 * Deferred job stats.
533 *
534 * Logged from:
535 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
536*/
537message DeferredJobStatsReported {
538 repeated AttributionNode attribution_node = 1;
539
540 // Number of jobs deferred.
541 optional int32 num_jobs_deferred = 2;
542
543 // Time since the last job runs.
544 optional int64 time_since_last_job_millis = 3;
545}
546
Bookatzc1a050a2017-10-10 15:49:28 -0700547/**
548 * Logs when a job scheduler job state changes.
549 *
550 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700551 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700552 */
553message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800554 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700555
556 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800557 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700558
559 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800560 FINISHED = 0;
561 STARTED = 1;
562 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700563 }
564 optional State state = 3;
565
Tej Singh33a412b2018-03-16 18:43:59 -0700566 // The reason a job has stopped.
567 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700568 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700569 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700570}
571
572/**
573 * Logs when the audio state changes.
574 *
575 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700576 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700577 */
578message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800579 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700580
581 enum State {
582 OFF = 0;
583 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700584 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
585 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700586 }
587 optional State state = 2;
588}
589
590/**
591 * Logs when the video codec state changes.
592 *
593 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700594 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700595 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800596message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800597 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700598
599 enum State {
600 OFF = 0;
601 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700602 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
603 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700604 }
605 optional State state = 2;
606}
607
608/**
609 * Logs when the flashlight state changes.
610 *
611 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700612 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700613 */
614message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800615 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700616
617 enum State {
618 OFF = 0;
619 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700620 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
621 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700622 }
623 optional State state = 2;
624}
625
626/**
627 * Logs when the camera state changes.
628 *
629 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700630 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700631 */
632message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800633 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700634
635 enum State {
636 OFF = 0;
637 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700638 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
639 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700640 }
641 optional State state = 2;
642}
643
644/**
645 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000646 *
647 * Logged from:
648 * TODO
649 */
Bookatzd6746242017-10-24 18:39:35 -0700650message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800651 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000652
Bookatz1a1b0462018-01-12 11:47:03 -0800653 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
654 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700655 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700656
657 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
658 optional string tag = 3;
659
660 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800661 RELEASE = 0;
662 ACQUIRE = 1;
663 CHANGE_RELEASE = 2;
664 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700665 }
666 optional State state = 4;
667}
668
669/**
Bookatzc1a050a2017-10-10 15:49:28 -0700670 * Logs when a partial wakelock is considered 'long' (over 1 min).
671 *
672 * Logged from:
673 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
674 */
675message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800676 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700677
Yao Chend54f9dd2017-10-17 17:37:48 +0000678 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
679 optional string tag = 2;
680
Bookatzc1a050a2017-10-10 15:49:28 -0700681 // TODO: I have no idea what this is.
682 optional string history_tag = 3;
683
684 enum State {
685 OFF = 0;
686 ON = 1;
687 }
688 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000689}
690
Bookatzc1a050a2017-10-10 15:49:28 -0700691/**
Bookatza66083f2018-09-20 17:24:00 -0700692 * Logs when the device is interactive, according to the PowerManager Notifier.
693 *
694 * Logged from:
695 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
696 */
697message InteractiveStateChanged {
698 enum State {
699 OFF = 0;
700 ON = 1;
701 }
702 optional State state = 1;
703}
704
705/**
Bookatzc1a050a2017-10-10 15:49:28 -0700706 * Logs Battery Saver state change.
707 *
708 * Logged from:
709 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
710 */
711message BatterySaverModeStateChanged {
712 enum State {
713 OFF = 0;
714 ON = 1;
715 }
716 optional State state = 1;
717}
718
719/**
720 * Logs Doze mode state change.
721 *
722 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800723 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700724 */
725message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800726 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800727}
728
729
730/**
731 * Logs state change of Doze mode including maintenance windows.
732 *
733 * Logged from:
734 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
735 */
736message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800737 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700738}
739
740/**
741 * Logs screen brightness level.
742 *
743 * Logged from:
744 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
745 */
746message ScreenBrightnessChanged {
747 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
748 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700749}
750
751/**
752 * Logs battery level (percent full, from 0 to 100).
753 *
754 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700755 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700756 */
757message BatteryLevelChanged {
758 // Battery level. Should be in [0, 100].
759 optional int32 battery_level = 1;
760}
761
762/**
763 * Logs change in charging status of the device.
764 *
765 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700766 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700767 */
768message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800769 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
770 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700771}
772
773/**
774 * Logs whether the device is plugged in, and what power source it is using.
775 *
776 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700777 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700778 */
779message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800780 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
781 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700782}
783
Bookatz8c6571b2017-10-24 15:04:41 -0700784/**
785 * Logs when an app's wakeup alarm fires.
786 *
787 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700788 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700789 */
790message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800791 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800792
793 // Name of the wakeup alarm.
794 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700795
796 // Name of source package (for historical reasons, since BatteryStats tracked it).
797 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800798}
799
800/**
801 * Logs when an an app causes the mobile radio to change state.
802 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
803 *
804 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700805 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800806 */
807message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800808 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800809
Bookatz1a1b0462018-01-12 11:47:03 -0800810 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
811 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800812}
813
814/**
815 * Logs when an an app causes the wifi radio to change state.
816 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
817 *
818 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700819 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800820 */
821message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800822 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800823
Bookatz1a1b0462018-01-12 11:47:03 -0800824 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
825 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700826}
827
828/**
829 * Logs kernel wakeup reasons and aborts.
830 *
831 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700832 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700833 */
834message KernelWakeupReported {
835 // Name of the kernel wakeup reason (or abort).
836 optional string wakeup_reason_name = 1;
837
838 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800839 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700840}
841
842/**
843 * Logs wifi locks held by an app.
844 *
845 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700846 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700847 */
848message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800849 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700850
851 enum State {
852 OFF = 0;
853 ON = 1;
854 }
855 optional State state = 2;
856}
857
858/**
859 * Logs wifi signal strength changes.
860 *
861 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700862 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700863 */
864message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800865 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
866 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700867}
868
869/**
870 * Logs wifi scans performed by an app.
871 *
872 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700873 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700874 */
875message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800876 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700877
878 enum State {
879 OFF = 0;
880 ON = 1;
881 }
882 optional State state = 2;
883}
884
885/**
Tej Singh4503e102018-01-04 14:35:01 -0800886 * Logs wifi multicast locks held by an app
887 *
888 * Logged from:
889 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
890 */
891message WifiMulticastLockStateChanged {
892 repeated AttributionNode attribution_node = 1;
893
894 enum State {
895 OFF = 0;
896 ON = 1;
897 }
898 optional State state = 2;
899}
900
901/**
Tej Singh1ea42892018-01-19 09:27:00 -0800902 * Logs shutdown reason and duration on next boot.
903 *
904 * Logged from:
905 * frameworks/base/core/java/com/android/server/BootReceiver.java
906 */
907message ShutdownSequenceReported {
908 // True if shutdown is for a reboot. Default: false if we do not know.
909 optional bool reboot = 1;
910
911 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
912 optional string reason = 2;
913
914 // Beginning of shutdown time in ms using wall clock time since unix epoch.
915 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800916 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800917
918 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800919 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800920}
921
Tej Singh6483ea42018-01-25 17:45:49 -0800922
923/**
924 * Logs boot reason and duration.
925 *
926 * Logged from:
927 * system/core/bootstat/bootstat.cpp
928 */
929message BootSequenceReported {
930 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
931 // Default: "<EMPTY>" if not available.
932 optional string bootloader_reason = 1;
933
934 // Reason for system boot. Eg. bootloader, reboot,userrequested
935 // Default: "<EMPTY>" if not available.
936 optional string system_reason = 2;
937
938 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800939 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800940
941 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800942 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800943
944 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800945 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800946
947 // Time since last boot in ms. Default: 0 if not available.
948 optional int64 time_since_last_boot = 6;
949}
950
Tej Singhc477d9c2018-02-05 18:31:39 -0800951
952/**
953 * Logs call state and disconnect cause (if applicable).
954 *
955 * Logged from:
956 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
957 */
958message CallStateChanged {
959 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
960 // From frameworks/base/core/proto/android/telecomm/enums.proto.
961 optional android.telecom.CallStateEnum call_state = 1;
962
963 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
964 // This value is only applicable when the call_state is DISCONNECTED, and
965 // should always be UNKNOWN if the call_state is not DISCONNECTED.
966 // From frameworks/base/core/proto/android/telecomm/enums.proto.
967 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
968
969 // True if the call is self-managed, which are apps that use the
970 // telecom infrastructure to make their own calls.
971 optional bool self_managed = 3;
972
973 // True if call is external. External calls are calls on connected Wear
974 // devices but show up in Telecom so the user can pull them onto the device.
975 optional bool external_call = 4;
976}
977
Tej Singh1ea42892018-01-19 09:27:00 -0800978/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800979 * Logs keyguard state. The keyguard is the lock screen.
980 *
981 * Logged from:
982 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
983 */
984message KeyguardStateChanged {
985 enum State {
986 UNKNOWN = 0;
987 // The keyguard is hidden when the phone is unlocked.
988 HIDDEN = 1;
989 // The keyguard is shown when the phone is locked (screen turns off).
990 SHOWN= 2;
991 // The keyguard is occluded when something is overlaying the keyguard.
992 // Eg. Opening the camera while on the lock screen.
993 OCCLUDED = 3;
994 }
995 optional State state = 1;
996}
997
998/**
999 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
1000 * prompts the user to enter a password (pattern, pin, etc).
1001 *
1002 * Logged from:
1003 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
1004 */
1005
1006message KeyguardBouncerStateChanged {
1007 enum State {
1008 UNKNOWN = 0;
1009 // Bouncer is hidden, either as a result of successfully entering the
1010 // password, screen timing out, or user going back to lock screen.
1011 HIDDEN = 1;
1012 // This is when the user is being prompted to enter the password.
1013 SHOWN = 2;
1014 }
1015 optional State state = 1;
1016}
1017
1018/**
1019 * Logs the result of entering a password into the keyguard bouncer.
1020 *
1021 * Logged from:
1022 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1023 */
1024message KeyguardBouncerPasswordEntered {
1025 enum BouncerResult {
1026 UNKNOWN = 0;
1027 // The password entered was incorrect.
1028 FAILURE = 1;
1029 // The password entered was correct.
1030 SUCCESS = 2;
1031 }
1032 optional BouncerResult result = 1;
1033}
1034
Tej Singha883b372018-02-15 11:30:01 -08001035/*
1036 * Logs changes to the configuration of the device. The configuration is defined
1037 * in frameworks/base/core/java/android/content/res/Configuration.java
1038 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1039 * Please go there to interpret the possible values each field can be.
1040 *
1041 * Logged from:
1042 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1043 */
1044message ResourceConfigurationChanged {
1045 // Bit mask of color capabilities of the screen.
1046 // Contains information about the color gamut and hdr mode of the screen.
1047 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001048 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001049
1050 // The target screen density being rendered to.
1051 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001052 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001053
1054 // Current user preference for the scaling factor for fonts,
1055 // relative to the base density scaling.
1056 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001057 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001058
1059 // Flag indicating whether the hard keyboard is hidden.
1060 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001061 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001062
1063 // The type of keyboard attached to the device.
1064 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1065 optional int32 keyboard = 5;
1066
1067 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1068 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001069 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001070
1071 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1072 // 0 if undefined.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1074 optional int32 mcc = 7;
1075
1076 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1077 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1078 // MNC_ZERO symbol defined in Configuration.java.
1079 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1080 optional int32 mnc = 8;
1081
1082 // The kind of navigation available on the device.
1083 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1084 optional int32 navigation = 9;
1085
1086 // Flag indicating whether the navigation is available.
1087 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001088 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001089
1090 // Overall orientation of the screen.
1091 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1092 optional int32 orientation = 11;
1093
1094 // The current height of the available screen space, in dp units.
1095 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001096 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001097
1098 // Bit mask of overall layout of the screen.
1099 // Contains information about screen size, whether the screen is wider/taller
1100 // than normal, whether the screen layout is right-tl-left or left-to-right,
1101 // and whether the screen has a rounded shape.
1102 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001103 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001104
1105 // Current width of the available screen space, in dp units.
1106 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001107 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001108
1109 // The smallest screen size an application will see in normal operation.
1110 // This is the smallest value of both screenWidthDp and screenHeightDp
1111 // in portrait and landscape.
1112 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001113 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001114
1115 // The type of touch screen attached to the device.
1116 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1117 optional int32 touchscreen = 16;
1118
1119 // Bit mask of the ui mode.
1120 // Contains information about the overall ui mode of the device.
1121 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1122 // Also contains information about whether the device is in night mode.
1123 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001124 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001125}
1126
Tej Singheee317b2018-03-07 19:28:05 -08001127
1128/**
1129 * Logs changes in the connection state of the mobile radio.
1130 *
1131 * Logged from:
1132 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1133 */
1134message MobileConnectionStateChanged {
1135 // States are from the state machine DataConnection.java.
1136 enum State {
1137 UNKNOWN = 0;
1138 // The connection is inactive, or disconnected.
1139 INACTIVE = 1;
1140 // The connection is being activated, or connecting.
1141 ACTIVATING = 2;
1142 // The connection is active, or connected.
1143 ACTIVE = 3;
1144 // The connection is disconnecting.
1145 DISCONNECTING = 4;
1146 // The connection is disconnecting after creating a connection.
1147 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1148 }
1149 optional State state = 1;
1150 // For multi-sim phones, this distinguishes between the sim cards.
1151 optional int32 sim_slot_index = 2;
1152 // Used to identify the connection. Starts at 0 and increments by 1 for
1153 // every new network created. Resets whenever the device reboots.
1154 optional int32 data_connection_id = 3;
1155 // A bitmask for the capabilities of this connection.
1156 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1157 // Default value (if we have no information): 0
1158 optional int64 capabilities = 4;
1159 // If this connection has internet.
1160 // This just checks if the DEFAULT bit of capabilities is set.
1161 optional bool has_internet = 5;
1162}
1163
1164/**
1165 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1166 *
1167 * Logged from:
1168 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1169 */
1170message MobileRadioTechnologyChanged {
1171 optional android.telephony.NetworkTypeEnum state = 1;
1172 // For multi-sim phones, this distinguishes between the sim cards.
1173 optional int32 sim_slot_index = 2;
1174}
1175
Andrew Chantb56388b2018-03-22 21:07:33 -07001176/**
1177 * Logs the VID and PID of any connected USB devices.
1178 *
1179 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1180 *
1181 * Logged by Vendor.
1182 */
1183message UsbDeviceAttached {
1184 optional int32 vid = 1;
1185 optional int32 pid = 2;
1186 optional bool has_audio = 3;
1187 optional bool has_hid = 4;
1188 optional bool has_storage = 5;
1189}
1190
Tej Singheee317b2018-03-07 19:28:05 -08001191
Tej Singhdd7bd352018-02-09 19:33:15 -08001192/**
Tej Singh5d991e12018-03-09 19:48:11 -08001193 * Logs when Bluetooth is enabled and disabled.
1194 *
1195 * Logged from:
1196 * services/core/java/com/android/server/BluetoothManagerService.java
1197 */
1198message BluetoothEnabledStateChanged {
1199 repeated AttributionNode attribution_node = 1;
1200 // Whether or not bluetooth is enabled on the device.
1201 enum State {
1202 UNKNOWN = 0;
1203 ENABLED = 1;
1204 DISABLED = 2;
1205 }
1206 optional State state = 2;
1207 // The reason for being enabled/disabled.
1208 // Eg. Airplane mode, crash, application request.
1209 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1210 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001211 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001212}
1213
1214/**
1215 * Logs when a Bluetooth device connects and disconnects.
1216 *
1217 * Logged from:
1218 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1219 */
1220message BluetoothConnectionStateChanged {
1221 // The state of the connection.
1222 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1223 optional android.bluetooth.ConnectionStateEnum state = 1;
1224 // An identifier that can be used to match connect and disconnect events.
1225 // Currently is last two bytes of a hash of a device level ID and
1226 // the mac address of the bluetooth device that is connected.
1227 optional int32 obfuscated_id = 2;
1228 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1229 // From android.bluetooth.BluetoothAdapter.java
1230 optional int32 bt_profile = 3;
1231}
1232
1233/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001234 * Logs when something is plugged into or removed from the USB-C connector.
1235 *
1236 * Logged from:
1237 * Vendor USB HAL.
1238 */
1239message UsbConnectorStateChanged {
1240 enum State {
1241 DISCONNECTED = 0;
1242 CONNECTED = 1;
1243 }
1244 optional State state = 1;
1245}
1246
1247/**
1248 * Logs the reported speaker impedance.
1249 *
1250 * Logged from:
1251 * Vendor audio implementation.
1252 */
1253message SpeakerImpedanceReported {
1254 optional int32 speaker_location = 1;
1255 optional int32 impedance = 2;
1256}
1257
1258/**
1259 * Logs the report of a failed hardware.
1260 *
1261 * Logged from:
1262 * Vendor HALs.
1263 *
1264 */
1265message HardwareFailed {
1266 enum HardwareType {
1267 HARDWARE_FAILED_UNKNOWN = 0;
1268 HARDWARE_FAILED_MICROPHONE = 1;
1269 HARDWARE_FAILED_CODEC = 2;
1270 HARDWARE_FAILED_SPEAKER = 3;
1271 HARDWARE_FAILED_FINGERPRINT = 4;
1272 }
1273 optional HardwareType hardware_type = 1;
1274
1275 /* hardware_location allows vendors to differentiate between multiple instances of
1276 * the same hardware_type. The specific locations are vendor defined integers,
1277 * referring to board-specific numbering schemes.
1278 */
1279 optional int32 hardware_location = 2;
1280
1281 /* failure_code is specific to the HardwareType of the failed hardware.
1282 * It should use the enum values defined below.
1283 */
1284 enum MicrophoneFailureCode {
1285 MICROPHONE_FAILURE_COMPLETE = 0;
1286 }
1287 enum CodecFailureCode {
1288 CODEC_FAILURE_COMPLETE = 0;
1289 }
1290 enum SpeakerFailureCode {
1291 SPEAKER_FAILURE_COMPLETE = 0;
1292 SPEAKER_FAILURE_HIGH_Z = 1;
1293 SPEAKER_FAILURE_SHORT = 2;
1294 }
1295 enum FingerprintFailureCode {
1296 FINGERPRINT_FAILURE_COMPLETE = 0;
1297 FINGERPRINT_SENSOR_BROKEN = 1;
1298 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1299 }
1300 optional int32 failure_code = 3;
1301}
1302
1303/**
1304 * Log an event when the device has been physically dropped.
1305 * Reported from the /vendor partition.
1306 */
1307message PhysicalDropDetected {
1308 // Confidence that the event was actually a drop, 0 -> 100
1309 optional int32 confidence_pctg = 1;
1310 // Peak acceleration of the drop, in 1/1000s of a g.
1311 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001312 // Duration of freefall in ms
1313 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001314}
1315
1316/**
1317 * Log bucketed battery charge cycles.
1318 *
1319 * Each bucket represents cycles of the battery past
1320 * a given charge point. For example, bucket 1 is the
1321 * lowest 1/8th of the battery, and bucket 8 is 100%.
1322 *
1323 * Logged from:
1324 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1325 */
1326message ChargeCyclesReported {
1327 optional int32 cycle_bucket_1 = 1;
1328 optional int32 cycle_bucket_2 = 2;
1329 optional int32 cycle_bucket_3 = 3;
1330 optional int32 cycle_bucket_4 = 4;
1331 optional int32 cycle_bucket_5 = 5;
1332 optional int32 cycle_bucket_6 = 6;
1333 optional int32 cycle_bucket_7 = 7;
1334 optional int32 cycle_bucket_8 = 8;
1335}
1336
1337/**
Howard Roa46b6582018-09-18 16:45:02 -07001338 * Log battery health snapshot.
1339 *
1340 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1341 * are snapshotted periodically over 24hrs.
1342 */
1343message BatteryHealthSnapshot {
1344 enum BatterySnapshotType {
1345 UNKNOWN = 0;
1346 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1347 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1348 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1349 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1350 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1351 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1352 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1353 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1354 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1355 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1356 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1357 }
1358 optional BatterySnapshotType type = 1;
1359 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001360 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001361 // Voltage Battery Voltage, in microVolts.
1362 optional int32 voltage_micro_volt = 3;
1363 // Current Battery current, in microAmps.
1364 optional int32 current_micro_amps = 4;
1365 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1366 optional int32 open_circuit_micro_volt = 5;
1367 // Resistance Battery Resistance, in microOhms.
1368 optional int32 resistance_micro_ohm = 6;
1369 // Level Battery Level, as % of full.
1370 optional int32 level_percent = 7;
1371}
1372
1373/**
1374 * Log slow I/O operations on the primary storage.
1375 */
1376message SlowIo {
1377 // Classifications of IO Operations.
1378 enum IoOperation {
1379 UNKNOWN = 0;
1380 READ = 1;
1381 WRITE = 2;
1382 UNMAP = 3;
1383 SYNC = 4;
1384 }
1385 optional IoOperation operation = 1;
1386
1387 // The number of slow IO operations of this type over 24 hours.
1388 optional int32 count = 2;
1389}
1390
1391/**
1392 * Log battery caused shutdown with the last recorded voltage.
1393 */
1394message BatteryCausedShutdown {
1395 // The last recorded battery voltage prior to shutdown.
1396 optional int32 last_recorded_micro_volt = 1;
1397}
1398
1399/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001400 * Logs the duration of a davey (jank of >=700ms) when it occurs
1401 *
1402 * Logged from:
1403 * frameworks/base/libs/hwui/JankTracker.cpp
1404 */
1405message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001406 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001407 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001408
Tej Singhbb8554a2018-01-26 11:59:14 -08001409 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001410 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001411}
1412
1413/**
Bookatze5885242017-10-24 20:10:31 -07001414 * Logs phone signal strength changes.
1415 *
1416 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001417 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001418 */
1419message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001420 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1421 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001422}
1423
Yangster4ccebea2018-10-09 17:09:02 -07001424
1425/**
1426 * Logs when the phone state, sim state or signal strength changes
1427 *
1428 * Logged from:
1429 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1430 */
1431message PhoneServiceStateChanged {
1432 optional android.telephony.ServiceStateEnum state = 1;
1433 optional android.telephony.SimStateEnum sim_state = 2;
1434 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1435}
1436
1437/**
1438 * Logs when the phone becomes on or off.
1439 *
1440 * Logged from:
1441 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1442 */
1443message PhoneStateChanged {
1444 enum State {
1445 OFF = 0;
1446 ON = 1;
1447 }
1448 optional State state = 1;
1449}
1450
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001451message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001452 optional android.stats.launcher.LauncherAction action = 1;
1453 optional android.stats.launcher.LauncherState src_state = 2;
1454 optional android.stats.launcher.LauncherState dst_state = 3;
1455 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001456 optional bool is_swipe_up_enabled = 5;
1457}
1458
David Chenc28b2bb2017-10-24 12:52:52 -07001459/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001460 * Logs when Settings UI has changed.
1461 *
1462 * Logged from:
1463 * packages/apps/Settings
1464 */
1465message SettingsUIChanged {
1466 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001467 * Where this SettingsUIChange event comes from. For example, if
1468 * it's a PAGE_VISIBLE event, where the page is opened from.
1469 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001470 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001471
1472 /**
1473 * What the UI action is.
1474 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001475 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001476
1477 /**
1478 * Where the action is happening
1479 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001480 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001481
1482 /**
1483 * What preference changed in this event.
1484 */
1485 optional string changedPreferenceKey = 4;
1486
1487 /**
1488 * The new value of the changed preference.
1489 */
1490 optional int64 changedPreferenceIntValue = 5;
1491}
1492
1493/**
David Chenc28b2bb2017-10-24 12:52:52 -07001494 * Logs that a setting was updated.
1495 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001496 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001497 * The tag and is_default allow resetting of settings to default values based on the specified
1498 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1499 */
1500message SettingChanged {
1501 // The name of the setting.
1502 optional string setting = 1;
1503
1504 // The change being imposed on this setting. May represent a number, eg "3".
1505 optional string value = 2;
1506
1507 // The new value of this setting. For most settings, this is same as value. For some settings,
1508 // value is +X or -X where X represents an element in a set. For example, if the previous value
1509 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1510 // The +/- feature is currently only used for location_providers_allowed.
1511 optional string new_value = 3;
1512
1513 // The previous value of this setting.
1514 optional string prev_value = 4;
1515
1516 // The tag used with the is_default for resetting sets of settings. This is generally null.
1517 optional string tag = 5;
1518
Bookatz90867622018-01-31 15:05:57 -08001519 // True if this setting with tag should be resettable.
1520 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001521
David Chenbd789912018-03-16 17:19:55 -07001522 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001523 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001524
1525 enum ChangeReason {
1526 UPDATED = 1; // Updated can be an insertion or an update.
1527 DELETED = 2;
1528 }
1529 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001530}
Chenjie Yub3dda412017-10-24 13:41:59 -07001531
Chenjie Yu05013b32017-11-21 10:21:41 -08001532/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001533 * Logs activity going to foreground or background
1534 *
1535 * Logged from:
1536 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1537 */
1538message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001539 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001540 optional string pkg_name = 2;
1541 optional string class_name = 3;
1542
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001543 enum State {
1544 BACKGROUND = 0;
1545 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001546 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001547 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001548}
David Chenc8a43242017-10-17 16:23:28 -07001549
1550/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001551 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001552 * Logged from:
1553 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1554 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001555message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001556 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001557
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001558 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001559
1560 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001561 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001562 optional string process_name = 3;
1563
1564 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001565 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001566
1567 optional string package_name = 5;
1568
1569 enum InstantApp {
1570 UNAVAILABLE = 0;
1571 FALSE = 1;
1572 TRUE = 2;
1573 }
1574 optional InstantApp is_instant_app = 6;
1575
1576 enum ForegroundState {
1577 UNKNOWN = 0;
1578 BACKGROUND = 1;
1579 FOREGROUND = 2;
1580 }
1581 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001582}
David Chen9e3808c2017-11-20 17:25:34 -08001583
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001584/**
1585 * Logs when a WTF (What a Terrible Failure) happened.
1586 * Logged from:
1587 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1588 */
1589message WTFOccurred {
1590 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001591
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001592 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001593
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001594 // The name of the process.
1595 // system_server if it is not by an app
1596 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001597
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001598 // The pid if available. -1 means not available.
1599 optional sint32 pid = 4;
1600}
1601
1602/**
1603 * Logs when system server reports low memory.
1604 * Logged from:
1605 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1606 */
1607message LowMemReported {
1608}
1609
1610/**
1611 * Logs when an app ANR (App Not Responding) occurs.
1612 * Logged from:
1613 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1614 */
1615message ANROccurred {
1616 optional int32 uid = 1 [(is_uid) = true];
1617
1618 optional string process_name = 2;
1619
1620 optional string short_component_name = 3;
1621
1622 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001623
1624 enum InstantApp {
1625 UNAVAILABLE = 0;
1626 FALSE = 1;
1627 TRUE = 2;
1628 }
1629 optional InstantApp is_instant_app = 5;
1630
1631 enum ForegroundState {
1632 UNKNOWN = 0;
1633 BACKGROUND = 1;
1634 FOREGROUND = 2;
1635 }
1636 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001637}
1638
Bookatza7020bd2018-08-28 16:29:35 -07001639/**
1640 * Logs when the vibrator state changes.
1641 * Logged from:
1642 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1643 */
1644message VibratorStateChanged {
1645 repeated AttributionNode attribution_node = 1;
1646
1647 enum State {
1648 OFF = 0;
1649 ON = 1;
1650 }
1651 optional State state = 2;
1652
1653 // Duration (in milliseconds) requested to keep the vibrator on.
1654 // Only applicable for State == ON.
1655 optional int64 duration_millis = 3;
1656}
1657
David Chen0a368b22017-12-06 16:28:16 -08001658/*
1659 * Allows other apps to push events into statsd.
1660 * Logged from:
1661 * frameworks/base/core/java/android/util/StatsLog.java
1662 */
David Chen0b5c90c2018-01-25 16:51:49 -08001663message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001664 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001665 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001666
1667 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1668 optional int32 label = 2;
1669
1670 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1671 // predicates for the metrics).
1672 enum State {
1673 UNKNOWN = 0;
1674 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1675 STOP = 2;
1676 START = 3;
1677 }
1678 optional State state = 3;
1679}
1680
David Chen9e3808c2017-11-20 17:25:34 -08001681/**
Bookatz7948c872018-09-04 12:58:33 -07001682 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1683 * For example, this could be due to the user manually changing the time.
1684 *
1685 * Logged from:
1686 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1687 */
1688message WallClockTimeShifted {
1689 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1690 optional int64 wall_clock_timestamp_millis = 1;
1691}
1692
1693/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001694 * Logs when statsd detects an anomaly.
1695 *
1696 * Logged from:
1697 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1698 */
1699message AnomalyDetected {
1700 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001701 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001702
Yangster-mac94e197c2018-01-02 16:03:03 -08001703 // Id of the config whose anomaly detection alert fired.
1704 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001705
Yangster-mac94e197c2018-01-02 16:03:03 -08001706 // Id of the alert (i.e. name of the anomaly that was detected).
1707 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001708}
1709
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001710message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001711 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001712 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001713
1714 // The app package name.
1715 optional string pkg_name = 2;
1716
1717 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001718 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001719 WARM = 1;
1720 HOT = 2;
1721 COLD = 3;
1722 }
1723 // The transition type.
1724 optional TransitionType type = 3;
1725
1726 // The activity name.
1727 optional string activity_name = 4;
1728
1729 // The name of the calling app. Empty if not set.
1730 optional string calling_pkg_name = 5;
1731
1732 // Whether the app is an instant app.
1733 optional bool is_instant_app = 6;
1734
1735 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001736 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001737
Bookatz80d11a02018-01-16 10:46:35 -08001738 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001739
David Chen0b5c90c2018-01-25 16:51:49 -08001740 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001741 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001742 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001743 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001744 optional int32 bind_application_delay_millis = 11;
1745 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001746
1747 // Empty if not set.
1748 optional string launch_token = 13;
1749
Calin Juravle759fbda2018-02-20 19:52:30 +00001750 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001751 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001752
1753 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001754 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001755}
1756
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001757message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001758 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001759 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001760
1761 // The app package name.
1762 optional string pkg_name = 2;
1763
1764 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001765 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001766 WARM = 1;
1767 HOT = 2;
1768 COLD = 3;
1769 }
1770 // The transition type.
1771 optional TransitionType type = 3;
1772
1773 // The activity name.
1774 optional string activity_name = 4;
1775}
1776
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001777message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001778 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001779 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001780
1781 // The app package name.
1782 optional string pkg_name = 2;
1783
1784 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001785 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001786 WITH_BUNDLE = 1;
1787 WITHOUT_BUNDLE = 2;
1788 }
1789 // The transition type.
1790 optional TransitionType type = 3;
1791
1792 // The activity name.
1793 optional string activity_name = 4;
1794
1795 optional bool transition_process_running = 5;
1796
1797 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001798 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001799}
1800
Bookatz8fcd09a2017-12-18 13:01:10 -08001801/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001802 * Logs a picture-in-picture action
1803 * Logged from:
1804 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1805 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1806 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1807 */
1808message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001809 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001810 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001811
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001812 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001813
Chenjie Yu52cacc62017-12-08 18:11:45 -08001814 enum State {
1815 ENTERED = 1;
1816 EXPANDED_TO_FULL_SCREEN = 2;
1817 MINIMIZED = 3;
1818 DISMISSED = 4;
1819 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001820 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001821}
1822
1823/**
Chenjie Yue8904192017-12-08 19:12:57 -08001824 * Logs overlay action
1825 * Logged from:
1826 * services/core/java/com/android/server/wm/Session.java
1827 */
1828message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001829 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001830
1831 optional string package_name = 2;
1832
1833 optional bool using_alert_window = 3;
1834
1835 enum State {
1836 ENTERED = 1;
1837 EXITED = 2;
1838 }
1839 optional State state = 4;
1840}
1841
Chenjie Yuccfe6452018-01-30 11:33:21 -08001842/*
1843 * Logs foreground service starts and stops.
1844 * Note that this is not when a service starts or stops, but when it is
1845 * considered foreground.
1846 * Logged from
1847 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1848 */
1849message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001850 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001851 // package_name + "/" + class_name
1852 optional string short_name = 2;
1853
1854 enum State {
1855 ENTER = 1;
1856 EXIT = 2;
1857 }
1858 optional State state = 3;
1859}
1860
Chenjie Yue8904192017-12-08 19:12:57 -08001861/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001862 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1863 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1864 * attributed back to the parent (host) uid. One example is Chrome.
1865 *
1866 * Logged from:
1867 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1868 */
1869message IsolatedUidChanged {
1870 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001871 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001872 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001873 optional int32 parent_uid = 1;
1874
1875 optional int32 isolated_uid = 2;
1876
1877 // We expect an isolated uid to be removed before if it's used for another parent uid.
1878 enum Event {
1879 REMOVED = 0;
1880 CREATED = 1;
1881 }
1882 optional Event event = 3;
1883}
1884
1885/*
1886 * Logs the reception of an incoming network packet causing the main system to wake up for
1887 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1888 * and processed by WakeupController.cpp.
1889 */
1890message PacketWakeupOccurred {
1891 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1892 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001893 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001894 // The interface name on which the packet was received.
1895 optional string iface = 2;
1896 // The ethertype value of the packet.
1897 optional int32 ethertype = 3;
1898 // String representation of the destination MAC address of the packet.
1899 optional string destination_hardware_address = 4;
1900 // String representation of the source address of the packet if this was an IP packet.
1901 optional string source_ip = 5;
1902 // String representation of the destination address of the packet if this was an IP packet.
1903 optional string destination_ip = 6;
1904 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1905 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1906 // families.
1907 optional int32 ip_next_header = 7;
1908 // The source port if this was a TCP or UDP packet.
1909 optional int32 source_port = 8;
1910 // The destination port if this was a TCP or UDP packet.
1911 optional int32 destination_port = 9;
1912}
1913
1914/*
1915 * Logs the memory stats for an app on startup.
1916 * Logged from:
1917 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1918 */
1919message AppStartMemoryStateCaptured {
1920 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001921 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001922
1923 // The process name.
1924 optional string process_name = 2;
1925
1926 // The activity name.
1927 optional string activity_name = 3;
1928
1929 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001930 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001931
1932 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001933 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001934
1935 // RSS
1936 optional int64 rss_in_bytes = 6;
1937
1938 // CACHE
1939 optional int64 cache_in_bytes = 7;
1940
1941 // SWAP
1942 optional int64 swap_in_bytes = 8;
1943}
1944
1945/*
1946 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1947 * for LMK event.
1948 * Logged from:
1949 * system/core/lmkd/lmkd.c
1950 */
1951message LmkStateChanged {
1952 enum State {
1953 UNKNOWN = 0;
1954 START = 1;
1955 STOP = 2;
1956 }
1957 optional State state = 1;
1958}
1959
1960/*
1961 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1962 * Logged from:
1963 * system/core/lmkd/lmkd.c
1964 */
1965message LmkKillOccurred {
1966 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001967 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001968
1969 // The process name.
1970 optional string process_name = 2;
1971
1972 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001973 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001974
1975 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001976 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001977
1978 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001979 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001980
1981 // RSS
1982 optional int64 rss_in_bytes = 6;
1983
1984 // CACHE
1985 optional int64 cache_in_bytes = 7;
1986
1987 // SWAP
1988 optional int64 swap_in_bytes = 8;
1989}
1990
Rajeev Kumar51b54602018-03-01 12:18:26 -08001991/*
1992 * Logs when the ActivityManagerService detects that an app died.
1993 *
1994 * Logged from:
1995 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1996 */
1997message AppDied {
1998 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07001999 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08002000}
2001
Howard Ro21a039c2018-08-06 14:55:47 -07002002/**
2003 * An atom for generic metrics logging. Available from Android Q.
2004 */
2005message GenericAtom {
2006 // The uid of the application that sent this custom atom.
2007 optional int32 uid = 1 [(is_uid) = true];
2008
2009 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002010 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002011}
2012
Tej Singhd6d6d772018-09-05 17:41:25 -07002013/**
2014 * Logs when a fingerprint acquire event occurs.
2015 *
2016 * Logged from:
2017 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2018 */
2019message FingerprintAcquired {
2020 // The associated user. Eg: 0 for owners, 10+ for others.
2021 // Defined in android/os/UserHandle.java
2022 optional int32 user = 1;
2023 // If this acquire is for a crypto fingerprint.
2024 // e.g. Secure purchases, unlock password storage.
2025 optional bool is_crypto = 2;
2026}
2027
2028/**
2029 * Logs when a fingerprint authentication event occurs.
2030 *
2031 * Logged from:
2032 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2033 */
2034message FingerprintAuthenticated {
2035 // The associated user. Eg: 0 for owners, 10+ for others.
2036 // Defined in android/os/UserHandle.java
2037 optional int32 user = 1;
2038 // If this authentication is for a crypto fingerprint.
2039 // e.g. Secure purchases, unlock password storage.
2040 optional bool is_crypto = 2;
2041 // Whether or not this authentication was successful.
2042 optional bool is_authenticated = 3;
2043}
2044
2045/**
2046 * Logs when a fingerprint error occurs.
2047 *
2048 * Logged from:
2049 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2050 */
2051message FingerprintErrorOccurred {
2052 // The associated user. Eg: 0 for owners, 10+ for others.
2053 // Defined in android/os/UserHandle.java
2054 optional int32 user = 1;
2055 // If this error is for a crypto fingerprint.
2056 // e.g. Secure purchases, unlock password storage.
2057 optional bool is_crypto = 2;
2058
2059 enum Error {
2060 UNKNOWN = 0;
2061 LOCKOUT = 1;
2062 PERMANENT_LOCKOUT = 2;
2063 }
2064 // The type of error.
2065 optional Error error = 3;
2066}
Howard Ro688ae182018-09-25 00:09:36 -07002067
2068message Notification {
2069
2070 // Type of notification event.
2071 enum Type {
2072 TYPE_UNKNOWN = 0;
2073 // Notification became visible to the user.
2074 TYPE_OPEN = 1;
2075 // Notification became hidden.
2076 TYPE_CLOSE = 2;
2077 // Notification switched to detail mode.
2078 TYPE_DETAIL = 3;
2079 // Notification was clicked.
2080 TYPE_ACTION = 4;
2081 // Notification was dismissed.
2082 TYPE_DISMISS = 5;
2083 // Notification switched to summary mode. The enum value of 14 is to
2084 // match that of metrics_constants.
2085 TYPE_COLLAPSE = 14;
2086 }
2087 optional Type type = 1;
2088
2089 // Package name associated with the notification.
2090 optional string package_name = 2;
2091
2092 // Tag associated with notification.
2093 optional string tag = 3;
2094
2095 // Application-supplied ID associated with the notification.
2096 optional int32 id = 4;
2097
2098 // Index of notification in the notification panel.
2099 optional int32 shade_index = 5;
2100
2101 // The number of notifications in the notification panel.
2102 optional int32 shade_count = 6;
2103
2104 // Importance for the notification.
2105 optional int32 importance = 7;
2106
2107 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002108 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002109
2110 // Importance for the notification channel.
2111 optional int32 channel_importance = 9;
2112
Howard Ro183c2bd2018-10-18 13:52:10 -07002113 // Application-supplied ID associated with the notifications group.
2114 optional string group_id = 10;
2115
Howard Ro688ae182018-09-25 00:09:36 -07002116 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002117 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002118
Howard Ro183c2bd2018-10-18 13:52:10 -07002119 // Reason for dismissal of a notification. This field is only meaningful for
2120 // TYPE_DISMISS events.
2121 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002122
Howard Ro183c2bd2018-10-18 13:52:10 -07002123 // The first post time of notification, stable across updates.
2124 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002125
Howard Ro183c2bd2018-10-18 13:52:10 -07002126 // The most recent interruption time, or the creation time if no updates.
2127 // Differs from update_millis because updates are filtered based on whether
2128 // they actually interrupted the user.
2129 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002130
Howard Ro183c2bd2018-10-18 13:52:10 -07002131 // The most recent update time, or the creation time if no updates.
2132 optional int64 update_millis = 15;
2133
2134 // The most recent visibility event.
2135 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002136}
2137
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002138/*
2139 * Logs when a connection becomes available and lost.
2140 * Logged in StatsCompanionService.java
2141 */
2142message ConnectivityStateChanged {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002143 // Id of the network.
2144 optional int32 net_id = 1;
2145
2146 enum State {
2147 UNKNOWN = 0;
2148 CONNECTED = 1;
2149 DISCONNECTED = 2;
2150 }
2151 // Connected state of a network.
2152 optional State state = 2;
2153}
2154
2155/**
2156 * Logs when a service starts and stops.
2157 * Logged from:
2158 * services/core/java/com/android/server/am/ActiveServices.java
2159 */
2160message ServiceStateChanged {
2161
2162 optional int32 uid = 1 [(is_uid) = true];
2163
2164 optional string package_name = 2;
2165
2166 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002167
2168 enum State {
Chenjie Yu75b3c492018-10-06 21:45:19 -07002169 START = 1;
2170 STOP = 2;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002171 }
Chenjie Yu75b3c492018-10-06 21:45:19 -07002172
2173 optional State state = 4;
2174}
2175
2176/**
2177 * Logs when a service is launched.
2178 * Logged from:
2179 * services/core/java/com/android/server/am/ActiveServices.java
2180 */
2181message ServiceLaunchReported {
2182
2183 optional int32 uid = 1 [(is_uid) = true];
2184
2185 optional string package_name = 2;
2186
2187 optional string service_name = 3;
Chenjie Yuae9dfac2018-10-25 16:06:56 -07002188}
Howard Ro688ae182018-09-25 00:09:36 -07002189
Chenjie Yubbcbc602018-02-05 16:51:52 -08002190//////////////////////////////////////////////////////////////////////
2191// Pulled atoms below this line //
2192//////////////////////////////////////////////////////////////////////
2193
2194/**
David Chenc8a43242017-10-17 16:23:28 -07002195 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2196 *
2197 * Pulled from:
2198 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2199 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002200message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002201 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002202
2203 optional int64 rx_bytes = 2;
2204
2205 optional int64 rx_packets = 3;
2206
2207 optional int64 tx_bytes = 4;
2208
2209 optional int64 tx_packets = 5;
2210}
2211
2212/**
2213 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2214 *
2215 * Pulled from:
2216 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2217 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002218message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002219 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002220
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002221 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2222 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002223
2224 optional int64 rx_bytes = 3;
2225
2226 optional int64 rx_packets = 4;
2227
2228 optional int64 tx_bytes = 5;
2229
2230 optional int64 tx_packets = 6;
2231}
2232
2233/**
2234 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2235 *
2236 * Pulled from:
2237 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2238 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002239message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002240 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002241
2242 optional int64 rx_bytes = 2;
2243
2244 optional int64 rx_packets = 3;
2245
2246 optional int64 tx_bytes = 4;
2247
2248 optional int64 tx_packets = 5;
2249}
2250
2251/**
2252 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2253 *
2254 * Pulled from:
2255 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2256 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002257message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002258 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002259
Yao Chenc40a19d2018-03-15 16:48:25 -07002260 // 1 denotes foreground and 0 denotes background. This is called Set in
2261 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002262 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002263
2264 optional int64 rx_bytes = 3;
2265
2266 optional int64 rx_packets = 4;
2267
2268 optional int64 tx_bytes = 5;
2269
2270 optional int64 tx_packets = 6;
2271}
2272
2273/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002274 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2275 *
2276 * Pulled from:
2277 * StatsCompanionService
2278 */
2279message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002280 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002281
2282 optional int64 rx_bytes = 2;
2283
2284 optional int64 tx_bytes = 3;
2285}
2286
2287/**
David Chenc8a43242017-10-17 16:23:28 -07002288 * Pulls the kernel wakelock durations. This atom is adapted from
2289 * android/internal/os/KernelWakelockStats.java
2290 *
2291 * Pulled from:
2292 * StatsCompanionService using KernelWakelockReader.
2293 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002294message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002295 optional string name = 1;
2296
2297 optional int32 count = 2;
2298
2299 optional int32 version = 3;
2300
Yangster-maca8a30442018-10-13 23:46:34 -07002301 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002302}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002303
Chenjie Yu05013b32017-11-21 10:21:41 -08002304/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002305 * Pulls low power state information. This includes platform and subsystem sleep state information,
2306 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002307 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002308 * hardware/interfaces/power/1.1/types.hal
2309 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002310message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002311 // Subsystem name
2312 optional string subsystem_name = 1;
2313 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2314 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2315 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002316 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002317 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002318 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002319 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002320}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002321
Chenjie Yu05013b32017-11-21 10:21:41 -08002322/**
Bookatz92da2832018-11-01 18:10:03 -07002323 * Pulls on-device power measurement information.
2324 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
2325 * Pulled from:
2326 * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
2327 */
2328message OnDevicePowerMeasurement {
2329 // Name of the subsystem (to which the rail belongs).
2330 optional string subsystem_name = 1;
2331
2332 // Rail name. The rail lies within the subsystem.
2333 optional string rail_name = 2;
2334
2335 // Time (in ms since boot) at which the rail energy value was measured.
2336 // This may differ slightly from the time that statsd logs this information.
2337 optional uint64 measurement_timestamp_millis = 3;
2338
2339 // Accumulated energy used via the rail since device boot in uWs.
2340 optional uint64 energy_microwatt_secs = 4;
2341}
2342
2343/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002344 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002345 * Pulls the time the cpu spend on the frequency index. Frequency index
2346 * starts from highest to lowest. The value should be monotonically
2347 * increasing since boot. However, if there is a cpu
2348 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002349 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002350message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002351 optional uint32 cluster = 1;
2352 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002353 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002354}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002355
Chenjie Yu05013b32017-11-21 10:21:41 -08002356/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002357 * Pulls Cpu Time Per Uid.
2358 * Note that isolated process uid time should be attributed to host uids.
2359 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002360message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002361 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002362 optional uint64 user_time_millis = 2;
2363 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002364}
2365
2366/**
2367 * Pulls Cpu Time Per Uid per frequency.
2368 * Note that isolated process uid time should be attributed to host uids.
2369 * For each uid, we order the time by descending frequencies.
2370 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002371message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002372 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002373 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002374 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002375}
Hugo Benichi884970e2017-11-14 22:42:46 +09002376
Chenjie Yu05013b32017-11-21 10:21:41 -08002377/**
2378 * Pulls Wifi Controller Activity Energy Info
2379 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002380message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002381 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002382 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002383 // stack reported state
2384 // TODO: replace this with proto enum
2385 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002386 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002387 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002388 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002389 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002390 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002391 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002392 // product of current(mA), voltage(V) and time(ms)
2393 optional uint64 controller_energy_used = 6;
2394}
2395
2396/**
2397 * Pulls Modem Activity Energy Info
2398 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002399message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002400 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002401 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002402 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002403 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002404 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002405 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002406 /**
2407 * Tx power index
2408 * index 0 = tx_power < 0dBm
2409 * index 1 = 0dBm < tx_power < 5dBm
2410 * index 2 = 5dBm < tx_power < 15dBm
2411 * index 3 = 15dBm < tx_power < 20dBm
2412 * index 4 = tx_power > 20dBm
2413 */
2414 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002415 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002416 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002417 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002418 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002419 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002420 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002421 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002422 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002423 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002424 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002425 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002426 // product of current(mA), voltage(V) and time(ms)
2427 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002428}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002429
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002430/**
2431 * Pulls Bluetooth Activity Energy Info
2432 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2433 */
2434message BluetoothActivityInfo {
2435 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002436 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002437 // bluetooth stack state
2438 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002439 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002440 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002441 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002442 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002443 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002444 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002445 // product of current(mA), voltage(V) and time(ms)
2446 optional uint64 energy_used = 6;
2447}
2448
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002449/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002450 * Logs the memory stats for a process.
2451 */
2452message ProcessMemoryState {
2453 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002454 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002455
2456 // The process name.
2457 optional string process_name = 2;
2458
2459 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002460 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002461
2462 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002463 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002464
2465 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002466 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002467
Rajeev Kumar90235992018-01-29 11:06:48 -08002468 // RSS
2469 optional int64 rss_in_bytes = 6;
2470
2471 // CACHE
2472 optional int64 cache_in_bytes = 7;
2473
2474 // SWAP
2475 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002476
2477 // RSS high watermark.
2478 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2479 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2480 optional int64 rss_high_watermark_in_bytes = 9;
Rafal Slawik272a8162018-11-01 15:12:28 +00002481
2482 // Elapsed real time when the process started.
2483 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2484 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002485}
2486
2487/*
Rafal Slawik08621582018-10-15 14:53:07 +01002488 * Logs the memory stats for a native process (from procfs).
2489 */
2490message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002491 // The uid if available. -1 means not available.
2492 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002493
Rafal Slawikbf67d072018-10-23 11:07:54 +01002494 // The process name.
2495 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002496
Rafal Slawikbf67d072018-10-23 11:07:54 +01002497 // # of page-faults
2498 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002499
Rafal Slawikbf67d072018-10-23 11:07:54 +01002500 // # of major page-faults
2501 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002502
Rafal Slawikbf67d072018-10-23 11:07:54 +01002503 // RSS
2504 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002505
Rafal Slawikbf67d072018-10-23 11:07:54 +01002506 // RSS high watermark.
2507 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
2508 optional int64 rss_high_watermark_in_bytes = 6;
2509
2510 // Elapsed real time when the process started.
2511 // Value is read from /proc/PID/stat, field 22.
2512 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002513}
2514
2515/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002516 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002517 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002518message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002519 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002520}
2521
2522/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002523 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002524 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002525message SystemUptime {
2526 // Milliseconds since the system was booted.
2527 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2528 // for external input).
2529 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002530 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002531}
2532
2533/*
2534 * Reads from /proc/uid_concurrent_active_time which has the format:
2535 * active: X (X is # cores)
2536 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2537 * [uid1]: [time-0] [time-1] [time-2] ... ...
2538 * ...
2539 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2540 * The file contains a monotonically increasing count of time for a single boot.
2541 */
2542message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002543 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002544 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002545}
2546
2547/**
2548 * Reads from /proc/uid_concurrent_policy_time which has the format:
2549 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2550 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2551 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2552 * ...
2553 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2554 * The file contains a monotonically increasing count of time for a single boot.
2555 */
2556message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002557 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002558 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002559 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002560}
2561
2562/*
2563 * Pulls free disk space, for data, system partition and temporary directory.
2564 */
2565message DiskSpace {
2566 // available bytes in data partition
2567 optional uint64 data_available_bytes = 1;
2568 // available bytes in system partition
2569 optional uint64 system_available_bytes = 2;
2570 // available bytes in download cache or temp directories
2571 optional uint64 temp_available_bytes = 3;
2572}
Tej Singhbf972d92018-01-10 20:51:13 -08002573
2574/**
2575 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002576 * Pulled from:
2577 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002578 */
2579message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002580 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002581}
2582
2583/**
2584 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002585 * Pulled from:
2586 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002587 */
2588message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002589 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002590}
2591
2592/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002593 * Pulls battery voltage.
2594 * Pulled from:
2595 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2596 */
2597message BatteryVoltage {
2598 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002599 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002600}
2601
2602/**
Tej Singhd89137e2018-03-26 14:51:40 -07002603 * Pulls the temperature of various parts of the device.
2604 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002605 *
2606 * Pulled from:
2607 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2608 */
2609message Temperature {
2610 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2611 optional android.os.TemperatureTypeEnum sensor_location = 1;
2612
2613 // The name of the temperature source. Eg. CPU0
2614 optional string sensor_name = 2;
2615
Tej Singhd89137e2018-03-26 14:51:40 -07002616 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002617 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002618}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002619
2620/**
2621 * Pulls the statistics of calls to Binder.
2622 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002623 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2624 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002625 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002626 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002627 */
2628message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002629 // UID of the process responsible for the binder transaction. It will be set if the process
2630 // executing the binder transaction attribute the transaction to another uid using
2631 // Binder.setThreadWorkSource().
2632 //
2633 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002634 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002635 // UID of the process executing the binder transaction.
2636 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002637 // Fully qualified class name of the API call.
2638 //
2639 // This is a system server class name.
2640 //
2641 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2642 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2643 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2644 // commonly used APIs.
2645 optional string service_class_name = 2;
2646 // Method name of the API call. It can also be a transaction code if we cannot
2647 // resolve it to a name. See Binder#getTransactionName.
2648 //
2649 // This is a system server method name.
2650 optional string service_method_name = 3;
2651 // Total number of API calls.
2652 optional int64 call_count = 4;
2653 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2654 optional bool screen_interactive = 13;
2655 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2656 // call_count will be equal to recorded_call_count.
2657 //
2658 // If recorded_call_count is different than call_count, it means data collection has been
2659 // sampled. All the fields below will be sampled in this case.
2660 optional int64 recorded_call_count = 12;
2661 // Number of exceptions thrown by the API.
2662 optional int64 recorded_exception_count = 5;
2663 // Total latency of all API calls.
2664 // Average can be computed using total_latency_micros / recorded_call_count.
2665 optional int64 recorded_total_latency_micros = 6;
2666 // Maximum latency of one API call.
2667 optional int64 recorded_max_latency_micros = 7;
2668 // Total CPU usage of all API calls.
2669 // Average can be computed using total_cpu_micros / recorded_call_count.
2670 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2671 optional int64 recorded_total_cpu_micros = 8;
2672 // Maximum CPU usage of one API call.
2673 optional int64 recorded_max_cpu_micros = 9;
2674 // Maximum parcel reply size of one API call.
2675 optional int64 recorded_max_reply_size_bytes = 10;
2676 // Maximum parcel request size of one API call.
2677 optional int64 recorded_max_request_size_bytes = 11;
2678}
2679
2680/**
2681 * Pulls the statistics of exceptions during calls to Binder.
2682 *
2683 * Binder stats are cumulative from boot unless somebody reset the data using
2684 * > adb shell dumpsys binder_calls_stats --reset
2685 */
2686message BinderCallsExceptions {
2687 // Exception class name, e.g. java.lang.IllegalArgumentException.
2688 //
2689 // This is an exception class name thrown by the system server.
2690 optional string exception_class_name = 1;
2691 // Total number of exceptions.
2692 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002693}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002694
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002695/**
2696 * Pulls the statistics of message dispatching on HandlerThreads.
2697 *
2698 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2699 * config on the device.
2700 *
2701 * Next tag: 11
2702 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002703message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002704 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002705 optional int32 uid = 1 [(is_uid) = true];
2706
2707 // Fully qualified class name of the handler target class.
2708 //
2709 // This field does not contain PII. This is a system server class name.
2710 optional string handler_class_name = 2;
2711
2712 // The name of the thread that runs the Looper.
2713 //
2714 // This field does not contain PII. This is a system server thread name.
2715 optional string looper_thread_name = 3;
2716
2717 // The name of the dispatched message.
2718 //
2719 // This field does not contain PII. This is a system server constant or class
2720 // name.
2721 optional string message_name = 4;
2722
2723 // Total number of successfully dispatched messages.
2724 optional int64 message_count = 5;
2725
2726 // Total number of messages that failed dispatching.
2727 optional int64 exception_count = 6;
2728
2729 // Total number of processed messages we have data recorded for. If we
2730 // collected data for all the messages, message_count will be equal to
2731 // recorded_message_count.
2732 //
2733 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002734 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002735 optional int64 recorded_message_count = 7;
2736
2737 // Total latency of all processed messages.
2738 // Average can be computed using recorded_total_latency_micros /
2739 // recorded_message_count.
2740 optional int64 recorded_total_latency_micros = 8;
2741
2742 // Total CPU usage of all processed message.
2743 // Average can be computed using recorded_total_cpu_micros /
2744 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002745 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002746 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002747
2748 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2749 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002750
2751 // Max recorded CPU usage of all processed messages.
2752 optional int64 recorded_max_cpu_micros = 11;
2753
2754 // Max recorded latency of all processed messages.
2755 optional int64 recorded_max_latency_micros = 12;
2756
2757 // Total number of messages we tracked the dispatching delay for. If we
2758 // collected data for all the messages, message_count will be equal to
2759 // recorded_delay_message_count.
2760 //
2761 // If recorded_delay_message_count is different than message_count, it means data
2762 // collection has been sampled or/and not all messages specified the target dispatch time.
2763 // The fields below will be sampled in this case.
2764 optional int64 recorded_delay_message_count = 13;
2765
2766 // Total dispatching delay of all processed messages.
2767 // Calculated as a difference between the target dispatching time (Message.when)
2768 // and the actual dispatching time.
2769 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2770 optional int64 recorded_total_delay_millis = 14;
2771
2772 // Max dispatching delay of all processed messages.
2773 // Calculated as a difference between the target dispatching time (Message.when)
2774 // and the actual dispatching time.
2775 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002776}
Tej Singh86dc9db2018-09-06 00:39:57 +00002777
2778/**
2779 * Pulls disk information, such as write speed and latency.
2780 */
2781message DiskStats {
2782 // Time taken to open, write 512B to, and close a file.
2783 // -1 if error performing the check.
2784 optional int64 data_write_latency_millis = 1;
2785
2786 optional bool file_based_encryption = 2;
2787
2788 // Recent disk write speed in kB/s.
2789 // -1 if error querying storageed.
2790 // 0 if data is unavailable.
2791 optional int32 recent_disk_write_speed = 3;
2792}
2793
2794
2795/**
2796 * Free and total bytes of the Data, Cache, and System partition.
2797 */
2798message DirectoryUsage {
2799 enum Directory {
2800 UNKNOWN = 0;
2801 DATA = 1;
2802 CACHE = 2;
2803 SYSTEM = 3;
2804 }
2805 optional Directory directory = 1;
2806 optional int64 free_bytes = 2;
2807 optional int64 total_bytes = 3;
2808}
2809
2810
2811/**
2812 * Size of an application: apk size, data size, and cache size.
2813 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2814 * Information is only reported for apps with the primary user (user 0).
2815 * Sizes are aggregated by package name.
2816 */
2817message AppSize {
2818 // Including uids will involve modifying diskstats logic.
2819 optional string package_name = 1;
2820 // App size in bytes. -1 if unavailable.
2821 optional int64 app_size_bytes = 2;
2822 // App data size in bytes. -1 if unavailable.
2823 optional int64 app_data_size_bytes = 3;
2824 // App cache size in bytes. -1 if unavailable.
2825 optional int64 app_cache_size_bytes = 4;
2826 // Time that the cache file was produced.
2827 // Uses System.currentTimeMillis(), which is wall clock time.
2828 optional int64 cache_time_millis = 5;
2829}
2830
2831
2832/**
2833 * Size of a particular category. Eg: photos, videos.
2834 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2835 */
2836message CategorySize {
2837 enum Category {
2838 UNKNOWN = 0;
2839 APP_SIZE = 1;
2840 APP_DATA_SIZE = 2;
2841 APP_CACHE_SIZE = 3;
2842 PHOTOS = 4;
2843 VIDEOS = 5;
2844 AUDIO = 6;
2845 DOWNLOADS = 7;
2846 SYSTEM = 8;
2847 OTHER = 9;
2848 }
2849 optional Category category = 1;
2850 // Category size in bytes.
2851 optional int64 size_bytes = 2;
2852 // Time that the cache file was produced.
2853 // Uses System.currentTimeMillis(), which is wall clock time.
2854 optional int64 cache_time_millis = 3;
2855}
Tej Singhd6d6d772018-09-05 17:41:25 -07002856
2857/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002858 * Pulls per uid I/O stats. The stats are cumulative since boot.
2859 *
2860 * Read/write bytes are I/O events from a storage device
2861 * Read/write chars are data requested by read/write syscalls, and can be
2862 * satisfied by caching.
2863 *
2864 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2865 */
2866message DiskIo {
2867 optional int32 uid = 1 [(is_uid) = true];
2868 optional int64 fg_chars_read = 2;
2869 optional int64 fg_chars_write = 3;
2870 optional int64 fg_bytes_read = 4;
2871 optional int64 fg_bytes_write = 5;
2872 optional int64 bg_chars_read = 6;
2873 optional int64 bg_chars_write = 7;
2874 optional int64 bg_bytes_read = 8;
2875 optional int64 bg_bytes_write = 9;
2876 optional int64 fg_fsync = 10;
2877 optional int64 bg_fsync= 11;
2878}
2879
2880
2881/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002882 * Pulls the number of fingerprints for each user.
2883 *
2884 * Pulled from StatsCompanionService, which queries FingerprintManager.
2885 */
2886message NumFingerprints {
2887 // The associated user. Eg: 0 for owners, 10+ for others.
2888 // Defined in android/os/UserHandle.java
2889 optional int32 user = 1;
2890 // Number of fingerprints registered to that user.
2891 optional int32 num_fingerprints = 2;
2892}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002893
Yangsteraf9aee72018-10-12 09:26:16 -07002894message AggStats {
2895 optional int64 min = 1;
2896
2897 optional int64 average = 2;
2898
2899 optional int64 max = 3;
2900}
2901
2902message ProcessStatsStateProto {
2903 optional android.service.procstats.ScreenState screen_state = 1;
2904
2905 optional android.service.procstats.MemoryState memory_state = 2;
2906
2907 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2908 // and not frameworks/base/core/java/android/app/ActivityManager.java
2909 optional android.service.procstats.ProcessState process_state = 3;
2910
2911 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002912 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002913
2914 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002915 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002916
2917 // # of samples taken
2918 optional int32 sample_size = 5;
2919
2920 // PSS is memory reserved for this process
2921 optional AggStats pss = 6;
2922
2923 // USS is memory shared between processes, divided evenly for accounting
2924 optional AggStats uss = 7;
2925
2926 // RSS is memory resident for this process
2927 optional AggStats rss = 8;
2928}
2929
2930// Next Tag: 7
2931message ProcessStatsProto {
2932 // Name of process.
2933 optional string process = 1;
2934
2935 // Uid of the process.
2936 optional int32 uid = 2;
2937
2938 // Information about how often kills occurred
2939 message Kill {
2940 // Count of excessive CPU kills
2941 optional int32 cpu = 1;
2942
2943 // Count of kills when cached
2944 optional int32 cached = 2;
2945
2946 // PSS stats during cached kill
2947 optional AggStats cached_pss = 3;
2948 }
2949 optional Kill kill = 3;
2950
2951 // Time and memory spent in various states.
2952 repeated ProcessStatsStateProto states = 5;
2953
2954 // Total time process has been running... screen_state, memory_state, and process_state
2955 // will not be set.
2956 optional ProcessStatsStateProto total_running_state = 6;
2957}
2958
2959message PackageServiceOperationStatsProto {
2960 // Operate enum: Started, Foreground, Bound, Executing
2961 optional android.service.procstats.ServiceOperationState operation = 1;
2962
2963 // Number of times the service was in this operation.
2964 optional int32 count = 2;
2965
2966 // Information about a state the service can be in.
2967 message StateStats {
2968 // Screen state enum.
2969 optional android.service.procstats.ScreenState screen_state = 1;
2970 // Memory state enum.
2971 optional android.service.procstats.MemoryState memory_state = 2;
2972
2973 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07002974 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002975 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002976 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002977 }
2978 repeated StateStats state_stats = 3;
2979}
2980
2981message PackageServiceStatsProto {
2982 // Name of service component.
2983 optional string service_name = 1;
2984
2985 // The operation stats.
2986 // The package_name, package_uid, package_version, service_name will not be set to save space.
2987 repeated PackageServiceOperationStatsProto operation_stats = 2;
2988}
2989
2990message PackageAssociationSourceProcessStatsProto {
2991 // Uid of the process.
2992 optional int32 process_uid = 1;
2993 // Process name.
2994 optional string process_name = 2;
2995
2996 // Total count of the times this association appeared.
2997 optional int32 total_count = 3;
2998
2999 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07003000 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003001
3002 // Total count of the times this association became actively impacting its target process.
3003 optional int32 active_count = 5;
3004
3005 // Information on one source in this association.
3006 message StateStats {
3007 // Process state enum.
3008 optional android.service.procstats.ProcessState process_state = 1;
3009 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003010 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003011 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07003012 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003013 }
3014 repeated StateStats active_state_stats = 6;
3015}
3016
3017message PackageAssociationProcessStatsProto {
3018 // Name of the target component.
3019 optional string component_name = 1;
3020 // Information on one source in this association.
3021 repeated PackageAssociationSourceProcessStatsProto sources = 2;
3022}
3023
3024
3025message ProcessStatsPackageProto {
3026 // Name of package.
3027 optional string package = 1;
3028
3029 // Uid of the package.
3030 optional int32 uid = 2;
3031
3032 // Version of the package.
3033 optional int64 version = 3;
3034
3035 // Stats for each process running with the package loaded in to it.
3036 repeated ProcessStatsProto process_stats = 4;
3037
3038 // Stats for each of the package's services.
3039 repeated PackageServiceStatsProto service_stats = 5;
3040
3041 // Stats for each association with the package.
3042 repeated PackageAssociationProcessStatsProto association_stats = 6;
3043}
3044
3045message ProcessStatsSectionProto {
3046 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003047 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07003048
3049 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003050 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07003051
3052 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003053 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07003054
3055 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07003056 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07003057
3058 // System runtime library. e.g. "libdvm.so", "libart.so".
3059 optional string runtime = 5;
3060
3061 // whether kernel reports swapped pss.
3062 optional bool has_swapped_pss = 6;
3063
3064 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
3065 enum Status {
3066 STATUS_UNKNOWN = 0;
3067 STATUS_COMPLETE = 1;
3068 STATUS_PARTIAL = 2;
3069 STATUS_SHUTDOWN = 3;
3070 STATUS_SYSPROPS = 4;
3071 }
3072 repeated Status status = 7;
3073
3074 // Stats for each process.
3075 repeated ProcessStatsProto process_stats = 8;
3076
3077 // Stats for each package.
3078 repeated ProcessStatsPackageProto package_stats = 9;
3079}
3080
Chenjie Yu12e5e672018-09-14 15:54:59 -07003081/**
3082 * Pulled from ProcessStatsService.java
3083 */
3084message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003085 optional ProcessStatsSectionProto proc_stats_section = 1;
3086}
3087
3088message PowerProfileProto {
3089 optional double cpu_suspend = 1;
3090
3091 optional double cpu_idle = 2;
3092
3093 optional double cpu_active = 3;
3094
3095 message CpuCluster {
3096 optional int32 id = 1;
3097 optional double cluster_power = 2;
3098 optional int32 cores = 3;
3099 repeated int64 speed = 4;
3100 repeated double core_power = 5;
3101 }
3102
3103 repeated CpuCluster cpu_cluster = 40;
3104
3105 optional double wifi_scan = 4;
3106
3107 optional double wifi_on = 5;
3108
3109 optional double wifi_active = 6;
3110
3111 optional double wifi_controller_idle = 7;
3112
3113 optional double wifi_controller_rx = 8;
3114
3115 optional double wifi_controller_tx = 9;
3116
3117 repeated double wifi_controller_tx_levels = 10;
3118
3119 optional double wifi_controller_operating_voltage = 11;
3120
3121 optional double bluetooth_controller_idle = 12;
3122
3123 optional double bluetooth_controller_rx = 13;
3124
3125 optional double bluetooth_controller_tx = 14;
3126
3127 optional double bluetooth_controller_operating_voltage = 15;
3128
3129 optional double modem_controller_sleep = 16;
3130
3131 optional double modem_controller_idle = 17;
3132
3133 optional double modem_controller_rx = 18;
3134
3135 repeated double modem_controller_tx = 19;
3136
3137 optional double modem_controller_operating_voltage = 20;
3138
3139 optional double gps_on = 21;
3140
3141 repeated double gps_signal_quality_based = 22;
3142
3143 optional double gps_operating_voltage = 23;
3144
3145 optional double bluetooth_on = 24;
3146
3147 optional double bluetooth_active = 25;
3148
3149 optional double bluetooth_at_cmd = 26;
3150
3151 optional double ambient_display = 27;
3152
3153 optional double screen_on = 28;
3154
3155 optional double radio_on = 29;
3156
3157 optional double radio_scanning = 30;
3158
3159 optional double radio_active = 31;
3160
3161 optional double screen_full = 32;
3162
3163 optional double audio = 33;
3164
3165 optional double video = 34;
3166
3167 optional double flashlight = 35;
3168
3169 optional double memory = 36;
3170
3171 optional double camera = 37;
3172
3173 optional double wifi_batched_scan = 38;
3174
3175 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003176}
Chenjie Yuab530202018-09-26 12:39:20 -07003177
3178/**
3179 * power_profile.xml and other constants for power model calculations.
3180 * Pulled from PowerProfile.java
3181 */
3182message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003183 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003184}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003185
3186/**
arangelovd5db50e2018-10-12 20:24:39 +01003187 * Logs when a user restriction was added or removed.
3188 *
3189 * Logged from:
3190 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3191 */
3192message UserRestrictionChanged {
3193 // The raw string of the user restriction as defined in UserManager.
3194 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3195 optional string restriction = 1;
3196 // Whether the restriction is enabled or disabled.
3197 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003198}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003199
3200/**
3201 * Pulls process user time and system time. Puller takes a snapshot of all pids
3202 * in the system and returns cpu stats for those that are working at the time.
3203 * Dead pids will be dropped. Kernel processes are excluded.
3204 * Min cool-down is 5 sec.
3205 */
3206message ProcessCpuTime {
3207 optional int32 uid = 1 [(is_uid) = true];
3208
3209 optional string process_name = 2;
3210 // Process cpu time in user space, cumulative from boot/process start
3211 optional int64 user_time_millis = 3;
3212 // Process cpu time in system space, cumulative from boot/process start
3213 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003214}
Misha Wagner5a51e002018-10-03 15:04:09 +01003215
3216/**
3217 * Pulls the CPU usage for each thread.
3218 *
3219 * Read from /proc/$PID/task/$TID/time_in_state files.
3220 *
3221 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3222 * time_in_state files not being present on some phones, have not been addressed. These should be
3223 * considered before a public release.
3224 */
3225message CpuTimePerThreadFreq {
3226 // UID that owns the process.
3227 optional int32 uid = 1 [(is_uid) = true];
3228 // ID of the process.
3229 optional uint32 process_id = 2;
3230 // ID of the thread.
3231 optional uint32 thread_id = 3;
3232 // Name of the process taken from `/proc/$PID/cmdline`.
3233 optional string process_name = 4;
3234 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3235 optional string thread_name = 5;
3236 // What frequency the CPU was running at, in KHz
3237 optional uint32 frequency_khz = 6;
3238 // Time spent in frequency in milliseconds, since thread start.
3239 optional uint32 time_millis = 7;
3240}