blob: 356f2443141ed6ceb769e8229bd5efc8d762dc4c [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Fan Zhangf837b8e2018-10-23 12:38:30 -070025import "frameworks/base/core/proto/android/app/settings_enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070026import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080027import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080028import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080029import "frameworks/base/core/proto/android/server/enums.proto";
Yangsteraf9aee72018-10-12 09:26:16 -070030import "frameworks/base/core/proto/android/service/procstats_enum.proto";
31import "frameworks/base/core/proto/android/stats/enums.proto";
Yao Chen8c433862018-10-24 14:09:20 -070032import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080033import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080034import "frameworks/base/core/proto/android/telephony/enums.proto";
35import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080036
Yao Chend54f9dd2017-10-17 17:37:48 +000037/**
Stefan Lafonae2df012017-11-14 09:17:21 -080038 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000039 * raw stats log events from the Android system, also known as "atoms."
40 *
41 * This field contains a single oneof with all of the available messages.
42 * The stats-log-api-gen tool runs as part of the Android build and
43 * generates the android.util.StatsLog class, which contains the constants
44 * and methods that Android uses to log.
45 *
Stefan Lafonae2df012017-11-14 09:17:21 -080046 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000047 * Instead, statsd on Android constructs these messages synthetically,
48 * in the format defined here and in stats_log.proto.
49 */
Stefan Lafonae2df012017-11-14 09:17:21 -080050message Atom {
51 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070052 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070053 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
54 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070055 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070056 BleScanResultReceived ble_scan_result_received = 4;
57 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080058 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070059 SyncStateChanged sync_state_changed = 7;
60 ScheduledJobStateChanged scheduled_job_state_changed = 8;
61 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070062 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080063 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
64 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
65 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070066 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
67 MemoryFactorStateChanged memory_factor_state_changed = 15;
68 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
69 CachedKillReported cached_kill_reported = 17;
70 ProcessMemoryStatReported process_memory_stat_reported = 18;
Hyunyoung Songc6d6b772018-10-17 13:35:32 -070071 LauncherUIChanged launcher_event = 19;
Bookatzddccf0a2017-11-28 16:48:14 -080072 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
73 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
74 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070075 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080076 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070077 CameraStateChanged camera_state_changed = 25;
78 FlashlightStateChanged flashlight_state_changed = 26;
79 UidProcessStateChanged uid_process_state_changed = 27;
80 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
81 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070082 BatteryLevelChanged battery_level_changed = 30;
83 ChargingStateChanged charging_state_changed = 31;
84 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070085 InteractiveStateChanged interactive_state_changed = 33;
86 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070087 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
88 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070089 WifiLockStateChanged wifi_lock_state_changed = 37;
90 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
91 WifiScanStateChanged wifi_scan_state_changed = 39;
92 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070093 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070094 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070095 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090096 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070097 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080098 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080099 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800100 AppStartOccurred app_start_occurred = 48;
101 AppStartCanceled app_start_canceled = 49;
102 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800104 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800105 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800106 LmkStateChanged lmk_state_changed = 54;
107 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800108 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800109 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800110 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800111 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800112 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800113 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800114 KeyguardStateChanged keyguard_state_changed = 62;
115 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
116 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800117 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800118 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800119 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
120 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700121 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700122 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800123 SpeakerImpedanceReported speaker_impedance_reported = 71;
124 HardwareFailed hardware_failed = 72;
125 PhysicalDropDetected physical_drop_detected = 73;
126 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800127 MobileConnectionStateChanged mobile_connection_state_changed = 75;
128 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700129 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800130 AppCrashOccurred app_crash_occurred = 78;
131 ANROccurred anr_occurred = 79;
132 WTFOccurred wtf_occurred = 80;
133 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700134 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700135 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700136 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700137 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700138 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700139 FingerprintAcquired fingerprint_acquired = 87;
140 FingerprintAuthenticated fingerprint_authenticated = 88;
141 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700142 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700143 BatteryHealthSnapshot battery_health_snapshot = 91;
144 SlowIo slow_io = 92;
145 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700146 PhoneServiceStateChanged phone_service_state_changed = 94;
147 PhoneStateChanged phone_state_changed = 95;
arangelovd5db50e2018-10-12 20:24:39 +0100148 UserRestrictionChanged user_restriction_changed = 96;
Fan Zhang916c13b2018-10-16 22:49:45 -0700149 SettingsUIChanged settings_ui_changed = 97;
Yao Chend54f9dd2017-10-17 17:37:48 +0000150 }
David Chenc8a43242017-10-17 16:23:28 -0700151
David Chen6e3e6cb2018-01-03 16:14:06 -0800152 // Pulled events will start at field 10000.
Misha Wagner5a51e002018-10-03 15:04:09 +0100153 // Next: 10038
David Chenc8a43242017-10-17 16:23:28 -0700154 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800155 WifiBytesTransfer wifi_bytes_transfer = 10000;
156 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
157 MobileBytesTransfer mobile_bytes_transfer = 10002;
158 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800159 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800160 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800161 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800162 CpuTimePerFreq cpu_time_per_freq = 10008;
163 CpuTimePerUid cpu_time_per_uid = 10009;
164 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800165 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800166 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800167 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800168 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800169 SystemElapsedRealtime system_elapsed_realtime = 10014;
170 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800171 CpuActiveTime cpu_active_time = 10016;
172 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000173 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800174 RemainingBatteryCapacity remaining_battery_capacity = 10019;
175 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800176 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100177 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100178 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100179 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000180 DiskStats disk_stats = 10025;
181 DirectoryUsage directory_usage = 10026;
182 AppSize app_size = 10027;
183 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700184 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700185 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700186 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700187 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700188 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700189 ProcStats proc_stats_pkg_proc = 10034;
Yangster-mac308ea0c2018-10-22 13:10:25 -0700190 ProcessCpuTime process_cpu_time = 10035;
Rafal Slawik08621582018-10-15 14:53:07 +0100191 NativeProcessMemoryState native_process_memory_state = 10036;
Misha Wagner5a51e002018-10-03 15:04:09 +0100192 CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037;
David Chenc8a43242017-10-17 16:23:28 -0700193 }
yroa1fe77c2018-02-26 14:22:54 -0800194
Bookatz76aafcf2018-09-17 16:17:10 -0700195 // DO NOT USE field numbers above 100,000 in AOSP.
196 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
197 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700198}
199
Yao Chend54f9dd2017-10-17 17:37:48 +0000200/**
Yangster-mac20877162017-12-22 17:19:39 -0800201 * This proto represents a node of an attribution chain.
202 * Note: All attribution chains are represented as a repeated field of type
203 * AttributionNode. It is understood that in such arrays, the order is that
204 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000205 */
Yangster-mac20877162017-12-22 17:19:39 -0800206message AttributionNode {
207 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800208 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800209
Yangster-mac20877162017-12-22 17:19:39 -0800210 // The (optional) string tag for an element in the attribution chain. If the
211 // element has no tag, it is encoded as an empty string.
212 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700213}
214
Yangster-mac48b3d622018-08-18 12:38:11 -0700215message KeyValuePair {
216 optional int32 key = 1;
217 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700218 int32 value_int = 2;
219 int64 value_long = 3;
220 string value_str = 4;
221 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700222 }
223}
224
225message KeyValuePairsAtom {
226 optional int32 uid = 1;
227 repeated KeyValuePair pairs = 2;
228}
229
Yao Chend54f9dd2017-10-17 17:37:48 +0000230/*
231 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800232 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000233 *
234 * RULES:
235 * - The field ids for each atom must start at 1, and count upwards by 1.
236 * Skipping field ids is not allowed.
237 * - These form an API, so renaming, renumbering or removing fields is
238 * not allowed between android releases. (This is not currently enforced,
239 * but there will be a tool to enforce this restriction).
240 * - The types must be built-in protocol buffer types, namely, no sub-messages
241 * are allowed (yet). The bytes type is also not allowed.
242 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800243 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000244 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800245 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000246 * - A field that is a uid should be a string field, tagged with the [xxx]
247 * annotation. The generated code on android will be represented by UIDs,
248 * and those UIDs will be translated in xxx to those strings.
249 *
250 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700251 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000252 * - If there is a UID, it goes first. Think in an object-oriented fashion.
253 * *****************************************************************************
254 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700255
Yao Chend54f9dd2017-10-17 17:37:48 +0000256/**
Yangster-mace16189a2018-08-26 12:20:16 -0700257 * Logs when the Thermal service HAL notifies the throttling start/stop events.
258 *
259 * Logged from:
260 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
261 */
262message ThermalThrottlingStateChanged {
263 optional android.os.TemperatureTypeEnum sensor_type = 1;
264
265 enum State {
266 UNKNOWN = 0;
267 START = 1;
268 STOP = 2;
269 }
270
271 optional State state = 2;
272
273 optional float temperature = 3;
274}
275
276/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000277 * Logs when the screen state changes.
278 *
279 * Logged from:
280 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
281 */
282message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800283 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700284 optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700285}
Yao Chend54f9dd2017-10-17 17:37:48 +0000286
287/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700288 * Logs that the process state of the uid, as determined by ActivityManager
289 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000290 *
291 * Logged from:
292 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
293 */
Bookatzc1a050a2017-10-10 15:49:28 -0700294message UidProcessStateChanged {
Yangster-macb6b77c62018-10-12 19:33:24 -0700295 optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000296
Bookatzdb026a22018-01-10 19:01:56 -0800297 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yangster-macb6b77c62018-10-12 19:33:24 -0700298 optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000299}
300
301/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700302 * Logs process state change of a process, as per the activity manager.
303 *
304 * Logged from:
305 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
306 */
307message ProcessStateChanged {
308 optional int32 uid = 1;
309 optional string process_name = 2;
310 optional string package_name = 3;
311 // TODO: remove this when validation is done
312 optional int64 version = 5;
313 // The state, from frameworks/base/core/proto/android/app/enums.proto.
314 optional android.app.ProcessStateEnum state = 4;
315}
316
317/**
318 * Logs when ActivityManagerService sleep state is changed.
319 *
320 * Logged from:
321 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
322 */
323message ActivityManagerSleepStateChanged {
324 // TODO: import frameworks proto
325 enum State {
326 UNKNOWN = 0;
327 ASLEEP = 1;
328 AWAKE = 2;
329 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700330 optional State state = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700331}
332
333/**
334 * Logs when system memory state changes.
335 *
336 * Logged from:
337 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
338 */
339message MemoryFactorStateChanged {
340 // TODO: import frameworks proto
341 enum State {
342 MEMORY_UNKNOWN = 0;
343 NORMAL = 1; // normal.
344 MODERATE = 2; // moderate memory pressure.
345 LOW = 3; // low memory.
346 CRITICAL = 4; // critical memory.
347
348 }
Yangster-macb6b77c62018-10-12 19:33:24 -0700349 optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700350}
351
352/**
353 * Logs when app is using too much cpu, according to ActivityManagerService.
354 *
355 * Logged from:
356 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
357 */
358message ExcessiveCpuUsageReported {
359 optional int32 uid = 1;
360 optional string process_name = 2;
361 optional string package_name = 3;
362 // package version. TODO: remove this when validation is done
363 optional int64 version = 4;
364}
365
366/**
367 * Logs when a cached process is killed, along with its pss.
368 *
369 * Logged from:
370 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
371 */
372message CachedKillReported {
373 optional int32 uid = 1;
374 optional string process_name = 2;
375 optional string package_name = 3;
376 // TODO: remove this when validation is done
377 optional int64 version = 5;
378 optional int64 pss = 4;
379}
380
381/**
382 * Logs when memory stats of a process is reported.
383 *
384 * Logged from:
385 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
386 */
387message ProcessMemoryStatReported {
388 optional int32 uid = 1;
389 optional string process_name = 2;
390 optional string package_name = 3;
391 //TODO: remove this when validation is done
392 optional int64 version = 9;
393 optional int64 pss = 4;
394 optional int64 uss = 5;
395 optional int64 rss = 6;
396 enum Type {
397 ADD_PSS_INTERNAL_SINGLE = 0;
398 ADD_PSS_INTERNAL_ALL_MEM = 1;
399 ADD_PSS_INTERNAL_ALL_POLL = 2;
400 ADD_PSS_EXTERNAL = 3;
401 ADD_PSS_EXTERNAL_SLOW = 4;
402 }
403 optional Type type = 7;
404 optional int64 duration = 8;
405}
406
407/**
Bookatzc1a050a2017-10-10 15:49:28 -0700408 * Logs that a process started, finished, crashed, or ANRed.
409 *
410 * Logged from:
411 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
412 */
413message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700414 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700415
David Chen0b5c90c2018-01-25 16:51:49 -0800416 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800417 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700418
Bookatzddccf0a2017-11-28 16:48:14 -0800419 // What lifecycle state the process changed to.
420 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800421 enum State {
422 FINISHED = 0;
423 STARTED = 1;
424 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800425 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800426 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700427}
428
Bookatzc1a050a2017-10-10 15:49:28 -0700429/**
430 * Logs when the ble scan state changes.
431 *
432 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700433 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700434 */
435message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800436 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700437
438 enum State {
439 OFF = 0;
440 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700441 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
442 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700443 }
444 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700445
Bookatze5ec0b42018-03-26 13:34:56 -0700446 // Does the scan have a filter.
447 optional bool is_filtered = 3;
448 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
449 optional bool is_first_match = 4;
450 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
451 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700452}
453
454/**
455 * Logs reporting of a ble scan finding results.
456 *
457 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700458 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700459 */
Bookatzae6738e2018-09-13 11:38:56 -0700460// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700461message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800462 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700463
464 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800465 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700466}
467
468/**
469 * Logs when a sensor state changes.
470 *
471 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700472 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700473 */
474message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800475 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700476
Bookatzc1a050a2017-10-10 15:49:28 -0700477 // The id (int) of the sensor.
478 optional int32 sensor_id = 2;
479
480 enum State {
481 OFF = 0;
482 ON = 1;
483 }
484 optional State state = 3;
485}
486
487
488/**
489 * Logs when GPS state changes.
490 *
491 * Logged from:
492 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
493 */
494message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800495 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700496
497 enum State {
498 OFF = 0;
499 ON = 1;
500 }
501 optional State state = 2;
502}
503
504
505/**
506 * Logs when a sync manager sync state changes.
507 *
508 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700509 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700510 */
511message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800512 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700513
David Chen0b5c90c2018-01-25 16:51:49 -0800514 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800515 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700516
517 enum State {
518 OFF = 0;
519 ON = 1;
520 }
521 optional State state = 3;
522}
523
Yangster-mac96353002018-09-05 11:18:55 -0700524/*
525 * Deferred job stats.
526 *
527 * Logged from:
528 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
529*/
530message DeferredJobStatsReported {
531 repeated AttributionNode attribution_node = 1;
532
533 // Number of jobs deferred.
534 optional int32 num_jobs_deferred = 2;
535
536 // Time since the last job runs.
537 optional int64 time_since_last_job_millis = 3;
538}
539
Bookatzc1a050a2017-10-10 15:49:28 -0700540/**
541 * Logs when a job scheduler job state changes.
542 *
543 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700544 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700545 */
546message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800547 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700548
549 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800550 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700551
552 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800553 FINISHED = 0;
554 STARTED = 1;
555 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700556 }
557 optional State state = 3;
558
Tej Singh33a412b2018-03-16 18:43:59 -0700559 // The reason a job has stopped.
560 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700561 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700562 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700563}
564
565/**
566 * Logs when the audio state changes.
567 *
568 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700569 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700570 */
571message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800572 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700573
574 enum State {
575 OFF = 0;
576 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700577 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
578 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700579 }
580 optional State state = 2;
581}
582
583/**
584 * Logs when the video codec state changes.
585 *
586 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700587 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700588 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800589message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800590 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700591
592 enum State {
593 OFF = 0;
594 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700595 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
596 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700597 }
598 optional State state = 2;
599}
600
601/**
602 * Logs when the flashlight state changes.
603 *
604 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700605 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700606 */
607message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800608 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700609
610 enum State {
611 OFF = 0;
612 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700613 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
614 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700615 }
616 optional State state = 2;
617}
618
619/**
620 * Logs when the camera state changes.
621 *
622 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700623 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700624 */
625message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800626 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700627
628 enum State {
629 OFF = 0;
630 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700631 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
632 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700633 }
634 optional State state = 2;
635}
636
637/**
638 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000639 *
640 * Logged from:
641 * TODO
642 */
Bookatzd6746242017-10-24 18:39:35 -0700643message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800644 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000645
Bookatz1a1b0462018-01-12 11:47:03 -0800646 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
647 // From frameworks/base/core/proto/android/os/enums.proto.
Yangster-maca8a30442018-10-13 23:46:34 -0700648 optional android.os.WakeLockLevelEnum type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700649
650 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
651 optional string tag = 3;
652
653 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800654 RELEASE = 0;
655 ACQUIRE = 1;
656 CHANGE_RELEASE = 2;
657 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700658 }
659 optional State state = 4;
660}
661
662/**
Bookatzc1a050a2017-10-10 15:49:28 -0700663 * Logs when a partial wakelock is considered 'long' (over 1 min).
664 *
665 * Logged from:
666 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
667 */
668message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800669 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700670
Yao Chend54f9dd2017-10-17 17:37:48 +0000671 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
672 optional string tag = 2;
673
Bookatzc1a050a2017-10-10 15:49:28 -0700674 // TODO: I have no idea what this is.
675 optional string history_tag = 3;
676
677 enum State {
678 OFF = 0;
679 ON = 1;
680 }
681 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000682}
683
Bookatzc1a050a2017-10-10 15:49:28 -0700684/**
Bookatza66083f2018-09-20 17:24:00 -0700685 * Logs when the device is interactive, according to the PowerManager Notifier.
686 *
687 * Logged from:
688 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
689 */
690message InteractiveStateChanged {
691 enum State {
692 OFF = 0;
693 ON = 1;
694 }
695 optional State state = 1;
696}
697
698/**
Bookatzc1a050a2017-10-10 15:49:28 -0700699 * Logs Battery Saver state change.
700 *
701 * Logged from:
702 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
703 */
704message BatterySaverModeStateChanged {
705 enum State {
706 OFF = 0;
707 ON = 1;
708 }
709 optional State state = 1;
710}
711
712/**
713 * Logs Doze mode state change.
714 *
715 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800716 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700717 */
718message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800719 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800720}
721
722
723/**
724 * Logs state change of Doze mode including maintenance windows.
725 *
726 * Logged from:
727 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
728 */
729message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800730 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700731}
732
733/**
734 * Logs screen brightness level.
735 *
736 * Logged from:
737 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
738 */
739message ScreenBrightnessChanged {
740 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
741 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700742}
743
744/**
745 * Logs battery level (percent full, from 0 to 100).
746 *
747 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700748 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700749 */
750message BatteryLevelChanged {
751 // Battery level. Should be in [0, 100].
752 optional int32 battery_level = 1;
753}
754
755/**
756 * Logs change in charging status of the device.
757 *
758 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700759 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700760 */
761message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800762 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
763 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700764}
765
766/**
767 * Logs whether the device is plugged in, and what power source it is using.
768 *
769 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700770 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700771 */
772message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800773 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
774 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700775}
776
Bookatz8c6571b2017-10-24 15:04:41 -0700777/**
778 * Logs when an app's wakeup alarm fires.
779 *
780 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700781 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700782 */
783message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800784 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800785
786 // Name of the wakeup alarm.
787 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700788
789 // Name of source package (for historical reasons, since BatteryStats tracked it).
790 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800791}
792
793/**
794 * Logs when an an app causes the mobile radio to change state.
795 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
796 *
797 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700798 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800799 */
800message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800801 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800802
Bookatz1a1b0462018-01-12 11:47:03 -0800803 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
804 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800805}
806
807/**
808 * Logs when an an app causes the wifi radio to change state.
809 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
810 *
811 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700812 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800813 */
814message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800815 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800816
Bookatz1a1b0462018-01-12 11:47:03 -0800817 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
818 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700819}
820
821/**
822 * Logs kernel wakeup reasons and aborts.
823 *
824 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700825 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700826 */
827message KernelWakeupReported {
828 // Name of the kernel wakeup reason (or abort).
829 optional string wakeup_reason_name = 1;
830
831 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800832 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700833}
834
835/**
836 * Logs wifi locks held by an app.
837 *
838 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700839 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700840 */
841message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800842 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700843
844 enum State {
845 OFF = 0;
846 ON = 1;
847 }
848 optional State state = 2;
849}
850
851/**
852 * Logs wifi signal strength changes.
853 *
854 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700855 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700856 */
857message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800858 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
859 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700860}
861
862/**
863 * Logs wifi scans performed by an app.
864 *
865 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700866 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700867 */
868message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800869 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700870
871 enum State {
872 OFF = 0;
873 ON = 1;
874 }
875 optional State state = 2;
876}
877
878/**
Tej Singh4503e102018-01-04 14:35:01 -0800879 * Logs wifi multicast locks held by an app
880 *
881 * Logged from:
882 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
883 */
884message WifiMulticastLockStateChanged {
885 repeated AttributionNode attribution_node = 1;
886
887 enum State {
888 OFF = 0;
889 ON = 1;
890 }
891 optional State state = 2;
892}
893
894/**
Tej Singh1ea42892018-01-19 09:27:00 -0800895 * Logs shutdown reason and duration on next boot.
896 *
897 * Logged from:
898 * frameworks/base/core/java/com/android/server/BootReceiver.java
899 */
900message ShutdownSequenceReported {
901 // True if shutdown is for a reboot. Default: false if we do not know.
902 optional bool reboot = 1;
903
904 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
905 optional string reason = 2;
906
907 // Beginning of shutdown time in ms using wall clock time since unix epoch.
908 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800909 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800910
911 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800912 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800913}
914
Tej Singh6483ea42018-01-25 17:45:49 -0800915
916/**
917 * Logs boot reason and duration.
918 *
919 * Logged from:
920 * system/core/bootstat/bootstat.cpp
921 */
922message BootSequenceReported {
923 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
924 // Default: "<EMPTY>" if not available.
925 optional string bootloader_reason = 1;
926
927 // Reason for system boot. Eg. bootloader, reboot,userrequested
928 // Default: "<EMPTY>" if not available.
929 optional string system_reason = 2;
930
931 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800932 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800933
934 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800935 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800936
937 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800938 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800939
940 // Time since last boot in ms. Default: 0 if not available.
941 optional int64 time_since_last_boot = 6;
942}
943
Tej Singhc477d9c2018-02-05 18:31:39 -0800944
945/**
946 * Logs call state and disconnect cause (if applicable).
947 *
948 * Logged from:
949 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
950 */
951message CallStateChanged {
952 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
953 // From frameworks/base/core/proto/android/telecomm/enums.proto.
954 optional android.telecom.CallStateEnum call_state = 1;
955
956 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
957 // This value is only applicable when the call_state is DISCONNECTED, and
958 // should always be UNKNOWN if the call_state is not DISCONNECTED.
959 // From frameworks/base/core/proto/android/telecomm/enums.proto.
960 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
961
962 // True if the call is self-managed, which are apps that use the
963 // telecom infrastructure to make their own calls.
964 optional bool self_managed = 3;
965
966 // True if call is external. External calls are calls on connected Wear
967 // devices but show up in Telecom so the user can pull them onto the device.
968 optional bool external_call = 4;
969}
970
Tej Singh1ea42892018-01-19 09:27:00 -0800971/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800972 * Logs keyguard state. The keyguard is the lock screen.
973 *
974 * Logged from:
975 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
976 */
977message KeyguardStateChanged {
978 enum State {
979 UNKNOWN = 0;
980 // The keyguard is hidden when the phone is unlocked.
981 HIDDEN = 1;
982 // The keyguard is shown when the phone is locked (screen turns off).
983 SHOWN= 2;
984 // The keyguard is occluded when something is overlaying the keyguard.
985 // Eg. Opening the camera while on the lock screen.
986 OCCLUDED = 3;
987 }
988 optional State state = 1;
989}
990
991/**
992 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
993 * prompts the user to enter a password (pattern, pin, etc).
994 *
995 * Logged from:
996 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
997 */
998
999message KeyguardBouncerStateChanged {
1000 enum State {
1001 UNKNOWN = 0;
1002 // Bouncer is hidden, either as a result of successfully entering the
1003 // password, screen timing out, or user going back to lock screen.
1004 HIDDEN = 1;
1005 // This is when the user is being prompted to enter the password.
1006 SHOWN = 2;
1007 }
1008 optional State state = 1;
1009}
1010
1011/**
1012 * Logs the result of entering a password into the keyguard bouncer.
1013 *
1014 * Logged from:
1015 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1016 */
1017message KeyguardBouncerPasswordEntered {
1018 enum BouncerResult {
1019 UNKNOWN = 0;
1020 // The password entered was incorrect.
1021 FAILURE = 1;
1022 // The password entered was correct.
1023 SUCCESS = 2;
1024 }
1025 optional BouncerResult result = 1;
1026}
1027
Tej Singha883b372018-02-15 11:30:01 -08001028/*
1029 * Logs changes to the configuration of the device. The configuration is defined
1030 * in frameworks/base/core/java/android/content/res/Configuration.java
1031 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1032 * Please go there to interpret the possible values each field can be.
1033 *
1034 * Logged from:
1035 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1036 */
1037message ResourceConfigurationChanged {
1038 // Bit mask of color capabilities of the screen.
1039 // Contains information about the color gamut and hdr mode of the screen.
1040 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
Yangster-maca8a30442018-10-13 23:46:34 -07001041 optional int32 color_mode = 1;
Tej Singha883b372018-02-15 11:30:01 -08001042
1043 // The target screen density being rendered to.
1044 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
Yangster-maca8a30442018-10-13 23:46:34 -07001045 optional int32 density_dpi = 2;
Tej Singha883b372018-02-15 11:30:01 -08001046
1047 // Current user preference for the scaling factor for fonts,
1048 // relative to the base density scaling.
1049 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
Yangster-maca8a30442018-10-13 23:46:34 -07001050 optional float font_scale = 3;
Tej Singha883b372018-02-15 11:30:01 -08001051
1052 // Flag indicating whether the hard keyboard is hidden.
1053 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001054 optional int32 hard_keyboard_hidden = 4;
Tej Singha883b372018-02-15 11:30:01 -08001055
1056 // The type of keyboard attached to the device.
1057 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1058 optional int32 keyboard = 5;
1059
1060 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1061 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001062 optional int32 keyboard_hidden = 6;
Tej Singha883b372018-02-15 11:30:01 -08001063
1064 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1065 // 0 if undefined.
1066 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1067 optional int32 mcc = 7;
1068
1069 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1070 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1071 // MNC_ZERO symbol defined in Configuration.java.
1072 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1073 optional int32 mnc = 8;
1074
1075 // The kind of navigation available on the device.
1076 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1077 optional int32 navigation = 9;
1078
1079 // Flag indicating whether the navigation is available.
1080 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
Yangster-maca8a30442018-10-13 23:46:34 -07001081 optional int32 navigation_hidden = 10;
Tej Singha883b372018-02-15 11:30:01 -08001082
1083 // Overall orientation of the screen.
1084 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1085 optional int32 orientation = 11;
1086
1087 // The current height of the available screen space, in dp units.
1088 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
Yangster-maca8a30442018-10-13 23:46:34 -07001089 optional int32 screen_height_dp = 12;
Tej Singha883b372018-02-15 11:30:01 -08001090
1091 // Bit mask of overall layout of the screen.
1092 // Contains information about screen size, whether the screen is wider/taller
1093 // than normal, whether the screen layout is right-tl-left or left-to-right,
1094 // and whether the screen has a rounded shape.
1095 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
Yangster-maca8a30442018-10-13 23:46:34 -07001096 optional int32 screen_layout = 13;
Tej Singha883b372018-02-15 11:30:01 -08001097
1098 // Current width of the available screen space, in dp units.
1099 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001100 optional int32 screen_width_dp = 14;
Tej Singha883b372018-02-15 11:30:01 -08001101
1102 // The smallest screen size an application will see in normal operation.
1103 // This is the smallest value of both screenWidthDp and screenHeightDp
1104 // in portrait and landscape.
1105 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
Yangster-maca8a30442018-10-13 23:46:34 -07001106 optional int32 smallest_screen_width_dp = 15;
Tej Singha883b372018-02-15 11:30:01 -08001107
1108 // The type of touch screen attached to the device.
1109 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1110 optional int32 touchscreen = 16;
1111
1112 // Bit mask of the ui mode.
1113 // Contains information about the overall ui mode of the device.
1114 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1115 // Also contains information about whether the device is in night mode.
1116 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
Yangster-maca8a30442018-10-13 23:46:34 -07001117 optional int32 ui_mode = 17;
Tej Singha883b372018-02-15 11:30:01 -08001118}
1119
Tej Singheee317b2018-03-07 19:28:05 -08001120
1121/**
1122 * Logs changes in the connection state of the mobile radio.
1123 *
1124 * Logged from:
1125 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1126 */
1127message MobileConnectionStateChanged {
1128 // States are from the state machine DataConnection.java.
1129 enum State {
1130 UNKNOWN = 0;
1131 // The connection is inactive, or disconnected.
1132 INACTIVE = 1;
1133 // The connection is being activated, or connecting.
1134 ACTIVATING = 2;
1135 // The connection is active, or connected.
1136 ACTIVE = 3;
1137 // The connection is disconnecting.
1138 DISCONNECTING = 4;
1139 // The connection is disconnecting after creating a connection.
1140 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1141 }
1142 optional State state = 1;
1143 // For multi-sim phones, this distinguishes between the sim cards.
1144 optional int32 sim_slot_index = 2;
1145 // Used to identify the connection. Starts at 0 and increments by 1 for
1146 // every new network created. Resets whenever the device reboots.
1147 optional int32 data_connection_id = 3;
1148 // A bitmask for the capabilities of this connection.
1149 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1150 // Default value (if we have no information): 0
1151 optional int64 capabilities = 4;
1152 // If this connection has internet.
1153 // This just checks if the DEFAULT bit of capabilities is set.
1154 optional bool has_internet = 5;
1155}
1156
1157/**
1158 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1159 *
1160 * Logged from:
1161 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1162 */
1163message MobileRadioTechnologyChanged {
1164 optional android.telephony.NetworkTypeEnum state = 1;
1165 // For multi-sim phones, this distinguishes between the sim cards.
1166 optional int32 sim_slot_index = 2;
1167}
1168
Andrew Chantb56388b2018-03-22 21:07:33 -07001169/**
1170 * Logs the VID and PID of any connected USB devices.
1171 *
1172 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1173 *
1174 * Logged by Vendor.
1175 */
1176message UsbDeviceAttached {
1177 optional int32 vid = 1;
1178 optional int32 pid = 2;
1179 optional bool has_audio = 3;
1180 optional bool has_hid = 4;
1181 optional bool has_storage = 5;
1182}
1183
Tej Singheee317b2018-03-07 19:28:05 -08001184
Tej Singhdd7bd352018-02-09 19:33:15 -08001185/**
Tej Singh5d991e12018-03-09 19:48:11 -08001186 * Logs when Bluetooth is enabled and disabled.
1187 *
1188 * Logged from:
1189 * services/core/java/com/android/server/BluetoothManagerService.java
1190 */
1191message BluetoothEnabledStateChanged {
1192 repeated AttributionNode attribution_node = 1;
1193 // Whether or not bluetooth is enabled on the device.
1194 enum State {
1195 UNKNOWN = 0;
1196 ENABLED = 1;
1197 DISABLED = 2;
1198 }
1199 optional State state = 2;
1200 // The reason for being enabled/disabled.
1201 // Eg. Airplane mode, crash, application request.
1202 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1203 // If the reason is an application request, this will be the package name.
Yangster-maca8a30442018-10-13 23:46:34 -07001204 optional string pkg_name = 4;
Tej Singh5d991e12018-03-09 19:48:11 -08001205}
1206
1207/**
1208 * Logs when a Bluetooth device connects and disconnects.
1209 *
1210 * Logged from:
1211 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1212 */
1213message BluetoothConnectionStateChanged {
1214 // The state of the connection.
1215 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1216 optional android.bluetooth.ConnectionStateEnum state = 1;
1217 // An identifier that can be used to match connect and disconnect events.
1218 // Currently is last two bytes of a hash of a device level ID and
1219 // the mac address of the bluetooth device that is connected.
1220 optional int32 obfuscated_id = 2;
1221 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1222 // From android.bluetooth.BluetoothAdapter.java
1223 optional int32 bt_profile = 3;
1224}
1225
1226/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001227 * Logs when something is plugged into or removed from the USB-C connector.
1228 *
1229 * Logged from:
1230 * Vendor USB HAL.
1231 */
1232message UsbConnectorStateChanged {
1233 enum State {
1234 DISCONNECTED = 0;
1235 CONNECTED = 1;
1236 }
1237 optional State state = 1;
1238}
1239
1240/**
1241 * Logs the reported speaker impedance.
1242 *
1243 * Logged from:
1244 * Vendor audio implementation.
1245 */
1246message SpeakerImpedanceReported {
1247 optional int32 speaker_location = 1;
1248 optional int32 impedance = 2;
1249}
1250
1251/**
1252 * Logs the report of a failed hardware.
1253 *
1254 * Logged from:
1255 * Vendor HALs.
1256 *
1257 */
1258message HardwareFailed {
1259 enum HardwareType {
1260 HARDWARE_FAILED_UNKNOWN = 0;
1261 HARDWARE_FAILED_MICROPHONE = 1;
1262 HARDWARE_FAILED_CODEC = 2;
1263 HARDWARE_FAILED_SPEAKER = 3;
1264 HARDWARE_FAILED_FINGERPRINT = 4;
1265 }
1266 optional HardwareType hardware_type = 1;
1267
1268 /* hardware_location allows vendors to differentiate between multiple instances of
1269 * the same hardware_type. The specific locations are vendor defined integers,
1270 * referring to board-specific numbering schemes.
1271 */
1272 optional int32 hardware_location = 2;
1273
1274 /* failure_code is specific to the HardwareType of the failed hardware.
1275 * It should use the enum values defined below.
1276 */
1277 enum MicrophoneFailureCode {
1278 MICROPHONE_FAILURE_COMPLETE = 0;
1279 }
1280 enum CodecFailureCode {
1281 CODEC_FAILURE_COMPLETE = 0;
1282 }
1283 enum SpeakerFailureCode {
1284 SPEAKER_FAILURE_COMPLETE = 0;
1285 SPEAKER_FAILURE_HIGH_Z = 1;
1286 SPEAKER_FAILURE_SHORT = 2;
1287 }
1288 enum FingerprintFailureCode {
1289 FINGERPRINT_FAILURE_COMPLETE = 0;
1290 FINGERPRINT_SENSOR_BROKEN = 1;
1291 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1292 }
1293 optional int32 failure_code = 3;
1294}
1295
1296/**
1297 * Log an event when the device has been physically dropped.
1298 * Reported from the /vendor partition.
1299 */
1300message PhysicalDropDetected {
1301 // Confidence that the event was actually a drop, 0 -> 100
1302 optional int32 confidence_pctg = 1;
1303 // Peak acceleration of the drop, in 1/1000s of a g.
1304 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001305 // Duration of freefall in ms
1306 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001307}
1308
1309/**
1310 * Log bucketed battery charge cycles.
1311 *
1312 * Each bucket represents cycles of the battery past
Maggie White38c9d322018-11-20 10:07:52 -08001313 * a given charge point. For example, if 10 cycle buckets are
1314 * initialized, bucket 1 is the lowest 1/10th of the battery,
1315 * and bucket 10 is 100%.
Andrew Chant28d627e2018-02-22 15:17:05 -08001316 *
1317 * Logged from:
1318 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1319 */
1320message ChargeCyclesReported {
1321 optional int32 cycle_bucket_1 = 1;
1322 optional int32 cycle_bucket_2 = 2;
1323 optional int32 cycle_bucket_3 = 3;
1324 optional int32 cycle_bucket_4 = 4;
1325 optional int32 cycle_bucket_5 = 5;
1326 optional int32 cycle_bucket_6 = 6;
1327 optional int32 cycle_bucket_7 = 7;
1328 optional int32 cycle_bucket_8 = 8;
Maggie White38c9d322018-11-20 10:07:52 -08001329 optional int32 cycle_bucket_9 = 9;
1330 optional int32 cycle_bucket_10 = 10;
Andrew Chant28d627e2018-02-22 15:17:05 -08001331}
1332
1333/**
Howard Roa46b6582018-09-18 16:45:02 -07001334 * Log battery health snapshot.
1335 *
1336 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1337 * are snapshotted periodically over 24hrs.
1338 */
1339message BatteryHealthSnapshot {
1340 enum BatterySnapshotType {
1341 UNKNOWN = 0;
1342 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1343 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1344 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1345 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1346 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1347 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1348 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1349 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1350 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1351 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1352 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1353 }
1354 optional BatterySnapshotType type = 1;
1355 // Temperature, in 1/10ths of degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07001356 optional int32 temperature_deci_celsius = 2;
Howard Roa46b6582018-09-18 16:45:02 -07001357 // Voltage Battery Voltage, in microVolts.
1358 optional int32 voltage_micro_volt = 3;
1359 // Current Battery current, in microAmps.
1360 optional int32 current_micro_amps = 4;
1361 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1362 optional int32 open_circuit_micro_volt = 5;
1363 // Resistance Battery Resistance, in microOhms.
1364 optional int32 resistance_micro_ohm = 6;
1365 // Level Battery Level, as % of full.
1366 optional int32 level_percent = 7;
1367}
1368
1369/**
1370 * Log slow I/O operations on the primary storage.
1371 */
1372message SlowIo {
1373 // Classifications of IO Operations.
1374 enum IoOperation {
1375 UNKNOWN = 0;
1376 READ = 1;
1377 WRITE = 2;
1378 UNMAP = 3;
1379 SYNC = 4;
1380 }
1381 optional IoOperation operation = 1;
1382
1383 // The number of slow IO operations of this type over 24 hours.
1384 optional int32 count = 2;
1385}
1386
1387/**
1388 * Log battery caused shutdown with the last recorded voltage.
1389 */
1390message BatteryCausedShutdown {
1391 // The last recorded battery voltage prior to shutdown.
1392 optional int32 last_recorded_micro_volt = 1;
1393}
1394
1395/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001396 * Logs the duration of a davey (jank of >=700ms) when it occurs
1397 *
1398 * Logged from:
1399 * frameworks/base/libs/hwui/JankTracker.cpp
1400 */
1401message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001402 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001403 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001404
Tej Singhbb8554a2018-01-26 11:59:14 -08001405 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001406 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001407}
1408
1409/**
Bookatze5885242017-10-24 20:10:31 -07001410 * Logs phone signal strength changes.
1411 *
1412 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001413 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001414 */
1415message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001416 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1417 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001418}
1419
Yangster4ccebea2018-10-09 17:09:02 -07001420
1421/**
1422 * Logs when the phone state, sim state or signal strength changes
1423 *
1424 * Logged from:
1425 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1426 */
1427message PhoneServiceStateChanged {
1428 optional android.telephony.ServiceStateEnum state = 1;
1429 optional android.telephony.SimStateEnum sim_state = 2;
1430 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1431}
1432
1433/**
1434 * Logs when the phone becomes on or off.
1435 *
1436 * Logged from:
1437 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1438 */
1439message PhoneStateChanged {
1440 enum State {
1441 OFF = 0;
1442 ON = 1;
1443 }
1444 optional State state = 1;
1445}
1446
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001447message LauncherUIChanged {
Yao Chen8c433862018-10-24 14:09:20 -07001448 optional android.stats.launcher.LauncherAction action = 1;
1449 optional android.stats.launcher.LauncherState src_state = 2;
1450 optional android.stats.launcher.LauncherState dst_state = 3;
1451 optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES];
Hyunyoung Songc6d6b772018-10-17 13:35:32 -07001452 optional bool is_swipe_up_enabled = 5;
1453}
1454
David Chenc28b2bb2017-10-24 12:52:52 -07001455/**
Fan Zhang916c13b2018-10-16 22:49:45 -07001456 * Logs when Settings UI has changed.
1457 *
1458 * Logged from:
1459 * packages/apps/Settings
1460 */
1461message SettingsUIChanged {
1462 /**
Fan Zhang916c13b2018-10-16 22:49:45 -07001463 * Where this SettingsUIChange event comes from. For example, if
1464 * it's a PAGE_VISIBLE event, where the page is opened from.
1465 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001466 optional android.app.settings.PageId attribution = 1;
Fan Zhang916c13b2018-10-16 22:49:45 -07001467
1468 /**
1469 * What the UI action is.
1470 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001471 optional android.app.settings.Action action = 2;
Fan Zhang916c13b2018-10-16 22:49:45 -07001472
1473 /**
1474 * Where the action is happening
1475 */
Fan Zhangf837b8e2018-10-23 12:38:30 -07001476 optional android.app.settings.PageId pageId = 3;
Fan Zhang916c13b2018-10-16 22:49:45 -07001477
1478 /**
1479 * What preference changed in this event.
1480 */
1481 optional string changedPreferenceKey = 4;
1482
1483 /**
1484 * The new value of the changed preference.
1485 */
1486 optional int64 changedPreferenceIntValue = 5;
1487}
1488
1489/**
David Chenc28b2bb2017-10-24 12:52:52 -07001490 * Logs that a setting was updated.
1491 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001492 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001493 * The tag and is_default allow resetting of settings to default values based on the specified
1494 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1495 */
1496message SettingChanged {
1497 // The name of the setting.
1498 optional string setting = 1;
1499
1500 // The change being imposed on this setting. May represent a number, eg "3".
1501 optional string value = 2;
1502
1503 // The new value of this setting. For most settings, this is same as value. For some settings,
1504 // value is +X or -X where X represents an element in a set. For example, if the previous value
1505 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1506 // The +/- feature is currently only used for location_providers_allowed.
1507 optional string new_value = 3;
1508
1509 // The previous value of this setting.
1510 optional string prev_value = 4;
1511
1512 // The tag used with the is_default for resetting sets of settings. This is generally null.
1513 optional string tag = 5;
1514
Bookatz90867622018-01-31 15:05:57 -08001515 // True if this setting with tag should be resettable.
1516 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001517
David Chenbd789912018-03-16 17:19:55 -07001518 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001519 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001520
1521 enum ChangeReason {
1522 UPDATED = 1; // Updated can be an insertion or an update.
1523 DELETED = 2;
1524 }
1525 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001526}
Chenjie Yub3dda412017-10-24 13:41:59 -07001527
Chenjie Yu05013b32017-11-21 10:21:41 -08001528/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001529 * Logs activity going to foreground or background
1530 *
1531 * Logged from:
1532 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1533 */
1534message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001535 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001536 optional string pkg_name = 2;
1537 optional string class_name = 3;
1538
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001539 enum State {
1540 BACKGROUND = 0;
1541 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001542 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001543 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001544}
David Chenc8a43242017-10-17 16:23:28 -07001545
1546/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001547 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001548 * Logged from:
1549 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1550 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001551message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001552 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001553
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001554 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001555
1556 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001557 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001558 optional string process_name = 3;
1559
1560 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001561 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001562
1563 optional string package_name = 5;
1564
1565 enum InstantApp {
1566 UNAVAILABLE = 0;
1567 FALSE = 1;
1568 TRUE = 2;
1569 }
1570 optional InstantApp is_instant_app = 6;
1571
1572 enum ForegroundState {
1573 UNKNOWN = 0;
1574 BACKGROUND = 1;
1575 FOREGROUND = 2;
1576 }
1577 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001578}
David Chen9e3808c2017-11-20 17:25:34 -08001579
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001580/**
1581 * Logs when a WTF (What a Terrible Failure) happened.
1582 * Logged from:
1583 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1584 */
1585message WTFOccurred {
1586 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001587
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001588 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001589
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001590 // The name of the process.
1591 // system_server if it is not by an app
1592 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001593
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001594 // The pid if available. -1 means not available.
1595 optional sint32 pid = 4;
1596}
1597
1598/**
1599 * Logs when system server reports low memory.
1600 * Logged from:
1601 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1602 */
1603message LowMemReported {
1604}
1605
1606/**
1607 * Logs when an app ANR (App Not Responding) occurs.
1608 * Logged from:
1609 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1610 */
1611message ANROccurred {
1612 optional int32 uid = 1 [(is_uid) = true];
1613
1614 optional string process_name = 2;
1615
1616 optional string short_component_name = 3;
1617
1618 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001619
1620 enum InstantApp {
1621 UNAVAILABLE = 0;
1622 FALSE = 1;
1623 TRUE = 2;
1624 }
1625 optional InstantApp is_instant_app = 5;
1626
1627 enum ForegroundState {
1628 UNKNOWN = 0;
1629 BACKGROUND = 1;
1630 FOREGROUND = 2;
1631 }
1632 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001633}
1634
Bookatza7020bd2018-08-28 16:29:35 -07001635/**
1636 * Logs when the vibrator state changes.
1637 * Logged from:
1638 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1639 */
1640message VibratorStateChanged {
1641 repeated AttributionNode attribution_node = 1;
1642
1643 enum State {
1644 OFF = 0;
1645 ON = 1;
1646 }
1647 optional State state = 2;
1648
1649 // Duration (in milliseconds) requested to keep the vibrator on.
1650 // Only applicable for State == ON.
1651 optional int64 duration_millis = 3;
1652}
1653
David Chen0a368b22017-12-06 16:28:16 -08001654/*
1655 * Allows other apps to push events into statsd.
1656 * Logged from:
1657 * frameworks/base/core/java/android/util/StatsLog.java
1658 */
David Chen0b5c90c2018-01-25 16:51:49 -08001659message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001660 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001661 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001662
1663 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1664 optional int32 label = 2;
1665
1666 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1667 // predicates for the metrics).
1668 enum State {
1669 UNKNOWN = 0;
1670 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1671 STOP = 2;
1672 START = 3;
1673 }
1674 optional State state = 3;
1675}
1676
David Chen9e3808c2017-11-20 17:25:34 -08001677/**
Bookatz7948c872018-09-04 12:58:33 -07001678 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1679 * For example, this could be due to the user manually changing the time.
1680 *
1681 * Logged from:
1682 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1683 */
1684message WallClockTimeShifted {
1685 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1686 optional int64 wall_clock_timestamp_millis = 1;
1687}
1688
1689/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001690 * Logs when statsd detects an anomaly.
1691 *
1692 * Logged from:
1693 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1694 */
1695message AnomalyDetected {
1696 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001697 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001698
Yangster-mac94e197c2018-01-02 16:03:03 -08001699 // Id of the config whose anomaly detection alert fired.
1700 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001701
Yangster-mac94e197c2018-01-02 16:03:03 -08001702 // Id of the alert (i.e. name of the anomaly that was detected).
1703 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001704}
1705
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001706message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001707 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001708 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001709
1710 // The app package name.
1711 optional string pkg_name = 2;
1712
1713 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001714 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001715 WARM = 1;
1716 HOT = 2;
1717 COLD = 3;
1718 }
1719 // The transition type.
1720 optional TransitionType type = 3;
1721
1722 // The activity name.
1723 optional string activity_name = 4;
1724
1725 // The name of the calling app. Empty if not set.
1726 optional string calling_pkg_name = 5;
1727
1728 // Whether the app is an instant app.
1729 optional bool is_instant_app = 6;
1730
1731 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001732 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001733
Bookatz80d11a02018-01-16 10:46:35 -08001734 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001735
David Chen0b5c90c2018-01-25 16:51:49 -08001736 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001737 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001738 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001739 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001740 optional int32 bind_application_delay_millis = 11;
1741 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001742
1743 // Empty if not set.
1744 optional string launch_token = 13;
1745
Calin Juravle759fbda2018-02-20 19:52:30 +00001746 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001747 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001748
1749 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001750 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001751}
1752
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001753message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001754 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001755 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001756
1757 // The app package name.
1758 optional string pkg_name = 2;
1759
1760 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001761 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001762 WARM = 1;
1763 HOT = 2;
1764 COLD = 3;
1765 }
1766 // The transition type.
1767 optional TransitionType type = 3;
1768
1769 // The activity name.
1770 optional string activity_name = 4;
1771}
1772
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001773message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001774 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001775 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001776
1777 // The app package name.
1778 optional string pkg_name = 2;
1779
1780 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001781 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001782 WITH_BUNDLE = 1;
1783 WITHOUT_BUNDLE = 2;
1784 }
1785 // The transition type.
1786 optional TransitionType type = 3;
1787
1788 // The activity name.
1789 optional string activity_name = 4;
1790
1791 optional bool transition_process_running = 5;
1792
1793 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001794 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001795}
1796
Bookatz8fcd09a2017-12-18 13:01:10 -08001797/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001798 * Logs a picture-in-picture action
1799 * Logged from:
1800 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1801 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1802 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1803 */
1804message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001805 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001806 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001807
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001808 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001809
Chenjie Yu52cacc62017-12-08 18:11:45 -08001810 enum State {
1811 ENTERED = 1;
1812 EXPANDED_TO_FULL_SCREEN = 2;
1813 MINIMIZED = 3;
1814 DISMISSED = 4;
1815 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001816 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001817}
1818
1819/**
Chenjie Yue8904192017-12-08 19:12:57 -08001820 * Logs overlay action
1821 * Logged from:
1822 * services/core/java/com/android/server/wm/Session.java
1823 */
1824message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001825 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001826
1827 optional string package_name = 2;
1828
1829 optional bool using_alert_window = 3;
1830
1831 enum State {
1832 ENTERED = 1;
1833 EXITED = 2;
1834 }
1835 optional State state = 4;
1836}
1837
Chenjie Yuccfe6452018-01-30 11:33:21 -08001838/*
1839 * Logs foreground service starts and stops.
1840 * Note that this is not when a service starts or stops, but when it is
1841 * considered foreground.
1842 * Logged from
1843 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1844 */
1845message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001846 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001847 // package_name + "/" + class_name
1848 optional string short_name = 2;
1849
1850 enum State {
1851 ENTER = 1;
1852 EXIT = 2;
1853 }
1854 optional State state = 3;
1855}
1856
Chenjie Yue8904192017-12-08 19:12:57 -08001857/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001858 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1859 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1860 * attributed back to the parent (host) uid. One example is Chrome.
1861 *
1862 * Logged from:
1863 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1864 */
1865message IsolatedUidChanged {
1866 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001867 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001868 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001869 optional int32 parent_uid = 1;
1870
1871 optional int32 isolated_uid = 2;
1872
1873 // We expect an isolated uid to be removed before if it's used for another parent uid.
1874 enum Event {
1875 REMOVED = 0;
1876 CREATED = 1;
1877 }
1878 optional Event event = 3;
1879}
1880
1881/*
1882 * Logs the reception of an incoming network packet causing the main system to wake up for
1883 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1884 * and processed by WakeupController.cpp.
1885 */
1886message PacketWakeupOccurred {
1887 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1888 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001889 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001890 // The interface name on which the packet was received.
1891 optional string iface = 2;
1892 // The ethertype value of the packet.
1893 optional int32 ethertype = 3;
1894 // String representation of the destination MAC address of the packet.
1895 optional string destination_hardware_address = 4;
1896 // String representation of the source address of the packet if this was an IP packet.
1897 optional string source_ip = 5;
1898 // String representation of the destination address of the packet if this was an IP packet.
1899 optional string destination_ip = 6;
1900 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1901 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1902 // families.
1903 optional int32 ip_next_header = 7;
1904 // The source port if this was a TCP or UDP packet.
1905 optional int32 source_port = 8;
1906 // The destination port if this was a TCP or UDP packet.
1907 optional int32 destination_port = 9;
1908}
1909
1910/*
1911 * Logs the memory stats for an app on startup.
1912 * Logged from:
1913 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1914 */
1915message AppStartMemoryStateCaptured {
1916 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001917 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001918
1919 // The process name.
1920 optional string process_name = 2;
1921
1922 // The activity name.
1923 optional string activity_name = 3;
1924
1925 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001926 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001927
1928 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001929 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001930
1931 // RSS
1932 optional int64 rss_in_bytes = 6;
1933
1934 // CACHE
1935 optional int64 cache_in_bytes = 7;
1936
1937 // SWAP
1938 optional int64 swap_in_bytes = 8;
1939}
1940
1941/*
1942 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1943 * for LMK event.
1944 * Logged from:
1945 * system/core/lmkd/lmkd.c
1946 */
1947message LmkStateChanged {
1948 enum State {
1949 UNKNOWN = 0;
1950 START = 1;
1951 STOP = 2;
1952 }
1953 optional State state = 1;
1954}
1955
1956/*
1957 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1958 * Logged from:
1959 * system/core/lmkd/lmkd.c
1960 */
1961message LmkKillOccurred {
1962 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001963 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001964
1965 // The process name.
1966 optional string process_name = 2;
1967
1968 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07001969 optional int32 oom_adj_score = 3;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001970
1971 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001972 optional int64 page_fault = 4;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001973
1974 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07001975 optional int64 page_major_fault = 5;
Chenjie Yubbcbc602018-02-05 16:51:52 -08001976
1977 // RSS
1978 optional int64 rss_in_bytes = 6;
1979
1980 // CACHE
1981 optional int64 cache_in_bytes = 7;
1982
1983 // SWAP
1984 optional int64 swap_in_bytes = 8;
1985}
1986
Rajeev Kumar51b54602018-03-01 12:18:26 -08001987/*
1988 * Logs when the ActivityManagerService detects that an app died.
1989 *
1990 * Logged from:
1991 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1992 */
1993message AppDied {
1994 // timestamp(elapsedRealtime) of record creation
Yangster-macb6b77c62018-10-12 19:33:24 -07001995 optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001996}
1997
Howard Ro21a039c2018-08-06 14:55:47 -07001998/**
1999 * An atom for generic metrics logging. Available from Android Q.
2000 */
2001message GenericAtom {
2002 // The uid of the application that sent this custom atom.
2003 optional int32 uid = 1 [(is_uid) = true];
2004
2005 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07002006 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07002007}
2008
Tej Singhd6d6d772018-09-05 17:41:25 -07002009/**
2010 * Logs when a fingerprint acquire event occurs.
2011 *
2012 * Logged from:
2013 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2014 */
2015message FingerprintAcquired {
2016 // The associated user. Eg: 0 for owners, 10+ for others.
2017 // Defined in android/os/UserHandle.java
2018 optional int32 user = 1;
2019 // If this acquire is for a crypto fingerprint.
2020 // e.g. Secure purchases, unlock password storage.
2021 optional bool is_crypto = 2;
2022}
2023
2024/**
2025 * Logs when a fingerprint authentication event occurs.
2026 *
2027 * Logged from:
2028 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2029 */
2030message FingerprintAuthenticated {
2031 // The associated user. Eg: 0 for owners, 10+ for others.
2032 // Defined in android/os/UserHandle.java
2033 optional int32 user = 1;
2034 // If this authentication is for a crypto fingerprint.
2035 // e.g. Secure purchases, unlock password storage.
2036 optional bool is_crypto = 2;
2037 // Whether or not this authentication was successful.
2038 optional bool is_authenticated = 3;
2039}
2040
2041/**
2042 * Logs when a fingerprint error occurs.
2043 *
2044 * Logged from:
2045 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
2046 */
2047message FingerprintErrorOccurred {
2048 // The associated user. Eg: 0 for owners, 10+ for others.
2049 // Defined in android/os/UserHandle.java
2050 optional int32 user = 1;
2051 // If this error is for a crypto fingerprint.
2052 // e.g. Secure purchases, unlock password storage.
2053 optional bool is_crypto = 2;
2054
2055 enum Error {
2056 UNKNOWN = 0;
2057 LOCKOUT = 1;
2058 PERMANENT_LOCKOUT = 2;
2059 }
2060 // The type of error.
2061 optional Error error = 3;
2062}
Howard Ro688ae182018-09-25 00:09:36 -07002063
2064message Notification {
2065
2066 // Type of notification event.
2067 enum Type {
2068 TYPE_UNKNOWN = 0;
2069 // Notification became visible to the user.
2070 TYPE_OPEN = 1;
2071 // Notification became hidden.
2072 TYPE_CLOSE = 2;
2073 // Notification switched to detail mode.
2074 TYPE_DETAIL = 3;
2075 // Notification was clicked.
2076 TYPE_ACTION = 4;
2077 // Notification was dismissed.
2078 TYPE_DISMISS = 5;
2079 // Notification switched to summary mode. The enum value of 14 is to
2080 // match that of metrics_constants.
2081 TYPE_COLLAPSE = 14;
2082 }
2083 optional Type type = 1;
2084
2085 // Package name associated with the notification.
2086 optional string package_name = 2;
2087
2088 // Tag associated with notification.
2089 optional string tag = 3;
2090
2091 // Application-supplied ID associated with the notification.
2092 optional int32 id = 4;
2093
2094 // Index of notification in the notification panel.
2095 optional int32 shade_index = 5;
2096
2097 // The number of notifications in the notification panel.
2098 optional int32 shade_count = 6;
2099
2100 // Importance for the notification.
2101 optional int32 importance = 7;
2102
2103 // ID for the notification channel.
Howard Ro183c2bd2018-10-18 13:52:10 -07002104 optional string channel_id = 8;
Howard Ro688ae182018-09-25 00:09:36 -07002105
2106 // Importance for the notification channel.
2107 optional int32 channel_importance = 9;
2108
Howard Ro183c2bd2018-10-18 13:52:10 -07002109 // Application-supplied ID associated with the notifications group.
2110 optional string group_id = 10;
2111
Howard Ro688ae182018-09-25 00:09:36 -07002112 // Whether notification was a group summary.
Howard Ro183c2bd2018-10-18 13:52:10 -07002113 optional bool group_summary = 11;
Howard Ro688ae182018-09-25 00:09:36 -07002114
Howard Ro183c2bd2018-10-18 13:52:10 -07002115 // Reason for dismissal of a notification. This field is only meaningful for
2116 // TYPE_DISMISS events.
2117 optional int32 dismiss_reason = 12;
Howard Ro688ae182018-09-25 00:09:36 -07002118
Howard Ro183c2bd2018-10-18 13:52:10 -07002119 // The first post time of notification, stable across updates.
2120 optional int64 creation_millis = 13;
Howard Ro688ae182018-09-25 00:09:36 -07002121
Howard Ro183c2bd2018-10-18 13:52:10 -07002122 // The most recent interruption time, or the creation time if no updates.
2123 // Differs from update_millis because updates are filtered based on whether
2124 // they actually interrupted the user.
2125 optional int64 interruption_millis = 14;
Howard Ro688ae182018-09-25 00:09:36 -07002126
Howard Ro183c2bd2018-10-18 13:52:10 -07002127 // The most recent update time, or the creation time if no updates.
2128 optional int64 update_millis = 15;
2129
2130 // The most recent visibility event.
2131 optional int64 visible_millis = 16;
Howard Ro688ae182018-09-25 00:09:36 -07002132}
2133
2134
Chenjie Yubbcbc602018-02-05 16:51:52 -08002135//////////////////////////////////////////////////////////////////////
2136// Pulled atoms below this line //
2137//////////////////////////////////////////////////////////////////////
2138
2139/**
David Chenc8a43242017-10-17 16:23:28 -07002140 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2141 *
2142 * Pulled from:
2143 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2144 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002145message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002146 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002147
2148 optional int64 rx_bytes = 2;
2149
2150 optional int64 rx_packets = 3;
2151
2152 optional int64 tx_bytes = 4;
2153
2154 optional int64 tx_packets = 5;
2155}
2156
2157/**
2158 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2159 *
2160 * Pulled from:
2161 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2162 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002163message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002164 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002165
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002166 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2167 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002168
2169 optional int64 rx_bytes = 3;
2170
2171 optional int64 rx_packets = 4;
2172
2173 optional int64 tx_bytes = 5;
2174
2175 optional int64 tx_packets = 6;
2176}
2177
2178/**
2179 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2180 *
2181 * Pulled from:
2182 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2183 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002184message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002185 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002186
2187 optional int64 rx_bytes = 2;
2188
2189 optional int64 rx_packets = 3;
2190
2191 optional int64 tx_bytes = 4;
2192
2193 optional int64 tx_packets = 5;
2194}
2195
2196/**
2197 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2198 *
2199 * Pulled from:
2200 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2201 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002202message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002203 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002204
Yao Chenc40a19d2018-03-15 16:48:25 -07002205 // 1 denotes foreground and 0 denotes background. This is called Set in
2206 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002207 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002208
2209 optional int64 rx_bytes = 3;
2210
2211 optional int64 rx_packets = 4;
2212
2213 optional int64 tx_bytes = 5;
2214
2215 optional int64 tx_packets = 6;
2216}
2217
2218/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002219 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2220 *
2221 * Pulled from:
2222 * StatsCompanionService
2223 */
2224message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002225 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002226
2227 optional int64 rx_bytes = 2;
2228
2229 optional int64 tx_bytes = 3;
2230}
2231
2232/**
David Chenc8a43242017-10-17 16:23:28 -07002233 * Pulls the kernel wakelock durations. This atom is adapted from
2234 * android/internal/os/KernelWakelockStats.java
2235 *
2236 * Pulled from:
2237 * StatsCompanionService using KernelWakelockReader.
2238 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002239message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002240 optional string name = 1;
2241
2242 optional int32 count = 2;
2243
2244 optional int32 version = 3;
2245
Yangster-maca8a30442018-10-13 23:46:34 -07002246 optional int64 time_micros = 4;
David Chenc8a43242017-10-17 16:23:28 -07002247}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002248
Chenjie Yu05013b32017-11-21 10:21:41 -08002249/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002250 * Pulls low power state information. This includes platform and subsystem sleep state information,
2251 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002252 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002253 * hardware/interfaces/power/1.1/types.hal
2254 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002255message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002256 // Subsystem name
2257 optional string subsystem_name = 1;
2258 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2259 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2260 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002261 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002262 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002263 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002264 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002265}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002266
Chenjie Yu05013b32017-11-21 10:21:41 -08002267/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002268 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002269 * Pulls the time the cpu spend on the frequency index. Frequency index
2270 * starts from highest to lowest. The value should be monotonically
2271 * increasing since boot. However, if there is a cpu
2272 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002273 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002274message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002275 optional uint32 cluster = 1;
2276 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002277 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002278}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002279
Chenjie Yu05013b32017-11-21 10:21:41 -08002280/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002281 * Pulls Cpu Time Per Uid.
2282 * Note that isolated process uid time should be attributed to host uids.
2283 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002284message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002285 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002286 optional uint64 user_time_millis = 2;
2287 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002288}
2289
2290/**
2291 * Pulls Cpu Time Per Uid per frequency.
2292 * Note that isolated process uid time should be attributed to host uids.
2293 * For each uid, we order the time by descending frequencies.
2294 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002295message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002296 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002297 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002298 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002299}
Hugo Benichi884970e2017-11-14 22:42:46 +09002300
Chenjie Yu05013b32017-11-21 10:21:41 -08002301/**
2302 * Pulls Wifi Controller Activity Energy Info
2303 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002304message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002305 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002306 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002307 // stack reported state
2308 // TODO: replace this with proto enum
2309 optional int32 stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002310 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002311 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002312 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002313 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002314 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002315 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002316 // product of current(mA), voltage(V) and time(ms)
2317 optional uint64 controller_energy_used = 6;
2318}
2319
2320/**
2321 * Pulls Modem Activity Energy Info
2322 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002323message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002324 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002325 optional uint64 timestamp_millis = 1;
Yangster-maca8a30442018-10-13 23:46:34 -07002326 // sleep time in millis.
David Chen0b5c90c2018-01-25 16:51:49 -08002327 optional uint64 sleep_time_millis = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002328 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002329 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002330 /**
2331 * Tx power index
2332 * index 0 = tx_power < 0dBm
2333 * index 1 = 0dBm < tx_power < 5dBm
2334 * index 2 = 5dBm < tx_power < 15dBm
2335 * index 3 = 15dBm < tx_power < 20dBm
2336 * index 4 = tx_power > 20dBm
2337 */
2338 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002339 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002340 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002341 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002342 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002343 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002344 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002345 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002346 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002347 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002348 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002349 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002350 // product of current(mA), voltage(V) and time(ms)
2351 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002352}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002353
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002354/**
2355 * Pulls Bluetooth Activity Energy Info
2356 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2357 */
2358message BluetoothActivityInfo {
2359 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002360 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002361 // bluetooth stack state
2362 optional int32 bluetooth_stack_state = 2;
Yangster-maca8a30442018-10-13 23:46:34 -07002363 // tx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002364 optional uint64 controller_tx_time_millis = 3;
Yangster-maca8a30442018-10-13 23:46:34 -07002365 // rx time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002366 optional uint64 controller_rx_time_millis = 4;
Yangster-maca8a30442018-10-13 23:46:34 -07002367 // idle time in millis
David Chen0b5c90c2018-01-25 16:51:49 -08002368 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002369 // product of current(mA), voltage(V) and time(ms)
2370 optional uint64 energy_used = 6;
2371}
2372
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002373/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002374 * Logs the memory stats for a process.
2375 */
2376message ProcessMemoryState {
2377 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002378 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002379
2380 // The process name.
2381 optional string process_name = 2;
2382
2383 // oom adj score.
Yangster-maca8a30442018-10-13 23:46:34 -07002384 optional int32 oom_adj_score = 3;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002385
2386 // # of page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002387 optional int64 page_fault = 4;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002388
2389 // # of major page-faults
Yangster-maca8a30442018-10-13 23:46:34 -07002390 optional int64 page_major_fault = 5;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002391
Rajeev Kumar90235992018-01-29 11:06:48 -08002392 // RSS
2393 optional int64 rss_in_bytes = 6;
2394
2395 // CACHE
2396 optional int64 cache_in_bytes = 7;
2397
2398 // SWAP
2399 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002400
2401 // RSS high watermark.
2402 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2403 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2404 optional int64 rss_high_watermark_in_bytes = 9;
Rafal Slawik272a8162018-11-01 15:12:28 +00002405
2406 // Elapsed real time when the process started.
2407 // Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
2408 optional int64 start_time_nanos = 10;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002409}
2410
2411/*
Rafal Slawik08621582018-10-15 14:53:07 +01002412 * Logs the memory stats for a native process (from procfs).
2413 */
2414message NativeProcessMemoryState {
Rafal Slawikbf67d072018-10-23 11:07:54 +01002415 // The uid if available. -1 means not available.
2416 optional int32 uid = 1 [(is_uid) = true];
Rafal Slawik08621582018-10-15 14:53:07 +01002417
Rafal Slawikbf67d072018-10-23 11:07:54 +01002418 // The process name.
2419 optional string process_name = 2;
Rafal Slawik08621582018-10-15 14:53:07 +01002420
Rafal Slawikbf67d072018-10-23 11:07:54 +01002421 // # of page-faults
2422 optional int64 page_fault = 3;
Rafal Slawik08621582018-10-15 14:53:07 +01002423
Rafal Slawikbf67d072018-10-23 11:07:54 +01002424 // # of major page-faults
2425 optional int64 page_major_fault = 4;
Rafal Slawik08621582018-10-15 14:53:07 +01002426
Rafal Slawikbf67d072018-10-23 11:07:54 +01002427 // RSS
2428 optional int64 rss_in_bytes = 5;
Rafal Slawik08621582018-10-15 14:53:07 +01002429
Rafal Slawikbf67d072018-10-23 11:07:54 +01002430 // RSS high watermark.
2431 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
2432 optional int64 rss_high_watermark_in_bytes = 6;
2433
2434 // Elapsed real time when the process started.
2435 // Value is read from /proc/PID/stat, field 22.
2436 optional int64 start_time_nanos = 7;
Rafal Slawik08621582018-10-15 14:53:07 +01002437}
2438
2439/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002440 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002441 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002442message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002443 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002444}
2445
2446/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002447 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002448 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002449message SystemUptime {
2450 // Milliseconds since the system was booted.
2451 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2452 // for external input).
2453 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002454 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002455}
2456
2457/*
2458 * Reads from /proc/uid_concurrent_active_time which has the format:
2459 * active: X (X is # cores)
2460 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2461 * [uid1]: [time-0] [time-1] [time-2] ... ...
2462 * ...
2463 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2464 * The file contains a monotonically increasing count of time for a single boot.
2465 */
2466message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002467 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002468 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002469}
2470
2471/**
2472 * Reads from /proc/uid_concurrent_policy_time which has the format:
2473 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2474 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2475 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2476 * ...
2477 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2478 * The file contains a monotonically increasing count of time for a single boot.
2479 */
2480message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002481 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002482 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002483 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002484}
2485
2486/*
2487 * Pulls free disk space, for data, system partition and temporary directory.
2488 */
2489message DiskSpace {
2490 // available bytes in data partition
2491 optional uint64 data_available_bytes = 1;
2492 // available bytes in system partition
2493 optional uint64 system_available_bytes = 2;
2494 // available bytes in download cache or temp directories
2495 optional uint64 temp_available_bytes = 3;
2496}
Tej Singhbf972d92018-01-10 20:51:13 -08002497
2498/**
2499 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002500 * Pulled from:
2501 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002502 */
2503message RemainingBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002504 optional int32 charge_micro_ampere_hour = 1;
Tej Singhbf972d92018-01-10 20:51:13 -08002505}
2506
2507/**
2508 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002509 * Pulled from:
2510 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002511 */
2512message FullBatteryCapacity {
Yangster-maca8a30442018-10-13 23:46:34 -07002513 optional int32 capacity_micro_ampere_hour = 1;
Tej Singh40298312018-02-16 00:15:09 -08002514}
2515
2516/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002517 * Pulls battery voltage.
2518 * Pulled from:
2519 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2520 */
2521message BatteryVoltage {
2522 // The voltage of the battery, in millivolts.
Yangster-maca8a30442018-10-13 23:46:34 -07002523 optional int32 voltage_millivolt = 1;
Bookatz17f0d8a2018-09-13 12:56:32 -07002524}
2525
2526/**
Tej Singhd89137e2018-03-26 14:51:40 -07002527 * Pulls the temperature of various parts of the device.
2528 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002529 *
2530 * Pulled from:
2531 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2532 */
2533message Temperature {
2534 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2535 optional android.os.TemperatureTypeEnum sensor_location = 1;
2536
2537 // The name of the temperature source. Eg. CPU0
2538 optional string sensor_name = 2;
2539
Tej Singhd89137e2018-03-26 14:51:40 -07002540 // Temperature in tenths of a degree C.
Yangster-maca8a30442018-10-13 23:46:34 -07002541 optional int32 temperature_deci_celsius = 3;
yroa1fe77c2018-02-26 14:22:54 -08002542}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002543
2544/**
2545 * Pulls the statistics of calls to Binder.
2546 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002547 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2548 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002549 *
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002550 * Next tag: 15
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002551 */
2552message BinderCalls {
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002553 // UID of the process responsible for the binder transaction. It will be set if the process
2554 // executing the binder transaction attribute the transaction to another uid using
2555 // Binder.setThreadWorkSource().
2556 //
2557 // If not set, the value will be -1.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002558 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillard720ec5b2018-10-30 17:32:56 +00002559 // UID of the process executing the binder transaction.
2560 optional int32 direct_caller_uid = 14;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002561 // Fully qualified class name of the API call.
2562 //
2563 // This is a system server class name.
2564 //
2565 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2566 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2567 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2568 // commonly used APIs.
2569 optional string service_class_name = 2;
2570 // Method name of the API call. It can also be a transaction code if we cannot
2571 // resolve it to a name. See Binder#getTransactionName.
2572 //
2573 // This is a system server method name.
2574 optional string service_method_name = 3;
2575 // Total number of API calls.
2576 optional int64 call_count = 4;
2577 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2578 optional bool screen_interactive = 13;
2579 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2580 // call_count will be equal to recorded_call_count.
2581 //
2582 // If recorded_call_count is different than call_count, it means data collection has been
2583 // sampled. All the fields below will be sampled in this case.
2584 optional int64 recorded_call_count = 12;
2585 // Number of exceptions thrown by the API.
2586 optional int64 recorded_exception_count = 5;
2587 // Total latency of all API calls.
2588 // Average can be computed using total_latency_micros / recorded_call_count.
2589 optional int64 recorded_total_latency_micros = 6;
2590 // Maximum latency of one API call.
2591 optional int64 recorded_max_latency_micros = 7;
2592 // Total CPU usage of all API calls.
2593 // Average can be computed using total_cpu_micros / recorded_call_count.
2594 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2595 optional int64 recorded_total_cpu_micros = 8;
2596 // Maximum CPU usage of one API call.
2597 optional int64 recorded_max_cpu_micros = 9;
2598 // Maximum parcel reply size of one API call.
2599 optional int64 recorded_max_reply_size_bytes = 10;
2600 // Maximum parcel request size of one API call.
2601 optional int64 recorded_max_request_size_bytes = 11;
2602}
2603
2604/**
2605 * Pulls the statistics of exceptions during calls to Binder.
2606 *
2607 * Binder stats are cumulative from boot unless somebody reset the data using
2608 * > adb shell dumpsys binder_calls_stats --reset
2609 */
2610message BinderCallsExceptions {
2611 // Exception class name, e.g. java.lang.IllegalArgumentException.
2612 //
2613 // This is an exception class name thrown by the system server.
2614 optional string exception_class_name = 1;
2615 // Total number of exceptions.
2616 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002617}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002618
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002619/**
2620 * Pulls the statistics of message dispatching on HandlerThreads.
2621 *
2622 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2623 * config on the device.
2624 *
2625 * Next tag: 11
2626 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002627message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002628 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002629 optional int32 uid = 1 [(is_uid) = true];
2630
2631 // Fully qualified class name of the handler target class.
2632 //
2633 // This field does not contain PII. This is a system server class name.
2634 optional string handler_class_name = 2;
2635
2636 // The name of the thread that runs the Looper.
2637 //
2638 // This field does not contain PII. This is a system server thread name.
2639 optional string looper_thread_name = 3;
2640
2641 // The name of the dispatched message.
2642 //
2643 // This field does not contain PII. This is a system server constant or class
2644 // name.
2645 optional string message_name = 4;
2646
2647 // Total number of successfully dispatched messages.
2648 optional int64 message_count = 5;
2649
2650 // Total number of messages that failed dispatching.
2651 optional int64 exception_count = 6;
2652
2653 // Total number of processed messages we have data recorded for. If we
2654 // collected data for all the messages, message_count will be equal to
2655 // recorded_message_count.
2656 //
2657 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002658 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002659 optional int64 recorded_message_count = 7;
2660
2661 // Total latency of all processed messages.
2662 // Average can be computed using recorded_total_latency_micros /
2663 // recorded_message_count.
2664 optional int64 recorded_total_latency_micros = 8;
2665
2666 // Total CPU usage of all processed message.
2667 // Average can be computed using recorded_total_cpu_micros /
2668 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002669 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002670 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002671
2672 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2673 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002674
2675 // Max recorded CPU usage of all processed messages.
2676 optional int64 recorded_max_cpu_micros = 11;
2677
2678 // Max recorded latency of all processed messages.
2679 optional int64 recorded_max_latency_micros = 12;
2680
2681 // Total number of messages we tracked the dispatching delay for. If we
2682 // collected data for all the messages, message_count will be equal to
2683 // recorded_delay_message_count.
2684 //
2685 // If recorded_delay_message_count is different than message_count, it means data
2686 // collection has been sampled or/and not all messages specified the target dispatch time.
2687 // The fields below will be sampled in this case.
2688 optional int64 recorded_delay_message_count = 13;
2689
2690 // Total dispatching delay of all processed messages.
2691 // Calculated as a difference between the target dispatching time (Message.when)
2692 // and the actual dispatching time.
2693 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2694 optional int64 recorded_total_delay_millis = 14;
2695
2696 // Max dispatching delay of all processed messages.
2697 // Calculated as a difference between the target dispatching time (Message.when)
2698 // and the actual dispatching time.
2699 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002700}
Tej Singh86dc9db2018-09-06 00:39:57 +00002701
2702/**
2703 * Pulls disk information, such as write speed and latency.
2704 */
2705message DiskStats {
2706 // Time taken to open, write 512B to, and close a file.
2707 // -1 if error performing the check.
2708 optional int64 data_write_latency_millis = 1;
2709
2710 optional bool file_based_encryption = 2;
2711
2712 // Recent disk write speed in kB/s.
2713 // -1 if error querying storageed.
2714 // 0 if data is unavailable.
2715 optional int32 recent_disk_write_speed = 3;
2716}
2717
2718
2719/**
2720 * Free and total bytes of the Data, Cache, and System partition.
2721 */
2722message DirectoryUsage {
2723 enum Directory {
2724 UNKNOWN = 0;
2725 DATA = 1;
2726 CACHE = 2;
2727 SYSTEM = 3;
2728 }
2729 optional Directory directory = 1;
2730 optional int64 free_bytes = 2;
2731 optional int64 total_bytes = 3;
2732}
2733
2734
2735/**
2736 * Size of an application: apk size, data size, and cache size.
2737 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2738 * Information is only reported for apps with the primary user (user 0).
2739 * Sizes are aggregated by package name.
2740 */
2741message AppSize {
2742 // Including uids will involve modifying diskstats logic.
2743 optional string package_name = 1;
2744 // App size in bytes. -1 if unavailable.
2745 optional int64 app_size_bytes = 2;
2746 // App data size in bytes. -1 if unavailable.
2747 optional int64 app_data_size_bytes = 3;
2748 // App cache size in bytes. -1 if unavailable.
2749 optional int64 app_cache_size_bytes = 4;
2750 // Time that the cache file was produced.
2751 // Uses System.currentTimeMillis(), which is wall clock time.
2752 optional int64 cache_time_millis = 5;
2753}
2754
2755
2756/**
2757 * Size of a particular category. Eg: photos, videos.
2758 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2759 */
2760message CategorySize {
2761 enum Category {
2762 UNKNOWN = 0;
2763 APP_SIZE = 1;
2764 APP_DATA_SIZE = 2;
2765 APP_CACHE_SIZE = 3;
2766 PHOTOS = 4;
2767 VIDEOS = 5;
2768 AUDIO = 6;
2769 DOWNLOADS = 7;
2770 SYSTEM = 8;
2771 OTHER = 9;
2772 }
2773 optional Category category = 1;
2774 // Category size in bytes.
2775 optional int64 size_bytes = 2;
2776 // Time that the cache file was produced.
2777 // Uses System.currentTimeMillis(), which is wall clock time.
2778 optional int64 cache_time_millis = 3;
2779}
Tej Singhd6d6d772018-09-05 17:41:25 -07002780
2781/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002782 * Pulls per uid I/O stats. The stats are cumulative since boot.
2783 *
2784 * Read/write bytes are I/O events from a storage device
2785 * Read/write chars are data requested by read/write syscalls, and can be
2786 * satisfied by caching.
2787 *
2788 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2789 */
2790message DiskIo {
2791 optional int32 uid = 1 [(is_uid) = true];
2792 optional int64 fg_chars_read = 2;
2793 optional int64 fg_chars_write = 3;
2794 optional int64 fg_bytes_read = 4;
2795 optional int64 fg_bytes_write = 5;
2796 optional int64 bg_chars_read = 6;
2797 optional int64 bg_chars_write = 7;
2798 optional int64 bg_bytes_read = 8;
2799 optional int64 bg_bytes_write = 9;
2800 optional int64 fg_fsync = 10;
2801 optional int64 bg_fsync= 11;
2802}
2803
2804
2805/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002806 * Pulls the number of fingerprints for each user.
2807 *
2808 * Pulled from StatsCompanionService, which queries FingerprintManager.
2809 */
2810message NumFingerprints {
2811 // The associated user. Eg: 0 for owners, 10+ for others.
2812 // Defined in android/os/UserHandle.java
2813 optional int32 user = 1;
2814 // Number of fingerprints registered to that user.
2815 optional int32 num_fingerprints = 2;
2816}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002817
Yangsteraf9aee72018-10-12 09:26:16 -07002818message AggStats {
2819 optional int64 min = 1;
2820
2821 optional int64 average = 2;
2822
2823 optional int64 max = 3;
2824}
2825
2826message ProcessStatsStateProto {
2827 optional android.service.procstats.ScreenState screen_state = 1;
2828
2829 optional android.service.procstats.MemoryState memory_state = 2;
2830
2831 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2832 // and not frameworks/base/core/java/android/app/ActivityManager.java
2833 optional android.service.procstats.ProcessState process_state = 3;
2834
2835 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002836 optional int64 duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002837
2838 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002839 optional int64 realtime_duration_millis = 9;
Yangsteraf9aee72018-10-12 09:26:16 -07002840
2841 // # of samples taken
2842 optional int32 sample_size = 5;
2843
2844 // PSS is memory reserved for this process
2845 optional AggStats pss = 6;
2846
2847 // USS is memory shared between processes, divided evenly for accounting
2848 optional AggStats uss = 7;
2849
2850 // RSS is memory resident for this process
2851 optional AggStats rss = 8;
2852}
2853
2854// Next Tag: 7
2855message ProcessStatsProto {
2856 // Name of process.
2857 optional string process = 1;
2858
2859 // Uid of the process.
2860 optional int32 uid = 2;
2861
2862 // Information about how often kills occurred
2863 message Kill {
2864 // Count of excessive CPU kills
2865 optional int32 cpu = 1;
2866
2867 // Count of kills when cached
2868 optional int32 cached = 2;
2869
2870 // PSS stats during cached kill
2871 optional AggStats cached_pss = 3;
2872 }
2873 optional Kill kill = 3;
2874
2875 // Time and memory spent in various states.
2876 repeated ProcessStatsStateProto states = 5;
2877
2878 // Total time process has been running... screen_state, memory_state, and process_state
2879 // will not be set.
2880 optional ProcessStatsStateProto total_running_state = 6;
2881}
2882
2883message PackageServiceOperationStatsProto {
2884 // Operate enum: Started, Foreground, Bound, Executing
2885 optional android.service.procstats.ServiceOperationState operation = 1;
2886
2887 // Number of times the service was in this operation.
2888 optional int32 count = 2;
2889
2890 // Information about a state the service can be in.
2891 message StateStats {
2892 // Screen state enum.
2893 optional android.service.procstats.ScreenState screen_state = 1;
2894 // Memory state enum.
2895 optional android.service.procstats.MemoryState memory_state = 2;
2896
2897 // duration in milliseconds.
Yangster-maca8a30442018-10-13 23:46:34 -07002898 optional int64 duration_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002899 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002900 optional int64 realtime_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002901 }
2902 repeated StateStats state_stats = 3;
2903}
2904
2905message PackageServiceStatsProto {
2906 // Name of service component.
2907 optional string service_name = 1;
2908
2909 // The operation stats.
2910 // The package_name, package_uid, package_version, service_name will not be set to save space.
2911 repeated PackageServiceOperationStatsProto operation_stats = 2;
2912}
2913
2914message PackageAssociationSourceProcessStatsProto {
2915 // Uid of the process.
2916 optional int32 process_uid = 1;
2917 // Process name.
2918 optional string process_name = 2;
2919
2920 // Total count of the times this association appeared.
2921 optional int32 total_count = 3;
2922
2923 // Millisecond uptime total duration this association was around.
Yangster-maca8a30442018-10-13 23:46:34 -07002924 optional int64 total_duration_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002925
2926 // Total count of the times this association became actively impacting its target process.
2927 optional int32 active_count = 5;
2928
2929 // Information on one source in this association.
2930 message StateStats {
2931 // Process state enum.
2932 optional android.service.procstats.ProcessState process_state = 1;
2933 // Millisecond uptime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002934 optional int64 duration_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07002935 // Millisecond elapsed realtime duration spent in this state
Yangster-maca8a30442018-10-13 23:46:34 -07002936 optional int64 realtime_duration_mmillis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002937 }
2938 repeated StateStats active_state_stats = 6;
2939}
2940
2941message PackageAssociationProcessStatsProto {
2942 // Name of the target component.
2943 optional string component_name = 1;
2944 // Information on one source in this association.
2945 repeated PackageAssociationSourceProcessStatsProto sources = 2;
2946}
2947
2948
2949message ProcessStatsPackageProto {
2950 // Name of package.
2951 optional string package = 1;
2952
2953 // Uid of the package.
2954 optional int32 uid = 2;
2955
2956 // Version of the package.
2957 optional int64 version = 3;
2958
2959 // Stats for each process running with the package loaded in to it.
2960 repeated ProcessStatsProto process_stats = 4;
2961
2962 // Stats for each of the package's services.
2963 repeated PackageServiceStatsProto service_stats = 5;
2964
2965 // Stats for each association with the package.
2966 repeated PackageAssociationProcessStatsProto association_stats = 6;
2967}
2968
2969message ProcessStatsSectionProto {
2970 // Elapsed realtime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002971 optional int64 start_realtime_millis = 1;
Yangsteraf9aee72018-10-12 09:26:16 -07002972
2973 // Elapsed realtime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002974 optional int64 end_realtime_millis = 2;
Yangsteraf9aee72018-10-12 09:26:16 -07002975
2976 // CPU uptime at start of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002977 optional int64 start_uptime_millis = 3;
Yangsteraf9aee72018-10-12 09:26:16 -07002978
2979 // CPU uptime at end of report.
Yangster-maca8a30442018-10-13 23:46:34 -07002980 optional int64 end_uptime_millis = 4;
Yangsteraf9aee72018-10-12 09:26:16 -07002981
2982 // System runtime library. e.g. "libdvm.so", "libart.so".
2983 optional string runtime = 5;
2984
2985 // whether kernel reports swapped pss.
2986 optional bool has_swapped_pss = 6;
2987
2988 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
2989 enum Status {
2990 STATUS_UNKNOWN = 0;
2991 STATUS_COMPLETE = 1;
2992 STATUS_PARTIAL = 2;
2993 STATUS_SHUTDOWN = 3;
2994 STATUS_SYSPROPS = 4;
2995 }
2996 repeated Status status = 7;
2997
2998 // Stats for each process.
2999 repeated ProcessStatsProto process_stats = 8;
3000
3001 // Stats for each package.
3002 repeated ProcessStatsPackageProto package_stats = 9;
3003}
3004
Chenjie Yu12e5e672018-09-14 15:54:59 -07003005/**
3006 * Pulled from ProcessStatsService.java
3007 */
3008message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07003009 optional ProcessStatsSectionProto proc_stats_section = 1;
3010}
3011
3012message PowerProfileProto {
3013 optional double cpu_suspend = 1;
3014
3015 optional double cpu_idle = 2;
3016
3017 optional double cpu_active = 3;
3018
3019 message CpuCluster {
3020 optional int32 id = 1;
3021 optional double cluster_power = 2;
3022 optional int32 cores = 3;
3023 repeated int64 speed = 4;
3024 repeated double core_power = 5;
3025 }
3026
3027 repeated CpuCluster cpu_cluster = 40;
3028
3029 optional double wifi_scan = 4;
3030
3031 optional double wifi_on = 5;
3032
3033 optional double wifi_active = 6;
3034
3035 optional double wifi_controller_idle = 7;
3036
3037 optional double wifi_controller_rx = 8;
3038
3039 optional double wifi_controller_tx = 9;
3040
3041 repeated double wifi_controller_tx_levels = 10;
3042
3043 optional double wifi_controller_operating_voltage = 11;
3044
3045 optional double bluetooth_controller_idle = 12;
3046
3047 optional double bluetooth_controller_rx = 13;
3048
3049 optional double bluetooth_controller_tx = 14;
3050
3051 optional double bluetooth_controller_operating_voltage = 15;
3052
3053 optional double modem_controller_sleep = 16;
3054
3055 optional double modem_controller_idle = 17;
3056
3057 optional double modem_controller_rx = 18;
3058
3059 repeated double modem_controller_tx = 19;
3060
3061 optional double modem_controller_operating_voltage = 20;
3062
3063 optional double gps_on = 21;
3064
3065 repeated double gps_signal_quality_based = 22;
3066
3067 optional double gps_operating_voltage = 23;
3068
3069 optional double bluetooth_on = 24;
3070
3071 optional double bluetooth_active = 25;
3072
3073 optional double bluetooth_at_cmd = 26;
3074
3075 optional double ambient_display = 27;
3076
3077 optional double screen_on = 28;
3078
3079 optional double radio_on = 29;
3080
3081 optional double radio_scanning = 30;
3082
3083 optional double radio_active = 31;
3084
3085 optional double screen_full = 32;
3086
3087 optional double audio = 33;
3088
3089 optional double video = 34;
3090
3091 optional double flashlight = 35;
3092
3093 optional double memory = 36;
3094
3095 optional double camera = 37;
3096
3097 optional double wifi_batched_scan = 38;
3098
3099 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07003100}
Chenjie Yuab530202018-09-26 12:39:20 -07003101
3102/**
3103 * power_profile.xml and other constants for power model calculations.
3104 * Pulled from PowerProfile.java
3105 */
3106message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07003107 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07003108}
Chenjie Yub35b5f72018-10-13 23:25:11 -07003109
3110/**
arangelovd5db50e2018-10-12 20:24:39 +01003111 * Logs when a user restriction was added or removed.
3112 *
3113 * Logged from:
3114 * frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
3115 */
3116message UserRestrictionChanged {
3117 // The raw string of the user restriction as defined in UserManager.
3118 // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
3119 optional string restriction = 1;
3120 // Whether the restriction is enabled or disabled.
3121 optional bool enabled = 2;
Howard Ro183c2bd2018-10-18 13:52:10 -07003122}
Yangster-mac308ea0c2018-10-22 13:10:25 -07003123
3124/**
3125 * Pulls process user time and system time. Puller takes a snapshot of all pids
3126 * in the system and returns cpu stats for those that are working at the time.
3127 * Dead pids will be dropped. Kernel processes are excluded.
3128 * Min cool-down is 5 sec.
3129 */
3130message ProcessCpuTime {
3131 optional int32 uid = 1 [(is_uid) = true];
3132
3133 optional string process_name = 2;
3134 // Process cpu time in user space, cumulative from boot/process start
3135 optional int64 user_time_millis = 3;
3136 // Process cpu time in system space, cumulative from boot/process start
3137 optional int64 system_time_millis = 4;
Rafal Slawikbf67d072018-10-23 11:07:54 +01003138}
Misha Wagner5a51e002018-10-03 15:04:09 +01003139
3140/**
3141 * Pulls the CPU usage for each thread.
3142 *
3143 * Read from /proc/$PID/task/$TID/time_in_state files.
3144 *
3145 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
3146 * time_in_state files not being present on some phones, have not been addressed. These should be
3147 * considered before a public release.
3148 */
3149message CpuTimePerThreadFreq {
3150 // UID that owns the process.
3151 optional int32 uid = 1 [(is_uid) = true];
3152 // ID of the process.
3153 optional uint32 process_id = 2;
3154 // ID of the thread.
3155 optional uint32 thread_id = 3;
3156 // Name of the process taken from `/proc/$PID/cmdline`.
3157 optional string process_name = 4;
3158 // Name of the thread taken from `/proc/$PID/task/$TID/comm`
3159 optional string thread_name = 5;
3160 // What frequency the CPU was running at, in KHz
3161 optional uint32 frequency_khz = 6;
3162 // Time spent in frequency in milliseconds, since thread start.
3163 optional uint32 time_millis = 7;
3164}