blob: 640384ff5b69d56b09caa8cc29f16539a7ae2520 [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";
Chenjie Yuab530202018-09-26 12:39:20 -070034import "frameworks/base/core/proto/android/internal/powerprofile.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080035
Yao Chend54f9dd2017-10-17 17:37:48 +000036/**
Stefan Lafonae2df012017-11-14 09:17:21 -080037 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000038 * raw stats log events from the Android system, also known as "atoms."
39 *
40 * This field contains a single oneof with all of the available messages.
41 * The stats-log-api-gen tool runs as part of the Android build and
42 * generates the android.util.StatsLog class, which contains the constants
43 * and methods that Android uses to log.
44 *
Stefan Lafonae2df012017-11-14 09:17:21 -080045 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000046 * Instead, statsd on Android constructs these messages synthetically,
47 * in the format defined here and in stats_log.proto.
48 */
Stefan Lafonae2df012017-11-14 09:17:21 -080049message Atom {
50 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070051 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070052 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
53 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070054 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070055 BleScanResultReceived ble_scan_result_received = 4;
56 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080057 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070058 SyncStateChanged sync_state_changed = 7;
59 ScheduledJobStateChanged scheduled_job_state_changed = 8;
60 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070061 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080062 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
63 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
64 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070065 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
66 MemoryFactorStateChanged memory_factor_state_changed = 15;
67 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
68 CachedKillReported cached_kill_reported = 17;
69 ProcessMemoryStatReported process_memory_stat_reported = 18;
70 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080071 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
72 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
73 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070074 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080075 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070076 CameraStateChanged camera_state_changed = 25;
77 FlashlightStateChanged flashlight_state_changed = 26;
78 UidProcessStateChanged uid_process_state_changed = 27;
79 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
80 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070081 BatteryLevelChanged battery_level_changed = 30;
82 ChargingStateChanged charging_state_changed = 31;
83 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070084 InteractiveStateChanged interactive_state_changed = 33;
85 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070086 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
87 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070088 WifiLockStateChanged wifi_lock_state_changed = 37;
89 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
90 WifiScanStateChanged wifi_scan_state_changed = 39;
91 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070092 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070093 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070094 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090095 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070096 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080097 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080098 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080099 AppStartOccurred app_start_occurred = 48;
100 AppStartCanceled app_start_canceled = 49;
101 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800102 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800103 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800104 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800105 LmkStateChanged lmk_state_changed = 54;
106 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800107 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800108 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800109 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800110 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800111 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800112 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800113 KeyguardStateChanged keyguard_state_changed = 62;
114 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
115 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800116 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800117 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800118 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
119 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700120 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700121 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800122 SpeakerImpedanceReported speaker_impedance_reported = 71;
123 HardwareFailed hardware_failed = 72;
124 PhysicalDropDetected physical_drop_detected = 73;
125 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800126 MobileConnectionStateChanged mobile_connection_state_changed = 75;
127 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700128 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800129 AppCrashOccurred app_crash_occurred = 78;
130 ANROccurred anr_occurred = 79;
131 WTFOccurred wtf_occurred = 80;
Yangster4ccebea2018-10-09 17:09:02 -0700132 PhoneServiceStateChanged phone_service_state_changed = 94;
133 PhoneStateChanged phone_state_changed = 95;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800134 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700135 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700136 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700137 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700138 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700139 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700140 FingerprintAcquired fingerprint_acquired = 87;
141 FingerprintAuthenticated fingerprint_authenticated = 88;
142 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700143 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700144 BatteryHealthSnapshot battery_health_snapshot = 91;
145 SlowIo slow_io = 92;
146 BatteryCausedShutdown battery_caused_shutdown = 93;
Yao Chend54f9dd2017-10-17 17:37:48 +0000147 }
David Chenc8a43242017-10-17 16:23:28 -0700148
David Chen6e3e6cb2018-01-03 16:14:06 -0800149 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100150 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700151 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800152 WifiBytesTransfer wifi_bytes_transfer = 10000;
153 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
154 MobileBytesTransfer mobile_bytes_transfer = 10002;
155 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800156 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800157 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800158 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800159 CpuTimePerFreq cpu_time_per_freq = 10008;
160 CpuTimePerUid cpu_time_per_uid = 10009;
161 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800162 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800163 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800164 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800165 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800166 SystemElapsedRealtime system_elapsed_realtime = 10014;
167 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800168 CpuActiveTime cpu_active_time = 10016;
169 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000170 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800171 RemainingBatteryCapacity remaining_battery_capacity = 10019;
172 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800173 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100174 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100175 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100176 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000177 DiskStats disk_stats = 10025;
178 DirectoryUsage directory_usage = 10026;
179 AppSize app_size = 10027;
180 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700181 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700182 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700183 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700184 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700185 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700186 ProcStats proc_stats_pkg_proc = 10034;
David Chenc8a43242017-10-17 16:23:28 -0700187 }
yroa1fe77c2018-02-26 14:22:54 -0800188
Bookatz76aafcf2018-09-17 16:17:10 -0700189 // DO NOT USE field numbers above 100,000 in AOSP.
190 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
191 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700192}
193
Yao Chend54f9dd2017-10-17 17:37:48 +0000194/**
Yangster-mac20877162017-12-22 17:19:39 -0800195 * This proto represents a node of an attribution chain.
196 * Note: All attribution chains are represented as a repeated field of type
197 * AttributionNode. It is understood that in such arrays, the order is that
198 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000199 */
Yangster-mac20877162017-12-22 17:19:39 -0800200message AttributionNode {
201 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800202 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800203
Yangster-mac20877162017-12-22 17:19:39 -0800204 // The (optional) string tag for an element in the attribution chain. If the
205 // element has no tag, it is encoded as an empty string.
206 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700207}
208
Yangster-mac48b3d622018-08-18 12:38:11 -0700209message KeyValuePair {
210 optional int32 key = 1;
211 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700212 int32 value_int = 2;
213 int64 value_long = 3;
214 string value_str = 4;
215 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700216 }
217}
218
219message KeyValuePairsAtom {
220 optional int32 uid = 1;
221 repeated KeyValuePair pairs = 2;
222}
223
Yao Chend54f9dd2017-10-17 17:37:48 +0000224/*
225 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800226 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000227 *
228 * RULES:
229 * - The field ids for each atom must start at 1, and count upwards by 1.
230 * Skipping field ids is not allowed.
231 * - These form an API, so renaming, renumbering or removing fields is
232 * not allowed between android releases. (This is not currently enforced,
233 * but there will be a tool to enforce this restriction).
234 * - The types must be built-in protocol buffer types, namely, no sub-messages
235 * are allowed (yet). The bytes type is also not allowed.
236 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800237 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000238 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800239 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000240 * - A field that is a uid should be a string field, tagged with the [xxx]
241 * annotation. The generated code on android will be represented by UIDs,
242 * and those UIDs will be translated in xxx to those strings.
243 *
244 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700245 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000246 * - If there is a UID, it goes first. Think in an object-oriented fashion.
247 * *****************************************************************************
248 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700249
Yao Chend54f9dd2017-10-17 17:37:48 +0000250/**
Yangster-mace16189a2018-08-26 12:20:16 -0700251 * Logs when the Thermal service HAL notifies the throttling start/stop events.
252 *
253 * Logged from:
254 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
255 */
256message ThermalThrottlingStateChanged {
257 optional android.os.TemperatureTypeEnum sensor_type = 1;
258
259 enum State {
260 UNKNOWN = 0;
261 START = 1;
262 STOP = 2;
263 }
264
265 optional State state = 2;
266
267 optional float temperature = 3;
268}
269
270/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000271 * Logs when the screen state changes.
272 *
273 * Logged from:
274 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
275 */
276message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800277 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800278 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700279}
Yao Chend54f9dd2017-10-17 17:37:48 +0000280
281/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700282 * Logs that the process state of the uid, as determined by ActivityManager
283 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000284 *
285 * Logged from:
286 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
287 */
Bookatzc1a050a2017-10-10 15:49:28 -0700288message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700289 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000290
Bookatzdb026a22018-01-10 19:01:56 -0800291 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800292 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000293}
294
295/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700296 * Logs process state change of a process, as per the activity manager.
297 *
298 * Logged from:
299 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
300 */
301message ProcessStateChanged {
302 optional int32 uid = 1;
303 optional string process_name = 2;
304 optional string package_name = 3;
305 // TODO: remove this when validation is done
306 optional int64 version = 5;
307 // The state, from frameworks/base/core/proto/android/app/enums.proto.
308 optional android.app.ProcessStateEnum state = 4;
309}
310
311/**
312 * Logs when ActivityManagerService sleep state is changed.
313 *
314 * Logged from:
315 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
316 */
317message ActivityManagerSleepStateChanged {
318 // TODO: import frameworks proto
319 enum State {
320 UNKNOWN = 0;
321 ASLEEP = 1;
322 AWAKE = 2;
323 }
324 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
325}
326
327/**
328 * Logs when system memory state changes.
329 *
330 * Logged from:
331 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
332 */
333message MemoryFactorStateChanged {
334 // TODO: import frameworks proto
335 enum State {
336 MEMORY_UNKNOWN = 0;
337 NORMAL = 1; // normal.
338 MODERATE = 2; // moderate memory pressure.
339 LOW = 3; // low memory.
340 CRITICAL = 4; // critical memory.
341
342 }
343 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
344}
345
346/**
347 * Logs when app is using too much cpu, according to ActivityManagerService.
348 *
349 * Logged from:
350 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
351 */
352message ExcessiveCpuUsageReported {
353 optional int32 uid = 1;
354 optional string process_name = 2;
355 optional string package_name = 3;
356 // package version. TODO: remove this when validation is done
357 optional int64 version = 4;
358}
359
360/**
361 * Logs when a cached process is killed, along with its pss.
362 *
363 * Logged from:
364 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
365 */
366message CachedKillReported {
367 optional int32 uid = 1;
368 optional string process_name = 2;
369 optional string package_name = 3;
370 // TODO: remove this when validation is done
371 optional int64 version = 5;
372 optional int64 pss = 4;
373}
374
375/**
376 * Logs when memory stats of a process is reported.
377 *
378 * Logged from:
379 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
380 */
381message ProcessMemoryStatReported {
382 optional int32 uid = 1;
383 optional string process_name = 2;
384 optional string package_name = 3;
385 //TODO: remove this when validation is done
386 optional int64 version = 9;
387 optional int64 pss = 4;
388 optional int64 uss = 5;
389 optional int64 rss = 6;
390 enum Type {
391 ADD_PSS_INTERNAL_SINGLE = 0;
392 ADD_PSS_INTERNAL_ALL_MEM = 1;
393 ADD_PSS_INTERNAL_ALL_POLL = 2;
394 ADD_PSS_EXTERNAL = 3;
395 ADD_PSS_EXTERNAL_SLOW = 4;
396 }
397 optional Type type = 7;
398 optional int64 duration = 8;
399}
400
401/**
Bookatzc1a050a2017-10-10 15:49:28 -0700402 * Logs that a process started, finished, crashed, or ANRed.
403 *
404 * Logged from:
405 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
406 */
407message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700408 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700409
David Chen0b5c90c2018-01-25 16:51:49 -0800410 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800411 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700412
Bookatzddccf0a2017-11-28 16:48:14 -0800413 // What lifecycle state the process changed to.
414 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800415 enum State {
416 FINISHED = 0;
417 STARTED = 1;
418 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800419 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800420 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700421}
422
Bookatzc1a050a2017-10-10 15:49:28 -0700423/**
424 * Logs when the ble scan state changes.
425 *
426 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700427 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700428 */
429message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800430 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700431
432 enum State {
433 OFF = 0;
434 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700435 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
436 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700437 }
438 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700439
Bookatze5ec0b42018-03-26 13:34:56 -0700440 // Does the scan have a filter.
441 optional bool is_filtered = 3;
442 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
443 optional bool is_first_match = 4;
444 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
445 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700446}
447
448/**
449 * Logs reporting of a ble scan finding results.
450 *
451 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700452 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700453 */
Bookatzae6738e2018-09-13 11:38:56 -0700454// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700455message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800456 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700457
458 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800459 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700460}
461
462/**
463 * Logs when a sensor state changes.
464 *
465 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700466 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700467 */
468message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800469 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700470
Bookatzc1a050a2017-10-10 15:49:28 -0700471 // The id (int) of the sensor.
472 optional int32 sensor_id = 2;
473
474 enum State {
475 OFF = 0;
476 ON = 1;
477 }
478 optional State state = 3;
479}
480
481
482/**
483 * Logs when GPS state changes.
484 *
485 * Logged from:
486 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
487 */
488message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800489 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700490
491 enum State {
492 OFF = 0;
493 ON = 1;
494 }
495 optional State state = 2;
496}
497
498
499/**
500 * Logs when a sync manager sync state changes.
501 *
502 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700503 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700504 */
505message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800506 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700507
David Chen0b5c90c2018-01-25 16:51:49 -0800508 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800509 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700510
511 enum State {
512 OFF = 0;
513 ON = 1;
514 }
515 optional State state = 3;
516}
517
Yangster-mac96353002018-09-05 11:18:55 -0700518/*
519 * Deferred job stats.
520 *
521 * Logged from:
522 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
523*/
524message DeferredJobStatsReported {
525 repeated AttributionNode attribution_node = 1;
526
527 // Number of jobs deferred.
528 optional int32 num_jobs_deferred = 2;
529
530 // Time since the last job runs.
531 optional int64 time_since_last_job_millis = 3;
532}
533
Bookatzc1a050a2017-10-10 15:49:28 -0700534/**
535 * Logs when a job scheduler job state changes.
536 *
537 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700538 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700539 */
540message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800541 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700542
543 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800544 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700545
546 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800547 FINISHED = 0;
548 STARTED = 1;
549 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700550 }
551 optional State state = 3;
552
Tej Singh33a412b2018-03-16 18:43:59 -0700553 // The reason a job has stopped.
554 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700555 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700556 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700557}
558
559/**
560 * Logs when the audio state changes.
561 *
562 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700563 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700564 */
565message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800566 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700567
568 enum State {
569 OFF = 0;
570 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700571 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
572 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700573 }
574 optional State state = 2;
575}
576
577/**
578 * Logs when the video codec state changes.
579 *
580 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700581 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700582 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800583message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800584 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700585
586 enum State {
587 OFF = 0;
588 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700589 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
590 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700591 }
592 optional State state = 2;
593}
594
595/**
596 * Logs when the flashlight state changes.
597 *
598 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700599 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700600 */
601message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800602 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700603
604 enum State {
605 OFF = 0;
606 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700607 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
608 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700609 }
610 optional State state = 2;
611}
612
613/**
614 * Logs when the camera state changes.
615 *
616 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700617 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700618 */
619message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800620 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700621
622 enum State {
623 OFF = 0;
624 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700625 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
626 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700627 }
628 optional State state = 2;
629}
630
631/**
632 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000633 *
634 * Logged from:
635 * TODO
636 */
Bookatzd6746242017-10-24 18:39:35 -0700637message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800638 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000639
Bookatz1a1b0462018-01-12 11:47:03 -0800640 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
641 // From frameworks/base/core/proto/android/os/enums.proto.
642 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700643
644 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
645 optional string tag = 3;
646
647 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800648 RELEASE = 0;
649 ACQUIRE = 1;
650 CHANGE_RELEASE = 2;
651 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700652 }
653 optional State state = 4;
654}
655
656/**
Bookatzc1a050a2017-10-10 15:49:28 -0700657 * Logs when a partial wakelock is considered 'long' (over 1 min).
658 *
659 * Logged from:
660 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
661 */
662message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800663 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700664
Yao Chend54f9dd2017-10-17 17:37:48 +0000665 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
666 optional string tag = 2;
667
Bookatzc1a050a2017-10-10 15:49:28 -0700668 // TODO: I have no idea what this is.
669 optional string history_tag = 3;
670
671 enum State {
672 OFF = 0;
673 ON = 1;
674 }
675 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000676}
677
Bookatzc1a050a2017-10-10 15:49:28 -0700678/**
Bookatza66083f2018-09-20 17:24:00 -0700679 * Logs when the device is interactive, according to the PowerManager Notifier.
680 *
681 * Logged from:
682 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
683 */
684message InteractiveStateChanged {
685 enum State {
686 OFF = 0;
687 ON = 1;
688 }
689 optional State state = 1;
690}
691
692/**
Bookatzc1a050a2017-10-10 15:49:28 -0700693 * Logs Battery Saver state change.
694 *
695 * Logged from:
696 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
697 */
698message BatterySaverModeStateChanged {
699 enum State {
700 OFF = 0;
701 ON = 1;
702 }
703 optional State state = 1;
704}
705
706/**
707 * Logs Doze mode state change.
708 *
709 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800710 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700711 */
712message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800713 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800714}
715
716
717/**
718 * Logs state change of Doze mode including maintenance windows.
719 *
720 * Logged from:
721 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
722 */
723message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800724 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700725}
726
727/**
728 * Logs screen brightness level.
729 *
730 * Logged from:
731 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
732 */
733message ScreenBrightnessChanged {
734 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
735 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700736}
737
738/**
739 * Logs battery level (percent full, from 0 to 100).
740 *
741 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700742 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700743 */
744message BatteryLevelChanged {
745 // Battery level. Should be in [0, 100].
746 optional int32 battery_level = 1;
747}
748
749/**
750 * Logs change in charging status of the device.
751 *
752 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700753 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700754 */
755message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800756 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
757 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700758}
759
760/**
761 * Logs whether the device is plugged in, and what power source it is using.
762 *
763 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700764 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700765 */
766message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800767 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
768 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700769}
770
Bookatz8c6571b2017-10-24 15:04:41 -0700771/**
772 * Logs when an app's wakeup alarm fires.
773 *
774 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700775 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700776 */
777message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800778 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800779
780 // Name of the wakeup alarm.
781 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700782
783 // Name of source package (for historical reasons, since BatteryStats tracked it).
784 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800785}
786
787/**
788 * Logs when an an app causes the mobile radio to change state.
789 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
790 *
791 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700792 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800793 */
794message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800795 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800796
Bookatz1a1b0462018-01-12 11:47:03 -0800797 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
798 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800799}
800
801/**
802 * Logs when an an app causes the wifi radio to change state.
803 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
804 *
805 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700806 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800807 */
808message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800809 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800810
Bookatz1a1b0462018-01-12 11:47:03 -0800811 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
812 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700813}
814
815/**
816 * Logs kernel wakeup reasons and aborts.
817 *
818 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700819 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700820 */
821message KernelWakeupReported {
822 // Name of the kernel wakeup reason (or abort).
823 optional string wakeup_reason_name = 1;
824
825 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800826 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700827}
828
829/**
830 * Logs wifi locks held by an app.
831 *
832 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700833 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700834 */
835message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800836 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700837
838 enum State {
839 OFF = 0;
840 ON = 1;
841 }
842 optional State state = 2;
843}
844
845/**
846 * Logs wifi signal strength changes.
847 *
848 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700849 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700850 */
851message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800852 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
853 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700854}
855
856/**
857 * Logs wifi scans performed by an app.
858 *
859 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700860 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700861 */
862message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800863 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700864
865 enum State {
866 OFF = 0;
867 ON = 1;
868 }
869 optional State state = 2;
870}
871
872/**
Tej Singh4503e102018-01-04 14:35:01 -0800873 * Logs wifi multicast locks held by an app
874 *
875 * Logged from:
876 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
877 */
878message WifiMulticastLockStateChanged {
879 repeated AttributionNode attribution_node = 1;
880
881 enum State {
882 OFF = 0;
883 ON = 1;
884 }
885 optional State state = 2;
886}
887
888/**
Tej Singh1ea42892018-01-19 09:27:00 -0800889 * Logs shutdown reason and duration on next boot.
890 *
891 * Logged from:
892 * frameworks/base/core/java/com/android/server/BootReceiver.java
893 */
894message ShutdownSequenceReported {
895 // True if shutdown is for a reboot. Default: false if we do not know.
896 optional bool reboot = 1;
897
898 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
899 optional string reason = 2;
900
901 // Beginning of shutdown time in ms using wall clock time since unix epoch.
902 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800903 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800904
905 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800906 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800907}
908
Tej Singh6483ea42018-01-25 17:45:49 -0800909
910/**
911 * Logs boot reason and duration.
912 *
913 * Logged from:
914 * system/core/bootstat/bootstat.cpp
915 */
916message BootSequenceReported {
917 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
918 // Default: "<EMPTY>" if not available.
919 optional string bootloader_reason = 1;
920
921 // Reason for system boot. Eg. bootloader, reboot,userrequested
922 // Default: "<EMPTY>" if not available.
923 optional string system_reason = 2;
924
925 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800926 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800927
928 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800929 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800930
931 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800932 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800933
934 // Time since last boot in ms. Default: 0 if not available.
935 optional int64 time_since_last_boot = 6;
936}
937
Tej Singhc477d9c2018-02-05 18:31:39 -0800938
939/**
940 * Logs call state and disconnect cause (if applicable).
941 *
942 * Logged from:
943 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
944 */
945message CallStateChanged {
946 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
947 // From frameworks/base/core/proto/android/telecomm/enums.proto.
948 optional android.telecom.CallStateEnum call_state = 1;
949
950 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
951 // This value is only applicable when the call_state is DISCONNECTED, and
952 // should always be UNKNOWN if the call_state is not DISCONNECTED.
953 // From frameworks/base/core/proto/android/telecomm/enums.proto.
954 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
955
956 // True if the call is self-managed, which are apps that use the
957 // telecom infrastructure to make their own calls.
958 optional bool self_managed = 3;
959
960 // True if call is external. External calls are calls on connected Wear
961 // devices but show up in Telecom so the user can pull them onto the device.
962 optional bool external_call = 4;
963}
964
Tej Singh1ea42892018-01-19 09:27:00 -0800965/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800966 * Logs keyguard state. The keyguard is the lock screen.
967 *
968 * Logged from:
969 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
970 */
971message KeyguardStateChanged {
972 enum State {
973 UNKNOWN = 0;
974 // The keyguard is hidden when the phone is unlocked.
975 HIDDEN = 1;
976 // The keyguard is shown when the phone is locked (screen turns off).
977 SHOWN= 2;
978 // The keyguard is occluded when something is overlaying the keyguard.
979 // Eg. Opening the camera while on the lock screen.
980 OCCLUDED = 3;
981 }
982 optional State state = 1;
983}
984
985/**
986 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
987 * prompts the user to enter a password (pattern, pin, etc).
988 *
989 * Logged from:
990 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
991 */
992
993message KeyguardBouncerStateChanged {
994 enum State {
995 UNKNOWN = 0;
996 // Bouncer is hidden, either as a result of successfully entering the
997 // password, screen timing out, or user going back to lock screen.
998 HIDDEN = 1;
999 // This is when the user is being prompted to enter the password.
1000 SHOWN = 2;
1001 }
1002 optional State state = 1;
1003}
1004
1005/**
1006 * Logs the result of entering a password into the keyguard bouncer.
1007 *
1008 * Logged from:
1009 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1010 */
1011message KeyguardBouncerPasswordEntered {
1012 enum BouncerResult {
1013 UNKNOWN = 0;
1014 // The password entered was incorrect.
1015 FAILURE = 1;
1016 // The password entered was correct.
1017 SUCCESS = 2;
1018 }
1019 optional BouncerResult result = 1;
1020}
1021
Tej Singha883b372018-02-15 11:30:01 -08001022/*
1023 * Logs changes to the configuration of the device. The configuration is defined
1024 * in frameworks/base/core/java/android/content/res/Configuration.java
1025 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1026 * Please go there to interpret the possible values each field can be.
1027 *
1028 * Logged from:
1029 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1030 */
1031message ResourceConfigurationChanged {
1032 // Bit mask of color capabilities of the screen.
1033 // Contains information about the color gamut and hdr mode of the screen.
1034 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1035 optional int32 colorMode = 1;
1036
1037 // The target screen density being rendered to.
1038 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1039 optional int32 densityDpi = 2;
1040
1041 // Current user preference for the scaling factor for fonts,
1042 // relative to the base density scaling.
1043 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1044 optional float fontScale = 3;
1045
1046 // Flag indicating whether the hard keyboard is hidden.
1047 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1048 optional int32 hardKeyboardHidden = 4;
1049
1050 // The type of keyboard attached to the device.
1051 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1052 optional int32 keyboard = 5;
1053
1054 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1055 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1056 optional int32 keyboardHideen = 6;
1057
1058 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1059 // 0 if undefined.
1060 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1061 optional int32 mcc = 7;
1062
1063 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1064 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1065 // MNC_ZERO symbol defined in Configuration.java.
1066 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1067 optional int32 mnc = 8;
1068
1069 // The kind of navigation available on the device.
1070 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1071 optional int32 navigation = 9;
1072
1073 // Flag indicating whether the navigation is available.
1074 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1075 optional int32 navigationHidden = 10;
1076
1077 // Overall orientation of the screen.
1078 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1079 optional int32 orientation = 11;
1080
1081 // The current height of the available screen space, in dp units.
1082 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1083 optional int32 screenHeightDp = 12;
1084
1085 // Bit mask of overall layout of the screen.
1086 // Contains information about screen size, whether the screen is wider/taller
1087 // than normal, whether the screen layout is right-tl-left or left-to-right,
1088 // and whether the screen has a rounded shape.
1089 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1090 optional int32 screenLayout = 13;
1091
1092 // Current width of the available screen space, in dp units.
1093 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1094 optional int32 screenWidthDp = 14;
1095
1096 // The smallest screen size an application will see in normal operation.
1097 // This is the smallest value of both screenWidthDp and screenHeightDp
1098 // in portrait and landscape.
1099 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1100 optional int32 smallestScreenWidthDp = 15;
1101
1102 // The type of touch screen attached to the device.
1103 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1104 optional int32 touchscreen = 16;
1105
1106 // Bit mask of the ui mode.
1107 // Contains information about the overall ui mode of the device.
1108 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1109 // Also contains information about whether the device is in night mode.
1110 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1111 optional int32 uiMode = 17;
1112}
1113
Tej Singheee317b2018-03-07 19:28:05 -08001114
1115/**
1116 * Logs changes in the connection state of the mobile radio.
1117 *
1118 * Logged from:
1119 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1120 */
1121message MobileConnectionStateChanged {
1122 // States are from the state machine DataConnection.java.
1123 enum State {
1124 UNKNOWN = 0;
1125 // The connection is inactive, or disconnected.
1126 INACTIVE = 1;
1127 // The connection is being activated, or connecting.
1128 ACTIVATING = 2;
1129 // The connection is active, or connected.
1130 ACTIVE = 3;
1131 // The connection is disconnecting.
1132 DISCONNECTING = 4;
1133 // The connection is disconnecting after creating a connection.
1134 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1135 }
1136 optional State state = 1;
1137 // For multi-sim phones, this distinguishes between the sim cards.
1138 optional int32 sim_slot_index = 2;
1139 // Used to identify the connection. Starts at 0 and increments by 1 for
1140 // every new network created. Resets whenever the device reboots.
1141 optional int32 data_connection_id = 3;
1142 // A bitmask for the capabilities of this connection.
1143 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1144 // Default value (if we have no information): 0
1145 optional int64 capabilities = 4;
1146 // If this connection has internet.
1147 // This just checks if the DEFAULT bit of capabilities is set.
1148 optional bool has_internet = 5;
1149}
1150
1151/**
1152 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1153 *
1154 * Logged from:
1155 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1156 */
1157message MobileRadioTechnologyChanged {
1158 optional android.telephony.NetworkTypeEnum state = 1;
1159 // For multi-sim phones, this distinguishes between the sim cards.
1160 optional int32 sim_slot_index = 2;
1161}
1162
Andrew Chantb56388b2018-03-22 21:07:33 -07001163/**
1164 * Logs the VID and PID of any connected USB devices.
1165 *
1166 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1167 *
1168 * Logged by Vendor.
1169 */
1170message UsbDeviceAttached {
1171 optional int32 vid = 1;
1172 optional int32 pid = 2;
1173 optional bool has_audio = 3;
1174 optional bool has_hid = 4;
1175 optional bool has_storage = 5;
1176}
1177
Tej Singheee317b2018-03-07 19:28:05 -08001178
Tej Singhdd7bd352018-02-09 19:33:15 -08001179/**
Tej Singh5d991e12018-03-09 19:48:11 -08001180 * Logs when Bluetooth is enabled and disabled.
1181 *
1182 * Logged from:
1183 * services/core/java/com/android/server/BluetoothManagerService.java
1184 */
1185message BluetoothEnabledStateChanged {
1186 repeated AttributionNode attribution_node = 1;
1187 // Whether or not bluetooth is enabled on the device.
1188 enum State {
1189 UNKNOWN = 0;
1190 ENABLED = 1;
1191 DISABLED = 2;
1192 }
1193 optional State state = 2;
1194 // The reason for being enabled/disabled.
1195 // Eg. Airplane mode, crash, application request.
1196 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1197 // If the reason is an application request, this will be the package name.
1198 optional string pkgName = 4;
1199}
1200
1201/**
1202 * Logs when a Bluetooth device connects and disconnects.
1203 *
1204 * Logged from:
1205 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1206 */
1207message BluetoothConnectionStateChanged {
1208 // The state of the connection.
1209 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1210 optional android.bluetooth.ConnectionStateEnum state = 1;
1211 // An identifier that can be used to match connect and disconnect events.
1212 // Currently is last two bytes of a hash of a device level ID and
1213 // the mac address of the bluetooth device that is connected.
1214 optional int32 obfuscated_id = 2;
1215 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1216 // From android.bluetooth.BluetoothAdapter.java
1217 optional int32 bt_profile = 3;
1218}
1219
1220/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001221 * Logs when something is plugged into or removed from the USB-C connector.
1222 *
1223 * Logged from:
1224 * Vendor USB HAL.
1225 */
1226message UsbConnectorStateChanged {
1227 enum State {
1228 DISCONNECTED = 0;
1229 CONNECTED = 1;
1230 }
1231 optional State state = 1;
1232}
1233
1234/**
1235 * Logs the reported speaker impedance.
1236 *
1237 * Logged from:
1238 * Vendor audio implementation.
1239 */
1240message SpeakerImpedanceReported {
1241 optional int32 speaker_location = 1;
1242 optional int32 impedance = 2;
1243}
1244
1245/**
1246 * Logs the report of a failed hardware.
1247 *
1248 * Logged from:
1249 * Vendor HALs.
1250 *
1251 */
1252message HardwareFailed {
1253 enum HardwareType {
1254 HARDWARE_FAILED_UNKNOWN = 0;
1255 HARDWARE_FAILED_MICROPHONE = 1;
1256 HARDWARE_FAILED_CODEC = 2;
1257 HARDWARE_FAILED_SPEAKER = 3;
1258 HARDWARE_FAILED_FINGERPRINT = 4;
1259 }
1260 optional HardwareType hardware_type = 1;
1261
1262 /* hardware_location allows vendors to differentiate between multiple instances of
1263 * the same hardware_type. The specific locations are vendor defined integers,
1264 * referring to board-specific numbering schemes.
1265 */
1266 optional int32 hardware_location = 2;
1267
1268 /* failure_code is specific to the HardwareType of the failed hardware.
1269 * It should use the enum values defined below.
1270 */
1271 enum MicrophoneFailureCode {
1272 MICROPHONE_FAILURE_COMPLETE = 0;
1273 }
1274 enum CodecFailureCode {
1275 CODEC_FAILURE_COMPLETE = 0;
1276 }
1277 enum SpeakerFailureCode {
1278 SPEAKER_FAILURE_COMPLETE = 0;
1279 SPEAKER_FAILURE_HIGH_Z = 1;
1280 SPEAKER_FAILURE_SHORT = 2;
1281 }
1282 enum FingerprintFailureCode {
1283 FINGERPRINT_FAILURE_COMPLETE = 0;
1284 FINGERPRINT_SENSOR_BROKEN = 1;
1285 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1286 }
1287 optional int32 failure_code = 3;
1288}
1289
1290/**
1291 * Log an event when the device has been physically dropped.
1292 * Reported from the /vendor partition.
1293 */
1294message PhysicalDropDetected {
1295 // Confidence that the event was actually a drop, 0 -> 100
1296 optional int32 confidence_pctg = 1;
1297 // Peak acceleration of the drop, in 1/1000s of a g.
1298 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001299 // Duration of freefall in ms
1300 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001301}
1302
1303/**
1304 * Log bucketed battery charge cycles.
1305 *
1306 * Each bucket represents cycles of the battery past
1307 * a given charge point. For example, bucket 1 is the
1308 * lowest 1/8th of the battery, and bucket 8 is 100%.
1309 *
1310 * Logged from:
1311 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1312 */
1313message ChargeCyclesReported {
1314 optional int32 cycle_bucket_1 = 1;
1315 optional int32 cycle_bucket_2 = 2;
1316 optional int32 cycle_bucket_3 = 3;
1317 optional int32 cycle_bucket_4 = 4;
1318 optional int32 cycle_bucket_5 = 5;
1319 optional int32 cycle_bucket_6 = 6;
1320 optional int32 cycle_bucket_7 = 7;
1321 optional int32 cycle_bucket_8 = 8;
1322}
1323
1324/**
Howard Roa46b6582018-09-18 16:45:02 -07001325 * Log battery health snapshot.
1326 *
1327 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1328 * are snapshotted periodically over 24hrs.
1329 */
1330message BatteryHealthSnapshot {
1331 enum BatterySnapshotType {
1332 UNKNOWN = 0;
1333 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1334 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1335 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1336 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1337 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1338 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1339 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1340 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1341 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1342 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1343 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1344 }
1345 optional BatterySnapshotType type = 1;
1346 // Temperature, in 1/10ths of degree C.
1347 optional int32 temperature_deci_celcius = 2;
1348 // Voltage Battery Voltage, in microVolts.
1349 optional int32 voltage_micro_volt = 3;
1350 // Current Battery current, in microAmps.
1351 optional int32 current_micro_amps = 4;
1352 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1353 optional int32 open_circuit_micro_volt = 5;
1354 // Resistance Battery Resistance, in microOhms.
1355 optional int32 resistance_micro_ohm = 6;
1356 // Level Battery Level, as % of full.
1357 optional int32 level_percent = 7;
1358}
1359
1360/**
1361 * Log slow I/O operations on the primary storage.
1362 */
1363message SlowIo {
1364 // Classifications of IO Operations.
1365 enum IoOperation {
1366 UNKNOWN = 0;
1367 READ = 1;
1368 WRITE = 2;
1369 UNMAP = 3;
1370 SYNC = 4;
1371 }
1372 optional IoOperation operation = 1;
1373
1374 // The number of slow IO operations of this type over 24 hours.
1375 optional int32 count = 2;
1376}
1377
1378/**
1379 * Log battery caused shutdown with the last recorded voltage.
1380 */
1381message BatteryCausedShutdown {
1382 // The last recorded battery voltage prior to shutdown.
1383 optional int32 last_recorded_micro_volt = 1;
1384}
1385
1386/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001387 * Logs the duration of a davey (jank of >=700ms) when it occurs
1388 *
1389 * Logged from:
1390 * frameworks/base/libs/hwui/JankTracker.cpp
1391 */
1392message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001393 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001394 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001395
Tej Singhbb8554a2018-01-26 11:59:14 -08001396 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001397 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001398}
1399
1400/**
Bookatze5885242017-10-24 20:10:31 -07001401 * Logs phone signal strength changes.
1402 *
1403 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001404 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001405 */
1406message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001407 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1408 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001409}
1410
Yangster4ccebea2018-10-09 17:09:02 -07001411
1412/**
1413 * Logs when the phone state, sim state or signal strength changes
1414 *
1415 * Logged from:
1416 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1417 */
1418message PhoneServiceStateChanged {
1419 optional android.telephony.ServiceStateEnum state = 1;
1420 optional android.telephony.SimStateEnum sim_state = 2;
1421 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1422}
1423
1424/**
1425 * Logs when the phone becomes on or off.
1426 *
1427 * Logged from:
1428 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1429 */
1430message PhoneStateChanged {
1431 enum State {
1432 OFF = 0;
1433 ON = 1;
1434 }
1435 optional State state = 1;
1436}
1437
David Chenc28b2bb2017-10-24 12:52:52 -07001438/**
1439 * Logs that a setting was updated.
1440 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001441 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001442 * The tag and is_default allow resetting of settings to default values based on the specified
1443 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1444 */
1445message SettingChanged {
1446 // The name of the setting.
1447 optional string setting = 1;
1448
1449 // The change being imposed on this setting. May represent a number, eg "3".
1450 optional string value = 2;
1451
1452 // The new value of this setting. For most settings, this is same as value. For some settings,
1453 // value is +X or -X where X represents an element in a set. For example, if the previous value
1454 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1455 // The +/- feature is currently only used for location_providers_allowed.
1456 optional string new_value = 3;
1457
1458 // The previous value of this setting.
1459 optional string prev_value = 4;
1460
1461 // The tag used with the is_default for resetting sets of settings. This is generally null.
1462 optional string tag = 5;
1463
Bookatz90867622018-01-31 15:05:57 -08001464 // True if this setting with tag should be resettable.
1465 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001466
David Chenbd789912018-03-16 17:19:55 -07001467 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001468 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001469
1470 enum ChangeReason {
1471 UPDATED = 1; // Updated can be an insertion or an update.
1472 DELETED = 2;
1473 }
1474 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001475}
Chenjie Yub3dda412017-10-24 13:41:59 -07001476
Chenjie Yu05013b32017-11-21 10:21:41 -08001477/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001478 * Logs activity going to foreground or background
1479 *
1480 * Logged from:
1481 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1482 */
1483message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001484 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001485 optional string pkg_name = 2;
1486 optional string class_name = 3;
1487
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001488 enum State {
1489 BACKGROUND = 0;
1490 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001491 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001492 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001493}
David Chenc8a43242017-10-17 16:23:28 -07001494
1495/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001496 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001497 * Logged from:
1498 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1499 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001500message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001501 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001502
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001503 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001504
1505 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001506 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001507 optional string process_name = 3;
1508
1509 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001510 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001511
1512 optional string package_name = 5;
1513
1514 enum InstantApp {
1515 UNAVAILABLE = 0;
1516 FALSE = 1;
1517 TRUE = 2;
1518 }
1519 optional InstantApp is_instant_app = 6;
1520
1521 enum ForegroundState {
1522 UNKNOWN = 0;
1523 BACKGROUND = 1;
1524 FOREGROUND = 2;
1525 }
1526 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001527}
David Chen9e3808c2017-11-20 17:25:34 -08001528
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001529/**
1530 * Logs when a WTF (What a Terrible Failure) happened.
1531 * Logged from:
1532 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1533 */
1534message WTFOccurred {
1535 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001536
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001537 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001538
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001539 // The name of the process.
1540 // system_server if it is not by an app
1541 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001542
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001543 // The pid if available. -1 means not available.
1544 optional sint32 pid = 4;
1545}
1546
1547/**
1548 * Logs when system server reports low memory.
1549 * Logged from:
1550 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1551 */
1552message LowMemReported {
1553}
1554
1555/**
1556 * Logs when an app ANR (App Not Responding) occurs.
1557 * Logged from:
1558 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1559 */
1560message ANROccurred {
1561 optional int32 uid = 1 [(is_uid) = true];
1562
1563 optional string process_name = 2;
1564
1565 optional string short_component_name = 3;
1566
1567 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001568
1569 enum InstantApp {
1570 UNAVAILABLE = 0;
1571 FALSE = 1;
1572 TRUE = 2;
1573 }
1574 optional InstantApp is_instant_app = 5;
1575
1576 enum ForegroundState {
1577 UNKNOWN = 0;
1578 BACKGROUND = 1;
1579 FOREGROUND = 2;
1580 }
1581 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001582}
1583
Bookatza7020bd2018-08-28 16:29:35 -07001584/**
1585 * Logs when the vibrator state changes.
1586 * Logged from:
1587 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1588 */
1589message VibratorStateChanged {
1590 repeated AttributionNode attribution_node = 1;
1591
1592 enum State {
1593 OFF = 0;
1594 ON = 1;
1595 }
1596 optional State state = 2;
1597
1598 // Duration (in milliseconds) requested to keep the vibrator on.
1599 // Only applicable for State == ON.
1600 optional int64 duration_millis = 3;
1601}
1602
David Chen0a368b22017-12-06 16:28:16 -08001603/*
1604 * Allows other apps to push events into statsd.
1605 * Logged from:
1606 * frameworks/base/core/java/android/util/StatsLog.java
1607 */
David Chen0b5c90c2018-01-25 16:51:49 -08001608message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001609 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001610 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001611
1612 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1613 optional int32 label = 2;
1614
1615 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1616 // predicates for the metrics).
1617 enum State {
1618 UNKNOWN = 0;
1619 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1620 STOP = 2;
1621 START = 3;
1622 }
1623 optional State state = 3;
1624}
1625
David Chen9e3808c2017-11-20 17:25:34 -08001626/**
Bookatz7948c872018-09-04 12:58:33 -07001627 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1628 * For example, this could be due to the user manually changing the time.
1629 *
1630 * Logged from:
1631 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1632 */
1633message WallClockTimeShifted {
1634 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1635 optional int64 wall_clock_timestamp_millis = 1;
1636}
1637
1638/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001639 * Logs when statsd detects an anomaly.
1640 *
1641 * Logged from:
1642 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1643 */
1644message AnomalyDetected {
1645 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001646 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001647
Yangster-mac94e197c2018-01-02 16:03:03 -08001648 // Id of the config whose anomaly detection alert fired.
1649 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001650
Yangster-mac94e197c2018-01-02 16:03:03 -08001651 // Id of the alert (i.e. name of the anomaly that was detected).
1652 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001653}
1654
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001655message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001656 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001657 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001658
1659 // The app package name.
1660 optional string pkg_name = 2;
1661
1662 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001663 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001664 WARM = 1;
1665 HOT = 2;
1666 COLD = 3;
1667 }
1668 // The transition type.
1669 optional TransitionType type = 3;
1670
1671 // The activity name.
1672 optional string activity_name = 4;
1673
1674 // The name of the calling app. Empty if not set.
1675 optional string calling_pkg_name = 5;
1676
1677 // Whether the app is an instant app.
1678 optional bool is_instant_app = 6;
1679
1680 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001681 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001682
Bookatz80d11a02018-01-16 10:46:35 -08001683 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001684
David Chen0b5c90c2018-01-25 16:51:49 -08001685 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001686 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001687 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001688 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001689 optional int32 bind_application_delay_millis = 11;
1690 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001691
1692 // Empty if not set.
1693 optional string launch_token = 13;
1694
Calin Juravle759fbda2018-02-20 19:52:30 +00001695 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001696 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001697
1698 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001699 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001700}
1701
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001702message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001703 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001704 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001705
1706 // The app package name.
1707 optional string pkg_name = 2;
1708
1709 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001710 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001711 WARM = 1;
1712 HOT = 2;
1713 COLD = 3;
1714 }
1715 // The transition type.
1716 optional TransitionType type = 3;
1717
1718 // The activity name.
1719 optional string activity_name = 4;
1720}
1721
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001722message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001723 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001724 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001725
1726 // The app package name.
1727 optional string pkg_name = 2;
1728
1729 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001730 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001731 WITH_BUNDLE = 1;
1732 WITHOUT_BUNDLE = 2;
1733 }
1734 // The transition type.
1735 optional TransitionType type = 3;
1736
1737 // The activity name.
1738 optional string activity_name = 4;
1739
1740 optional bool transition_process_running = 5;
1741
1742 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001743 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001744}
1745
Bookatz8fcd09a2017-12-18 13:01:10 -08001746/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001747 * Logs a picture-in-picture action
1748 * Logged from:
1749 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1750 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1751 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1752 */
1753message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001754 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001755 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001756
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001757 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001758
Chenjie Yu52cacc62017-12-08 18:11:45 -08001759 enum State {
1760 ENTERED = 1;
1761 EXPANDED_TO_FULL_SCREEN = 2;
1762 MINIMIZED = 3;
1763 DISMISSED = 4;
1764 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001765 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001766}
1767
1768/**
Chenjie Yue8904192017-12-08 19:12:57 -08001769 * Logs overlay action
1770 * Logged from:
1771 * services/core/java/com/android/server/wm/Session.java
1772 */
1773message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001774 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001775
1776 optional string package_name = 2;
1777
1778 optional bool using_alert_window = 3;
1779
1780 enum State {
1781 ENTERED = 1;
1782 EXITED = 2;
1783 }
1784 optional State state = 4;
1785}
1786
Chenjie Yuccfe6452018-01-30 11:33:21 -08001787/*
1788 * Logs foreground service starts and stops.
1789 * Note that this is not when a service starts or stops, but when it is
1790 * considered foreground.
1791 * Logged from
1792 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1793 */
1794message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001795 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001796 // package_name + "/" + class_name
1797 optional string short_name = 2;
1798
1799 enum State {
1800 ENTER = 1;
1801 EXIT = 2;
1802 }
1803 optional State state = 3;
1804}
1805
Chenjie Yue8904192017-12-08 19:12:57 -08001806/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001807 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1808 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1809 * attributed back to the parent (host) uid. One example is Chrome.
1810 *
1811 * Logged from:
1812 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1813 */
1814message IsolatedUidChanged {
1815 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001816 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001817 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001818 optional int32 parent_uid = 1;
1819
1820 optional int32 isolated_uid = 2;
1821
1822 // We expect an isolated uid to be removed before if it's used for another parent uid.
1823 enum Event {
1824 REMOVED = 0;
1825 CREATED = 1;
1826 }
1827 optional Event event = 3;
1828}
1829
1830/*
1831 * Logs the reception of an incoming network packet causing the main system to wake up for
1832 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1833 * and processed by WakeupController.cpp.
1834 */
1835message PacketWakeupOccurred {
1836 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1837 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001838 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001839 // The interface name on which the packet was received.
1840 optional string iface = 2;
1841 // The ethertype value of the packet.
1842 optional int32 ethertype = 3;
1843 // String representation of the destination MAC address of the packet.
1844 optional string destination_hardware_address = 4;
1845 // String representation of the source address of the packet if this was an IP packet.
1846 optional string source_ip = 5;
1847 // String representation of the destination address of the packet if this was an IP packet.
1848 optional string destination_ip = 6;
1849 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1850 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1851 // families.
1852 optional int32 ip_next_header = 7;
1853 // The source port if this was a TCP or UDP packet.
1854 optional int32 source_port = 8;
1855 // The destination port if this was a TCP or UDP packet.
1856 optional int32 destination_port = 9;
1857}
1858
1859/*
1860 * Logs the memory stats for an app on startup.
1861 * Logged from:
1862 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1863 */
1864message AppStartMemoryStateCaptured {
1865 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001866 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001867
1868 // The process name.
1869 optional string process_name = 2;
1870
1871 // The activity name.
1872 optional string activity_name = 3;
1873
1874 // # of page-faults
1875 optional int64 pgfault = 4;
1876
1877 // # of major page-faults
1878 optional int64 pgmajfault = 5;
1879
1880 // RSS
1881 optional int64 rss_in_bytes = 6;
1882
1883 // CACHE
1884 optional int64 cache_in_bytes = 7;
1885
1886 // SWAP
1887 optional int64 swap_in_bytes = 8;
1888}
1889
1890/*
1891 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1892 * for LMK event.
1893 * Logged from:
1894 * system/core/lmkd/lmkd.c
1895 */
1896message LmkStateChanged {
1897 enum State {
1898 UNKNOWN = 0;
1899 START = 1;
1900 STOP = 2;
1901 }
1902 optional State state = 1;
1903}
1904
1905/*
1906 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1907 * Logged from:
1908 * system/core/lmkd/lmkd.c
1909 */
1910message LmkKillOccurred {
1911 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001912 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001913
1914 // The process name.
1915 optional string process_name = 2;
1916
1917 // oom adj score.
1918 optional int32 oom_score = 3;
1919
1920 // # of page-faults
1921 optional int64 pgfault = 4;
1922
1923 // # of major page-faults
1924 optional int64 pgmajfault = 5;
1925
1926 // RSS
1927 optional int64 rss_in_bytes = 6;
1928
1929 // CACHE
1930 optional int64 cache_in_bytes = 7;
1931
1932 // SWAP
1933 optional int64 swap_in_bytes = 8;
1934}
1935
Rajeev Kumar51b54602018-03-01 12:18:26 -08001936/*
1937 * Logs when the ActivityManagerService detects that an app died.
1938 *
1939 * Logged from:
1940 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1941 */
1942message AppDied {
1943 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001944 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001945}
1946
Howard Ro21a039c2018-08-06 14:55:47 -07001947/**
1948 * An atom for generic metrics logging. Available from Android Q.
1949 */
1950message GenericAtom {
1951 // The uid of the application that sent this custom atom.
1952 optional int32 uid = 1 [(is_uid) = true];
1953
1954 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001955 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001956}
1957
Tej Singhd6d6d772018-09-05 17:41:25 -07001958/**
1959 * Logs when a fingerprint acquire event occurs.
1960 *
1961 * Logged from:
1962 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1963 */
1964message FingerprintAcquired {
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 acquire is for a crypto fingerprint.
1969 // e.g. Secure purchases, unlock password storage.
1970 optional bool is_crypto = 2;
1971}
1972
1973/**
1974 * Logs when a fingerprint authentication event occurs.
1975 *
1976 * Logged from:
1977 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1978 */
1979message FingerprintAuthenticated {
1980 // The associated user. Eg: 0 for owners, 10+ for others.
1981 // Defined in android/os/UserHandle.java
1982 optional int32 user = 1;
1983 // If this authentication is for a crypto fingerprint.
1984 // e.g. Secure purchases, unlock password storage.
1985 optional bool is_crypto = 2;
1986 // Whether or not this authentication was successful.
1987 optional bool is_authenticated = 3;
1988}
1989
1990/**
1991 * Logs when a fingerprint error occurs.
1992 *
1993 * Logged from:
1994 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1995 */
1996message FingerprintErrorOccurred {
1997 // The associated user. Eg: 0 for owners, 10+ for others.
1998 // Defined in android/os/UserHandle.java
1999 optional int32 user = 1;
2000 // If this error is for a crypto fingerprint.
2001 // e.g. Secure purchases, unlock password storage.
2002 optional bool is_crypto = 2;
2003
2004 enum Error {
2005 UNKNOWN = 0;
2006 LOCKOUT = 1;
2007 PERMANENT_LOCKOUT = 2;
2008 }
2009 // The type of error.
2010 optional Error error = 3;
2011}
Howard Ro688ae182018-09-25 00:09:36 -07002012
2013message Notification {
2014
2015 // Type of notification event.
2016 enum Type {
2017 TYPE_UNKNOWN = 0;
2018 // Notification became visible to the user.
2019 TYPE_OPEN = 1;
2020 // Notification became hidden.
2021 TYPE_CLOSE = 2;
2022 // Notification switched to detail mode.
2023 TYPE_DETAIL = 3;
2024 // Notification was clicked.
2025 TYPE_ACTION = 4;
2026 // Notification was dismissed.
2027 TYPE_DISMISS = 5;
2028 // Notification switched to summary mode. The enum value of 14 is to
2029 // match that of metrics_constants.
2030 TYPE_COLLAPSE = 14;
2031 }
2032 optional Type type = 1;
2033
2034 // Package name associated with the notification.
2035 optional string package_name = 2;
2036
2037 // Tag associated with notification.
2038 optional string tag = 3;
2039
2040 // Application-supplied ID associated with the notification.
2041 optional int32 id = 4;
2042
2043 // Index of notification in the notification panel.
2044 optional int32 shade_index = 5;
2045
2046 // The number of notifications in the notification panel.
2047 optional int32 shade_count = 6;
2048
2049 // Importance for the notification.
2050 optional int32 importance = 7;
2051
2052 // ID for the notification channel.
2053 optional int32 channel_id = 8;
2054
2055 // Importance for the notification channel.
2056 optional int32 channel_importance = 9;
2057
2058 // Whether notification was a group summary.
2059 optional bool group_summary = 10;
2060
2061 // Time since notification was created in milliseconds.
2062 optional int64 since_create_millis = 11;
2063
2064 // Time since notification was interrupted in milliseconds.
2065 optional int64 since_interruption_millis = 12;
2066
2067 // Time since notification was updated in milliseconds.
2068 optional int64 since_update_millis = 13;
2069
2070 // Time since notification was visible in milliseconds.
2071 optional int64 since_visible_millis = 14;
2072}
2073
2074
Chenjie Yubbcbc602018-02-05 16:51:52 -08002075//////////////////////////////////////////////////////////////////////
2076// Pulled atoms below this line //
2077//////////////////////////////////////////////////////////////////////
2078
2079/**
David Chenc8a43242017-10-17 16:23:28 -07002080 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2081 *
2082 * Pulled from:
2083 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2084 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002085message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002086 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002087
2088 optional int64 rx_bytes = 2;
2089
2090 optional int64 rx_packets = 3;
2091
2092 optional int64 tx_bytes = 4;
2093
2094 optional int64 tx_packets = 5;
2095}
2096
2097/**
2098 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2099 *
2100 * Pulled from:
2101 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2102 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002103message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002104 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002105
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002106 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2107 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002108
2109 optional int64 rx_bytes = 3;
2110
2111 optional int64 rx_packets = 4;
2112
2113 optional int64 tx_bytes = 5;
2114
2115 optional int64 tx_packets = 6;
2116}
2117
2118/**
2119 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2120 *
2121 * Pulled from:
2122 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2123 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002124message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002125 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002126
2127 optional int64 rx_bytes = 2;
2128
2129 optional int64 rx_packets = 3;
2130
2131 optional int64 tx_bytes = 4;
2132
2133 optional int64 tx_packets = 5;
2134}
2135
2136/**
2137 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2138 *
2139 * Pulled from:
2140 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2141 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002142message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002143 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002144
Yao Chenc40a19d2018-03-15 16:48:25 -07002145 // 1 denotes foreground and 0 denotes background. This is called Set in
2146 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002147 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002148
2149 optional int64 rx_bytes = 3;
2150
2151 optional int64 rx_packets = 4;
2152
2153 optional int64 tx_bytes = 5;
2154
2155 optional int64 tx_packets = 6;
2156}
2157
2158/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002159 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2160 *
2161 * Pulled from:
2162 * StatsCompanionService
2163 */
2164message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002165 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002166
2167 optional int64 rx_bytes = 2;
2168
2169 optional int64 tx_bytes = 3;
2170}
2171
2172/**
David Chenc8a43242017-10-17 16:23:28 -07002173 * Pulls the kernel wakelock durations. This atom is adapted from
2174 * android/internal/os/KernelWakelockStats.java
2175 *
2176 * Pulled from:
2177 * StatsCompanionService using KernelWakelockReader.
2178 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002179message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002180 optional string name = 1;
2181
2182 optional int32 count = 2;
2183
2184 optional int32 version = 3;
2185
2186 optional int64 time = 4;
2187}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002188
Chenjie Yu05013b32017-11-21 10:21:41 -08002189/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002190 * Pulls low power state information. This includes platform and subsystem sleep state information,
2191 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002192 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002193 * hardware/interfaces/power/1.1/types.hal
2194 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002195message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002196 // Subsystem name
2197 optional string subsystem_name = 1;
2198 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2199 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2200 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002201 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002202 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002203 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002204 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002205}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002206
Chenjie Yu05013b32017-11-21 10:21:41 -08002207/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002208 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002209 * Pulls the time the cpu spend on the frequency index. Frequency index
2210 * starts from highest to lowest. The value should be monotonically
2211 * increasing since boot. However, if there is a cpu
2212 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002213 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002214message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002215 optional uint32 cluster = 1;
2216 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002217 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002218}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002219
Chenjie Yu05013b32017-11-21 10:21:41 -08002220/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002221 * Pulls Cpu Time Per Uid.
2222 * Note that isolated process uid time should be attributed to host uids.
2223 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002224message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002225 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002226 optional uint64 user_time_millis = 2;
2227 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002228}
2229
2230/**
2231 * Pulls Cpu Time Per Uid per frequency.
2232 * Note that isolated process uid time should be attributed to host uids.
2233 * For each uid, we order the time by descending frequencies.
2234 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002235message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002236 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002237 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002238 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002239}
Hugo Benichi884970e2017-11-14 22:42:46 +09002240
Chenjie Yu05013b32017-11-21 10:21:41 -08002241/**
2242 * Pulls Wifi Controller Activity Energy Info
2243 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002244message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002245 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002246 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002247 // stack reported state
2248 // TODO: replace this with proto enum
2249 optional int32 stack_state = 2;
2250 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002251 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002252 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002253 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002254 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002255 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002256 // product of current(mA), voltage(V) and time(ms)
2257 optional uint64 controller_energy_used = 6;
2258}
2259
2260/**
2261 * Pulls Modem Activity Energy Info
2262 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002263message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002264 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002265 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002266 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002267 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002268 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002269 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002270 /**
2271 * Tx power index
2272 * index 0 = tx_power < 0dBm
2273 * index 1 = 0dBm < tx_power < 5dBm
2274 * index 2 = 5dBm < tx_power < 15dBm
2275 * index 3 = 15dBm < tx_power < 20dBm
2276 * index 4 = tx_power > 20dBm
2277 */
2278 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002279 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002280 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002281 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002282 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002283 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002284 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002285 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002286 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002287 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002288 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002289 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002290 // product of current(mA), voltage(V) and time(ms)
2291 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002292}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002293
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002294/**
2295 * Pulls Bluetooth Activity Energy Info
2296 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2297 */
2298message BluetoothActivityInfo {
2299 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002300 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002301 // bluetooth stack state
2302 optional int32 bluetooth_stack_state = 2;
2303 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002304 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002305 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002306 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002307 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002308 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002309 // product of current(mA), voltage(V) and time(ms)
2310 optional uint64 energy_used = 6;
2311}
2312
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002313/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002314 * Logs the memory stats for a process.
2315 */
2316message ProcessMemoryState {
2317 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002318 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002319
2320 // The process name.
2321 optional string process_name = 2;
2322
2323 // oom adj score.
2324 optional int32 oom_score = 3;
2325
2326 // # of page-faults
2327 optional int64 pgfault = 4;
2328
2329 // # of major page-faults
2330 optional int64 pgmajfault = 5;
2331
Rajeev Kumar90235992018-01-29 11:06:48 -08002332 // RSS
2333 optional int64 rss_in_bytes = 6;
2334
2335 // CACHE
2336 optional int64 cache_in_bytes = 7;
2337
2338 // SWAP
2339 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002340
2341 // RSS high watermark.
2342 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2343 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2344 optional int64 rss_high_watermark_in_bytes = 9;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002345}
2346
2347/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002348 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002349 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002350message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002351 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002352}
2353
2354/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002355 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002356 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002357message SystemUptime {
2358 // Milliseconds since the system was booted.
2359 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2360 // for external input).
2361 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002362 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002363}
2364
2365/*
2366 * Reads from /proc/uid_concurrent_active_time which has the format:
2367 * active: X (X is # cores)
2368 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2369 * [uid1]: [time-0] [time-1] [time-2] ... ...
2370 * ...
2371 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2372 * The file contains a monotonically increasing count of time for a single boot.
2373 */
2374message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002375 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002376 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002377}
2378
2379/**
2380 * Reads from /proc/uid_concurrent_policy_time which has the format:
2381 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2382 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2383 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2384 * ...
2385 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2386 * The file contains a monotonically increasing count of time for a single boot.
2387 */
2388message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002389 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002390 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002391 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002392}
2393
2394/*
2395 * Pulls free disk space, for data, system partition and temporary directory.
2396 */
2397message DiskSpace {
2398 // available bytes in data partition
2399 optional uint64 data_available_bytes = 1;
2400 // available bytes in system partition
2401 optional uint64 system_available_bytes = 2;
2402 // available bytes in download cache or temp directories
2403 optional uint64 temp_available_bytes = 3;
2404}
Tej Singhbf972d92018-01-10 20:51:13 -08002405
2406/**
2407 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002408 * Pulled from:
2409 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002410 */
2411message RemainingBatteryCapacity {
2412 optional int32 charge_uAh = 1;
2413}
2414
2415/**
2416 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002417 * Pulled from:
2418 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002419 */
2420message FullBatteryCapacity {
2421 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002422}
2423
2424/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002425 * Pulls battery voltage.
2426 * Pulled from:
2427 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2428 */
2429message BatteryVoltage {
2430 // The voltage of the battery, in millivolts.
2431 optional int32 voltage_mV = 1;
2432}
2433
2434/**
Tej Singhd89137e2018-03-26 14:51:40 -07002435 * Pulls the temperature of various parts of the device.
2436 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002437 *
2438 * Pulled from:
2439 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2440 */
2441message Temperature {
2442 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2443 optional android.os.TemperatureTypeEnum sensor_location = 1;
2444
2445 // The name of the temperature source. Eg. CPU0
2446 optional string sensor_name = 2;
2447
Tej Singhd89137e2018-03-26 14:51:40 -07002448 // Temperature in tenths of a degree C.
2449 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002450}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002451
2452/**
2453 * Pulls the statistics of calls to Binder.
2454 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002455 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2456 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002457 *
2458 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002459 */
2460message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002461 optional int32 uid = 1 [(is_uid) = true];
2462 // Fully qualified class name of the API call.
2463 //
2464 // This is a system server class name.
2465 //
2466 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2467 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2468 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2469 // commonly used APIs.
2470 optional string service_class_name = 2;
2471 // Method name of the API call. It can also be a transaction code if we cannot
2472 // resolve it to a name. See Binder#getTransactionName.
2473 //
2474 // This is a system server method name.
2475 optional string service_method_name = 3;
2476 // Total number of API calls.
2477 optional int64 call_count = 4;
2478 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2479 optional bool screen_interactive = 13;
2480 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2481 // call_count will be equal to recorded_call_count.
2482 //
2483 // If recorded_call_count is different than call_count, it means data collection has been
2484 // sampled. All the fields below will be sampled in this case.
2485 optional int64 recorded_call_count = 12;
2486 // Number of exceptions thrown by the API.
2487 optional int64 recorded_exception_count = 5;
2488 // Total latency of all API calls.
2489 // Average can be computed using total_latency_micros / recorded_call_count.
2490 optional int64 recorded_total_latency_micros = 6;
2491 // Maximum latency of one API call.
2492 optional int64 recorded_max_latency_micros = 7;
2493 // Total CPU usage of all API calls.
2494 // Average can be computed using total_cpu_micros / recorded_call_count.
2495 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2496 optional int64 recorded_total_cpu_micros = 8;
2497 // Maximum CPU usage of one API call.
2498 optional int64 recorded_max_cpu_micros = 9;
2499 // Maximum parcel reply size of one API call.
2500 optional int64 recorded_max_reply_size_bytes = 10;
2501 // Maximum parcel request size of one API call.
2502 optional int64 recorded_max_request_size_bytes = 11;
2503}
2504
2505/**
2506 * Pulls the statistics of exceptions during calls to Binder.
2507 *
2508 * Binder stats are cumulative from boot unless somebody reset the data using
2509 * > adb shell dumpsys binder_calls_stats --reset
2510 */
2511message BinderCallsExceptions {
2512 // Exception class name, e.g. java.lang.IllegalArgumentException.
2513 //
2514 // This is an exception class name thrown by the system server.
2515 optional string exception_class_name = 1;
2516 // Total number of exceptions.
2517 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002518}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002519
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002520/**
2521 * Pulls the statistics of message dispatching on HandlerThreads.
2522 *
2523 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2524 * config on the device.
2525 *
2526 * Next tag: 11
2527 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002528message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002529 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002530 optional int32 uid = 1 [(is_uid) = true];
2531
2532 // Fully qualified class name of the handler target class.
2533 //
2534 // This field does not contain PII. This is a system server class name.
2535 optional string handler_class_name = 2;
2536
2537 // The name of the thread that runs the Looper.
2538 //
2539 // This field does not contain PII. This is a system server thread name.
2540 optional string looper_thread_name = 3;
2541
2542 // The name of the dispatched message.
2543 //
2544 // This field does not contain PII. This is a system server constant or class
2545 // name.
2546 optional string message_name = 4;
2547
2548 // Total number of successfully dispatched messages.
2549 optional int64 message_count = 5;
2550
2551 // Total number of messages that failed dispatching.
2552 optional int64 exception_count = 6;
2553
2554 // Total number of processed messages we have data recorded for. If we
2555 // collected data for all the messages, message_count will be equal to
2556 // recorded_message_count.
2557 //
2558 // If recorded_message_count is different than message_count, it means data
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002559 // collection has been sampled. The fields below will be sampled in this case.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002560 optional int64 recorded_message_count = 7;
2561
2562 // Total latency of all processed messages.
2563 // Average can be computed using recorded_total_latency_micros /
2564 // recorded_message_count.
2565 optional int64 recorded_total_latency_micros = 8;
2566
2567 // Total CPU usage of all processed message.
2568 // Average can be computed using recorded_total_cpu_micros /
2569 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002570 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002571 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002572
2573 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2574 optional bool screen_interactive = 10;
Marcin Oczeretkoc06331a2018-10-02 13:00:38 +01002575
2576 // Max recorded CPU usage of all processed messages.
2577 optional int64 recorded_max_cpu_micros = 11;
2578
2579 // Max recorded latency of all processed messages.
2580 optional int64 recorded_max_latency_micros = 12;
2581
2582 // Total number of messages we tracked the dispatching delay for. If we
2583 // collected data for all the messages, message_count will be equal to
2584 // recorded_delay_message_count.
2585 //
2586 // If recorded_delay_message_count is different than message_count, it means data
2587 // collection has been sampled or/and not all messages specified the target dispatch time.
2588 // The fields below will be sampled in this case.
2589 optional int64 recorded_delay_message_count = 13;
2590
2591 // Total dispatching delay of all processed messages.
2592 // Calculated as a difference between the target dispatching time (Message.when)
2593 // and the actual dispatching time.
2594 // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
2595 optional int64 recorded_total_delay_millis = 14;
2596
2597 // Max dispatching delay of all processed messages.
2598 // Calculated as a difference between the target dispatching time (Message.when)
2599 // and the actual dispatching time.
2600 optional int64 recorded_max_delay_millis = 15;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002601}
Tej Singh86dc9db2018-09-06 00:39:57 +00002602
2603/**
2604 * Pulls disk information, such as write speed and latency.
2605 */
2606message DiskStats {
2607 // Time taken to open, write 512B to, and close a file.
2608 // -1 if error performing the check.
2609 optional int64 data_write_latency_millis = 1;
2610
2611 optional bool file_based_encryption = 2;
2612
2613 // Recent disk write speed in kB/s.
2614 // -1 if error querying storageed.
2615 // 0 if data is unavailable.
2616 optional int32 recent_disk_write_speed = 3;
2617}
2618
2619
2620/**
2621 * Free and total bytes of the Data, Cache, and System partition.
2622 */
2623message DirectoryUsage {
2624 enum Directory {
2625 UNKNOWN = 0;
2626 DATA = 1;
2627 CACHE = 2;
2628 SYSTEM = 3;
2629 }
2630 optional Directory directory = 1;
2631 optional int64 free_bytes = 2;
2632 optional int64 total_bytes = 3;
2633}
2634
2635
2636/**
2637 * Size of an application: apk size, data size, and cache size.
2638 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2639 * Information is only reported for apps with the primary user (user 0).
2640 * Sizes are aggregated by package name.
2641 */
2642message AppSize {
2643 // Including uids will involve modifying diskstats logic.
2644 optional string package_name = 1;
2645 // App size in bytes. -1 if unavailable.
2646 optional int64 app_size_bytes = 2;
2647 // App data size in bytes. -1 if unavailable.
2648 optional int64 app_data_size_bytes = 3;
2649 // App cache size in bytes. -1 if unavailable.
2650 optional int64 app_cache_size_bytes = 4;
2651 // Time that the cache file was produced.
2652 // Uses System.currentTimeMillis(), which is wall clock time.
2653 optional int64 cache_time_millis = 5;
2654}
2655
2656
2657/**
2658 * Size of a particular category. Eg: photos, videos.
2659 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2660 */
2661message CategorySize {
2662 enum Category {
2663 UNKNOWN = 0;
2664 APP_SIZE = 1;
2665 APP_DATA_SIZE = 2;
2666 APP_CACHE_SIZE = 3;
2667 PHOTOS = 4;
2668 VIDEOS = 5;
2669 AUDIO = 6;
2670 DOWNLOADS = 7;
2671 SYSTEM = 8;
2672 OTHER = 9;
2673 }
2674 optional Category category = 1;
2675 // Category size in bytes.
2676 optional int64 size_bytes = 2;
2677 // Time that the cache file was produced.
2678 // Uses System.currentTimeMillis(), which is wall clock time.
2679 optional int64 cache_time_millis = 3;
2680}
Tej Singhd6d6d772018-09-05 17:41:25 -07002681
2682/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002683 * Pulls per uid I/O stats. The stats are cumulative since boot.
2684 *
2685 * Read/write bytes are I/O events from a storage device
2686 * Read/write chars are data requested by read/write syscalls, and can be
2687 * satisfied by caching.
2688 *
2689 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2690 */
2691message DiskIo {
2692 optional int32 uid = 1 [(is_uid) = true];
2693 optional int64 fg_chars_read = 2;
2694 optional int64 fg_chars_write = 3;
2695 optional int64 fg_bytes_read = 4;
2696 optional int64 fg_bytes_write = 5;
2697 optional int64 bg_chars_read = 6;
2698 optional int64 bg_chars_write = 7;
2699 optional int64 bg_bytes_read = 8;
2700 optional int64 bg_bytes_write = 9;
2701 optional int64 fg_fsync = 10;
2702 optional int64 bg_fsync= 11;
2703}
2704
2705
2706/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002707 * Pulls the number of fingerprints for each user.
2708 *
2709 * Pulled from StatsCompanionService, which queries FingerprintManager.
2710 */
2711message NumFingerprints {
2712 // The associated user. Eg: 0 for owners, 10+ for others.
2713 // Defined in android/os/UserHandle.java
2714 optional int32 user = 1;
2715 // Number of fingerprints registered to that user.
2716 optional int32 num_fingerprints = 2;
2717}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002718
2719/**
2720 * Pulled from ProcessStatsService.java
2721 */
2722message ProcStats {
2723 optional android.service.procstats.ProcessStatsSectionProto proc_stats_section = 1;
2724}
Chenjie Yuab530202018-09-26 12:39:20 -07002725
2726/**
2727 * power_profile.xml and other constants for power model calculations.
2728 * Pulled from PowerProfile.java
2729 */
2730message PowerProfile {
2731 optional com.android.internal.os.PowerProfileProto power_profile_proto = 1;
2732}