blob: f704fb78c55e09c91cb20a6d533b1ca8c1b2eb76 [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";
Yangsteraf9aee72018-10-12 09:26:16 -070029import "frameworks/base/core/proto/android/service/procstats_enum.proto";
30import "frameworks/base/core/proto/android/stats/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080031import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080032import "frameworks/base/core/proto/android/telephony/enums.proto";
33import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080034
Yao Chend54f9dd2017-10-17 17:37:48 +000035/**
Stefan Lafonae2df012017-11-14 09:17:21 -080036 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000037 * raw stats log events from the Android system, also known as "atoms."
38 *
39 * This field contains a single oneof with all of the available messages.
40 * The stats-log-api-gen tool runs as part of the Android build and
41 * generates the android.util.StatsLog class, which contains the constants
42 * and methods that Android uses to log.
43 *
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * Instead, statsd on Android constructs these messages synthetically,
46 * in the format defined here and in stats_log.proto.
47 */
Stefan Lafonae2df012017-11-14 09:17:21 -080048message Atom {
49 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070050 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070051 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
52 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070053 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070054 BleScanResultReceived ble_scan_result_received = 4;
55 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080056 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070057 SyncStateChanged sync_state_changed = 7;
58 ScheduledJobStateChanged scheduled_job_state_changed = 8;
59 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070060 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080061 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
62 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
63 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070064 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
65 MemoryFactorStateChanged memory_factor_state_changed = 15;
66 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
67 CachedKillReported cached_kill_reported = 17;
68 ProcessMemoryStatReported process_memory_stat_reported = 18;
69 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080070 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
71 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
72 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070073 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080074 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070075 CameraStateChanged camera_state_changed = 25;
76 FlashlightStateChanged flashlight_state_changed = 26;
77 UidProcessStateChanged uid_process_state_changed = 27;
78 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
79 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070080 BatteryLevelChanged battery_level_changed = 30;
81 ChargingStateChanged charging_state_changed = 31;
82 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070083 InteractiveStateChanged interactive_state_changed = 33;
84 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070085 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
86 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070087 WifiLockStateChanged wifi_lock_state_changed = 37;
88 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
89 WifiScanStateChanged wifi_scan_state_changed = 39;
90 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070091 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070092 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070093 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090094 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070095 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080096 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080097 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080098 AppStartOccurred app_start_occurred = 48;
99 AppStartCanceled app_start_canceled = 49;
100 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800102 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800103 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800104 LmkStateChanged lmk_state_changed = 54;
105 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800106 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800107 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800108 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800109 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800110 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800111 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800112 KeyguardStateChanged keyguard_state_changed = 62;
113 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
114 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800115 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800116 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800117 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
118 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700119 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700120 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800121 SpeakerImpedanceReported speaker_impedance_reported = 71;
122 HardwareFailed hardware_failed = 72;
123 PhysicalDropDetected physical_drop_detected = 73;
124 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800125 MobileConnectionStateChanged mobile_connection_state_changed = 75;
126 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700127 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800128 AppCrashOccurred app_crash_occurred = 78;
129 ANROccurred anr_occurred = 79;
130 WTFOccurred wtf_occurred = 80;
131 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700132 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700133 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700134 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700135 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700136 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700137 FingerprintAcquired fingerprint_acquired = 87;
138 FingerprintAuthenticated fingerprint_authenticated = 88;
139 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700140 Notification notification = 90;
Howard Roa46b6582018-09-18 16:45:02 -0700141 BatteryHealthSnapshot battery_health_snapshot = 91;
142 SlowIo slow_io = 92;
143 BatteryCausedShutdown battery_caused_shutdown = 93;
Yangsteraf9aee72018-10-12 09:26:16 -0700144 PhoneServiceStateChanged phone_service_state_changed = 94;
145 PhoneStateChanged phone_state_changed = 95;
Yao Chend54f9dd2017-10-17 17:37:48 +0000146 }
David Chenc8a43242017-10-17 16:23:28 -0700147
David Chen6e3e6cb2018-01-03 16:14:06 -0800148 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100149 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700150 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800151 WifiBytesTransfer wifi_bytes_transfer = 10000;
152 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
153 MobileBytesTransfer mobile_bytes_transfer = 10002;
154 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800155 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800156 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800157 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800158 CpuTimePerFreq cpu_time_per_freq = 10008;
159 CpuTimePerUid cpu_time_per_uid = 10009;
160 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800161 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800162 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800163 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800164 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800165 SystemElapsedRealtime system_elapsed_realtime = 10014;
166 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800167 CpuActiveTime cpu_active_time = 10016;
168 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000169 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800170 RemainingBatteryCapacity remaining_battery_capacity = 10019;
171 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800172 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100173 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100174 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100175 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000176 DiskStats disk_stats = 10025;
177 DirectoryUsage directory_usage = 10026;
178 AppSize app_size = 10027;
179 CategorySize category_size = 10028;
Chenjie Yuab530202018-09-26 12:39:20 -0700180 ProcStats proc_stats = 10029;
Bookatz17f0d8a2018-09-13 12:56:32 -0700181 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700182 NumFingerprints num_fingerprints = 10031;
Tej Singhe7726dc2018-09-21 11:42:12 -0700183 DiskIo disk_io = 10032;
Chenjie Yuab530202018-09-26 12:39:20 -0700184 PowerProfile power_profile = 10033;
Chenjie Yub52779e2018-10-05 12:03:36 -0700185 ProcStats proc_stats_pkg_proc = 10034;
David Chenc8a43242017-10-17 16:23:28 -0700186 }
yroa1fe77c2018-02-26 14:22:54 -0800187
Bookatz76aafcf2018-09-17 16:17:10 -0700188 // DO NOT USE field numbers above 100,000 in AOSP.
189 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
190 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700191}
192
Yao Chend54f9dd2017-10-17 17:37:48 +0000193/**
Yangster-mac20877162017-12-22 17:19:39 -0800194 * This proto represents a node of an attribution chain.
195 * Note: All attribution chains are represented as a repeated field of type
196 * AttributionNode. It is understood that in such arrays, the order is that
197 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000198 */
Yangster-mac20877162017-12-22 17:19:39 -0800199message AttributionNode {
200 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800201 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800202
Yangster-mac20877162017-12-22 17:19:39 -0800203 // The (optional) string tag for an element in the attribution chain. If the
204 // element has no tag, it is encoded as an empty string.
205 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700206}
207
Yangster-mac48b3d622018-08-18 12:38:11 -0700208message KeyValuePair {
209 optional int32 key = 1;
210 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700211 int32 value_int = 2;
212 int64 value_long = 3;
213 string value_str = 4;
214 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700215 }
216}
217
218message KeyValuePairsAtom {
219 optional int32 uid = 1;
220 repeated KeyValuePair pairs = 2;
221}
222
Yao Chend54f9dd2017-10-17 17:37:48 +0000223/*
224 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800225 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000226 *
227 * RULES:
228 * - The field ids for each atom must start at 1, and count upwards by 1.
229 * Skipping field ids is not allowed.
230 * - These form an API, so renaming, renumbering or removing fields is
231 * not allowed between android releases. (This is not currently enforced,
232 * but there will be a tool to enforce this restriction).
233 * - The types must be built-in protocol buffer types, namely, no sub-messages
234 * are allowed (yet). The bytes type is also not allowed.
235 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800236 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000237 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800238 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000239 * - A field that is a uid should be a string field, tagged with the [xxx]
240 * annotation. The generated code on android will be represented by UIDs,
241 * and those UIDs will be translated in xxx to those strings.
242 *
243 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700244 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000245 * - If there is a UID, it goes first. Think in an object-oriented fashion.
246 * *****************************************************************************
247 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700248
Yao Chend54f9dd2017-10-17 17:37:48 +0000249/**
Yangster-mace16189a2018-08-26 12:20:16 -0700250 * Logs when the Thermal service HAL notifies the throttling start/stop events.
251 *
252 * Logged from:
253 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
254 */
255message ThermalThrottlingStateChanged {
256 optional android.os.TemperatureTypeEnum sensor_type = 1;
257
258 enum State {
259 UNKNOWN = 0;
260 START = 1;
261 STOP = 2;
262 }
263
264 optional State state = 2;
265
266 optional float temperature = 3;
267}
268
269/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000270 * Logs when the screen state changes.
271 *
272 * Logged from:
273 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
274 */
275message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800276 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800277 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700278}
Yao Chend54f9dd2017-10-17 17:37:48 +0000279
280/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700281 * Logs that the process state of the uid, as determined by ActivityManager
282 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000283 *
284 * Logged from:
285 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
286 */
Bookatzc1a050a2017-10-10 15:49:28 -0700287message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700288 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000289
Bookatzdb026a22018-01-10 19:01:56 -0800290 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800291 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000292}
293
294/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700295 * Logs process state change of a process, as per the activity manager.
296 *
297 * Logged from:
298 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
299 */
300message ProcessStateChanged {
301 optional int32 uid = 1;
302 optional string process_name = 2;
303 optional string package_name = 3;
304 // TODO: remove this when validation is done
305 optional int64 version = 5;
306 // The state, from frameworks/base/core/proto/android/app/enums.proto.
307 optional android.app.ProcessStateEnum state = 4;
308}
309
310/**
311 * Logs when ActivityManagerService sleep state is changed.
312 *
313 * Logged from:
314 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
315 */
316message ActivityManagerSleepStateChanged {
317 // TODO: import frameworks proto
318 enum State {
319 UNKNOWN = 0;
320 ASLEEP = 1;
321 AWAKE = 2;
322 }
323 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
324}
325
326/**
327 * Logs when system memory state changes.
328 *
329 * Logged from:
330 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
331 */
332message MemoryFactorStateChanged {
333 // TODO: import frameworks proto
334 enum State {
335 MEMORY_UNKNOWN = 0;
336 NORMAL = 1; // normal.
337 MODERATE = 2; // moderate memory pressure.
338 LOW = 3; // low memory.
339 CRITICAL = 4; // critical memory.
340
341 }
342 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
343}
344
345/**
346 * Logs when app is using too much cpu, according to ActivityManagerService.
347 *
348 * Logged from:
349 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
350 */
351message ExcessiveCpuUsageReported {
352 optional int32 uid = 1;
353 optional string process_name = 2;
354 optional string package_name = 3;
355 // package version. TODO: remove this when validation is done
356 optional int64 version = 4;
357}
358
359/**
360 * Logs when a cached process is killed, along with its pss.
361 *
362 * Logged from:
363 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
364 */
365message CachedKillReported {
366 optional int32 uid = 1;
367 optional string process_name = 2;
368 optional string package_name = 3;
369 // TODO: remove this when validation is done
370 optional int64 version = 5;
371 optional int64 pss = 4;
372}
373
374/**
375 * Logs when memory stats of a process is reported.
376 *
377 * Logged from:
378 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
379 */
380message ProcessMemoryStatReported {
381 optional int32 uid = 1;
382 optional string process_name = 2;
383 optional string package_name = 3;
384 //TODO: remove this when validation is done
385 optional int64 version = 9;
386 optional int64 pss = 4;
387 optional int64 uss = 5;
388 optional int64 rss = 6;
389 enum Type {
390 ADD_PSS_INTERNAL_SINGLE = 0;
391 ADD_PSS_INTERNAL_ALL_MEM = 1;
392 ADD_PSS_INTERNAL_ALL_POLL = 2;
393 ADD_PSS_EXTERNAL = 3;
394 ADD_PSS_EXTERNAL_SLOW = 4;
395 }
396 optional Type type = 7;
397 optional int64 duration = 8;
398}
399
400/**
Bookatzc1a050a2017-10-10 15:49:28 -0700401 * Logs that a process started, finished, crashed, or ANRed.
402 *
403 * Logged from:
404 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
405 */
406message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700407 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700408
David Chen0b5c90c2018-01-25 16:51:49 -0800409 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800410 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700411
Bookatzddccf0a2017-11-28 16:48:14 -0800412 // What lifecycle state the process changed to.
413 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800414 enum State {
415 FINISHED = 0;
416 STARTED = 1;
417 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800418 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800419 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700420}
421
Bookatzc1a050a2017-10-10 15:49:28 -0700422/**
423 * Logs when the ble scan state changes.
424 *
425 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700426 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700427 */
428message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800429 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700430
431 enum State {
432 OFF = 0;
433 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700434 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
435 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700436 }
437 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700438
Bookatze5ec0b42018-03-26 13:34:56 -0700439 // Does the scan have a filter.
440 optional bool is_filtered = 3;
441 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
442 optional bool is_first_match = 4;
443 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
444 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700445}
446
447/**
448 * Logs reporting of a ble scan finding results.
449 *
450 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700451 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700452 */
Bookatzae6738e2018-09-13 11:38:56 -0700453// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700454message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800455 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700456
457 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800458 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700459}
460
461/**
462 * Logs when a sensor state changes.
463 *
464 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700465 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700466 */
467message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800468 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700469
Bookatzc1a050a2017-10-10 15:49:28 -0700470 // The id (int) of the sensor.
471 optional int32 sensor_id = 2;
472
473 enum State {
474 OFF = 0;
475 ON = 1;
476 }
477 optional State state = 3;
478}
479
480
481/**
482 * Logs when GPS state changes.
483 *
484 * Logged from:
485 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
486 */
487message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800488 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700489
490 enum State {
491 OFF = 0;
492 ON = 1;
493 }
494 optional State state = 2;
495}
496
497
498/**
499 * Logs when a sync manager sync state changes.
500 *
501 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700502 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700503 */
504message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800505 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700506
David Chen0b5c90c2018-01-25 16:51:49 -0800507 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800508 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700509
510 enum State {
511 OFF = 0;
512 ON = 1;
513 }
514 optional State state = 3;
515}
516
Yangster-mac96353002018-09-05 11:18:55 -0700517/*
518 * Deferred job stats.
519 *
520 * Logged from:
521 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
522*/
523message DeferredJobStatsReported {
524 repeated AttributionNode attribution_node = 1;
525
526 // Number of jobs deferred.
527 optional int32 num_jobs_deferred = 2;
528
529 // Time since the last job runs.
530 optional int64 time_since_last_job_millis = 3;
531}
532
Bookatzc1a050a2017-10-10 15:49:28 -0700533/**
534 * Logs when a job scheduler job state changes.
535 *
536 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700537 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700538 */
539message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800540 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700541
542 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800543 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700544
545 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800546 FINISHED = 0;
547 STARTED = 1;
548 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700549 }
550 optional State state = 3;
551
Tej Singh33a412b2018-03-16 18:43:59 -0700552 // The reason a job has stopped.
553 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700554 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700555 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700556}
557
558/**
559 * Logs when the audio state changes.
560 *
561 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700562 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700563 */
564message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800565 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700566
567 enum State {
568 OFF = 0;
569 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700570 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
571 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700572 }
573 optional State state = 2;
574}
575
576/**
577 * Logs when the video codec state changes.
578 *
579 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700580 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700581 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800582message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800583 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700584
585 enum State {
586 OFF = 0;
587 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700588 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
589 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700590 }
591 optional State state = 2;
592}
593
594/**
595 * Logs when the flashlight state changes.
596 *
597 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700598 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700599 */
600message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800601 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700602
603 enum State {
604 OFF = 0;
605 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700606 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
607 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700608 }
609 optional State state = 2;
610}
611
612/**
613 * Logs when the camera state changes.
614 *
615 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700616 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700617 */
618message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800619 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700620
621 enum State {
622 OFF = 0;
623 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700624 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
625 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700626 }
627 optional State state = 2;
628}
629
630/**
631 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000632 *
633 * Logged from:
634 * TODO
635 */
Bookatzd6746242017-10-24 18:39:35 -0700636message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800637 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000638
Bookatz1a1b0462018-01-12 11:47:03 -0800639 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
640 // From frameworks/base/core/proto/android/os/enums.proto.
641 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700642
643 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
644 optional string tag = 3;
645
646 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800647 RELEASE = 0;
648 ACQUIRE = 1;
649 CHANGE_RELEASE = 2;
650 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700651 }
652 optional State state = 4;
653}
654
655/**
Bookatzc1a050a2017-10-10 15:49:28 -0700656 * Logs when a partial wakelock is considered 'long' (over 1 min).
657 *
658 * Logged from:
659 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
660 */
661message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800662 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700663
Yao Chend54f9dd2017-10-17 17:37:48 +0000664 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
665 optional string tag = 2;
666
Bookatzc1a050a2017-10-10 15:49:28 -0700667 // TODO: I have no idea what this is.
668 optional string history_tag = 3;
669
670 enum State {
671 OFF = 0;
672 ON = 1;
673 }
674 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000675}
676
Bookatzc1a050a2017-10-10 15:49:28 -0700677/**
Bookatza66083f2018-09-20 17:24:00 -0700678 * Logs when the device is interactive, according to the PowerManager Notifier.
679 *
680 * Logged from:
681 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
682 */
683message InteractiveStateChanged {
684 enum State {
685 OFF = 0;
686 ON = 1;
687 }
688 optional State state = 1;
689}
690
691/**
Bookatzc1a050a2017-10-10 15:49:28 -0700692 * Logs Battery Saver state change.
693 *
694 * Logged from:
695 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
696 */
697message BatterySaverModeStateChanged {
698 enum State {
699 OFF = 0;
700 ON = 1;
701 }
702 optional State state = 1;
703}
704
705/**
706 * Logs Doze mode state change.
707 *
708 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800709 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700710 */
711message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800712 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800713}
714
715
716/**
717 * Logs state change of Doze mode including maintenance windows.
718 *
719 * Logged from:
720 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
721 */
722message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800723 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700724}
725
726/**
727 * Logs screen brightness level.
728 *
729 * Logged from:
730 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
731 */
732message ScreenBrightnessChanged {
733 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
734 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700735}
736
737/**
738 * Logs battery level (percent full, from 0 to 100).
739 *
740 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700741 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700742 */
743message BatteryLevelChanged {
744 // Battery level. Should be in [0, 100].
745 optional int32 battery_level = 1;
746}
747
748/**
749 * Logs change in charging status of the device.
750 *
751 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700752 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700753 */
754message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800755 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
756 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700757}
758
759/**
760 * Logs whether the device is plugged in, and what power source it is using.
761 *
762 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700763 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700764 */
765message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800766 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
767 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700768}
769
Bookatz8c6571b2017-10-24 15:04:41 -0700770/**
771 * Logs when an app's wakeup alarm fires.
772 *
773 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700774 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700775 */
776message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800777 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800778
779 // Name of the wakeup alarm.
780 optional string tag = 2;
Bookatzcaf2293e2018-09-23 13:07:43 -0700781
782 // Name of source package (for historical reasons, since BatteryStats tracked it).
783 optional string package_name = 3;
Bookatzddccf0a2017-11-28 16:48:14 -0800784}
785
786/**
787 * Logs when an an app causes the mobile radio to change state.
788 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
789 *
790 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700791 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800792 */
793message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800794 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800795
Bookatz1a1b0462018-01-12 11:47:03 -0800796 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
797 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800798}
799
800/**
801 * Logs when an an app causes the wifi radio to change state.
802 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
803 *
804 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700805 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800806 */
807message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800808 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800809
Bookatz1a1b0462018-01-12 11:47:03 -0800810 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
811 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700812}
813
814/**
815 * Logs kernel wakeup reasons and aborts.
816 *
817 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700818 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700819 */
820message KernelWakeupReported {
821 // Name of the kernel wakeup reason (or abort).
822 optional string wakeup_reason_name = 1;
823
824 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800825 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700826}
827
828/**
829 * Logs wifi locks held by an app.
830 *
831 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700832 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700833 */
834message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800835 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700836
837 enum State {
838 OFF = 0;
839 ON = 1;
840 }
841 optional State state = 2;
842}
843
844/**
845 * Logs wifi signal strength changes.
846 *
847 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700848 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700849 */
850message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800851 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
852 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700853}
854
855/**
856 * Logs wifi scans performed by an app.
857 *
858 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700859 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700860 */
861message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800862 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700863
864 enum State {
865 OFF = 0;
866 ON = 1;
867 }
868 optional State state = 2;
869}
870
871/**
Tej Singh4503e102018-01-04 14:35:01 -0800872 * Logs wifi multicast locks held by an app
873 *
874 * Logged from:
875 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
876 */
877message WifiMulticastLockStateChanged {
878 repeated AttributionNode attribution_node = 1;
879
880 enum State {
881 OFF = 0;
882 ON = 1;
883 }
884 optional State state = 2;
885}
886
887/**
Tej Singh1ea42892018-01-19 09:27:00 -0800888 * Logs shutdown reason and duration on next boot.
889 *
890 * Logged from:
891 * frameworks/base/core/java/com/android/server/BootReceiver.java
892 */
893message ShutdownSequenceReported {
894 // True if shutdown is for a reboot. Default: false if we do not know.
895 optional bool reboot = 1;
896
897 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
898 optional string reason = 2;
899
900 // Beginning of shutdown time in ms using wall clock time since unix epoch.
901 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800902 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800903
904 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800905 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800906}
907
Tej Singh6483ea42018-01-25 17:45:49 -0800908
909/**
910 * Logs boot reason and duration.
911 *
912 * Logged from:
913 * system/core/bootstat/bootstat.cpp
914 */
915message BootSequenceReported {
916 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
917 // Default: "<EMPTY>" if not available.
918 optional string bootloader_reason = 1;
919
920 // Reason for system boot. Eg. bootloader, reboot,userrequested
921 // Default: "<EMPTY>" if not available.
922 optional string system_reason = 2;
923
924 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800925 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800926
927 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800928 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800929
930 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800931 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800932
933 // Time since last boot in ms. Default: 0 if not available.
934 optional int64 time_since_last_boot = 6;
935}
936
Tej Singhc477d9c2018-02-05 18:31:39 -0800937
938/**
939 * Logs call state and disconnect cause (if applicable).
940 *
941 * Logged from:
942 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
943 */
944message CallStateChanged {
945 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
946 // From frameworks/base/core/proto/android/telecomm/enums.proto.
947 optional android.telecom.CallStateEnum call_state = 1;
948
949 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
950 // This value is only applicable when the call_state is DISCONNECTED, and
951 // should always be UNKNOWN if the call_state is not DISCONNECTED.
952 // From frameworks/base/core/proto/android/telecomm/enums.proto.
953 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
954
955 // True if the call is self-managed, which are apps that use the
956 // telecom infrastructure to make their own calls.
957 optional bool self_managed = 3;
958
959 // True if call is external. External calls are calls on connected Wear
960 // devices but show up in Telecom so the user can pull them onto the device.
961 optional bool external_call = 4;
962}
963
Tej Singh1ea42892018-01-19 09:27:00 -0800964/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800965 * Logs keyguard state. The keyguard is the lock screen.
966 *
967 * Logged from:
968 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
969 */
970message KeyguardStateChanged {
971 enum State {
972 UNKNOWN = 0;
973 // The keyguard is hidden when the phone is unlocked.
974 HIDDEN = 1;
975 // The keyguard is shown when the phone is locked (screen turns off).
976 SHOWN= 2;
977 // The keyguard is occluded when something is overlaying the keyguard.
978 // Eg. Opening the camera while on the lock screen.
979 OCCLUDED = 3;
980 }
981 optional State state = 1;
982}
983
984/**
985 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
986 * prompts the user to enter a password (pattern, pin, etc).
987 *
988 * Logged from:
989 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
990 */
991
992message KeyguardBouncerStateChanged {
993 enum State {
994 UNKNOWN = 0;
995 // Bouncer is hidden, either as a result of successfully entering the
996 // password, screen timing out, or user going back to lock screen.
997 HIDDEN = 1;
998 // This is when the user is being prompted to enter the password.
999 SHOWN = 2;
1000 }
1001 optional State state = 1;
1002}
1003
1004/**
1005 * Logs the result of entering a password into the keyguard bouncer.
1006 *
1007 * Logged from:
1008 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
1009 */
1010message KeyguardBouncerPasswordEntered {
1011 enum BouncerResult {
1012 UNKNOWN = 0;
1013 // The password entered was incorrect.
1014 FAILURE = 1;
1015 // The password entered was correct.
1016 SUCCESS = 2;
1017 }
1018 optional BouncerResult result = 1;
1019}
1020
Tej Singha883b372018-02-15 11:30:01 -08001021/*
1022 * Logs changes to the configuration of the device. The configuration is defined
1023 * in frameworks/base/core/java/android/content/res/Configuration.java
1024 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1025 * Please go there to interpret the possible values each field can be.
1026 *
1027 * Logged from:
1028 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1029 */
1030message ResourceConfigurationChanged {
1031 // Bit mask of color capabilities of the screen.
1032 // Contains information about the color gamut and hdr mode of the screen.
1033 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1034 optional int32 colorMode = 1;
1035
1036 // The target screen density being rendered to.
1037 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1038 optional int32 densityDpi = 2;
1039
1040 // Current user preference for the scaling factor for fonts,
1041 // relative to the base density scaling.
1042 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1043 optional float fontScale = 3;
1044
1045 // Flag indicating whether the hard keyboard is hidden.
1046 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1047 optional int32 hardKeyboardHidden = 4;
1048
1049 // The type of keyboard attached to the device.
1050 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1051 optional int32 keyboard = 5;
1052
1053 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1054 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1055 optional int32 keyboardHideen = 6;
1056
1057 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1058 // 0 if undefined.
1059 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1060 optional int32 mcc = 7;
1061
1062 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1063 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1064 // MNC_ZERO symbol defined in Configuration.java.
1065 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1066 optional int32 mnc = 8;
1067
1068 // The kind of navigation available on the device.
1069 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1070 optional int32 navigation = 9;
1071
1072 // Flag indicating whether the navigation is available.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1074 optional int32 navigationHidden = 10;
1075
1076 // Overall orientation of the screen.
1077 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1078 optional int32 orientation = 11;
1079
1080 // The current height of the available screen space, in dp units.
1081 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1082 optional int32 screenHeightDp = 12;
1083
1084 // Bit mask of overall layout of the screen.
1085 // Contains information about screen size, whether the screen is wider/taller
1086 // than normal, whether the screen layout is right-tl-left or left-to-right,
1087 // and whether the screen has a rounded shape.
1088 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1089 optional int32 screenLayout = 13;
1090
1091 // Current width of the available screen space, in dp units.
1092 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1093 optional int32 screenWidthDp = 14;
1094
1095 // The smallest screen size an application will see in normal operation.
1096 // This is the smallest value of both screenWidthDp and screenHeightDp
1097 // in portrait and landscape.
1098 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1099 optional int32 smallestScreenWidthDp = 15;
1100
1101 // The type of touch screen attached to the device.
1102 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1103 optional int32 touchscreen = 16;
1104
1105 // Bit mask of the ui mode.
1106 // Contains information about the overall ui mode of the device.
1107 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1108 // Also contains information about whether the device is in night mode.
1109 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1110 optional int32 uiMode = 17;
1111}
1112
Tej Singheee317b2018-03-07 19:28:05 -08001113
1114/**
1115 * Logs changes in the connection state of the mobile radio.
1116 *
1117 * Logged from:
1118 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1119 */
1120message MobileConnectionStateChanged {
1121 // States are from the state machine DataConnection.java.
1122 enum State {
1123 UNKNOWN = 0;
1124 // The connection is inactive, or disconnected.
1125 INACTIVE = 1;
1126 // The connection is being activated, or connecting.
1127 ACTIVATING = 2;
1128 // The connection is active, or connected.
1129 ACTIVE = 3;
1130 // The connection is disconnecting.
1131 DISCONNECTING = 4;
1132 // The connection is disconnecting after creating a connection.
1133 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1134 }
1135 optional State state = 1;
1136 // For multi-sim phones, this distinguishes between the sim cards.
1137 optional int32 sim_slot_index = 2;
1138 // Used to identify the connection. Starts at 0 and increments by 1 for
1139 // every new network created. Resets whenever the device reboots.
1140 optional int32 data_connection_id = 3;
1141 // A bitmask for the capabilities of this connection.
1142 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1143 // Default value (if we have no information): 0
1144 optional int64 capabilities = 4;
1145 // If this connection has internet.
1146 // This just checks if the DEFAULT bit of capabilities is set.
1147 optional bool has_internet = 5;
1148}
1149
1150/**
1151 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1152 *
1153 * Logged from:
1154 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1155 */
1156message MobileRadioTechnologyChanged {
1157 optional android.telephony.NetworkTypeEnum state = 1;
1158 // For multi-sim phones, this distinguishes between the sim cards.
1159 optional int32 sim_slot_index = 2;
1160}
1161
Andrew Chantb56388b2018-03-22 21:07:33 -07001162/**
1163 * Logs the VID and PID of any connected USB devices.
1164 *
1165 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1166 *
1167 * Logged by Vendor.
1168 */
1169message UsbDeviceAttached {
1170 optional int32 vid = 1;
1171 optional int32 pid = 2;
1172 optional bool has_audio = 3;
1173 optional bool has_hid = 4;
1174 optional bool has_storage = 5;
1175}
1176
Tej Singheee317b2018-03-07 19:28:05 -08001177
Tej Singhdd7bd352018-02-09 19:33:15 -08001178/**
Tej Singh5d991e12018-03-09 19:48:11 -08001179 * Logs when Bluetooth is enabled and disabled.
1180 *
1181 * Logged from:
1182 * services/core/java/com/android/server/BluetoothManagerService.java
1183 */
1184message BluetoothEnabledStateChanged {
1185 repeated AttributionNode attribution_node = 1;
1186 // Whether or not bluetooth is enabled on the device.
1187 enum State {
1188 UNKNOWN = 0;
1189 ENABLED = 1;
1190 DISABLED = 2;
1191 }
1192 optional State state = 2;
1193 // The reason for being enabled/disabled.
1194 // Eg. Airplane mode, crash, application request.
1195 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1196 // If the reason is an application request, this will be the package name.
1197 optional string pkgName = 4;
1198}
1199
1200/**
1201 * Logs when a Bluetooth device connects and disconnects.
1202 *
1203 * Logged from:
1204 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1205 */
1206message BluetoothConnectionStateChanged {
1207 // The state of the connection.
1208 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1209 optional android.bluetooth.ConnectionStateEnum state = 1;
1210 // An identifier that can be used to match connect and disconnect events.
1211 // Currently is last two bytes of a hash of a device level ID and
1212 // the mac address of the bluetooth device that is connected.
1213 optional int32 obfuscated_id = 2;
1214 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1215 // From android.bluetooth.BluetoothAdapter.java
1216 optional int32 bt_profile = 3;
1217}
1218
1219/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001220 * Logs when something is plugged into or removed from the USB-C connector.
1221 *
1222 * Logged from:
1223 * Vendor USB HAL.
1224 */
1225message UsbConnectorStateChanged {
1226 enum State {
1227 DISCONNECTED = 0;
1228 CONNECTED = 1;
1229 }
1230 optional State state = 1;
1231}
1232
1233/**
1234 * Logs the reported speaker impedance.
1235 *
1236 * Logged from:
1237 * Vendor audio implementation.
1238 */
1239message SpeakerImpedanceReported {
1240 optional int32 speaker_location = 1;
1241 optional int32 impedance = 2;
1242}
1243
1244/**
1245 * Logs the report of a failed hardware.
1246 *
1247 * Logged from:
1248 * Vendor HALs.
1249 *
1250 */
1251message HardwareFailed {
1252 enum HardwareType {
1253 HARDWARE_FAILED_UNKNOWN = 0;
1254 HARDWARE_FAILED_MICROPHONE = 1;
1255 HARDWARE_FAILED_CODEC = 2;
1256 HARDWARE_FAILED_SPEAKER = 3;
1257 HARDWARE_FAILED_FINGERPRINT = 4;
1258 }
1259 optional HardwareType hardware_type = 1;
1260
1261 /* hardware_location allows vendors to differentiate between multiple instances of
1262 * the same hardware_type. The specific locations are vendor defined integers,
1263 * referring to board-specific numbering schemes.
1264 */
1265 optional int32 hardware_location = 2;
1266
1267 /* failure_code is specific to the HardwareType of the failed hardware.
1268 * It should use the enum values defined below.
1269 */
1270 enum MicrophoneFailureCode {
1271 MICROPHONE_FAILURE_COMPLETE = 0;
1272 }
1273 enum CodecFailureCode {
1274 CODEC_FAILURE_COMPLETE = 0;
1275 }
1276 enum SpeakerFailureCode {
1277 SPEAKER_FAILURE_COMPLETE = 0;
1278 SPEAKER_FAILURE_HIGH_Z = 1;
1279 SPEAKER_FAILURE_SHORT = 2;
1280 }
1281 enum FingerprintFailureCode {
1282 FINGERPRINT_FAILURE_COMPLETE = 0;
1283 FINGERPRINT_SENSOR_BROKEN = 1;
1284 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1285 }
1286 optional int32 failure_code = 3;
1287}
1288
1289/**
1290 * Log an event when the device has been physically dropped.
1291 * Reported from the /vendor partition.
1292 */
1293message PhysicalDropDetected {
1294 // Confidence that the event was actually a drop, 0 -> 100
1295 optional int32 confidence_pctg = 1;
1296 // Peak acceleration of the drop, in 1/1000s of a g.
1297 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001298 // Duration of freefall in ms
1299 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001300}
1301
1302/**
1303 * Log bucketed battery charge cycles.
1304 *
1305 * Each bucket represents cycles of the battery past
1306 * a given charge point. For example, bucket 1 is the
1307 * lowest 1/8th of the battery, and bucket 8 is 100%.
1308 *
1309 * Logged from:
1310 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1311 */
1312message ChargeCyclesReported {
1313 optional int32 cycle_bucket_1 = 1;
1314 optional int32 cycle_bucket_2 = 2;
1315 optional int32 cycle_bucket_3 = 3;
1316 optional int32 cycle_bucket_4 = 4;
1317 optional int32 cycle_bucket_5 = 5;
1318 optional int32 cycle_bucket_6 = 6;
1319 optional int32 cycle_bucket_7 = 7;
1320 optional int32 cycle_bucket_8 = 8;
1321}
1322
1323/**
Howard Roa46b6582018-09-18 16:45:02 -07001324 * Log battery health snapshot.
1325 *
1326 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
1327 * are snapshotted periodically over 24hrs.
1328 */
1329message BatteryHealthSnapshot {
1330 enum BatterySnapshotType {
1331 UNKNOWN = 0;
1332 MIN_TEMP = 1; // Snapshot at min batt temp over 24hrs.
1333 MAX_TEMP = 2; // Snapshot at max batt temp over 24hrs.
1334 MIN_RESISTANCE = 3; // Snapshot at min batt resistance over 24hrs.
1335 MAX_RESISTANCE = 4; // Snapshot at max batt resistance over 24hrs.
1336 MIN_VOLTAGE = 5; // Snapshot at min batt voltage over 24hrs.
1337 MAX_VOLTAGE = 6; // Snapshot at max batt voltage over 24hrs.
1338 MIN_CURRENT = 7; // Snapshot at min batt current over 24hrs.
1339 MAX_CURRENT = 8; // Snapshot at max batt current over 24hrs.
1340 MIN_BATT_LEVEL = 9; // Snapshot at min battery level (SoC) over 24hrs.
1341 MAX_BATT_LEVEL = 10; // Snapshot at max battery level (SoC) over 24hrs.
1342 AVG_RESISTANCE = 11; // Snapshot at average battery resistance over 24hrs.
1343 }
1344 optional BatterySnapshotType type = 1;
1345 // Temperature, in 1/10ths of degree C.
1346 optional int32 temperature_deci_celcius = 2;
1347 // Voltage Battery Voltage, in microVolts.
1348 optional int32 voltage_micro_volt = 3;
1349 // Current Battery current, in microAmps.
1350 optional int32 current_micro_amps = 4;
1351 // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
1352 optional int32 open_circuit_micro_volt = 5;
1353 // Resistance Battery Resistance, in microOhms.
1354 optional int32 resistance_micro_ohm = 6;
1355 // Level Battery Level, as % of full.
1356 optional int32 level_percent = 7;
1357}
1358
1359/**
1360 * Log slow I/O operations on the primary storage.
1361 */
1362message SlowIo {
1363 // Classifications of IO Operations.
1364 enum IoOperation {
1365 UNKNOWN = 0;
1366 READ = 1;
1367 WRITE = 2;
1368 UNMAP = 3;
1369 SYNC = 4;
1370 }
1371 optional IoOperation operation = 1;
1372
1373 // The number of slow IO operations of this type over 24 hours.
1374 optional int32 count = 2;
1375}
1376
1377/**
1378 * Log battery caused shutdown with the last recorded voltage.
1379 */
1380message BatteryCausedShutdown {
1381 // The last recorded battery voltage prior to shutdown.
1382 optional int32 last_recorded_micro_volt = 1;
1383}
1384
1385/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001386 * Logs the duration of a davey (jank of >=700ms) when it occurs
1387 *
1388 * Logged from:
1389 * frameworks/base/libs/hwui/JankTracker.cpp
1390 */
1391message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001392 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001393 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001394
Tej Singhbb8554a2018-01-26 11:59:14 -08001395 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001396 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001397}
1398
1399/**
Bookatze5885242017-10-24 20:10:31 -07001400 * Logs phone signal strength changes.
1401 *
1402 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001403 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001404 */
1405message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001406 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1407 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001408}
1409
Yangster4ccebea2018-10-09 17:09:02 -07001410
1411/**
1412 * Logs when the phone state, sim state or signal strength changes
1413 *
1414 * Logged from:
1415 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1416 */
1417message PhoneServiceStateChanged {
1418 optional android.telephony.ServiceStateEnum state = 1;
1419 optional android.telephony.SimStateEnum sim_state = 2;
1420 optional android.telephony.SignalStrengthEnum signal_strength = 3;
1421}
1422
1423/**
1424 * Logs when the phone becomes on or off.
1425 *
1426 * Logged from:
1427 * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
1428 */
1429message PhoneStateChanged {
1430 enum State {
1431 OFF = 0;
1432 ON = 1;
1433 }
1434 optional State state = 1;
1435}
1436
David Chenc28b2bb2017-10-24 12:52:52 -07001437/**
1438 * Logs that a setting was updated.
1439 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001440 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001441 * The tag and is_default allow resetting of settings to default values based on the specified
1442 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1443 */
1444message SettingChanged {
1445 // The name of the setting.
1446 optional string setting = 1;
1447
1448 // The change being imposed on this setting. May represent a number, eg "3".
1449 optional string value = 2;
1450
1451 // The new value of this setting. For most settings, this is same as value. For some settings,
1452 // value is +X or -X where X represents an element in a set. For example, if the previous value
1453 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1454 // The +/- feature is currently only used for location_providers_allowed.
1455 optional string new_value = 3;
1456
1457 // The previous value of this setting.
1458 optional string prev_value = 4;
1459
1460 // The tag used with the is_default for resetting sets of settings. This is generally null.
1461 optional string tag = 5;
1462
Bookatz90867622018-01-31 15:05:57 -08001463 // True if this setting with tag should be resettable.
1464 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001465
David Chenbd789912018-03-16 17:19:55 -07001466 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001467 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001468
1469 enum ChangeReason {
1470 UPDATED = 1; // Updated can be an insertion or an update.
1471 DELETED = 2;
1472 }
1473 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001474}
Chenjie Yub3dda412017-10-24 13:41:59 -07001475
Chenjie Yu05013b32017-11-21 10:21:41 -08001476/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001477 * Logs activity going to foreground or background
1478 *
1479 * Logged from:
1480 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1481 */
1482message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001483 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001484 optional string pkg_name = 2;
1485 optional string class_name = 3;
1486
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001487 enum State {
1488 BACKGROUND = 0;
1489 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001490 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001491 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001492}
David Chenc8a43242017-10-17 16:23:28 -07001493
1494/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001495 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001496 * Logged from:
1497 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1498 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001499message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001500 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001501
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001502 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001503
1504 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001505 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001506 optional string process_name = 3;
1507
1508 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001509 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001510
1511 optional string package_name = 5;
1512
1513 enum InstantApp {
1514 UNAVAILABLE = 0;
1515 FALSE = 1;
1516 TRUE = 2;
1517 }
1518 optional InstantApp is_instant_app = 6;
1519
1520 enum ForegroundState {
1521 UNKNOWN = 0;
1522 BACKGROUND = 1;
1523 FOREGROUND = 2;
1524 }
1525 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001526}
David Chen9e3808c2017-11-20 17:25:34 -08001527
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001528/**
1529 * Logs when a WTF (What a Terrible Failure) happened.
1530 * Logged from:
1531 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1532 */
1533message WTFOccurred {
1534 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001535
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001536 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001537
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001538 // The name of the process.
1539 // system_server if it is not by an app
1540 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001541
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001542 // The pid if available. -1 means not available.
1543 optional sint32 pid = 4;
1544}
1545
1546/**
1547 * Logs when system server reports low memory.
1548 * Logged from:
1549 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1550 */
1551message LowMemReported {
1552}
1553
1554/**
1555 * Logs when an app ANR (App Not Responding) occurs.
1556 * Logged from:
1557 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1558 */
1559message ANROccurred {
1560 optional int32 uid = 1 [(is_uid) = true];
1561
1562 optional string process_name = 2;
1563
1564 optional string short_component_name = 3;
1565
1566 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001567
1568 enum InstantApp {
1569 UNAVAILABLE = 0;
1570 FALSE = 1;
1571 TRUE = 2;
1572 }
1573 optional InstantApp is_instant_app = 5;
1574
1575 enum ForegroundState {
1576 UNKNOWN = 0;
1577 BACKGROUND = 1;
1578 FOREGROUND = 2;
1579 }
1580 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001581}
1582
Bookatza7020bd2018-08-28 16:29:35 -07001583/**
1584 * Logs when the vibrator state changes.
1585 * Logged from:
1586 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1587 */
1588message VibratorStateChanged {
1589 repeated AttributionNode attribution_node = 1;
1590
1591 enum State {
1592 OFF = 0;
1593 ON = 1;
1594 }
1595 optional State state = 2;
1596
1597 // Duration (in milliseconds) requested to keep the vibrator on.
1598 // Only applicable for State == ON.
1599 optional int64 duration_millis = 3;
1600}
1601
David Chen0a368b22017-12-06 16:28:16 -08001602/*
1603 * Allows other apps to push events into statsd.
1604 * Logged from:
1605 * frameworks/base/core/java/android/util/StatsLog.java
1606 */
David Chen0b5c90c2018-01-25 16:51:49 -08001607message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001608 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001609 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001610
1611 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1612 optional int32 label = 2;
1613
1614 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1615 // predicates for the metrics).
1616 enum State {
1617 UNKNOWN = 0;
1618 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1619 STOP = 2;
1620 START = 3;
1621 }
1622 optional State state = 3;
1623}
1624
David Chen9e3808c2017-11-20 17:25:34 -08001625/**
Bookatz7948c872018-09-04 12:58:33 -07001626 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1627 * For example, this could be due to the user manually changing the time.
1628 *
1629 * Logged from:
1630 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1631 */
1632message WallClockTimeShifted {
1633 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1634 optional int64 wall_clock_timestamp_millis = 1;
1635}
1636
1637/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001638 * Logs when statsd detects an anomaly.
1639 *
1640 * Logged from:
1641 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1642 */
1643message AnomalyDetected {
1644 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001645 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001646
Yangster-mac94e197c2018-01-02 16:03:03 -08001647 // Id of the config whose anomaly detection alert fired.
1648 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001649
Yangster-mac94e197c2018-01-02 16:03:03 -08001650 // Id of the alert (i.e. name of the anomaly that was detected).
1651 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001652}
1653
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001654message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001655 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001656 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001657
1658 // The app package name.
1659 optional string pkg_name = 2;
1660
1661 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001662 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001663 WARM = 1;
1664 HOT = 2;
1665 COLD = 3;
1666 }
1667 // The transition type.
1668 optional TransitionType type = 3;
1669
1670 // The activity name.
1671 optional string activity_name = 4;
1672
1673 // The name of the calling app. Empty if not set.
1674 optional string calling_pkg_name = 5;
1675
1676 // Whether the app is an instant app.
1677 optional bool is_instant_app = 6;
1678
1679 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001680 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001681
Bookatz80d11a02018-01-16 10:46:35 -08001682 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001683
David Chen0b5c90c2018-01-25 16:51:49 -08001684 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001685 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001686 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001687 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001688 optional int32 bind_application_delay_millis = 11;
1689 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001690
1691 // Empty if not set.
1692 optional string launch_token = 13;
1693
Calin Juravle759fbda2018-02-20 19:52:30 +00001694 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001695 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001696
1697 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001698 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001699}
1700
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001701message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001702 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001703 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001704
1705 // The app package name.
1706 optional string pkg_name = 2;
1707
1708 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001709 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001710 WARM = 1;
1711 HOT = 2;
1712 COLD = 3;
1713 }
1714 // The transition type.
1715 optional TransitionType type = 3;
1716
1717 // The activity name.
1718 optional string activity_name = 4;
1719}
1720
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001721message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001722 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001723 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001724
1725 // The app package name.
1726 optional string pkg_name = 2;
1727
1728 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001729 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001730 WITH_BUNDLE = 1;
1731 WITHOUT_BUNDLE = 2;
1732 }
1733 // The transition type.
1734 optional TransitionType type = 3;
1735
1736 // The activity name.
1737 optional string activity_name = 4;
1738
1739 optional bool transition_process_running = 5;
1740
1741 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001742 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001743}
1744
Bookatz8fcd09a2017-12-18 13:01:10 -08001745/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001746 * Logs a picture-in-picture action
1747 * Logged from:
1748 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1749 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1750 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1751 */
1752message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001753 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001754 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001755
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001756 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001757
Chenjie Yu52cacc62017-12-08 18:11:45 -08001758 enum State {
1759 ENTERED = 1;
1760 EXPANDED_TO_FULL_SCREEN = 2;
1761 MINIMIZED = 3;
1762 DISMISSED = 4;
1763 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001764 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001765}
1766
1767/**
Chenjie Yue8904192017-12-08 19:12:57 -08001768 * Logs overlay action
1769 * Logged from:
1770 * services/core/java/com/android/server/wm/Session.java
1771 */
1772message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001773 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001774
1775 optional string package_name = 2;
1776
1777 optional bool using_alert_window = 3;
1778
1779 enum State {
1780 ENTERED = 1;
1781 EXITED = 2;
1782 }
1783 optional State state = 4;
1784}
1785
Chenjie Yuccfe6452018-01-30 11:33:21 -08001786/*
1787 * Logs foreground service starts and stops.
1788 * Note that this is not when a service starts or stops, but when it is
1789 * considered foreground.
1790 * Logged from
1791 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1792 */
1793message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001794 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001795 // package_name + "/" + class_name
1796 optional string short_name = 2;
1797
1798 enum State {
1799 ENTER = 1;
1800 EXIT = 2;
1801 }
1802 optional State state = 3;
1803}
1804
Chenjie Yue8904192017-12-08 19:12:57 -08001805/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001806 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1807 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1808 * attributed back to the parent (host) uid. One example is Chrome.
1809 *
1810 * Logged from:
1811 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1812 */
1813message IsolatedUidChanged {
1814 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001815 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001816 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001817 optional int32 parent_uid = 1;
1818
1819 optional int32 isolated_uid = 2;
1820
1821 // We expect an isolated uid to be removed before if it's used for another parent uid.
1822 enum Event {
1823 REMOVED = 0;
1824 CREATED = 1;
1825 }
1826 optional Event event = 3;
1827}
1828
1829/*
1830 * Logs the reception of an incoming network packet causing the main system to wake up for
1831 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1832 * and processed by WakeupController.cpp.
1833 */
1834message PacketWakeupOccurred {
1835 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1836 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001837 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001838 // The interface name on which the packet was received.
1839 optional string iface = 2;
1840 // The ethertype value of the packet.
1841 optional int32 ethertype = 3;
1842 // String representation of the destination MAC address of the packet.
1843 optional string destination_hardware_address = 4;
1844 // String representation of the source address of the packet if this was an IP packet.
1845 optional string source_ip = 5;
1846 // String representation of the destination address of the packet if this was an IP packet.
1847 optional string destination_ip = 6;
1848 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1849 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1850 // families.
1851 optional int32 ip_next_header = 7;
1852 // The source port if this was a TCP or UDP packet.
1853 optional int32 source_port = 8;
1854 // The destination port if this was a TCP or UDP packet.
1855 optional int32 destination_port = 9;
1856}
1857
1858/*
1859 * Logs the memory stats for an app on startup.
1860 * Logged from:
1861 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1862 */
1863message AppStartMemoryStateCaptured {
1864 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001865 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001866
1867 // The process name.
1868 optional string process_name = 2;
1869
1870 // The activity name.
1871 optional string activity_name = 3;
1872
1873 // # of page-faults
1874 optional int64 pgfault = 4;
1875
1876 // # of major page-faults
1877 optional int64 pgmajfault = 5;
1878
1879 // RSS
1880 optional int64 rss_in_bytes = 6;
1881
1882 // CACHE
1883 optional int64 cache_in_bytes = 7;
1884
1885 // SWAP
1886 optional int64 swap_in_bytes = 8;
1887}
1888
1889/*
1890 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1891 * for LMK event.
1892 * Logged from:
1893 * system/core/lmkd/lmkd.c
1894 */
1895message LmkStateChanged {
1896 enum State {
1897 UNKNOWN = 0;
1898 START = 1;
1899 STOP = 2;
1900 }
1901 optional State state = 1;
1902}
1903
1904/*
1905 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1906 * Logged from:
1907 * system/core/lmkd/lmkd.c
1908 */
1909message LmkKillOccurred {
1910 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001911 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001912
1913 // The process name.
1914 optional string process_name = 2;
1915
1916 // oom adj score.
1917 optional int32 oom_score = 3;
1918
1919 // # of page-faults
1920 optional int64 pgfault = 4;
1921
1922 // # of major page-faults
1923 optional int64 pgmajfault = 5;
1924
1925 // RSS
1926 optional int64 rss_in_bytes = 6;
1927
1928 // CACHE
1929 optional int64 cache_in_bytes = 7;
1930
1931 // SWAP
1932 optional int64 swap_in_bytes = 8;
1933}
1934
Rajeev Kumar51b54602018-03-01 12:18:26 -08001935/*
1936 * Logs when the ActivityManagerService detects that an app died.
1937 *
1938 * Logged from:
1939 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1940 */
1941message AppDied {
1942 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001943 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001944}
1945
Howard Ro21a039c2018-08-06 14:55:47 -07001946/**
1947 * An atom for generic metrics logging. Available from Android Q.
1948 */
1949message GenericAtom {
1950 // The uid of the application that sent this custom atom.
1951 optional int32 uid = 1 [(is_uid) = true];
1952
1953 // An event_id indicates the type of event.
Howard Ro9a862de2018-10-11 16:03:33 -07001954 optional android.stats.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001955}
1956
Tej Singhd6d6d772018-09-05 17:41:25 -07001957/**
1958 * Logs when a fingerprint acquire event occurs.
1959 *
1960 * Logged from:
1961 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1962 */
1963message FingerprintAcquired {
1964 // The associated user. Eg: 0 for owners, 10+ for others.
1965 // Defined in android/os/UserHandle.java
1966 optional int32 user = 1;
1967 // If this acquire is for a crypto fingerprint.
1968 // e.g. Secure purchases, unlock password storage.
1969 optional bool is_crypto = 2;
1970}
1971
1972/**
1973 * Logs when a fingerprint authentication event occurs.
1974 *
1975 * Logged from:
1976 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1977 */
1978message FingerprintAuthenticated {
1979 // The associated user. Eg: 0 for owners, 10+ for others.
1980 // Defined in android/os/UserHandle.java
1981 optional int32 user = 1;
1982 // If this authentication is for a crypto fingerprint.
1983 // e.g. Secure purchases, unlock password storage.
1984 optional bool is_crypto = 2;
1985 // Whether or not this authentication was successful.
1986 optional bool is_authenticated = 3;
1987}
1988
1989/**
1990 * Logs when a fingerprint error occurs.
1991 *
1992 * Logged from:
1993 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1994 */
1995message FingerprintErrorOccurred {
1996 // The associated user. Eg: 0 for owners, 10+ for others.
1997 // Defined in android/os/UserHandle.java
1998 optional int32 user = 1;
1999 // If this error is for a crypto fingerprint.
2000 // e.g. Secure purchases, unlock password storage.
2001 optional bool is_crypto = 2;
2002
2003 enum Error {
2004 UNKNOWN = 0;
2005 LOCKOUT = 1;
2006 PERMANENT_LOCKOUT = 2;
2007 }
2008 // The type of error.
2009 optional Error error = 3;
2010}
Howard Ro688ae182018-09-25 00:09:36 -07002011
2012message Notification {
2013
2014 // Type of notification event.
2015 enum Type {
2016 TYPE_UNKNOWN = 0;
2017 // Notification became visible to the user.
2018 TYPE_OPEN = 1;
2019 // Notification became hidden.
2020 TYPE_CLOSE = 2;
2021 // Notification switched to detail mode.
2022 TYPE_DETAIL = 3;
2023 // Notification was clicked.
2024 TYPE_ACTION = 4;
2025 // Notification was dismissed.
2026 TYPE_DISMISS = 5;
2027 // Notification switched to summary mode. The enum value of 14 is to
2028 // match that of metrics_constants.
2029 TYPE_COLLAPSE = 14;
2030 }
2031 optional Type type = 1;
2032
2033 // Package name associated with the notification.
2034 optional string package_name = 2;
2035
2036 // Tag associated with notification.
2037 optional string tag = 3;
2038
2039 // Application-supplied ID associated with the notification.
2040 optional int32 id = 4;
2041
2042 // Index of notification in the notification panel.
2043 optional int32 shade_index = 5;
2044
2045 // The number of notifications in the notification panel.
2046 optional int32 shade_count = 6;
2047
2048 // Importance for the notification.
2049 optional int32 importance = 7;
2050
2051 // ID for the notification channel.
2052 optional int32 channel_id = 8;
2053
2054 // Importance for the notification channel.
2055 optional int32 channel_importance = 9;
2056
2057 // Whether notification was a group summary.
2058 optional bool group_summary = 10;
2059
2060 // Time since notification was created in milliseconds.
2061 optional int64 since_create_millis = 11;
2062
2063 // Time since notification was interrupted in milliseconds.
2064 optional int64 since_interruption_millis = 12;
2065
2066 // Time since notification was updated in milliseconds.
2067 optional int64 since_update_millis = 13;
2068
2069 // Time since notification was visible in milliseconds.
2070 optional int64 since_visible_millis = 14;
2071}
2072
2073
Chenjie Yubbcbc602018-02-05 16:51:52 -08002074//////////////////////////////////////////////////////////////////////
2075// Pulled atoms below this line //
2076//////////////////////////////////////////////////////////////////////
2077
2078/**
David Chenc8a43242017-10-17 16:23:28 -07002079 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
2080 *
2081 * Pulled from:
2082 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2083 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002084message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002085 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002086
2087 optional int64 rx_bytes = 2;
2088
2089 optional int64 rx_packets = 3;
2090
2091 optional int64 tx_bytes = 4;
2092
2093 optional int64 tx_packets = 5;
2094}
2095
2096/**
2097 * Pulls bytes transferred via wifi (separated by foreground and background usage).
2098 *
2099 * Pulled from:
2100 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2101 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002102message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002103 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002104
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002105 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2106 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002107
2108 optional int64 rx_bytes = 3;
2109
2110 optional int64 rx_packets = 4;
2111
2112 optional int64 tx_bytes = 5;
2113
2114 optional int64 tx_packets = 6;
2115}
2116
2117/**
2118 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2119 *
2120 * Pulled from:
2121 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2122 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002123message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002124 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002125
2126 optional int64 rx_bytes = 2;
2127
2128 optional int64 rx_packets = 3;
2129
2130 optional int64 tx_bytes = 4;
2131
2132 optional int64 tx_packets = 5;
2133}
2134
2135/**
2136 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2137 *
2138 * Pulled from:
2139 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2140 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002141message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002142 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002143
Yao Chenc40a19d2018-03-15 16:48:25 -07002144 // 1 denotes foreground and 0 denotes background. This is called Set in
2145 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002146 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002147
2148 optional int64 rx_bytes = 3;
2149
2150 optional int64 rx_packets = 4;
2151
2152 optional int64 tx_bytes = 5;
2153
2154 optional int64 tx_packets = 6;
2155}
2156
2157/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002158 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2159 *
2160 * Pulled from:
2161 * StatsCompanionService
2162 */
2163message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002164 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002165
2166 optional int64 rx_bytes = 2;
2167
2168 optional int64 tx_bytes = 3;
2169}
2170
2171/**
David Chenc8a43242017-10-17 16:23:28 -07002172 * Pulls the kernel wakelock durations. This atom is adapted from
2173 * android/internal/os/KernelWakelockStats.java
2174 *
2175 * Pulled from:
2176 * StatsCompanionService using KernelWakelockReader.
2177 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002178message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002179 optional string name = 1;
2180
2181 optional int32 count = 2;
2182
2183 optional int32 version = 3;
2184
2185 optional int64 time = 4;
2186}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002187
Chenjie Yu05013b32017-11-21 10:21:41 -08002188/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002189 * Pulls low power state information. This includes platform and subsystem sleep state information,
2190 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002191 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002192 * hardware/interfaces/power/1.1/types.hal
2193 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002194message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002195 // Subsystem name
2196 optional string subsystem_name = 1;
2197 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2198 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2199 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002200 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002201 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002202 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002203 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002204}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002205
Chenjie Yu05013b32017-11-21 10:21:41 -08002206/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002207 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002208 * Pulls the time the cpu spend on the frequency index. Frequency index
2209 * starts from highest to lowest. The value should be monotonically
2210 * increasing since boot. However, if there is a cpu
2211 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002212 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002213message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002214 optional uint32 cluster = 1;
2215 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002216 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002217}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002218
Chenjie Yu05013b32017-11-21 10:21:41 -08002219/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002220 * Pulls Cpu Time Per Uid.
2221 * Note that isolated process uid time should be attributed to host uids.
2222 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002223message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002224 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002225 optional uint64 user_time_millis = 2;
2226 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002227}
2228
2229/**
2230 * Pulls Cpu Time Per Uid per frequency.
2231 * Note that isolated process uid time should be attributed to host uids.
2232 * For each uid, we order the time by descending frequencies.
2233 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002234message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002235 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002236 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002237 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002238}
Hugo Benichi884970e2017-11-14 22:42:46 +09002239
Chenjie Yu05013b32017-11-21 10:21:41 -08002240/**
2241 * Pulls Wifi Controller Activity Energy Info
2242 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002243message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002244 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002245 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002246 // stack reported state
2247 // TODO: replace this with proto enum
2248 optional int32 stack_state = 2;
2249 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002250 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002251 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002252 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002253 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002254 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002255 // product of current(mA), voltage(V) and time(ms)
2256 optional uint64 controller_energy_used = 6;
2257}
2258
2259/**
2260 * Pulls Modem Activity Energy Info
2261 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002262message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002263 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002264 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002265 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002266 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002267 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002268 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002269 /**
2270 * Tx power index
2271 * index 0 = tx_power < 0dBm
2272 * index 1 = 0dBm < tx_power < 5dBm
2273 * index 2 = 5dBm < tx_power < 15dBm
2274 * index 3 = 15dBm < tx_power < 20dBm
2275 * index 4 = tx_power > 20dBm
2276 */
2277 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002278 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002279 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002280 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002281 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002282 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002283 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002284 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002285 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002286 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002287 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002288 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002289 // product of current(mA), voltage(V) and time(ms)
2290 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002291}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002292
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002293/**
2294 * Pulls Bluetooth Activity Energy Info
2295 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2296 */
2297message BluetoothActivityInfo {
2298 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002299 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002300 // bluetooth stack state
2301 optional int32 bluetooth_stack_state = 2;
2302 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002303 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002304 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002305 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002306 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002307 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002308 // product of current(mA), voltage(V) and time(ms)
2309 optional uint64 energy_used = 6;
2310}
2311
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002312/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002313 * Logs the memory stats for a process.
2314 */
2315message ProcessMemoryState {
2316 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002317 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002318
2319 // The process name.
2320 optional string process_name = 2;
2321
2322 // oom adj score.
2323 optional int32 oom_score = 3;
2324
2325 // # of page-faults
2326 optional int64 pgfault = 4;
2327
2328 // # of major page-faults
2329 optional int64 pgmajfault = 5;
2330
Rajeev Kumar90235992018-01-29 11:06:48 -08002331 // RSS
2332 optional int64 rss_in_bytes = 6;
2333
2334 // CACHE
2335 optional int64 cache_in_bytes = 7;
2336
2337 // SWAP
2338 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002339
2340 // RSS high watermark.
2341 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2342 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2343 optional int64 rss_high_watermark_in_bytes = 9;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002344}
2345
2346/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002347 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002348 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002349message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002350 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002351}
2352
2353/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002354 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002355 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002356message SystemUptime {
2357 // Milliseconds since the system was booted.
2358 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2359 // for external input).
2360 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002361 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002362}
2363
2364/*
2365 * Reads from /proc/uid_concurrent_active_time which has the format:
2366 * active: X (X is # cores)
2367 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2368 * [uid1]: [time-0] [time-1] [time-2] ... ...
2369 * ...
2370 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2371 * The file contains a monotonically increasing count of time for a single boot.
2372 */
2373message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002374 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002375 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002376}
2377
2378/**
2379 * Reads from /proc/uid_concurrent_policy_time which has the format:
2380 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2381 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2382 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2383 * ...
2384 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2385 * The file contains a monotonically increasing count of time for a single boot.
2386 */
2387message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002388 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002389 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002390 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002391}
2392
2393/*
2394 * Pulls free disk space, for data, system partition and temporary directory.
2395 */
2396message DiskSpace {
2397 // available bytes in data partition
2398 optional uint64 data_available_bytes = 1;
2399 // available bytes in system partition
2400 optional uint64 system_available_bytes = 2;
2401 // available bytes in download cache or temp directories
2402 optional uint64 temp_available_bytes = 3;
2403}
Tej Singhbf972d92018-01-10 20:51:13 -08002404
2405/**
2406 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002407 * Pulled from:
2408 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002409 */
2410message RemainingBatteryCapacity {
2411 optional int32 charge_uAh = 1;
2412}
2413
2414/**
2415 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002416 * Pulled from:
2417 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002418 */
2419message FullBatteryCapacity {
2420 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002421}
2422
2423/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002424 * Pulls battery voltage.
2425 * Pulled from:
2426 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2427 */
2428message BatteryVoltage {
2429 // The voltage of the battery, in millivolts.
2430 optional int32 voltage_mV = 1;
2431}
2432
2433/**
Tej Singhd89137e2018-03-26 14:51:40 -07002434 * Pulls the temperature of various parts of the device.
2435 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002436 *
2437 * Pulled from:
2438 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2439 */
2440message Temperature {
2441 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2442 optional android.os.TemperatureTypeEnum sensor_location = 1;
2443
2444 // The name of the temperature source. Eg. CPU0
2445 optional string sensor_name = 2;
2446
Tej Singhd89137e2018-03-26 14:51:40 -07002447 // Temperature in tenths of a degree C.
2448 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002449}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002450
2451/**
2452 * Pulls the statistics of calls to Binder.
2453 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002454 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2455 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002456 *
2457 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002458 */
2459message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002460 optional int32 uid = 1 [(is_uid) = true];
2461 // Fully qualified class name of the API call.
2462 //
2463 // This is a system server class name.
2464 //
2465 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2466 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2467 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2468 // commonly used APIs.
2469 optional string service_class_name = 2;
2470 // Method name of the API call. It can also be a transaction code if we cannot
2471 // resolve it to a name. See Binder#getTransactionName.
2472 //
2473 // This is a system server method name.
2474 optional string service_method_name = 3;
2475 // Total number of API calls.
2476 optional int64 call_count = 4;
2477 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2478 optional bool screen_interactive = 13;
2479 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2480 // call_count will be equal to recorded_call_count.
2481 //
2482 // If recorded_call_count is different than call_count, it means data collection has been
2483 // sampled. All the fields below will be sampled in this case.
2484 optional int64 recorded_call_count = 12;
2485 // Number of exceptions thrown by the API.
2486 optional int64 recorded_exception_count = 5;
2487 // Total latency of all API calls.
2488 // Average can be computed using total_latency_micros / recorded_call_count.
2489 optional int64 recorded_total_latency_micros = 6;
2490 // Maximum latency of one API call.
2491 optional int64 recorded_max_latency_micros = 7;
2492 // Total CPU usage of all API calls.
2493 // Average can be computed using total_cpu_micros / recorded_call_count.
2494 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2495 optional int64 recorded_total_cpu_micros = 8;
2496 // Maximum CPU usage of one API call.
2497 optional int64 recorded_max_cpu_micros = 9;
2498 // Maximum parcel reply size of one API call.
2499 optional int64 recorded_max_reply_size_bytes = 10;
2500 // Maximum parcel request size of one API call.
2501 optional int64 recorded_max_request_size_bytes = 11;
2502}
2503
2504/**
2505 * Pulls the statistics of exceptions during calls to Binder.
2506 *
2507 * Binder stats are cumulative from boot unless somebody reset the data using
2508 * > adb shell dumpsys binder_calls_stats --reset
2509 */
2510message BinderCallsExceptions {
2511 // Exception class name, e.g. java.lang.IllegalArgumentException.
2512 //
2513 // This is an exception class name thrown by the system server.
2514 optional string exception_class_name = 1;
2515 // Total number of exceptions.
2516 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002517}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002518
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002519/**
2520 * Pulls the statistics of message dispatching on HandlerThreads.
2521 *
2522 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2523 * config on the device.
2524 *
2525 * Next tag: 11
2526 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002527message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002528 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002529 optional int32 uid = 1 [(is_uid) = true];
2530
2531 // Fully qualified class name of the handler target class.
2532 //
2533 // This field does not contain PII. This is a system server class name.
2534 optional string handler_class_name = 2;
2535
2536 // The name of the thread that runs the Looper.
2537 //
2538 // This field does not contain PII. This is a system server thread name.
2539 optional string looper_thread_name = 3;
2540
2541 // The name of the dispatched message.
2542 //
2543 // This field does not contain PII. This is a system server constant or class
2544 // name.
2545 optional string message_name = 4;
2546
2547 // Total number of successfully dispatched messages.
2548 optional int64 message_count = 5;
2549
2550 // Total number of messages that failed dispatching.
2551 optional int64 exception_count = 6;
2552
2553 // Total number of processed messages we have data recorded for. If we
2554 // collected data for all the messages, message_count will be equal to
2555 // recorded_message_count.
2556 //
2557 // If recorded_message_count is different than message_count, it means data
2558 // collection has been sampled. All the fields below will be sampled in this
2559 // case.
2560 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 Oczeretkod8cc8592018-08-22 16:07:36 +01002575}
Tej Singh86dc9db2018-09-06 00:39:57 +00002576
2577/**
2578 * Pulls disk information, such as write speed and latency.
2579 */
2580message DiskStats {
2581 // Time taken to open, write 512B to, and close a file.
2582 // -1 if error performing the check.
2583 optional int64 data_write_latency_millis = 1;
2584
2585 optional bool file_based_encryption = 2;
2586
2587 // Recent disk write speed in kB/s.
2588 // -1 if error querying storageed.
2589 // 0 if data is unavailable.
2590 optional int32 recent_disk_write_speed = 3;
2591}
2592
2593
2594/**
2595 * Free and total bytes of the Data, Cache, and System partition.
2596 */
2597message DirectoryUsage {
2598 enum Directory {
2599 UNKNOWN = 0;
2600 DATA = 1;
2601 CACHE = 2;
2602 SYSTEM = 3;
2603 }
2604 optional Directory directory = 1;
2605 optional int64 free_bytes = 2;
2606 optional int64 total_bytes = 3;
2607}
2608
2609
2610/**
2611 * Size of an application: apk size, data size, and cache size.
2612 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2613 * Information is only reported for apps with the primary user (user 0).
2614 * Sizes are aggregated by package name.
2615 */
2616message AppSize {
2617 // Including uids will involve modifying diskstats logic.
2618 optional string package_name = 1;
2619 // App size in bytes. -1 if unavailable.
2620 optional int64 app_size_bytes = 2;
2621 // App data size in bytes. -1 if unavailable.
2622 optional int64 app_data_size_bytes = 3;
2623 // App cache size in bytes. -1 if unavailable.
2624 optional int64 app_cache_size_bytes = 4;
2625 // Time that the cache file was produced.
2626 // Uses System.currentTimeMillis(), which is wall clock time.
2627 optional int64 cache_time_millis = 5;
2628}
2629
2630
2631/**
2632 * Size of a particular category. Eg: photos, videos.
2633 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2634 */
2635message CategorySize {
2636 enum Category {
2637 UNKNOWN = 0;
2638 APP_SIZE = 1;
2639 APP_DATA_SIZE = 2;
2640 APP_CACHE_SIZE = 3;
2641 PHOTOS = 4;
2642 VIDEOS = 5;
2643 AUDIO = 6;
2644 DOWNLOADS = 7;
2645 SYSTEM = 8;
2646 OTHER = 9;
2647 }
2648 optional Category category = 1;
2649 // Category size in bytes.
2650 optional int64 size_bytes = 2;
2651 // Time that the cache file was produced.
2652 // Uses System.currentTimeMillis(), which is wall clock time.
2653 optional int64 cache_time_millis = 3;
2654}
Tej Singhd6d6d772018-09-05 17:41:25 -07002655
2656/**
Tej Singhe7726dc2018-09-21 11:42:12 -07002657 * Pulls per uid I/O stats. The stats are cumulative since boot.
2658 *
2659 * Read/write bytes are I/O events from a storage device
2660 * Read/write chars are data requested by read/write syscalls, and can be
2661 * satisfied by caching.
2662 *
2663 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
2664 */
2665message DiskIo {
2666 optional int32 uid = 1 [(is_uid) = true];
2667 optional int64 fg_chars_read = 2;
2668 optional int64 fg_chars_write = 3;
2669 optional int64 fg_bytes_read = 4;
2670 optional int64 fg_bytes_write = 5;
2671 optional int64 bg_chars_read = 6;
2672 optional int64 bg_chars_write = 7;
2673 optional int64 bg_bytes_read = 8;
2674 optional int64 bg_bytes_write = 9;
2675 optional int64 fg_fsync = 10;
2676 optional int64 bg_fsync= 11;
2677}
2678
2679
2680/**
Tej Singhd6d6d772018-09-05 17:41:25 -07002681 * Pulls the number of fingerprints for each user.
2682 *
2683 * Pulled from StatsCompanionService, which queries FingerprintManager.
2684 */
2685message NumFingerprints {
2686 // The associated user. Eg: 0 for owners, 10+ for others.
2687 // Defined in android/os/UserHandle.java
2688 optional int32 user = 1;
2689 // Number of fingerprints registered to that user.
2690 optional int32 num_fingerprints = 2;
2691}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002692
Yangsteraf9aee72018-10-12 09:26:16 -07002693message AggStats {
2694 optional int64 min = 1;
2695
2696 optional int64 average = 2;
2697
2698 optional int64 max = 3;
2699}
2700
2701message ProcessStatsStateProto {
2702 optional android.service.procstats.ScreenState screen_state = 1;
2703
2704 optional android.service.procstats.MemoryState memory_state = 2;
2705
2706 // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
2707 // and not frameworks/base/core/java/android/app/ActivityManager.java
2708 optional android.service.procstats.ProcessState process_state = 3;
2709
2710 // Millisecond uptime duration spent in this state
2711 optional int64 duration_ms = 4;
2712
2713 // Millisecond elapsed realtime duration spent in this state
2714 optional int64 realtime_duration_ms = 9;
2715
2716 // # of samples taken
2717 optional int32 sample_size = 5;
2718
2719 // PSS is memory reserved for this process
2720 optional AggStats pss = 6;
2721
2722 // USS is memory shared between processes, divided evenly for accounting
2723 optional AggStats uss = 7;
2724
2725 // RSS is memory resident for this process
2726 optional AggStats rss = 8;
2727}
2728
2729// Next Tag: 7
2730message ProcessStatsProto {
2731 // Name of process.
2732 optional string process = 1;
2733
2734 // Uid of the process.
2735 optional int32 uid = 2;
2736
2737 // Information about how often kills occurred
2738 message Kill {
2739 // Count of excessive CPU kills
2740 optional int32 cpu = 1;
2741
2742 // Count of kills when cached
2743 optional int32 cached = 2;
2744
2745 // PSS stats during cached kill
2746 optional AggStats cached_pss = 3;
2747 }
2748 optional Kill kill = 3;
2749
2750 // Time and memory spent in various states.
2751 repeated ProcessStatsStateProto states = 5;
2752
2753 // Total time process has been running... screen_state, memory_state, and process_state
2754 // will not be set.
2755 optional ProcessStatsStateProto total_running_state = 6;
2756}
2757
2758message PackageServiceOperationStatsProto {
2759 // Operate enum: Started, Foreground, Bound, Executing
2760 optional android.service.procstats.ServiceOperationState operation = 1;
2761
2762 // Number of times the service was in this operation.
2763 optional int32 count = 2;
2764
2765 // Information about a state the service can be in.
2766 message StateStats {
2767 // Screen state enum.
2768 optional android.service.procstats.ScreenState screen_state = 1;
2769 // Memory state enum.
2770 optional android.service.procstats.MemoryState memory_state = 2;
2771
2772 // duration in milliseconds.
2773 optional int64 duration_ms = 3;
2774 // Millisecond elapsed realtime duration spent in this state
2775 optional int64 realtime_duration_ms = 4;
2776 }
2777 repeated StateStats state_stats = 3;
2778}
2779
2780message PackageServiceStatsProto {
2781 // Name of service component.
2782 optional string service_name = 1;
2783
2784 // The operation stats.
2785 // The package_name, package_uid, package_version, service_name will not be set to save space.
2786 repeated PackageServiceOperationStatsProto operation_stats = 2;
2787}
2788
2789message PackageAssociationSourceProcessStatsProto {
2790 // Uid of the process.
2791 optional int32 process_uid = 1;
2792 // Process name.
2793 optional string process_name = 2;
2794
2795 // Total count of the times this association appeared.
2796 optional int32 total_count = 3;
2797
2798 // Millisecond uptime total duration this association was around.
2799 optional int64 total_duration_ms = 4;
2800
2801 // Total count of the times this association became actively impacting its target process.
2802 optional int32 active_count = 5;
2803
2804 // Information on one source in this association.
2805 message StateStats {
2806 // Process state enum.
2807 optional android.service.procstats.ProcessState process_state = 1;
2808 // Millisecond uptime duration spent in this state
2809 optional int64 duration_ms = 2;
2810 // Millisecond elapsed realtime duration spent in this state
2811 optional int64 realtime_duration_ms = 3;
2812 }
2813 repeated StateStats active_state_stats = 6;
2814}
2815
2816message PackageAssociationProcessStatsProto {
2817 // Name of the target component.
2818 optional string component_name = 1;
2819 // Information on one source in this association.
2820 repeated PackageAssociationSourceProcessStatsProto sources = 2;
2821}
2822
2823
2824message ProcessStatsPackageProto {
2825 // Name of package.
2826 optional string package = 1;
2827
2828 // Uid of the package.
2829 optional int32 uid = 2;
2830
2831 // Version of the package.
2832 optional int64 version = 3;
2833
2834 // Stats for each process running with the package loaded in to it.
2835 repeated ProcessStatsProto process_stats = 4;
2836
2837 // Stats for each of the package's services.
2838 repeated PackageServiceStatsProto service_stats = 5;
2839
2840 // Stats for each association with the package.
2841 repeated PackageAssociationProcessStatsProto association_stats = 6;
2842}
2843
2844message ProcessStatsSectionProto {
2845 // Elapsed realtime at start of report.
2846 optional int64 start_realtime_ms = 1;
2847
2848 // Elapsed realtime at end of report.
2849 optional int64 end_realtime_ms = 2;
2850
2851 // CPU uptime at start of report.
2852 optional int64 start_uptime_ms = 3;
2853
2854 // CPU uptime at end of report.
2855 optional int64 end_uptime_ms = 4;
2856
2857 // System runtime library. e.g. "libdvm.so", "libart.so".
2858 optional string runtime = 5;
2859
2860 // whether kernel reports swapped pss.
2861 optional bool has_swapped_pss = 6;
2862
2863 // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
2864 enum Status {
2865 STATUS_UNKNOWN = 0;
2866 STATUS_COMPLETE = 1;
2867 STATUS_PARTIAL = 2;
2868 STATUS_SHUTDOWN = 3;
2869 STATUS_SYSPROPS = 4;
2870 }
2871 repeated Status status = 7;
2872
2873 // Stats for each process.
2874 repeated ProcessStatsProto process_stats = 8;
2875
2876 // Stats for each package.
2877 repeated ProcessStatsPackageProto package_stats = 9;
2878}
2879
Chenjie Yu12e5e672018-09-14 15:54:59 -07002880/**
2881 * Pulled from ProcessStatsService.java
2882 */
2883message ProcStats {
Yangsteraf9aee72018-10-12 09:26:16 -07002884 optional ProcessStatsSectionProto proc_stats_section = 1;
2885}
2886
2887message PowerProfileProto {
2888 optional double cpu_suspend = 1;
2889
2890 optional double cpu_idle = 2;
2891
2892 optional double cpu_active = 3;
2893
2894 message CpuCluster {
2895 optional int32 id = 1;
2896 optional double cluster_power = 2;
2897 optional int32 cores = 3;
2898 repeated int64 speed = 4;
2899 repeated double core_power = 5;
2900 }
2901
2902 repeated CpuCluster cpu_cluster = 40;
2903
2904 optional double wifi_scan = 4;
2905
2906 optional double wifi_on = 5;
2907
2908 optional double wifi_active = 6;
2909
2910 optional double wifi_controller_idle = 7;
2911
2912 optional double wifi_controller_rx = 8;
2913
2914 optional double wifi_controller_tx = 9;
2915
2916 repeated double wifi_controller_tx_levels = 10;
2917
2918 optional double wifi_controller_operating_voltage = 11;
2919
2920 optional double bluetooth_controller_idle = 12;
2921
2922 optional double bluetooth_controller_rx = 13;
2923
2924 optional double bluetooth_controller_tx = 14;
2925
2926 optional double bluetooth_controller_operating_voltage = 15;
2927
2928 optional double modem_controller_sleep = 16;
2929
2930 optional double modem_controller_idle = 17;
2931
2932 optional double modem_controller_rx = 18;
2933
2934 repeated double modem_controller_tx = 19;
2935
2936 optional double modem_controller_operating_voltage = 20;
2937
2938 optional double gps_on = 21;
2939
2940 repeated double gps_signal_quality_based = 22;
2941
2942 optional double gps_operating_voltage = 23;
2943
2944 optional double bluetooth_on = 24;
2945
2946 optional double bluetooth_active = 25;
2947
2948 optional double bluetooth_at_cmd = 26;
2949
2950 optional double ambient_display = 27;
2951
2952 optional double screen_on = 28;
2953
2954 optional double radio_on = 29;
2955
2956 optional double radio_scanning = 30;
2957
2958 optional double radio_active = 31;
2959
2960 optional double screen_full = 32;
2961
2962 optional double audio = 33;
2963
2964 optional double video = 34;
2965
2966 optional double flashlight = 35;
2967
2968 optional double memory = 36;
2969
2970 optional double camera = 37;
2971
2972 optional double wifi_batched_scan = 38;
2973
2974 optional double battery_capacity = 39;
Chenjie Yu12e5e672018-09-14 15:54:59 -07002975}
Chenjie Yuab530202018-09-26 12:39:20 -07002976
2977/**
2978 * power_profile.xml and other constants for power model calculations.
2979 * Pulled from PowerProfile.java
2980 */
2981message PowerProfile {
Yangsteraf9aee72018-10-12 09:26:16 -07002982 optional PowerProfileProto power_profile = 1;
Howard Ro9a862de2018-10-11 16:03:33 -07002983}