blob: 988ffc4d95b7db78ea08c796cedb09f8fcf03576 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Howard Ro0546d542018-08-30 16:23:44 -070032import "frameworks/base/proto/src/stats_enums.proto";
Chenjie Yu159e4f82018-08-29 11:49:11 -070033import "frameworks/base/core/proto/android/service/procstats.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080034
Yao Chend54f9dd2017-10-17 17:37:48 +000035/**
Stefan Lafonae2df012017-11-14 09:17:21 -080036 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000037 * raw stats log events from the Android system, also known as "atoms."
38 *
39 * This field contains a single oneof with all of the available messages.
40 * The stats-log-api-gen tool runs as part of the Android build and
41 * generates the android.util.StatsLog class, which contains the constants
42 * and methods that Android uses to log.
43 *
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * Instead, statsd on Android constructs these messages synthetically,
46 * in the format defined here and in stats_log.proto.
47 */
Stefan Lafonae2df012017-11-14 09:17:21 -080048message Atom {
49 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070050 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070051 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
52 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070053 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070054 BleScanResultReceived ble_scan_result_received = 4;
55 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080056 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070057 SyncStateChanged sync_state_changed = 7;
58 ScheduledJobStateChanged scheduled_job_state_changed = 8;
59 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070060 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080061 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
62 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
63 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070064 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
65 MemoryFactorStateChanged memory_factor_state_changed = 15;
66 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
67 CachedKillReported cached_kill_reported = 17;
68 ProcessMemoryStatReported process_memory_stat_reported = 18;
69 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080070 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
71 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
72 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070073 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080074 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070075 CameraStateChanged camera_state_changed = 25;
76 FlashlightStateChanged flashlight_state_changed = 26;
77 UidProcessStateChanged uid_process_state_changed = 27;
78 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
79 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070080 BatteryLevelChanged battery_level_changed = 30;
81 ChargingStateChanged charging_state_changed = 31;
82 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070083 InteractiveStateChanged interactive_state_changed = 33;
84 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070085 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
86 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070087 WifiLockStateChanged wifi_lock_state_changed = 37;
88 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
89 WifiScanStateChanged wifi_scan_state_changed = 39;
90 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070091 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070092 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070093 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090094 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070095 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080096 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080097 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080098 AppStartOccurred app_start_occurred = 48;
99 AppStartCanceled app_start_canceled = 49;
100 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800102 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800103 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800104 LmkStateChanged lmk_state_changed = 54;
105 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800106 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800107 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800108 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800109 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800110 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800111 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800112 KeyguardStateChanged keyguard_state_changed = 62;
113 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
114 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800115 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800116 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800117 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
118 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700119 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700120 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800121 SpeakerImpedanceReported speaker_impedance_reported = 71;
122 HardwareFailed hardware_failed = 72;
123 PhysicalDropDetected physical_drop_detected = 73;
124 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800125 MobileConnectionStateChanged mobile_connection_state_changed = 75;
126 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700127 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800128 AppCrashOccurred app_crash_occurred = 78;
129 ANROccurred anr_occurred = 79;
130 WTFOccurred wtf_occurred = 80;
131 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700132 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700133 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700134 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700135 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700136 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700137 FingerprintAcquired fingerprint_acquired = 87;
138 FingerprintAuthenticated fingerprint_authenticated = 88;
139 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700140 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700141 BatteryHealthSnapshot battery_health_snapshot = 91;
142 SlowIo slow_io = 92;
143 BatteryCausedShutdown battery_caused_shutdown = 93;
Yao Chend54f9dd2017-10-17 17:37:48 +0000144 }
David Chenc8a43242017-10-17 16:23:28 -0700145
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100147 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700148 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800149 WifiBytesTransfer wifi_bytes_transfer = 10000;
150 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
151 MobileBytesTransfer mobile_bytes_transfer = 10002;
152 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800153 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800154 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800155 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800156 CpuTimePerFreq cpu_time_per_freq = 10008;
157 CpuTimePerUid cpu_time_per_uid = 10009;
158 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800159 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800160 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800161 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800162 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800163 SystemElapsedRealtime system_elapsed_realtime = 10014;
164 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800165 CpuActiveTime cpu_active_time = 10016;
166 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000167 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800168 RemainingBatteryCapacity remaining_battery_capacity = 10019;
169 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800170 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100171 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100172 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100173 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000174 DiskStats disk_stats = 10025;
175 DirectoryUsage directory_usage = 10026;
176 AppSize app_size = 10027;
177 CategorySize category_size = 10028;
Bookatz17f0d8a2018-09-13 12:56:32 -0700178 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700179 NumFingerprints num_fingerprints = 10031;
Chenjie Yu12e5e672018-09-14 15:54:59 -0700180 ProcStats proc_stats = 10029;
Tej Singhe7726dc2018-09-21 11:42:12 -0700181 DiskIo disk_io = 10032;
David Chenc8a43242017-10-17 16:23:28 -0700182 }
yroa1fe77c2018-02-26 14:22:54 -0800183
Bookatz76aafcf2018-09-17 16:17:10 -0700184 // DO NOT USE field numbers above 100,000 in AOSP.
185 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
186 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700187}
188
Yao Chend54f9dd2017-10-17 17:37:48 +0000189/**
Yangster-mac20877162017-12-22 17:19:39 -0800190 * This proto represents a node of an attribution chain.
191 * Note: All attribution chains are represented as a repeated field of type
192 * AttributionNode. It is understood that in such arrays, the order is that
193 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000194 */
Yangster-mac20877162017-12-22 17:19:39 -0800195message AttributionNode {
196 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800197 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800198
Yangster-mac20877162017-12-22 17:19:39 -0800199 // The (optional) string tag for an element in the attribution chain. If the
200 // element has no tag, it is encoded as an empty string.
201 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700202}
203
Yangster-mac48b3d622018-08-18 12:38:11 -0700204message KeyValuePair {
205 optional int32 key = 1;
206 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700207 int32 value_int = 2;
208 int64 value_long = 3;
209 string value_str = 4;
210 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700211 }
212}
213
214message KeyValuePairsAtom {
215 optional int32 uid = 1;
216 repeated KeyValuePair pairs = 2;
217}
218
Yao Chend54f9dd2017-10-17 17:37:48 +0000219/*
220 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800221 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000222 *
223 * RULES:
224 * - The field ids for each atom must start at 1, and count upwards by 1.
225 * Skipping field ids is not allowed.
226 * - These form an API, so renaming, renumbering or removing fields is
227 * not allowed between android releases. (This is not currently enforced,
228 * but there will be a tool to enforce this restriction).
229 * - The types must be built-in protocol buffer types, namely, no sub-messages
230 * are allowed (yet). The bytes type is also not allowed.
231 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800232 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000233 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800234 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000235 * - A field that is a uid should be a string field, tagged with the [xxx]
236 * annotation. The generated code on android will be represented by UIDs,
237 * and those UIDs will be translated in xxx to those strings.
238 *
239 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700240 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000241 * - If there is a UID, it goes first. Think in an object-oriented fashion.
242 * *****************************************************************************
243 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700244
Yao Chend54f9dd2017-10-17 17:37:48 +0000245/**
Yangster-mace16189a2018-08-26 12:20:16 -0700246 * Logs when the Thermal service HAL notifies the throttling start/stop events.
247 *
248 * Logged from:
249 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
250 */
251message ThermalThrottlingStateChanged {
252 optional android.os.TemperatureTypeEnum sensor_type = 1;
253
254 enum State {
255 UNKNOWN = 0;
256 START = 1;
257 STOP = 2;
258 }
259
260 optional State state = 2;
261
262 optional float temperature = 3;
263}
264
265/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000266 * Logs when the screen state changes.
267 *
268 * Logged from:
269 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
270 */
271message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800272 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800273 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700274}
Yao Chend54f9dd2017-10-17 17:37:48 +0000275
276/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700277 * Logs that the process state of the uid, as determined by ActivityManager
278 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000279 *
280 * Logged from:
281 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
282 */
Bookatzc1a050a2017-10-10 15:49:28 -0700283message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700284 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000285
Bookatzdb026a22018-01-10 19:01:56 -0800286 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800287 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000288}
289
290/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700291 * Logs process state change of a process, as per the activity manager.
292 *
293 * Logged from:
294 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
295 */
296message ProcessStateChanged {
297 optional int32 uid = 1;
298 optional string process_name = 2;
299 optional string package_name = 3;
300 // TODO: remove this when validation is done
301 optional int64 version = 5;
302 // The state, from frameworks/base/core/proto/android/app/enums.proto.
303 optional android.app.ProcessStateEnum state = 4;
304}
305
306/**
307 * Logs when ActivityManagerService sleep state is changed.
308 *
309 * Logged from:
310 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
311 */
312message ActivityManagerSleepStateChanged {
313 // TODO: import frameworks proto
314 enum State {
315 UNKNOWN = 0;
316 ASLEEP = 1;
317 AWAKE = 2;
318 }
319 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
320}
321
322/**
323 * Logs when system memory state changes.
324 *
325 * Logged from:
326 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
327 */
328message MemoryFactorStateChanged {
329 // TODO: import frameworks proto
330 enum State {
331 MEMORY_UNKNOWN = 0;
332 NORMAL = 1; // normal.
333 MODERATE = 2; // moderate memory pressure.
334 LOW = 3; // low memory.
335 CRITICAL = 4; // critical memory.
336
337 }
338 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
339}
340
341/**
342 * Logs when app is using too much cpu, according to ActivityManagerService.
343 *
344 * Logged from:
345 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
346 */
347message ExcessiveCpuUsageReported {
348 optional int32 uid = 1;
349 optional string process_name = 2;
350 optional string package_name = 3;
351 // package version. TODO: remove this when validation is done
352 optional int64 version = 4;
353}
354
355/**
356 * Logs when a cached process is killed, along with its pss.
357 *
358 * Logged from:
359 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
360 */
361message CachedKillReported {
362 optional int32 uid = 1;
363 optional string process_name = 2;
364 optional string package_name = 3;
365 // TODO: remove this when validation is done
366 optional int64 version = 5;
367 optional int64 pss = 4;
368}
369
370/**
371 * Logs when memory stats of a process is reported.
372 *
373 * Logged from:
374 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
375 */
376message ProcessMemoryStatReported {
377 optional int32 uid = 1;
378 optional string process_name = 2;
379 optional string package_name = 3;
380 //TODO: remove this when validation is done
381 optional int64 version = 9;
382 optional int64 pss = 4;
383 optional int64 uss = 5;
384 optional int64 rss = 6;
385 enum Type {
386 ADD_PSS_INTERNAL_SINGLE = 0;
387 ADD_PSS_INTERNAL_ALL_MEM = 1;
388 ADD_PSS_INTERNAL_ALL_POLL = 2;
389 ADD_PSS_EXTERNAL = 3;
390 ADD_PSS_EXTERNAL_SLOW = 4;
391 }
392 optional Type type = 7;
393 optional int64 duration = 8;
394}
395
396/**
Bookatzc1a050a2017-10-10 15:49:28 -0700397 * Logs that a process started, finished, crashed, or ANRed.
398 *
399 * Logged from:
400 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
401 */
402message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700403 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700404
David Chen0b5c90c2018-01-25 16:51:49 -0800405 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800406 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700407
Bookatzddccf0a2017-11-28 16:48:14 -0800408 // What lifecycle state the process changed to.
409 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800410 enum State {
411 FINISHED = 0;
412 STARTED = 1;
413 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800414 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800415 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700416}
417
Bookatzc1a050a2017-10-10 15:49:28 -0700418/**
419 * Logs when the ble scan state changes.
420 *
421 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700422 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700423 */
424message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800425 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700426
427 enum State {
428 OFF = 0;
429 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700430 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
431 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700432 }
433 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700434
Bookatze5ec0b42018-03-26 13:34:56 -0700435 // Does the scan have a filter.
436 optional bool is_filtered = 3;
437 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
438 optional bool is_first_match = 4;
439 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
440 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700441}
442
443/**
444 * Logs reporting of a ble scan finding results.
445 *
446 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700447 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700448 */
Bookatzae6738e2018-09-13 11:38:56 -0700449// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700450message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800451 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700452
453 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800454 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700455}
456
457/**
458 * Logs when a sensor state changes.
459 *
460 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700461 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700462 */
463message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800464 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700465
Bookatzc1a050a2017-10-10 15:49:28 -0700466 // The id (int) of the sensor.
467 optional int32 sensor_id = 2;
468
469 enum State {
470 OFF = 0;
471 ON = 1;
472 }
473 optional State state = 3;
474}
475
476
477/**
478 * Logs when GPS state changes.
479 *
480 * Logged from:
481 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
482 */
483message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800484 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700485
486 enum State {
487 OFF = 0;
488 ON = 1;
489 }
490 optional State state = 2;
491}
492
493
494/**
495 * Logs when a sync manager sync state changes.
496 *
497 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700498 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700499 */
500message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800501 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700502
David Chen0b5c90c2018-01-25 16:51:49 -0800503 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800504 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700505
506 enum State {
507 OFF = 0;
508 ON = 1;
509 }
510 optional State state = 3;
511}
512
Yangster-mac96353002018-09-05 11:18:55 -0700513/*
514 * Deferred job stats.
515 *
516 * Logged from:
517 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
518*/
519message DeferredJobStatsReported {
520 repeated AttributionNode attribution_node = 1;
521
522 // Number of jobs deferred.
523 optional int32 num_jobs_deferred = 2;
524
525 // Time since the last job runs.
526 optional int64 time_since_last_job_millis = 3;
527}
528
Bookatzc1a050a2017-10-10 15:49:28 -0700529/**
530 * Logs when a job scheduler job state changes.
531 *
532 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700533 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700534 */
535message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800536 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700537
538 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800539 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700540
541 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800542 FINISHED = 0;
543 STARTED = 1;
544 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700545 }
546 optional State state = 3;
547
Tej Singh33a412b2018-03-16 18:43:59 -0700548 // The reason a job has stopped.
549 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700550 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700551 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700552}
553
554/**
555 * Logs when the audio state changes.
556 *
557 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700558 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700559 */
560message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800561 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700562
563 enum State {
564 OFF = 0;
565 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700566 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
567 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700568 }
569 optional State state = 2;
570}
571
572/**
573 * Logs when the video codec state changes.
574 *
575 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700576 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700577 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800578message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800579 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700580
581 enum State {
582 OFF = 0;
583 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700584 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
585 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700586 }
587 optional State state = 2;
588}
589
590/**
591 * Logs when the flashlight state changes.
592 *
593 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700594 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700595 */
596message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800597 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700598
599 enum State {
600 OFF = 0;
601 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700602 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
603 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700604 }
605 optional State state = 2;
606}
607
608/**
609 * Logs when the camera state changes.
610 *
611 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700612 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700613 */
614message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800615 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700616
617 enum State {
618 OFF = 0;
619 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700620 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
621 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700622 }
623 optional State state = 2;
624}
625
626/**
627 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000628 *
629 * Logged from:
630 * TODO
631 */
Bookatzd6746242017-10-24 18:39:35 -0700632message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800633 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000634
Bookatz1a1b0462018-01-12 11:47:03 -0800635 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
636 // From frameworks/base/core/proto/android/os/enums.proto.
637 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700638
639 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
640 optional string tag = 3;
641
642 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800643 RELEASE = 0;
644 ACQUIRE = 1;
645 CHANGE_RELEASE = 2;
646 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700647 }
648 optional State state = 4;
649}
650
651/**
Bookatzc1a050a2017-10-10 15:49:28 -0700652 * Logs when a partial wakelock is considered 'long' (over 1 min).
653 *
654 * Logged from:
655 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
656 */
657message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800658 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700659
Yao Chend54f9dd2017-10-17 17:37:48 +0000660 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
661 optional string tag = 2;
662
Bookatzc1a050a2017-10-10 15:49:28 -0700663 // TODO: I have no idea what this is.
664 optional string history_tag = 3;
665
666 enum State {
667 OFF = 0;
668 ON = 1;
669 }
670 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000671}
672
Bookatzc1a050a2017-10-10 15:49:28 -0700673/**
Bookatza66083f2018-09-20 17:24:00 -0700674 * Logs when the device is interactive, according to the PowerManager Notifier.
675 *
676 * Logged from:
677 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
678 */
679message InteractiveStateChanged {
680 enum State {
681 OFF = 0;
682 ON = 1;
683 }
684 optional State state = 1;
685}
686
687/**
Bookatzc1a050a2017-10-10 15:49:28 -0700688 * Logs Battery Saver state change.
689 *
690 * Logged from:
691 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
692 */
693message BatterySaverModeStateChanged {
694 enum State {
695 OFF = 0;
696 ON = 1;
697 }
698 optional State state = 1;
699}
700
701/**
702 * Logs Doze mode state change.
703 *
704 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800705 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700706 */
707message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800708 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800709}
710
711
712/**
713 * Logs state change of Doze mode including maintenance windows.
714 *
715 * Logged from:
716 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
717 */
718message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800719 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700720}
721
722/**
723 * Logs screen brightness level.
724 *
725 * Logged from:
726 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
727 */
728message ScreenBrightnessChanged {
729 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
730 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700731}
732
733/**
734 * Logs battery level (percent full, from 0 to 100).
735 *
736 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700737 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700738 */
739message BatteryLevelChanged {
740 // Battery level. Should be in [0, 100].
741 optional int32 battery_level = 1;
742}
743
744/**
745 * Logs change in charging status of the device.
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 ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800751 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
752 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700753}
754
755/**
756 * Logs whether the device is plugged in, and what power source it is using.
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 PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800762 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
763 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700764}
765
Bookatz8c6571b2017-10-24 15:04:41 -0700766/**
767 * Logs when an app's wakeup alarm fires.
768 *
769 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700770 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700771 */
772message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800773 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800774
775 // Name of the wakeup alarm.
776 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700777
778 // Name of source package (for historical reasons, since BatteryStats tracked it).
779 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800780}
781
782/**
783 * Logs when an an app causes the mobile radio to change state.
784 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
785 *
786 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700787 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800788 */
789message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800790 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800791
Bookatz1a1b0462018-01-12 11:47:03 -0800792 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
793 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800794}
795
796/**
797 * Logs when an an app causes the wifi radio to change state.
798 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
799 *
800 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700801 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800802 */
803message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800804 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800805
Bookatz1a1b0462018-01-12 11:47:03 -0800806 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
807 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700808}
809
810/**
811 * Logs kernel wakeup reasons and aborts.
812 *
813 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700814 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700815 */
816message KernelWakeupReported {
817 // Name of the kernel wakeup reason (or abort).
818 optional string wakeup_reason_name = 1;
819
820 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800821 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700822}
823
824/**
825 * Logs wifi locks held by an app.
826 *
827 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700828 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700829 */
830message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800831 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700832
833 enum State {
834 OFF = 0;
835 ON = 1;
836 }
837 optional State state = 2;
838}
839
840/**
841 * Logs wifi signal strength changes.
842 *
843 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700844 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700845 */
846message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800847 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
848 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700849}
850
851/**
852 * Logs wifi scans performed by an app.
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 WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800858 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700859
860 enum State {
861 OFF = 0;
862 ON = 1;
863 }
864 optional State state = 2;
865}
866
867/**
Tej Singh4503e102018-01-04 14:35:01 -0800868 * Logs wifi multicast locks held by an app
869 *
870 * Logged from:
871 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
872 */
873message WifiMulticastLockStateChanged {
874 repeated AttributionNode attribution_node = 1;
875
876 enum State {
877 OFF = 0;
878 ON = 1;
879 }
880 optional State state = 2;
881}
882
883/**
Tej Singh1ea42892018-01-19 09:27:00 -0800884 * Logs shutdown reason and duration on next boot.
885 *
886 * Logged from:
887 * frameworks/base/core/java/com/android/server/BootReceiver.java
888 */
889message ShutdownSequenceReported {
890 // True if shutdown is for a reboot. Default: false if we do not know.
891 optional bool reboot = 1;
892
893 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
894 optional string reason = 2;
895
896 // Beginning of shutdown time in ms using wall clock time since unix epoch.
897 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800898 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800899
900 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800901 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800902}
903
Tej Singh6483ea42018-01-25 17:45:49 -0800904
905/**
906 * Logs boot reason and duration.
907 *
908 * Logged from:
909 * system/core/bootstat/bootstat.cpp
910 */
911message BootSequenceReported {
912 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
913 // Default: "<EMPTY>" if not available.
914 optional string bootloader_reason = 1;
915
916 // Reason for system boot. Eg. bootloader, reboot,userrequested
917 // Default: "<EMPTY>" if not available.
918 optional string system_reason = 2;
919
920 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800921 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800922
923 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800924 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800925
926 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800927 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800928
929 // Time since last boot in ms. Default: 0 if not available.
930 optional int64 time_since_last_boot = 6;
931}
932
Tej Singhc477d9c2018-02-05 18:31:39 -0800933
934/**
935 * Logs call state and disconnect cause (if applicable).
936 *
937 * Logged from:
938 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
939 */
940message CallStateChanged {
941 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
942 // From frameworks/base/core/proto/android/telecomm/enums.proto.
943 optional android.telecom.CallStateEnum call_state = 1;
944
945 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
946 // This value is only applicable when the call_state is DISCONNECTED, and
947 // should always be UNKNOWN if the call_state is not DISCONNECTED.
948 // From frameworks/base/core/proto/android/telecomm/enums.proto.
949 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
950
951 // True if the call is self-managed, which are apps that use the
952 // telecom infrastructure to make their own calls.
953 optional bool self_managed = 3;
954
955 // True if call is external. External calls are calls on connected Wear
956 // devices but show up in Telecom so the user can pull them onto the device.
957 optional bool external_call = 4;
958}
959
Tej Singh1ea42892018-01-19 09:27:00 -0800960/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800961 * Logs keyguard state. The keyguard is the lock screen.
962 *
963 * Logged from:
964 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
965 */
966message KeyguardStateChanged {
967 enum State {
968 UNKNOWN = 0;
969 // The keyguard is hidden when the phone is unlocked.
970 HIDDEN = 1;
971 // The keyguard is shown when the phone is locked (screen turns off).
972 SHOWN= 2;
973 // The keyguard is occluded when something is overlaying the keyguard.
974 // Eg. Opening the camera while on the lock screen.
975 OCCLUDED = 3;
976 }
977 optional State state = 1;
978}
979
980/**
981 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
982 * prompts the user to enter a password (pattern, pin, etc).
983 *
984 * Logged from:
985 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
986 */
987
988message KeyguardBouncerStateChanged {
989 enum State {
990 UNKNOWN = 0;
991 // Bouncer is hidden, either as a result of successfully entering the
992 // password, screen timing out, or user going back to lock screen.
993 HIDDEN = 1;
994 // This is when the user is being prompted to enter the password.
995 SHOWN = 2;
996 }
997 optional State state = 1;
998}
999
1000/**
1001 * Logs the result of entering a password into the keyguard bouncer.
1002 *
1003 * Logged from:
1004 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1005 */
1006message KeyguardBouncerPasswordEntered {
1007 enum BouncerResult {
1008 UNKNOWN = 0;
1009 // The password entered was incorrect.
1010 FAILURE = 1;
1011 // The password entered was correct.
1012 SUCCESS = 2;
1013 }
1014 optional BouncerResult result = 1;
1015}
1016
Tej Singha883b372018-02-15 11:30:01 -08001017/*
1018 * Logs changes to the configuration of the device. The configuration is defined
1019 * in frameworks/base/core/java/android/content/res/Configuration.java
1020 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1021 * Please go there to interpret the possible values each field can be.
1022 *
1023 * Logged from:
1024 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1025 */
1026message ResourceConfigurationChanged {
1027 // Bit mask of color capabilities of the screen.
1028 // Contains information about the color gamut and hdr mode of the screen.
1029 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1030 optional int32 colorMode = 1;
1031
1032 // The target screen density being rendered to.
1033 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1034 optional int32 densityDpi = 2;
1035
1036 // Current user preference for the scaling factor for fonts,
1037 // relative to the base density scaling.
1038 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1039 optional float fontScale = 3;
1040
1041 // Flag indicating whether the hard keyboard is hidden.
1042 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1043 optional int32 hardKeyboardHidden = 4;
1044
1045 // The type of keyboard attached to the device.
1046 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1047 optional int32 keyboard = 5;
1048
1049 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1050 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1051 optional int32 keyboardHideen = 6;
1052
1053 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1054 // 0 if undefined.
1055 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1056 optional int32 mcc = 7;
1057
1058 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1059 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1060 // MNC_ZERO symbol defined in Configuration.java.
1061 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1062 optional int32 mnc = 8;
1063
1064 // The kind of navigation available on the device.
1065 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1066 optional int32 navigation = 9;
1067
1068 // Flag indicating whether the navigation is available.
1069 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1070 optional int32 navigationHidden = 10;
1071
1072 // Overall orientation of the screen.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1074 optional int32 orientation = 11;
1075
1076 // The current height of the available screen space, in dp units.
1077 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1078 optional int32 screenHeightDp = 12;
1079
1080 // Bit mask of overall layout of the screen.
1081 // Contains information about screen size, whether the screen is wider/taller
1082 // than normal, whether the screen layout is right-tl-left or left-to-right,
1083 // and whether the screen has a rounded shape.
1084 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1085 optional int32 screenLayout = 13;
1086
1087 // Current width of the available screen space, in dp units.
1088 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1089 optional int32 screenWidthDp = 14;
1090
1091 // The smallest screen size an application will see in normal operation.
1092 // This is the smallest value of both screenWidthDp and screenHeightDp
1093 // in portrait and landscape.
1094 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1095 optional int32 smallestScreenWidthDp = 15;
1096
1097 // The type of touch screen attached to the device.
1098 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1099 optional int32 touchscreen = 16;
1100
1101 // Bit mask of the ui mode.
1102 // Contains information about the overall ui mode of the device.
1103 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1104 // Also contains information about whether the device is in night mode.
1105 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1106 optional int32 uiMode = 17;
1107}
1108
Tej Singheee317b2018-03-07 19:28:05 -08001109
1110/**
1111 * Logs changes in the connection state of the mobile radio.
1112 *
1113 * Logged from:
1114 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1115 */
1116message MobileConnectionStateChanged {
1117 // States are from the state machine DataConnection.java.
1118 enum State {
1119 UNKNOWN = 0;
1120 // The connection is inactive, or disconnected.
1121 INACTIVE = 1;
1122 // The connection is being activated, or connecting.
1123 ACTIVATING = 2;
1124 // The connection is active, or connected.
1125 ACTIVE = 3;
1126 // The connection is disconnecting.
1127 DISCONNECTING = 4;
1128 // The connection is disconnecting after creating a connection.
1129 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1130 }
1131 optional State state = 1;
1132 // For multi-sim phones, this distinguishes between the sim cards.
1133 optional int32 sim_slot_index = 2;
1134 // Used to identify the connection. Starts at 0 and increments by 1 for
1135 // every new network created. Resets whenever the device reboots.
1136 optional int32 data_connection_id = 3;
1137 // A bitmask for the capabilities of this connection.
1138 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1139 // Default value (if we have no information): 0
1140 optional int64 capabilities = 4;
1141 // If this connection has internet.
1142 // This just checks if the DEFAULT bit of capabilities is set.
1143 optional bool has_internet = 5;
1144}
1145
1146/**
1147 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1148 *
1149 * Logged from:
1150 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1151 */
1152message MobileRadioTechnologyChanged {
1153 optional android.telephony.NetworkTypeEnum state = 1;
1154 // For multi-sim phones, this distinguishes between the sim cards.
1155 optional int32 sim_slot_index = 2;
1156}
1157
Andrew Chantb56388b2018-03-22 21:07:33 -07001158/**
1159 * Logs the VID and PID of any connected USB devices.
1160 *
1161 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1162 *
1163 * Logged by Vendor.
1164 */
1165message UsbDeviceAttached {
1166 optional int32 vid = 1;
1167 optional int32 pid = 2;
1168 optional bool has_audio = 3;
1169 optional bool has_hid = 4;
1170 optional bool has_storage = 5;
1171}
1172
Tej Singheee317b2018-03-07 19:28:05 -08001173
Tej Singhdd7bd352018-02-09 19:33:15 -08001174/**
Tej Singh5d991e12018-03-09 19:48:11 -08001175 * Logs when Bluetooth is enabled and disabled.
1176 *
1177 * Logged from:
1178 * services/core/java/com/android/server/BluetoothManagerService.java
1179 */
1180message BluetoothEnabledStateChanged {
1181 repeated AttributionNode attribution_node = 1;
1182 // Whether or not bluetooth is enabled on the device.
1183 enum State {
1184 UNKNOWN = 0;
1185 ENABLED = 1;
1186 DISABLED = 2;
1187 }
1188 optional State state = 2;
1189 // The reason for being enabled/disabled.
1190 // Eg. Airplane mode, crash, application request.
1191 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1192 // If the reason is an application request, this will be the package name.
1193 optional string pkgName = 4;
1194}
1195
1196/**
1197 * Logs when a Bluetooth device connects and disconnects.
1198 *
1199 * Logged from:
1200 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1201 */
1202message BluetoothConnectionStateChanged {
1203 // The state of the connection.
1204 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1205 optional android.bluetooth.ConnectionStateEnum state = 1;
1206 // An identifier that can be used to match connect and disconnect events.
1207 // Currently is last two bytes of a hash of a device level ID and
1208 // the mac address of the bluetooth device that is connected.
1209 optional int32 obfuscated_id = 2;
1210 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1211 // From android.bluetooth.BluetoothAdapter.java
1212 optional int32 bt_profile = 3;
1213}
1214
1215/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001216 * Logs when something is plugged into or removed from the USB-C connector.
1217 *
1218 * Logged from:
1219 * Vendor USB HAL.
1220 */
1221message UsbConnectorStateChanged {
1222 enum State {
1223 DISCONNECTED = 0;
1224 CONNECTED = 1;
1225 }
1226 optional State state = 1;
1227}
1228
1229/**
1230 * Logs the reported speaker impedance.
1231 *
1232 * Logged from:
1233 * Vendor audio implementation.
1234 */
1235message SpeakerImpedanceReported {
1236 optional int32 speaker_location = 1;
1237 optional int32 impedance = 2;
1238}
1239
1240/**
1241 * Logs the report of a failed hardware.
1242 *
1243 * Logged from:
1244 * Vendor HALs.
1245 *
1246 */
1247message HardwareFailed {
1248 enum HardwareType {
1249 HARDWARE_FAILED_UNKNOWN = 0;
1250 HARDWARE_FAILED_MICROPHONE = 1;
1251 HARDWARE_FAILED_CODEC = 2;
1252 HARDWARE_FAILED_SPEAKER = 3;
1253 HARDWARE_FAILED_FINGERPRINT = 4;
1254 }
1255 optional HardwareType hardware_type = 1;
1256
1257 /* hardware_location allows vendors to differentiate between multiple instances of
1258 * the same hardware_type. The specific locations are vendor defined integers,
1259 * referring to board-specific numbering schemes.
1260 */
1261 optional int32 hardware_location = 2;
1262
1263 /* failure_code is specific to the HardwareType of the failed hardware.
1264 * It should use the enum values defined below.
1265 */
1266 enum MicrophoneFailureCode {
1267 MICROPHONE_FAILURE_COMPLETE = 0;
1268 }
1269 enum CodecFailureCode {
1270 CODEC_FAILURE_COMPLETE = 0;
1271 }
1272 enum SpeakerFailureCode {
1273 SPEAKER_FAILURE_COMPLETE = 0;
1274 SPEAKER_FAILURE_HIGH_Z = 1;
1275 SPEAKER_FAILURE_SHORT = 2;
1276 }
1277 enum FingerprintFailureCode {
1278 FINGERPRINT_FAILURE_COMPLETE = 0;
1279 FINGERPRINT_SENSOR_BROKEN = 1;
1280 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1281 }
1282 optional int32 failure_code = 3;
1283}
1284
1285/**
1286 * Log an event when the device has been physically dropped.
1287 * Reported from the /vendor partition.
1288 */
1289message PhysicalDropDetected {
1290 // Confidence that the event was actually a drop, 0 -> 100
1291 optional int32 confidence_pctg = 1;
1292 // Peak acceleration of the drop, in 1/1000s of a g.
1293 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001294 // Duration of freefall in ms
1295 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001296}
1297
1298/**
1299 * Log bucketed battery charge cycles.
1300 *
1301 * Each bucket represents cycles of the battery past
1302 * a given charge point. For example, bucket 1 is the
1303 * lowest 1/8th of the battery, and bucket 8 is 100%.
1304 *
1305 * Logged from:
1306 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1307 */
1308message ChargeCyclesReported {
1309 optional int32 cycle_bucket_1 = 1;
1310 optional int32 cycle_bucket_2 = 2;
1311 optional int32 cycle_bucket_3 = 3;
1312 optional int32 cycle_bucket_4 = 4;
1313 optional int32 cycle_bucket_5 = 5;
1314 optional int32 cycle_bucket_6 = 6;
1315 optional int32 cycle_bucket_7 = 7;
1316 optional int32 cycle_bucket_8 = 8;
1317}
1318
1319/**
Howard Roa46b6582018-09-18 16:45:02 -07001320 * Log battery health snapshot.
1321 *
1322 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1323 * are snapshotted periodically over 24hrs.
1324 */
1325message BatteryHealthSnapshot {
1326 enum BatterySnapshotType {
1327 UNKNOWN = 0;
1328 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1329 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1330 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1331 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1332 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1333 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1334 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1335 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1336 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1337 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1338 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1339 }
1340 optional BatterySnapshotType type = 1;
1341 // Temperature, in 1/10ths of degree C.
1342 optional int32 temperature_deci_celcius = 2;
1343 // Voltage Battery Voltage, in microVolts.
1344 optional int32 voltage_micro_volt = 3;
1345 // Current Battery current, in microAmps.
1346 optional int32 current_micro_amps = 4;
1347 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1348 optional int32 open_circuit_micro_volt = 5;
1349 // Resistance Battery Resistance, in microOhms.
1350 optional int32 resistance_micro_ohm = 6;
1351 // Level Battery Level, as % of full.
1352 optional int32 level_percent = 7;
1353}
1354
1355/**
1356 * Log slow I/O operations on the primary storage.
1357 */
1358message SlowIo {
1359 // Classifications of IO Operations.
1360 enum IoOperation {
1361 UNKNOWN = 0;
1362 READ = 1;
1363 WRITE = 2;
1364 UNMAP = 3;
1365 SYNC = 4;
1366 }
1367 optional IoOperation operation = 1;
1368
1369 // The number of slow IO operations of this type over 24 hours.
1370 optional int32 count = 2;
1371}
1372
1373/**
1374 * Log battery caused shutdown with the last recorded voltage.
1375 */
1376message BatteryCausedShutdown {
1377 // The last recorded battery voltage prior to shutdown.
1378 optional int32 last_recorded_micro_volt = 1;
1379}
1380
1381/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001382 * Logs the duration of a davey (jank of >=700ms) when it occurs
1383 *
1384 * Logged from:
1385 * frameworks/base/libs/hwui/JankTracker.cpp
1386 */
1387message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001388 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001389 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001390
Tej Singhbb8554a2018-01-26 11:59:14 -08001391 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001392 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001393}
1394
1395/**
Bookatze5885242017-10-24 20:10:31 -07001396 * Logs phone signal strength changes.
1397 *
1398 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001399 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001400 */
1401message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001402 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1403 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001404}
1405
1406/**
1407 * Logs that a setting was updated.
1408 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001409 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001410 * The tag and is_default allow resetting of settings to default values based on the specified
1411 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1412 */
1413message SettingChanged {
1414 // The name of the setting.
1415 optional string setting = 1;
1416
1417 // The change being imposed on this setting. May represent a number, eg "3".
1418 optional string value = 2;
1419
1420 // The new value of this setting. For most settings, this is same as value. For some settings,
1421 // value is +X or -X where X represents an element in a set. For example, if the previous value
1422 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1423 // The +/- feature is currently only used for location_providers_allowed.
1424 optional string new_value = 3;
1425
1426 // The previous value of this setting.
1427 optional string prev_value = 4;
1428
1429 // The tag used with the is_default for resetting sets of settings. This is generally null.
1430 optional string tag = 5;
1431
Bookatz90867622018-01-31 15:05:57 -08001432 // True if this setting with tag should be resettable.
1433 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001434
David Chenbd789912018-03-16 17:19:55 -07001435 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001436 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001437
1438 enum ChangeReason {
1439 UPDATED = 1; // Updated can be an insertion or an update.
1440 DELETED = 2;
1441 }
1442 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001443}
Chenjie Yub3dda412017-10-24 13:41:59 -07001444
Chenjie Yu05013b32017-11-21 10:21:41 -08001445/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001446 * Logs activity going to foreground or background
1447 *
1448 * Logged from:
1449 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1450 */
1451message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001452 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001453 optional string pkg_name = 2;
1454 optional string class_name = 3;
1455
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001456 enum State {
1457 BACKGROUND = 0;
1458 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001459 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001460 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001461}
David Chenc8a43242017-10-17 16:23:28 -07001462
1463/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001464 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001465 * Logged from:
1466 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1467 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001468message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001469 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001470
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001471 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001472
1473 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001474 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001475 optional string process_name = 3;
1476
1477 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001478 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001479
1480 optional string package_name = 5;
1481
1482 enum InstantApp {
1483 UNAVAILABLE = 0;
1484 FALSE = 1;
1485 TRUE = 2;
1486 }
1487 optional InstantApp is_instant_app = 6;
1488
1489 enum ForegroundState {
1490 UNKNOWN = 0;
1491 BACKGROUND = 1;
1492 FOREGROUND = 2;
1493 }
1494 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001495}
David Chen9e3808c2017-11-20 17:25:34 -08001496
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001497/**
1498 * Logs when a WTF (What a Terrible Failure) happened.
1499 * Logged from:
1500 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1501 */
1502message WTFOccurred {
1503 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001504
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001505 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001506
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001507 // The name of the process.
1508 // system_server if it is not by an app
1509 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001510
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001511 // The pid if available. -1 means not available.
1512 optional sint32 pid = 4;
1513}
1514
1515/**
1516 * Logs when system server reports low memory.
1517 * Logged from:
1518 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1519 */
1520message LowMemReported {
1521}
1522
1523/**
1524 * Logs when an app ANR (App Not Responding) occurs.
1525 * Logged from:
1526 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1527 */
1528message ANROccurred {
1529 optional int32 uid = 1 [(is_uid) = true];
1530
1531 optional string process_name = 2;
1532
1533 optional string short_component_name = 3;
1534
1535 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001536
1537 enum InstantApp {
1538 UNAVAILABLE = 0;
1539 FALSE = 1;
1540 TRUE = 2;
1541 }
1542 optional InstantApp is_instant_app = 5;
1543
1544 enum ForegroundState {
1545 UNKNOWN = 0;
1546 BACKGROUND = 1;
1547 FOREGROUND = 2;
1548 }
1549 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001550}
1551
Bookatza7020bd2018-08-28 16:29:35 -07001552/**
1553 * Logs when the vibrator state changes.
1554 * Logged from:
1555 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1556 */
1557message VibratorStateChanged {
1558 repeated AttributionNode attribution_node = 1;
1559
1560 enum State {
1561 OFF = 0;
1562 ON = 1;
1563 }
1564 optional State state = 2;
1565
1566 // Duration (in milliseconds) requested to keep the vibrator on.
1567 // Only applicable for State == ON.
1568 optional int64 duration_millis = 3;
1569}
1570
David Chen0a368b22017-12-06 16:28:16 -08001571/*
1572 * Allows other apps to push events into statsd.
1573 * Logged from:
1574 * frameworks/base/core/java/android/util/StatsLog.java
1575 */
David Chen0b5c90c2018-01-25 16:51:49 -08001576message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001577 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001578 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001579
1580 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1581 optional int32 label = 2;
1582
1583 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1584 // predicates for the metrics).
1585 enum State {
1586 UNKNOWN = 0;
1587 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1588 STOP = 2;
1589 START = 3;
1590 }
1591 optional State state = 3;
1592}
1593
David Chen9e3808c2017-11-20 17:25:34 -08001594/**
Bookatz7948c872018-09-04 12:58:33 -07001595 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1596 * For example, this could be due to the user manually changing the time.
1597 *
1598 * Logged from:
1599 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1600 */
1601message WallClockTimeShifted {
1602 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1603 optional int64 wall_clock_timestamp_millis = 1;
1604}
1605
1606/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001607 * Logs when statsd detects an anomaly.
1608 *
1609 * Logged from:
1610 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1611 */
1612message AnomalyDetected {
1613 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001614 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001615
Yangster-mac94e197c2018-01-02 16:03:03 -08001616 // Id of the config whose anomaly detection alert fired.
1617 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001618
Yangster-mac94e197c2018-01-02 16:03:03 -08001619 // Id of the alert (i.e. name of the anomaly that was detected).
1620 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001621}
1622
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001623message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001624 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001625 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001626
1627 // The app package name.
1628 optional string pkg_name = 2;
1629
1630 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001631 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001632 WARM = 1;
1633 HOT = 2;
1634 COLD = 3;
1635 }
1636 // The transition type.
1637 optional TransitionType type = 3;
1638
1639 // The activity name.
1640 optional string activity_name = 4;
1641
1642 // The name of the calling app. Empty if not set.
1643 optional string calling_pkg_name = 5;
1644
1645 // Whether the app is an instant app.
1646 optional bool is_instant_app = 6;
1647
1648 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001649 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001650
Bookatz80d11a02018-01-16 10:46:35 -08001651 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001652
David Chen0b5c90c2018-01-25 16:51:49 -08001653 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001654 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001655 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001656 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001657 optional int32 bind_application_delay_millis = 11;
1658 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001659
1660 // Empty if not set.
1661 optional string launch_token = 13;
1662
Calin Juravle759fbda2018-02-20 19:52:30 +00001663 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001664 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001665
1666 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001667 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001668}
1669
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001670message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001671 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001672 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001673
1674 // The app package name.
1675 optional string pkg_name = 2;
1676
1677 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001678 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001679 WARM = 1;
1680 HOT = 2;
1681 COLD = 3;
1682 }
1683 // The transition type.
1684 optional TransitionType type = 3;
1685
1686 // The activity name.
1687 optional string activity_name = 4;
1688}
1689
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001690message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001691 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001692 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001693
1694 // The app package name.
1695 optional string pkg_name = 2;
1696
1697 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001698 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001699 WITH_BUNDLE = 1;
1700 WITHOUT_BUNDLE = 2;
1701 }
1702 // The transition type.
1703 optional TransitionType type = 3;
1704
1705 // The activity name.
1706 optional string activity_name = 4;
1707
1708 optional bool transition_process_running = 5;
1709
1710 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001711 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001712}
1713
Bookatz8fcd09a2017-12-18 13:01:10 -08001714/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001715 * Logs a picture-in-picture action
1716 * Logged from:
1717 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1718 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1719 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1720 */
1721message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001722 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001723 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001724
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001725 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001726
Chenjie Yu52cacc62017-12-08 18:11:45 -08001727 enum State {
1728 ENTERED = 1;
1729 EXPANDED_TO_FULL_SCREEN = 2;
1730 MINIMIZED = 3;
1731 DISMISSED = 4;
1732 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001733 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001734}
1735
1736/**
Chenjie Yue8904192017-12-08 19:12:57 -08001737 * Logs overlay action
1738 * Logged from:
1739 * services/core/java/com/android/server/wm/Session.java
1740 */
1741message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001742 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001743
1744 optional string package_name = 2;
1745
1746 optional bool using_alert_window = 3;
1747
1748 enum State {
1749 ENTERED = 1;
1750 EXITED = 2;
1751 }
1752 optional State state = 4;
1753}
1754
Chenjie Yuccfe6452018-01-30 11:33:21 -08001755/*
1756 * Logs foreground service starts and stops.
1757 * Note that this is not when a service starts or stops, but when it is
1758 * considered foreground.
1759 * Logged from
1760 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1761 */
1762message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001763 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001764 // package_name + "/" + class_name
1765 optional string short_name = 2;
1766
1767 enum State {
1768 ENTER = 1;
1769 EXIT = 2;
1770 }
1771 optional State state = 3;
1772}
1773
Chenjie Yue8904192017-12-08 19:12:57 -08001774/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001775 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1776 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1777 * attributed back to the parent (host) uid. One example is Chrome.
1778 *
1779 * Logged from:
1780 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1781 */
1782message IsolatedUidChanged {
1783 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001784 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001785 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001786 optional int32 parent_uid = 1;
1787
1788 optional int32 isolated_uid = 2;
1789
1790 // We expect an isolated uid to be removed before if it's used for another parent uid.
1791 enum Event {
1792 REMOVED = 0;
1793 CREATED = 1;
1794 }
1795 optional Event event = 3;
1796}
1797
1798/*
1799 * Logs the reception of an incoming network packet causing the main system to wake up for
1800 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1801 * and processed by WakeupController.cpp.
1802 */
1803message PacketWakeupOccurred {
1804 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1805 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001806 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001807 // The interface name on which the packet was received.
1808 optional string iface = 2;
1809 // The ethertype value of the packet.
1810 optional int32 ethertype = 3;
1811 // String representation of the destination MAC address of the packet.
1812 optional string destination_hardware_address = 4;
1813 // String representation of the source address of the packet if this was an IP packet.
1814 optional string source_ip = 5;
1815 // String representation of the destination address of the packet if this was an IP packet.
1816 optional string destination_ip = 6;
1817 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1818 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1819 // families.
1820 optional int32 ip_next_header = 7;
1821 // The source port if this was a TCP or UDP packet.
1822 optional int32 source_port = 8;
1823 // The destination port if this was a TCP or UDP packet.
1824 optional int32 destination_port = 9;
1825}
1826
1827/*
1828 * Logs the memory stats for an app on startup.
1829 * Logged from:
1830 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1831 */
1832message AppStartMemoryStateCaptured {
1833 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001834 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001835
1836 // The process name.
1837 optional string process_name = 2;
1838
1839 // The activity name.
1840 optional string activity_name = 3;
1841
1842 // # of page-faults
1843 optional int64 pgfault = 4;
1844
1845 // # of major page-faults
1846 optional int64 pgmajfault = 5;
1847
1848 // RSS
1849 optional int64 rss_in_bytes = 6;
1850
1851 // CACHE
1852 optional int64 cache_in_bytes = 7;
1853
1854 // SWAP
1855 optional int64 swap_in_bytes = 8;
1856}
1857
1858/*
1859 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1860 * for LMK event.
1861 * Logged from:
1862 * system/core/lmkd/lmkd.c
1863 */
1864message LmkStateChanged {
1865 enum State {
1866 UNKNOWN = 0;
1867 START = 1;
1868 STOP = 2;
1869 }
1870 optional State state = 1;
1871}
1872
1873/*
1874 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1875 * Logged from:
1876 * system/core/lmkd/lmkd.c
1877 */
1878message LmkKillOccurred {
1879 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001880 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001881
1882 // The process name.
1883 optional string process_name = 2;
1884
1885 // oom adj score.
1886 optional int32 oom_score = 3;
1887
1888 // # of page-faults
1889 optional int64 pgfault = 4;
1890
1891 // # of major page-faults
1892 optional int64 pgmajfault = 5;
1893
1894 // RSS
1895 optional int64 rss_in_bytes = 6;
1896
1897 // CACHE
1898 optional int64 cache_in_bytes = 7;
1899
1900 // SWAP
1901 optional int64 swap_in_bytes = 8;
1902}
1903
Rajeev Kumar51b54602018-03-01 12:18:26 -08001904/*
1905 * Logs when the ActivityManagerService detects that an app died.
1906 *
1907 * Logged from:
1908 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1909 */
1910message AppDied {
1911 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001912 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001913}
1914
Howard Ro21a039c2018-08-06 14:55:47 -07001915/**
1916 * An atom for generic metrics logging. Available from Android Q.
1917 */
1918message GenericAtom {
1919 // The uid of the application that sent this custom atom.
1920 optional int32 uid = 1 [(is_uid) = true];
1921
1922 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001923 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001924}
1925
Tej Singhd6d6d772018-09-05 17:41:25 -07001926/**
1927 * Logs when a fingerprint acquire event occurs.
1928 *
1929 * Logged from:
1930 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1931 */
1932message FingerprintAcquired {
1933 // The associated user. Eg: 0 for owners, 10+ for others.
1934 // Defined in android/os/UserHandle.java
1935 optional int32 user = 1;
1936 // If this acquire is for a crypto fingerprint.
1937 // e.g. Secure purchases, unlock password storage.
1938 optional bool is_crypto = 2;
1939}
1940
1941/**
1942 * Logs when a fingerprint authentication event occurs.
1943 *
1944 * Logged from:
1945 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1946 */
1947message FingerprintAuthenticated {
1948 // The associated user. Eg: 0 for owners, 10+ for others.
1949 // Defined in android/os/UserHandle.java
1950 optional int32 user = 1;
1951 // If this authentication is for a crypto fingerprint.
1952 // e.g. Secure purchases, unlock password storage.
1953 optional bool is_crypto = 2;
1954 // Whether or not this authentication was successful.
1955 optional bool is_authenticated = 3;
1956}
1957
1958/**
1959 * Logs when a fingerprint error occurs.
1960 *
1961 * Logged from:
1962 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1963 */
1964message FingerprintErrorOccurred {
1965 // The associated user. Eg: 0 for owners, 10+ for others.
1966 // Defined in android/os/UserHandle.java
1967 optional int32 user = 1;
1968 // If this error is for a crypto fingerprint.
1969 // e.g. Secure purchases, unlock password storage.
1970 optional bool is_crypto = 2;
1971
1972 enum Error {
1973 UNKNOWN = 0;
1974 LOCKOUT = 1;
1975 PERMANENT_LOCKOUT = 2;
1976 }
1977 // The type of error.
1978 optional Error error = 3;
1979}
Howard Ro688ae182018-09-25 00:09:36 -07001980
1981message Notification {
1982
1983 // Type of notification event.
1984 enum Type {
1985 TYPE_UNKNOWN = 0;
1986 // Notification became visible to the user.
1987 TYPE_OPEN = 1;
1988 // Notification became hidden.
1989 TYPE_CLOSE = 2;
1990 // Notification switched to detail mode.
1991 TYPE_DETAIL = 3;
1992 // Notification was clicked.
1993 TYPE_ACTION = 4;
1994 // Notification was dismissed.
1995 TYPE_DISMISS = 5;
1996 // Notification switched to summary mode. The enum value of 14 is to
1997 // match that of metrics_constants.
1998 TYPE_COLLAPSE = 14;
1999 }
2000 optional Type type = 1;
2001
2002 // Package name associated with the notification.
2003 optional string package_name = 2;
2004
2005 // Tag associated with notification.
2006 optional string tag = 3;
2007
2008 // Application-supplied ID associated with the notification.
2009 optional int32 id = 4;
2010
2011 // Index of notification in the notification panel.
2012 optional int32 shade_index = 5;
2013
2014 // The number of notifications in the notification panel.
2015 optional int32 shade_count = 6;
2016
2017 // Importance for the notification.
2018 optional int32 importance = 7;
2019
2020 // ID for the notification channel.
2021 optional int32 channel_id = 8;
2022
2023 // Importance for the notification channel.
2024 optional int32 channel_importance = 9;
2025
2026 // Whether notification was a group summary.
2027 optional bool group_summary = 10;
2028
2029 // Time since notification was created in milliseconds.
2030 optional int64 since_create_millis = 11;
2031
2032 // Time since notification was interrupted in milliseconds.
2033 optional int64 since_interruption_millis = 12;
2034
2035 // Time since notification was updated in milliseconds.
2036 optional int64 since_update_millis = 13;
2037
2038 // Time since notification was visible in milliseconds.
2039 optional int64 since_visible_millis = 14;
2040}
2041
2042
Chenjie Yubbcbc602018-02-05 16:51:52 -08002043//////////////////////////////////////////////////////////////////////
2044// Pulled atoms below this line //
2045//////////////////////////////////////////////////////////////////////
2046
2047/**
David Chenc8a43242017-10-17 16:23:28 -07002048 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2049 *
2050 * Pulled from:
2051 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2052 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002053message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002054 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002055
2056 optional int64 rx_bytes = 2;
2057
2058 optional int64 rx_packets = 3;
2059
2060 optional int64 tx_bytes = 4;
2061
2062 optional int64 tx_packets = 5;
2063}
2064
2065/**
2066 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2067 *
2068 * Pulled from:
2069 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2070 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002071message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002072 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002073
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002074 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2075 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002076
2077 optional int64 rx_bytes = 3;
2078
2079 optional int64 rx_packets = 4;
2080
2081 optional int64 tx_bytes = 5;
2082
2083 optional int64 tx_packets = 6;
2084}
2085
2086/**
2087 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2088 *
2089 * Pulled from:
2090 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2091 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002092message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002093 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002094
2095 optional int64 rx_bytes = 2;
2096
2097 optional int64 rx_packets = 3;
2098
2099 optional int64 tx_bytes = 4;
2100
2101 optional int64 tx_packets = 5;
2102}
2103
2104/**
2105 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2106 *
2107 * Pulled from:
2108 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2109 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002110message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002111 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002112
Yao Chenc40a19d2018-03-15 16:48:25 -07002113 // 1 denotes foreground and 0 denotes background. This is called Set in
2114 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002115 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002116
2117 optional int64 rx_bytes = 3;
2118
2119 optional int64 rx_packets = 4;
2120
2121 optional int64 tx_bytes = 5;
2122
2123 optional int64 tx_packets = 6;
2124}
2125
2126/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002127 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2128 *
2129 * Pulled from:
2130 * StatsCompanionService
2131 */
2132message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002133 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002134
2135 optional int64 rx_bytes = 2;
2136
2137 optional int64 tx_bytes = 3;
2138}
2139
2140/**
David Chenc8a43242017-10-17 16:23:28 -07002141 * Pulls the kernel wakelock durations. This atom is adapted from
2142 * android/internal/os/KernelWakelockStats.java
2143 *
2144 * Pulled from:
2145 * StatsCompanionService using KernelWakelockReader.
2146 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002147message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002148 optional string name = 1;
2149
2150 optional int32 count = 2;
2151
2152 optional int32 version = 3;
2153
2154 optional int64 time = 4;
2155}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002156
Chenjie Yu05013b32017-11-21 10:21:41 -08002157/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002158 * Pulls low power state information. This includes platform and subsystem sleep state information,
2159 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002160 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002161 * hardware/interfaces/power/1.1/types.hal
2162 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002163message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002164 // Subsystem name
2165 optional string subsystem_name = 1;
2166 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2167 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2168 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002169 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002170 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002171 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002172 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002173}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002174
Chenjie Yu05013b32017-11-21 10:21:41 -08002175/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002176 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002177 * Pulls the time the cpu spend on the frequency index. Frequency index
2178 * starts from highest to lowest. The value should be monotonically
2179 * increasing since boot. However, if there is a cpu
2180 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002181 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002182message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002183 optional uint32 cluster = 1;
2184 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002185 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002186}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002187
Chenjie Yu05013b32017-11-21 10:21:41 -08002188/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002189 * Pulls Cpu Time Per Uid.
2190 * Note that isolated process uid time should be attributed to host uids.
2191 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002192message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002193 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002194 optional uint64 user_time_millis = 2;
2195 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002196}
2197
2198/**
2199 * Pulls Cpu Time Per Uid per frequency.
2200 * Note that isolated process uid time should be attributed to host uids.
2201 * For each uid, we order the time by descending frequencies.
2202 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002203message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002204 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002205 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002206 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002207}
Hugo Benichi884970e2017-11-14 22:42:46 +09002208
Chenjie Yu05013b32017-11-21 10:21:41 -08002209/**
2210 * Pulls Wifi Controller Activity Energy Info
2211 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002212message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002213 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002214 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002215 // stack reported state
2216 // TODO: replace this with proto enum
2217 optional int32 stack_state = 2;
2218 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002219 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002220 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002221 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002222 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002223 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002224 // product of current(mA), voltage(V) and time(ms)
2225 optional uint64 controller_energy_used = 6;
2226}
2227
2228/**
2229 * Pulls Modem Activity Energy Info
2230 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002231message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002232 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002233 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002234 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002235 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002236 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002237 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002238 /**
2239 * Tx power index
2240 * index 0 = tx_power < 0dBm
2241 * index 1 = 0dBm < tx_power < 5dBm
2242 * index 2 = 5dBm < tx_power < 15dBm
2243 * index 3 = 15dBm < tx_power < 20dBm
2244 * index 4 = tx_power > 20dBm
2245 */
2246 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002247 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002248 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002249 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002250 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002251 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002252 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002253 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002254 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002255 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002256 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002257 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002258 // product of current(mA), voltage(V) and time(ms)
2259 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002260}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002261
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002262/**
2263 * Pulls Bluetooth Activity Energy Info
2264 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2265 */
2266message BluetoothActivityInfo {
2267 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002268 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002269 // bluetooth stack state
2270 optional int32 bluetooth_stack_state = 2;
2271 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002272 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002273 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002274 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002275 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002276 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002277 // product of current(mA), voltage(V) and time(ms)
2278 optional uint64 energy_used = 6;
2279}
2280
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002281/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002282 * Logs the memory stats for a process.
2283 */
2284message ProcessMemoryState {
2285 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002286 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002287
2288 // The process name.
2289 optional string process_name = 2;
2290
2291 // oom adj score.
2292 optional int32 oom_score = 3;
2293
2294 // # of page-faults
2295 optional int64 pgfault = 4;
2296
2297 // # of major page-faults
2298 optional int64 pgmajfault = 5;
2299
Rajeev Kumar90235992018-01-29 11:06:48 -08002300 // RSS
2301 optional int64 rss_in_bytes = 6;
2302
2303 // CACHE
2304 optional int64 cache_in_bytes = 7;
2305
2306 // SWAP
2307 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002308
2309 // RSS high watermark.
2310 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2311 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2312 optional int64 rss_high_watermark_in_bytes = 9;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002313}
2314
2315/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002316 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002317 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002318message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002319 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002320}
2321
2322/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002323 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002324 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002325message SystemUptime {
2326 // Milliseconds since the system was booted.
2327 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2328 // for external input).
2329 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002330 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002331}
2332
2333/*
2334 * Reads from /proc/uid_concurrent_active_time which has the format:
2335 * active: X (X is # cores)
2336 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2337 * [uid1]: [time-0] [time-1] [time-2] ... ...
2338 * ...
2339 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2340 * The file contains a monotonically increasing count of time for a single boot.
2341 */
2342message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002343 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002344 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002345}
2346
2347/**
2348 * Reads from /proc/uid_concurrent_policy_time which has the format:
2349 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2350 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2351 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2352 * ...
2353 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2354 * The file contains a monotonically increasing count of time for a single boot.
2355 */
2356message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002357 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002358 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002359 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002360}
2361
2362/*
2363 * Pulls free disk space, for data, system partition and temporary directory.
2364 */
2365message DiskSpace {
2366 // available bytes in data partition
2367 optional uint64 data_available_bytes = 1;
2368 // available bytes in system partition
2369 optional uint64 system_available_bytes = 2;
2370 // available bytes in download cache or temp directories
2371 optional uint64 temp_available_bytes = 3;
2372}
Tej Singhbf972d92018-01-10 20:51:13 -08002373
2374/**
2375 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002376 * Pulled from:
2377 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002378 */
2379message RemainingBatteryCapacity {
2380 optional int32 charge_uAh = 1;
2381}
2382
2383/**
2384 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002385 * Pulled from:
2386 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002387 */
2388message FullBatteryCapacity {
2389 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002390}
2391
2392/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002393 * Pulls battery voltage.
2394 * Pulled from:
2395 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2396 */
2397message BatteryVoltage {
2398 // The voltage of the battery, in millivolts.
2399 optional int32 voltage_mV = 1;
2400}
2401
2402/**
Tej Singhd89137e2018-03-26 14:51:40 -07002403 * Pulls the temperature of various parts of the device.
2404 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002405 *
2406 * Pulled from:
2407 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2408 */
2409message Temperature {
2410 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2411 optional android.os.TemperatureTypeEnum sensor_location = 1;
2412
2413 // The name of the temperature source. Eg. CPU0
2414 optional string sensor_name = 2;
2415
Tej Singhd89137e2018-03-26 14:51:40 -07002416 // Temperature in tenths of a degree C.
2417 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002418}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002419
2420/**
2421 * Pulls the statistics of calls to Binder.
2422 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002423 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2424 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002425 *
2426 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002427 */
2428message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002429 optional int32 uid = 1 [(is_uid) = true];
2430 // Fully qualified class name of the API call.
2431 //
2432 // This is a system server class name.
2433 //
2434 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2435 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2436 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2437 // commonly used APIs.
2438 optional string service_class_name = 2;
2439 // Method name of the API call. It can also be a transaction code if we cannot
2440 // resolve it to a name. See Binder#getTransactionName.
2441 //
2442 // This is a system server method name.
2443 optional string service_method_name = 3;
2444 // Total number of API calls.
2445 optional int64 call_count = 4;
2446 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2447 optional bool screen_interactive = 13;
2448 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2449 // call_count will be equal to recorded_call_count.
2450 //
2451 // If recorded_call_count is different than call_count, it means data collection has been
2452 // sampled. All the fields below will be sampled in this case.
2453 optional int64 recorded_call_count = 12;
2454 // Number of exceptions thrown by the API.
2455 optional int64 recorded_exception_count = 5;
2456 // Total latency of all API calls.
2457 // Average can be computed using total_latency_micros / recorded_call_count.
2458 optional int64 recorded_total_latency_micros = 6;
2459 // Maximum latency of one API call.
2460 optional int64 recorded_max_latency_micros = 7;
2461 // Total CPU usage of all API calls.
2462 // Average can be computed using total_cpu_micros / recorded_call_count.
2463 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2464 optional int64 recorded_total_cpu_micros = 8;
2465 // Maximum CPU usage of one API call.
2466 optional int64 recorded_max_cpu_micros = 9;
2467 // Maximum parcel reply size of one API call.
2468 optional int64 recorded_max_reply_size_bytes = 10;
2469 // Maximum parcel request size of one API call.
2470 optional int64 recorded_max_request_size_bytes = 11;
2471}
2472
2473/**
2474 * Pulls the statistics of exceptions during calls to Binder.
2475 *
2476 * Binder stats are cumulative from boot unless somebody reset the data using
2477 * > adb shell dumpsys binder_calls_stats --reset
2478 */
2479message BinderCallsExceptions {
2480 // Exception class name, e.g. java.lang.IllegalArgumentException.
2481 //
2482 // This is an exception class name thrown by the system server.
2483 optional string exception_class_name = 1;
2484 // Total number of exceptions.
2485 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002486}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002487
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002488/**
2489 * Pulls the statistics of message dispatching on HandlerThreads.
2490 *
2491 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2492 * config on the device.
2493 *
2494 * Next tag: 11
2495 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002496message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002497 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002498 optional int32 uid = 1 [(is_uid) = true];
2499
2500 // Fully qualified class name of the handler target class.
2501 //
2502 // This field does not contain PII. This is a system server class name.
2503 optional string handler_class_name = 2;
2504
2505 // The name of the thread that runs the Looper.
2506 //
2507 // This field does not contain PII. This is a system server thread name.
2508 optional string looper_thread_name = 3;
2509
2510 // The name of the dispatched message.
2511 //
2512 // This field does not contain PII. This is a system server constant or class
2513 // name.
2514 optional string message_name = 4;
2515
2516 // Total number of successfully dispatched messages.
2517 optional int64 message_count = 5;
2518
2519 // Total number of messages that failed dispatching.
2520 optional int64 exception_count = 6;
2521
2522 // Total number of processed messages we have data recorded for. If we
2523 // collected data for all the messages, message_count will be equal to
2524 // recorded_message_count.
2525 //
2526 // If recorded_message_count is different than message_count, it means data
2527 // collection has been sampled. All the fields below will be sampled in this
2528 // case.
2529 optional int64 recorded_message_count = 7;
2530
2531 // Total latency of all processed messages.
2532 // Average can be computed using recorded_total_latency_micros /
2533 // recorded_message_count.
2534 optional int64 recorded_total_latency_micros = 8;
2535
2536 // Total CPU usage of all processed message.
2537 // Average can be computed using recorded_total_cpu_micros /
2538 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002539 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002540 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002541
2542 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2543 optional bool screen_interactive = 10;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002544}
Tej Singh86dc9db2018-09-06 00:39:57 +00002545
2546/**
2547 * Pulls disk information, such as write speed and latency.
2548 */
2549message DiskStats {
2550 // Time taken to open, write 512B to, and close a file.
2551 // -1 if error performing the check.
2552 optional int64 data_write_latency_millis = 1;
2553
2554 optional bool file_based_encryption = 2;
2555
2556 // Recent disk write speed in kB/s.
2557 // -1 if error querying storageed.
2558 // 0 if data is unavailable.
2559 optional int32 recent_disk_write_speed = 3;
2560}
2561
2562
2563/**
2564 * Free and total bytes of the Data, Cache, and System partition.
2565 */
2566message DirectoryUsage {
2567 enum Directory {
2568 UNKNOWN = 0;
2569 DATA = 1;
2570 CACHE = 2;
2571 SYSTEM = 3;
2572 }
2573 optional Directory directory = 1;
2574 optional int64 free_bytes = 2;
2575 optional int64 total_bytes = 3;
2576}
2577
2578
2579/**
2580 * Size of an application: apk size, data size, and cache size.
2581 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2582 * Information is only reported for apps with the primary user (user 0).
2583 * Sizes are aggregated by package name.
2584 */
2585message AppSize {
2586 // Including uids will involve modifying diskstats logic.
2587 optional string package_name = 1;
2588 // App size in bytes. -1 if unavailable.
2589 optional int64 app_size_bytes = 2;
2590 // App data size in bytes. -1 if unavailable.
2591 optional int64 app_data_size_bytes = 3;
2592 // App cache size in bytes. -1 if unavailable.
2593 optional int64 app_cache_size_bytes = 4;
2594 // Time that the cache file was produced.
2595 // Uses System.currentTimeMillis(), which is wall clock time.
2596 optional int64 cache_time_millis = 5;
2597}
2598
2599
2600/**
2601 * Size of a particular category. Eg: photos, videos.
2602 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2603 */
2604message CategorySize {
2605 enum Category {
2606 UNKNOWN = 0;
2607 APP_SIZE = 1;
2608 APP_DATA_SIZE = 2;
2609 APP_CACHE_SIZE = 3;
2610 PHOTOS = 4;
2611 VIDEOS = 5;
2612 AUDIO = 6;
2613 DOWNLOADS = 7;
2614 SYSTEM = 8;
2615 OTHER = 9;
2616 }
2617 optional Category category = 1;
2618 // Category size in bytes.
2619 optional int64 size_bytes = 2;
2620 // Time that the cache file was produced.
2621 // Uses System.currentTimeMillis(), which is wall clock time.
2622 optional int64 cache_time_millis = 3;
2623}
Tej Singhd6d6d772018-09-05 17:41:25 -07002624
2625/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002626 * Pulls per uid I/O stats. The stats are cumulative since boot.
2627 *
2628 * Read/write bytes are I/O events from a storage device
2629 * Read/write chars are data requested by read/write syscalls, and can be
2630 * satisfied by caching.
2631 *
2632 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2633 */
2634message DiskIo {
2635 optional int32 uid = 1 [(is_uid) = true];
2636 optional int64 fg_chars_read = 2;
2637 optional int64 fg_chars_write = 3;
2638 optional int64 fg_bytes_read = 4;
2639 optional int64 fg_bytes_write = 5;
2640 optional int64 bg_chars_read = 6;
2641 optional int64 bg_chars_write = 7;
2642 optional int64 bg_bytes_read = 8;
2643 optional int64 bg_bytes_write = 9;
2644 optional int64 fg_fsync = 10;
2645 optional int64 bg_fsync= 11;
2646}
2647
2648
2649/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002650 * Pulls the number of fingerprints for each user.
2651 *
2652 * Pulled from StatsCompanionService, which queries FingerprintManager.
2653 */
2654message NumFingerprints {
2655 // The associated user. Eg: 0 for owners, 10+ for others.
2656 // Defined in android/os/UserHandle.java
2657 optional int32 user = 1;
2658 // Number of fingerprints registered to that user.
2659 optional int32 num_fingerprints = 2;
2660}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002661
2662/**
2663 * Pulled from ProcessStatsService.java
2664 */
2665message ProcStats {
2666 optional android.service.procstats.ProcessStatsSectionProto proc_stats_section = 1;
2667}