blob: 16cb7ac99377124410f704ea68297840b0973fa2 [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070018
19package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080021option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070022
Yao Chen9c1debe2018-02-19 14:39:19 -080023import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080024import "frameworks/base/core/proto/android/app/enums.proto";
Tej Singh33a412b2018-03-16 18:43:59 -070025import "frameworks/base/core/proto/android/app/job/enums.proto";
Tej Singh5d991e12018-03-09 19:48:11 -080026import "frameworks/base/core/proto/android/bluetooth/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080027import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080028import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080029import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080030import "frameworks/base/core/proto/android/telephony/enums.proto";
31import "frameworks/base/core/proto/android/view/enums.proto";
Howard Ro0546d542018-08-30 16:23:44 -070032import "frameworks/base/proto/src/stats_enums.proto";
Chenjie Yu159e4f82018-08-29 11:49:11 -070033import "frameworks/base/core/proto/android/service/procstats.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080034
Yao Chend54f9dd2017-10-17 17:37:48 +000035/**
Stefan Lafonae2df012017-11-14 09:17:21 -080036 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000037 * raw stats log events from the Android system, also known as "atoms."
38 *
39 * This field contains a single oneof with all of the available messages.
40 * The stats-log-api-gen tool runs as part of the Android build and
41 * generates the android.util.StatsLog class, which contains the constants
42 * and methods that Android uses to log.
43 *
Stefan Lafonae2df012017-11-14 09:17:21 -080044 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000045 * Instead, statsd on Android constructs these messages synthetically,
46 * in the format defined here and in stats_log.proto.
47 */
Stefan Lafonae2df012017-11-14 09:17:21 -080048message Atom {
49 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070050 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070051 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
52 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070053 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070054 BleScanResultReceived ble_scan_result_received = 4;
55 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080056 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070057 SyncStateChanged sync_state_changed = 7;
58 ScheduledJobStateChanged scheduled_job_state_changed = 8;
59 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070060 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080061 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
62 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
63 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070064 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
65 MemoryFactorStateChanged memory_factor_state_changed = 15;
66 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
67 CachedKillReported cached_kill_reported = 17;
68 ProcessMemoryStatReported process_memory_stat_reported = 18;
69 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080070 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
71 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
72 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070073 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080074 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070075 CameraStateChanged camera_state_changed = 25;
76 FlashlightStateChanged flashlight_state_changed = 26;
77 UidProcessStateChanged uid_process_state_changed = 27;
78 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
79 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070080 BatteryLevelChanged battery_level_changed = 30;
81 ChargingStateChanged charging_state_changed = 31;
82 PluggedStateChanged plugged_state_changed = 32;
Bookatza66083f2018-09-20 17:24:00 -070083 InteractiveStateChanged interactive_state_changed = 33;
84 // 34 is available
Bookatz8c6571b2017-10-24 15:04:41 -070085 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
86 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070087 WifiLockStateChanged wifi_lock_state_changed = 37;
88 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
89 WifiScanStateChanged wifi_scan_state_changed = 39;
90 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070091 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070092 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070093 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090094 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070095 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080096 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080097 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080098 AppStartOccurred app_start_occurred = 48;
99 AppStartCanceled app_start_canceled = 49;
100 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800102 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800103 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800104 LmkStateChanged lmk_state_changed = 54;
105 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800106 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800107 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800108 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800109 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800110 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800111 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800112 KeyguardStateChanged keyguard_state_changed = 62;
113 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
114 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800115 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800116 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800117 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
118 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700119 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700120 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800121 SpeakerImpedanceReported speaker_impedance_reported = 71;
122 HardwareFailed hardware_failed = 72;
123 PhysicalDropDetected physical_drop_detected = 73;
124 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800125 MobileConnectionStateChanged mobile_connection_state_changed = 75;
126 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700127 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800128 AppCrashOccurred app_crash_occurred = 78;
129 ANROccurred anr_occurred = 79;
130 WTFOccurred wtf_occurred = 80;
131 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700132 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700133 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700134 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700135 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700136 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700137 FingerprintAcquired fingerprint_acquired = 87;
138 FingerprintAuthenticated fingerprint_authenticated = 88;
139 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Howard Ro688ae182018-09-25 00:09:36 -0700140 Notification notification = 90;
Yao Chend54f9dd2017-10-17 17:37:48 +0000141 }
David Chenc8a43242017-10-17 16:23:28 -0700142
David Chen6e3e6cb2018-01-03 16:14:06 -0800143 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100144 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700145 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 WifiBytesTransfer wifi_bytes_transfer = 10000;
147 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
148 MobileBytesTransfer mobile_bytes_transfer = 10002;
149 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800150 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800151 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800152 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800153 CpuTimePerFreq cpu_time_per_freq = 10008;
154 CpuTimePerUid cpu_time_per_uid = 10009;
155 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800156 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800157 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800158 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800159 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800160 SystemElapsedRealtime system_elapsed_realtime = 10014;
161 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800162 CpuActiveTime cpu_active_time = 10016;
163 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000164 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800165 RemainingBatteryCapacity remaining_battery_capacity = 10019;
166 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800167 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100168 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100169 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100170 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000171 DiskStats disk_stats = 10025;
172 DirectoryUsage directory_usage = 10026;
173 AppSize app_size = 10027;
174 CategorySize category_size = 10028;
Bookatz17f0d8a2018-09-13 12:56:32 -0700175 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700176 NumFingerprints num_fingerprints = 10031;
Chenjie Yu12e5e672018-09-14 15:54:59 -0700177 ProcStats proc_stats = 10029;
David Chenc8a43242017-10-17 16:23:28 -0700178 }
yroa1fe77c2018-02-26 14:22:54 -0800179
Bookatz76aafcf2018-09-17 16:17:10 -0700180 // DO NOT USE field numbers above 100,000 in AOSP.
181 // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
182 // Field numbers 200,000 and above are reserved for future use; do not use them at all.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700183}
184
Yao Chend54f9dd2017-10-17 17:37:48 +0000185/**
Yangster-mac20877162017-12-22 17:19:39 -0800186 * This proto represents a node of an attribution chain.
187 * Note: All attribution chains are represented as a repeated field of type
188 * AttributionNode. It is understood that in such arrays, the order is that
189 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000190 */
Yangster-mac20877162017-12-22 17:19:39 -0800191message AttributionNode {
192 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800193 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800194
Yangster-mac20877162017-12-22 17:19:39 -0800195 // The (optional) string tag for an element in the attribution chain. If the
196 // element has no tag, it is encoded as an empty string.
197 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700198}
199
Yangster-mac48b3d622018-08-18 12:38:11 -0700200message KeyValuePair {
201 optional int32 key = 1;
202 oneof value {
Howard Ro4078dd42018-09-27 17:41:08 -0700203 int32 value_int = 2;
204 int64 value_long = 3;
205 string value_str = 4;
206 float value_float = 5;
Yangster-mac48b3d622018-08-18 12:38:11 -0700207 }
208}
209
210message KeyValuePairsAtom {
211 optional int32 uid = 1;
212 repeated KeyValuePair pairs = 2;
213}
214
Yao Chend54f9dd2017-10-17 17:37:48 +0000215/*
216 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800217 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000218 *
219 * RULES:
220 * - The field ids for each atom must start at 1, and count upwards by 1.
221 * Skipping field ids is not allowed.
222 * - These form an API, so renaming, renumbering or removing fields is
223 * not allowed between android releases. (This is not currently enforced,
224 * but there will be a tool to enforce this restriction).
225 * - The types must be built-in protocol buffer types, namely, no sub-messages
226 * are allowed (yet). The bytes type is also not allowed.
227 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800228 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000229 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800230 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000231 * - A field that is a uid should be a string field, tagged with the [xxx]
232 * annotation. The generated code on android will be represented by UIDs,
233 * and those UIDs will be translated in xxx to those strings.
234 *
235 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700236 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000237 * - If there is a UID, it goes first. Think in an object-oriented fashion.
238 * *****************************************************************************
239 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700240
Yao Chend54f9dd2017-10-17 17:37:48 +0000241/**
Yangster-mace16189a2018-08-26 12:20:16 -0700242 * Logs when the Thermal service HAL notifies the throttling start/stop events.
243 *
244 * Logged from:
245 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
246 */
247message ThermalThrottlingStateChanged {
248 optional android.os.TemperatureTypeEnum sensor_type = 1;
249
250 enum State {
251 UNKNOWN = 0;
252 START = 1;
253 STOP = 2;
254 }
255
256 optional State state = 2;
257
258 optional float temperature = 3;
259}
260
261/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000262 * Logs when the screen state changes.
263 *
264 * Logged from:
265 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
266 */
267message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800268 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800269 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700270}
Yao Chend54f9dd2017-10-17 17:37:48 +0000271
272/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700273 * Logs that the process state of the uid, as determined by ActivityManager
274 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000275 *
276 * Logged from:
277 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
278 */
Bookatzc1a050a2017-10-10 15:49:28 -0700279message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700280 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000281
Bookatzdb026a22018-01-10 19:01:56 -0800282 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800283 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000284}
285
286/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700287 * Logs process state change of a process, as per the activity manager.
288 *
289 * Logged from:
290 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
291 */
292message ProcessStateChanged {
293 optional int32 uid = 1;
294 optional string process_name = 2;
295 optional string package_name = 3;
296 // TODO: remove this when validation is done
297 optional int64 version = 5;
298 // The state, from frameworks/base/core/proto/android/app/enums.proto.
299 optional android.app.ProcessStateEnum state = 4;
300}
301
302/**
303 * Logs when ActivityManagerService sleep state is changed.
304 *
305 * Logged from:
306 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
307 */
308message ActivityManagerSleepStateChanged {
309 // TODO: import frameworks proto
310 enum State {
311 UNKNOWN = 0;
312 ASLEEP = 1;
313 AWAKE = 2;
314 }
315 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
316}
317
318/**
319 * Logs when system memory state changes.
320 *
321 * Logged from:
322 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
323 */
324message MemoryFactorStateChanged {
325 // TODO: import frameworks proto
326 enum State {
327 MEMORY_UNKNOWN = 0;
328 NORMAL = 1; // normal.
329 MODERATE = 2; // moderate memory pressure.
330 LOW = 3; // low memory.
331 CRITICAL = 4; // critical memory.
332
333 }
334 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
335}
336
337/**
338 * Logs when app is using too much cpu, according to ActivityManagerService.
339 *
340 * Logged from:
341 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
342 */
343message ExcessiveCpuUsageReported {
344 optional int32 uid = 1;
345 optional string process_name = 2;
346 optional string package_name = 3;
347 // package version. TODO: remove this when validation is done
348 optional int64 version = 4;
349}
350
351/**
352 * Logs when a cached process is killed, along with its pss.
353 *
354 * Logged from:
355 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
356 */
357message CachedKillReported {
358 optional int32 uid = 1;
359 optional string process_name = 2;
360 optional string package_name = 3;
361 // TODO: remove this when validation is done
362 optional int64 version = 5;
363 optional int64 pss = 4;
364}
365
366/**
367 * Logs when memory stats of a process is reported.
368 *
369 * Logged from:
370 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
371 */
372message ProcessMemoryStatReported {
373 optional int32 uid = 1;
374 optional string process_name = 2;
375 optional string package_name = 3;
376 //TODO: remove this when validation is done
377 optional int64 version = 9;
378 optional int64 pss = 4;
379 optional int64 uss = 5;
380 optional int64 rss = 6;
381 enum Type {
382 ADD_PSS_INTERNAL_SINGLE = 0;
383 ADD_PSS_INTERNAL_ALL_MEM = 1;
384 ADD_PSS_INTERNAL_ALL_POLL = 2;
385 ADD_PSS_EXTERNAL = 3;
386 ADD_PSS_EXTERNAL_SLOW = 4;
387 }
388 optional Type type = 7;
389 optional int64 duration = 8;
390}
391
392/**
Bookatzc1a050a2017-10-10 15:49:28 -0700393 * Logs that a process started, finished, crashed, or ANRed.
394 *
395 * Logged from:
396 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
397 */
398message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700399 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700400
David Chen0b5c90c2018-01-25 16:51:49 -0800401 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800402 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700403
Bookatzddccf0a2017-11-28 16:48:14 -0800404 // What lifecycle state the process changed to.
405 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800406 enum State {
407 FINISHED = 0;
408 STARTED = 1;
409 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800410 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800411 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700412}
413
Bookatzc1a050a2017-10-10 15:49:28 -0700414/**
415 * Logs when the ble scan state changes.
416 *
417 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700418 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700419 */
420message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800421 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700422
423 enum State {
424 OFF = 0;
425 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700426 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
427 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700428 }
429 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700430
Bookatze5ec0b42018-03-26 13:34:56 -0700431 // Does the scan have a filter.
432 optional bool is_filtered = 3;
433 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
434 optional bool is_first_match = 4;
435 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
436 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700437}
438
439/**
440 * Logs reporting of a ble scan finding results.
441 *
442 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700443 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700444 */
Bookatzae6738e2018-09-13 11:38:56 -0700445// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700446message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800447 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700448
449 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800450 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700451}
452
453/**
454 * Logs when a sensor state changes.
455 *
456 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700457 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700458 */
459message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800460 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700461
Bookatzc1a050a2017-10-10 15:49:28 -0700462 // The id (int) of the sensor.
463 optional int32 sensor_id = 2;
464
465 enum State {
466 OFF = 0;
467 ON = 1;
468 }
469 optional State state = 3;
470}
471
472
473/**
474 * Logs when GPS state changes.
475 *
476 * Logged from:
477 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
478 */
479message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800480 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700481
482 enum State {
483 OFF = 0;
484 ON = 1;
485 }
486 optional State state = 2;
487}
488
489
490/**
491 * Logs when a sync manager sync state changes.
492 *
493 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700494 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700495 */
496message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800497 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700498
David Chen0b5c90c2018-01-25 16:51:49 -0800499 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800500 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700501
502 enum State {
503 OFF = 0;
504 ON = 1;
505 }
506 optional State state = 3;
507}
508
Yangster-mac96353002018-09-05 11:18:55 -0700509/*
510 * Deferred job stats.
511 *
512 * Logged from:
513 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
514*/
515message DeferredJobStatsReported {
516 repeated AttributionNode attribution_node = 1;
517
518 // Number of jobs deferred.
519 optional int32 num_jobs_deferred = 2;
520
521 // Time since the last job runs.
522 optional int64 time_since_last_job_millis = 3;
523}
524
Bookatzc1a050a2017-10-10 15:49:28 -0700525/**
526 * Logs when a job scheduler job state changes.
527 *
528 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700529 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700530 */
531message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800532 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700533
534 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800535 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700536
537 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800538 FINISHED = 0;
539 STARTED = 1;
540 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700541 }
542 optional State state = 3;
543
Tej Singh33a412b2018-03-16 18:43:59 -0700544 // The reason a job has stopped.
545 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700546 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700547 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700548}
549
550/**
551 * Logs when the audio state changes.
552 *
553 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700554 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700555 */
556message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800557 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700558
559 enum State {
560 OFF = 0;
561 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700562 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
563 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700564 }
565 optional State state = 2;
566}
567
568/**
569 * Logs when the video codec state changes.
570 *
571 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700572 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700573 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800574message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800575 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700576
577 enum State {
578 OFF = 0;
579 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700580 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
581 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700582 }
583 optional State state = 2;
584}
585
586/**
587 * Logs when the flashlight state changes.
588 *
589 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700590 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700591 */
592message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800593 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700594
595 enum State {
596 OFF = 0;
597 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700598 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
599 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700600 }
601 optional State state = 2;
602}
603
604/**
605 * Logs when the camera state changes.
606 *
607 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700608 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700609 */
610message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800611 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700612
613 enum State {
614 OFF = 0;
615 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700616 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
617 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700618 }
619 optional State state = 2;
620}
621
622/**
623 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000624 *
625 * Logged from:
626 * TODO
627 */
Bookatzd6746242017-10-24 18:39:35 -0700628message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800629 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000630
Bookatz1a1b0462018-01-12 11:47:03 -0800631 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
632 // From frameworks/base/core/proto/android/os/enums.proto.
633 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700634
635 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
636 optional string tag = 3;
637
638 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800639 RELEASE = 0;
640 ACQUIRE = 1;
641 CHANGE_RELEASE = 2;
642 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700643 }
644 optional State state = 4;
645}
646
647/**
Bookatzc1a050a2017-10-10 15:49:28 -0700648 * Logs when a partial wakelock is considered 'long' (over 1 min).
649 *
650 * Logged from:
651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
652 */
653message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800654 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700655
Yao Chend54f9dd2017-10-17 17:37:48 +0000656 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
657 optional string tag = 2;
658
Bookatzc1a050a2017-10-10 15:49:28 -0700659 // TODO: I have no idea what this is.
660 optional string history_tag = 3;
661
662 enum State {
663 OFF = 0;
664 ON = 1;
665 }
666 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000667}
668
Bookatzc1a050a2017-10-10 15:49:28 -0700669/**
Bookatza66083f2018-09-20 17:24:00 -0700670 * Logs when the device is interactive, according to the PowerManager Notifier.
671 *
672 * Logged from:
673 * frameworks/base/services/core/java/com/android/server/power/Notifier.java
674 */
675message InteractiveStateChanged {
676 enum State {
677 OFF = 0;
678 ON = 1;
679 }
680 optional State state = 1;
681}
682
683/**
Bookatzc1a050a2017-10-10 15:49:28 -0700684 * Logs Battery Saver state change.
685 *
686 * Logged from:
687 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
688 */
689message BatterySaverModeStateChanged {
690 enum State {
691 OFF = 0;
692 ON = 1;
693 }
694 optional State state = 1;
695}
696
697/**
698 * Logs Doze mode state change.
699 *
700 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800701 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700702 */
703message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800704 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800705}
706
707
708/**
709 * Logs state change of Doze mode including maintenance windows.
710 *
711 * Logged from:
712 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
713 */
714message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800715 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700716}
717
718/**
719 * Logs screen brightness level.
720 *
721 * Logged from:
722 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
723 */
724message ScreenBrightnessChanged {
725 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
726 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700727}
728
729/**
730 * Logs battery level (percent full, from 0 to 100).
731 *
732 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700733 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700734 */
735message BatteryLevelChanged {
736 // Battery level. Should be in [0, 100].
737 optional int32 battery_level = 1;
738}
739
740/**
741 * Logs change in charging status of the device.
742 *
743 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700744 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700745 */
746message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800747 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
748 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700749}
750
751/**
752 * Logs whether the device is plugged in, and what power source it is using.
753 *
754 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700755 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700756 */
757message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800758 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
759 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700760}
761
Bookatz8c6571b2017-10-24 15:04:41 -0700762/**
763 * Logs when an app's wakeup alarm fires.
764 *
765 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700766 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700767 */
768message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800769 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800770
771 // Name of the wakeup alarm.
772 optional string tag = 2;
773}
774
775/**
776 * Logs when an an app causes the mobile radio to change state.
777 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
778 *
779 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700780 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800781 */
782message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800783 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800784
Bookatz1a1b0462018-01-12 11:47:03 -0800785 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
786 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800787}
788
789/**
790 * Logs when an an app causes the wifi radio to change state.
791 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
792 *
793 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700794 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800795 */
796message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800797 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800798
Bookatz1a1b0462018-01-12 11:47:03 -0800799 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
800 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700801}
802
803/**
804 * Logs kernel wakeup reasons and aborts.
805 *
806 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700807 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700808 */
809message KernelWakeupReported {
810 // Name of the kernel wakeup reason (or abort).
811 optional string wakeup_reason_name = 1;
812
813 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800814 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700815}
816
817/**
818 * Logs wifi locks held by an app.
819 *
820 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700821 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700822 */
823message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800824 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700825
826 enum State {
827 OFF = 0;
828 ON = 1;
829 }
830 optional State state = 2;
831}
832
833/**
834 * Logs wifi signal strength changes.
835 *
836 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700837 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700838 */
839message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800840 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
841 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700842}
843
844/**
845 * Logs wifi scans performed by an app.
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 WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800851 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700852
853 enum State {
854 OFF = 0;
855 ON = 1;
856 }
857 optional State state = 2;
858}
859
860/**
Tej Singh4503e102018-01-04 14:35:01 -0800861 * Logs wifi multicast locks held by an app
862 *
863 * Logged from:
864 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
865 */
866message WifiMulticastLockStateChanged {
867 repeated AttributionNode attribution_node = 1;
868
869 enum State {
870 OFF = 0;
871 ON = 1;
872 }
873 optional State state = 2;
874}
875
876/**
Tej Singh1ea42892018-01-19 09:27:00 -0800877 * Logs shutdown reason and duration on next boot.
878 *
879 * Logged from:
880 * frameworks/base/core/java/com/android/server/BootReceiver.java
881 */
882message ShutdownSequenceReported {
883 // True if shutdown is for a reboot. Default: false if we do not know.
884 optional bool reboot = 1;
885
886 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
887 optional string reason = 2;
888
889 // Beginning of shutdown time in ms using wall clock time since unix epoch.
890 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800891 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800892
893 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800894 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800895}
896
Tej Singh6483ea42018-01-25 17:45:49 -0800897
898/**
899 * Logs boot reason and duration.
900 *
901 * Logged from:
902 * system/core/bootstat/bootstat.cpp
903 */
904message BootSequenceReported {
905 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
906 // Default: "<EMPTY>" if not available.
907 optional string bootloader_reason = 1;
908
909 // Reason for system boot. Eg. bootloader, reboot,userrequested
910 // Default: "<EMPTY>" if not available.
911 optional string system_reason = 2;
912
913 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800914 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800915
916 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800917 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800918
919 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800920 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800921
922 // Time since last boot in ms. Default: 0 if not available.
923 optional int64 time_since_last_boot = 6;
924}
925
Tej Singhc477d9c2018-02-05 18:31:39 -0800926
927/**
928 * Logs call state and disconnect cause (if applicable).
929 *
930 * Logged from:
931 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
932 */
933message CallStateChanged {
934 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
935 // From frameworks/base/core/proto/android/telecomm/enums.proto.
936 optional android.telecom.CallStateEnum call_state = 1;
937
938 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
939 // This value is only applicable when the call_state is DISCONNECTED, and
940 // should always be UNKNOWN if the call_state is not DISCONNECTED.
941 // From frameworks/base/core/proto/android/telecomm/enums.proto.
942 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
943
944 // True if the call is self-managed, which are apps that use the
945 // telecom infrastructure to make their own calls.
946 optional bool self_managed = 3;
947
948 // True if call is external. External calls are calls on connected Wear
949 // devices but show up in Telecom so the user can pull them onto the device.
950 optional bool external_call = 4;
951}
952
Tej Singh1ea42892018-01-19 09:27:00 -0800953/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800954 * Logs keyguard state. The keyguard is the lock screen.
955 *
956 * Logged from:
957 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
958 */
959message KeyguardStateChanged {
960 enum State {
961 UNKNOWN = 0;
962 // The keyguard is hidden when the phone is unlocked.
963 HIDDEN = 1;
964 // The keyguard is shown when the phone is locked (screen turns off).
965 SHOWN= 2;
966 // The keyguard is occluded when something is overlaying the keyguard.
967 // Eg. Opening the camera while on the lock screen.
968 OCCLUDED = 3;
969 }
970 optional State state = 1;
971}
972
973/**
974 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
975 * prompts the user to enter a password (pattern, pin, etc).
976 *
977 * Logged from:
978 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
979 */
980
981message KeyguardBouncerStateChanged {
982 enum State {
983 UNKNOWN = 0;
984 // Bouncer is hidden, either as a result of successfully entering the
985 // password, screen timing out, or user going back to lock screen.
986 HIDDEN = 1;
987 // This is when the user is being prompted to enter the password.
988 SHOWN = 2;
989 }
990 optional State state = 1;
991}
992
993/**
994 * Logs the result of entering a password into the keyguard bouncer.
995 *
996 * Logged from:
997 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
998 */
999message KeyguardBouncerPasswordEntered {
1000 enum BouncerResult {
1001 UNKNOWN = 0;
1002 // The password entered was incorrect.
1003 FAILURE = 1;
1004 // The password entered was correct.
1005 SUCCESS = 2;
1006 }
1007 optional BouncerResult result = 1;
1008}
1009
Tej Singha883b372018-02-15 11:30:01 -08001010/*
1011 * Logs changes to the configuration of the device. The configuration is defined
1012 * in frameworks/base/core/java/android/content/res/Configuration.java
1013 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
1014 * Please go there to interpret the possible values each field can be.
1015 *
1016 * Logged from:
1017 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1018 */
1019message ResourceConfigurationChanged {
1020 // Bit mask of color capabilities of the screen.
1021 // Contains information about the color gamut and hdr mode of the screen.
1022 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1023 optional int32 colorMode = 1;
1024
1025 // The target screen density being rendered to.
1026 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1027 optional int32 densityDpi = 2;
1028
1029 // Current user preference for the scaling factor for fonts,
1030 // relative to the base density scaling.
1031 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1032 optional float fontScale = 3;
1033
1034 // Flag indicating whether the hard keyboard is hidden.
1035 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1036 optional int32 hardKeyboardHidden = 4;
1037
1038 // The type of keyboard attached to the device.
1039 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1040 optional int32 keyboard = 5;
1041
1042 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1043 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1044 optional int32 keyboardHideen = 6;
1045
1046 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1047 // 0 if undefined.
1048 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1049 optional int32 mcc = 7;
1050
1051 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1052 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1053 // MNC_ZERO symbol defined in Configuration.java.
1054 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1055 optional int32 mnc = 8;
1056
1057 // The kind of navigation available on the device.
1058 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1059 optional int32 navigation = 9;
1060
1061 // Flag indicating whether the navigation is available.
1062 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1063 optional int32 navigationHidden = 10;
1064
1065 // Overall orientation of the screen.
1066 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1067 optional int32 orientation = 11;
1068
1069 // The current height of the available screen space, in dp units.
1070 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1071 optional int32 screenHeightDp = 12;
1072
1073 // Bit mask of overall layout of the screen.
1074 // Contains information about screen size, whether the screen is wider/taller
1075 // than normal, whether the screen layout is right-tl-left or left-to-right,
1076 // and whether the screen has a rounded shape.
1077 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1078 optional int32 screenLayout = 13;
1079
1080 // Current width of the available screen space, in dp units.
1081 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1082 optional int32 screenWidthDp = 14;
1083
1084 // The smallest screen size an application will see in normal operation.
1085 // This is the smallest value of both screenWidthDp and screenHeightDp
1086 // in portrait and landscape.
1087 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1088 optional int32 smallestScreenWidthDp = 15;
1089
1090 // The type of touch screen attached to the device.
1091 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1092 optional int32 touchscreen = 16;
1093
1094 // Bit mask of the ui mode.
1095 // Contains information about the overall ui mode of the device.
1096 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1097 // Also contains information about whether the device is in night mode.
1098 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1099 optional int32 uiMode = 17;
1100}
1101
Tej Singheee317b2018-03-07 19:28:05 -08001102
1103/**
1104 * Logs changes in the connection state of the mobile radio.
1105 *
1106 * Logged from:
1107 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1108 */
1109message MobileConnectionStateChanged {
1110 // States are from the state machine DataConnection.java.
1111 enum State {
1112 UNKNOWN = 0;
1113 // The connection is inactive, or disconnected.
1114 INACTIVE = 1;
1115 // The connection is being activated, or connecting.
1116 ACTIVATING = 2;
1117 // The connection is active, or connected.
1118 ACTIVE = 3;
1119 // The connection is disconnecting.
1120 DISCONNECTING = 4;
1121 // The connection is disconnecting after creating a connection.
1122 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1123 }
1124 optional State state = 1;
1125 // For multi-sim phones, this distinguishes between the sim cards.
1126 optional int32 sim_slot_index = 2;
1127 // Used to identify the connection. Starts at 0 and increments by 1 for
1128 // every new network created. Resets whenever the device reboots.
1129 optional int32 data_connection_id = 3;
1130 // A bitmask for the capabilities of this connection.
1131 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1132 // Default value (if we have no information): 0
1133 optional int64 capabilities = 4;
1134 // If this connection has internet.
1135 // This just checks if the DEFAULT bit of capabilities is set.
1136 optional bool has_internet = 5;
1137}
1138
1139/**
1140 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1141 *
1142 * Logged from:
1143 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1144 */
1145message MobileRadioTechnologyChanged {
1146 optional android.telephony.NetworkTypeEnum state = 1;
1147 // For multi-sim phones, this distinguishes between the sim cards.
1148 optional int32 sim_slot_index = 2;
1149}
1150
Andrew Chantb56388b2018-03-22 21:07:33 -07001151/**
1152 * Logs the VID and PID of any connected USB devices.
1153 *
1154 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1155 *
1156 * Logged by Vendor.
1157 */
1158message UsbDeviceAttached {
1159 optional int32 vid = 1;
1160 optional int32 pid = 2;
1161 optional bool has_audio = 3;
1162 optional bool has_hid = 4;
1163 optional bool has_storage = 5;
1164}
1165
Tej Singheee317b2018-03-07 19:28:05 -08001166
Tej Singhdd7bd352018-02-09 19:33:15 -08001167/**
Tej Singh5d991e12018-03-09 19:48:11 -08001168 * Logs when Bluetooth is enabled and disabled.
1169 *
1170 * Logged from:
1171 * services/core/java/com/android/server/BluetoothManagerService.java
1172 */
1173message BluetoothEnabledStateChanged {
1174 repeated AttributionNode attribution_node = 1;
1175 // Whether or not bluetooth is enabled on the device.
1176 enum State {
1177 UNKNOWN = 0;
1178 ENABLED = 1;
1179 DISABLED = 2;
1180 }
1181 optional State state = 2;
1182 // The reason for being enabled/disabled.
1183 // Eg. Airplane mode, crash, application request.
1184 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1185 // If the reason is an application request, this will be the package name.
1186 optional string pkgName = 4;
1187}
1188
1189/**
1190 * Logs when a Bluetooth device connects and disconnects.
1191 *
1192 * Logged from:
1193 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1194 */
1195message BluetoothConnectionStateChanged {
1196 // The state of the connection.
1197 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1198 optional android.bluetooth.ConnectionStateEnum state = 1;
1199 // An identifier that can be used to match connect and disconnect events.
1200 // Currently is last two bytes of a hash of a device level ID and
1201 // the mac address of the bluetooth device that is connected.
1202 optional int32 obfuscated_id = 2;
1203 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1204 // From android.bluetooth.BluetoothAdapter.java
1205 optional int32 bt_profile = 3;
1206}
1207
1208/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001209 * Logs when something is plugged into or removed from the USB-C connector.
1210 *
1211 * Logged from:
1212 * Vendor USB HAL.
1213 */
1214message UsbConnectorStateChanged {
1215 enum State {
1216 DISCONNECTED = 0;
1217 CONNECTED = 1;
1218 }
1219 optional State state = 1;
1220}
1221
1222/**
1223 * Logs the reported speaker impedance.
1224 *
1225 * Logged from:
1226 * Vendor audio implementation.
1227 */
1228message SpeakerImpedanceReported {
1229 optional int32 speaker_location = 1;
1230 optional int32 impedance = 2;
1231}
1232
1233/**
1234 * Logs the report of a failed hardware.
1235 *
1236 * Logged from:
1237 * Vendor HALs.
1238 *
1239 */
1240message HardwareFailed {
1241 enum HardwareType {
1242 HARDWARE_FAILED_UNKNOWN = 0;
1243 HARDWARE_FAILED_MICROPHONE = 1;
1244 HARDWARE_FAILED_CODEC = 2;
1245 HARDWARE_FAILED_SPEAKER = 3;
1246 HARDWARE_FAILED_FINGERPRINT = 4;
1247 }
1248 optional HardwareType hardware_type = 1;
1249
1250 /* hardware_location allows vendors to differentiate between multiple instances of
1251 * the same hardware_type. The specific locations are vendor defined integers,
1252 * referring to board-specific numbering schemes.
1253 */
1254 optional int32 hardware_location = 2;
1255
1256 /* failure_code is specific to the HardwareType of the failed hardware.
1257 * It should use the enum values defined below.
1258 */
1259 enum MicrophoneFailureCode {
1260 MICROPHONE_FAILURE_COMPLETE = 0;
1261 }
1262 enum CodecFailureCode {
1263 CODEC_FAILURE_COMPLETE = 0;
1264 }
1265 enum SpeakerFailureCode {
1266 SPEAKER_FAILURE_COMPLETE = 0;
1267 SPEAKER_FAILURE_HIGH_Z = 1;
1268 SPEAKER_FAILURE_SHORT = 2;
1269 }
1270 enum FingerprintFailureCode {
1271 FINGERPRINT_FAILURE_COMPLETE = 0;
1272 FINGERPRINT_SENSOR_BROKEN = 1;
1273 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1274 }
1275 optional int32 failure_code = 3;
1276}
1277
1278/**
1279 * Log an event when the device has been physically dropped.
1280 * Reported from the /vendor partition.
1281 */
1282message PhysicalDropDetected {
1283 // Confidence that the event was actually a drop, 0 -> 100
1284 optional int32 confidence_pctg = 1;
1285 // Peak acceleration of the drop, in 1/1000s of a g.
1286 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001287 // Duration of freefall in ms
1288 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001289}
1290
1291/**
1292 * Log bucketed battery charge cycles.
1293 *
1294 * Each bucket represents cycles of the battery past
1295 * a given charge point. For example, bucket 1 is the
1296 * lowest 1/8th of the battery, and bucket 8 is 100%.
1297 *
1298 * Logged from:
1299 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1300 */
1301message ChargeCyclesReported {
1302 optional int32 cycle_bucket_1 = 1;
1303 optional int32 cycle_bucket_2 = 2;
1304 optional int32 cycle_bucket_3 = 3;
1305 optional int32 cycle_bucket_4 = 4;
1306 optional int32 cycle_bucket_5 = 5;
1307 optional int32 cycle_bucket_6 = 6;
1308 optional int32 cycle_bucket_7 = 7;
1309 optional int32 cycle_bucket_8 = 8;
1310}
1311
1312/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001313 * Logs the duration of a davey (jank of >=700ms) when it occurs
1314 *
1315 * Logged from:
1316 * frameworks/base/libs/hwui/JankTracker.cpp
1317 */
1318message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001319 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001320 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001321
Tej Singhbb8554a2018-01-26 11:59:14 -08001322 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001323 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001324}
1325
1326/**
Bookatze5885242017-10-24 20:10:31 -07001327 * Logs phone signal strength changes.
1328 *
1329 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001330 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001331 */
1332message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001333 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1334 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001335}
1336
1337/**
1338 * Logs that a setting was updated.
1339 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001340 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001341 * The tag and is_default allow resetting of settings to default values based on the specified
1342 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1343 */
1344message SettingChanged {
1345 // The name of the setting.
1346 optional string setting = 1;
1347
1348 // The change being imposed on this setting. May represent a number, eg "3".
1349 optional string value = 2;
1350
1351 // The new value of this setting. For most settings, this is same as value. For some settings,
1352 // value is +X or -X where X represents an element in a set. For example, if the previous value
1353 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1354 // The +/- feature is currently only used for location_providers_allowed.
1355 optional string new_value = 3;
1356
1357 // The previous value of this setting.
1358 optional string prev_value = 4;
1359
1360 // The tag used with the is_default for resetting sets of settings. This is generally null.
1361 optional string tag = 5;
1362
Bookatz90867622018-01-31 15:05:57 -08001363 // True if this setting with tag should be resettable.
1364 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001365
David Chenbd789912018-03-16 17:19:55 -07001366 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001367 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001368
1369 enum ChangeReason {
1370 UPDATED = 1; // Updated can be an insertion or an update.
1371 DELETED = 2;
1372 }
1373 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001374}
Chenjie Yub3dda412017-10-24 13:41:59 -07001375
Chenjie Yu05013b32017-11-21 10:21:41 -08001376/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001377 * Logs activity going to foreground or background
1378 *
1379 * Logged from:
1380 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1381 */
1382message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001383 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001384 optional string pkg_name = 2;
1385 optional string class_name = 3;
1386
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001387 enum State {
1388 BACKGROUND = 0;
1389 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001390 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001391 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001392}
David Chenc8a43242017-10-17 16:23:28 -07001393
1394/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001395 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001396 * Logged from:
1397 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1398 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001399message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001400 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001401
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001402 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001403
1404 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001405 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001406 optional string process_name = 3;
1407
1408 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001409 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001410
1411 optional string package_name = 5;
1412
1413 enum InstantApp {
1414 UNAVAILABLE = 0;
1415 FALSE = 1;
1416 TRUE = 2;
1417 }
1418 optional InstantApp is_instant_app = 6;
1419
1420 enum ForegroundState {
1421 UNKNOWN = 0;
1422 BACKGROUND = 1;
1423 FOREGROUND = 2;
1424 }
1425 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001426}
David Chen9e3808c2017-11-20 17:25:34 -08001427
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001428/**
1429 * Logs when a WTF (What a Terrible Failure) happened.
1430 * Logged from:
1431 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1432 */
1433message WTFOccurred {
1434 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001435
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001436 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001437
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001438 // The name of the process.
1439 // system_server if it is not by an app
1440 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001441
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001442 // The pid if available. -1 means not available.
1443 optional sint32 pid = 4;
1444}
1445
1446/**
1447 * Logs when system server reports low memory.
1448 * Logged from:
1449 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1450 */
1451message LowMemReported {
1452}
1453
1454/**
1455 * Logs when an app ANR (App Not Responding) occurs.
1456 * Logged from:
1457 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1458 */
1459message ANROccurred {
1460 optional int32 uid = 1 [(is_uid) = true];
1461
1462 optional string process_name = 2;
1463
1464 optional string short_component_name = 3;
1465
1466 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001467
1468 enum InstantApp {
1469 UNAVAILABLE = 0;
1470 FALSE = 1;
1471 TRUE = 2;
1472 }
1473 optional InstantApp is_instant_app = 5;
1474
1475 enum ForegroundState {
1476 UNKNOWN = 0;
1477 BACKGROUND = 1;
1478 FOREGROUND = 2;
1479 }
1480 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001481}
1482
Bookatza7020bd2018-08-28 16:29:35 -07001483/**
1484 * Logs when the vibrator state changes.
1485 * Logged from:
1486 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1487 */
1488message VibratorStateChanged {
1489 repeated AttributionNode attribution_node = 1;
1490
1491 enum State {
1492 OFF = 0;
1493 ON = 1;
1494 }
1495 optional State state = 2;
1496
1497 // Duration (in milliseconds) requested to keep the vibrator on.
1498 // Only applicable for State == ON.
1499 optional int64 duration_millis = 3;
1500}
1501
David Chen0a368b22017-12-06 16:28:16 -08001502/*
1503 * Allows other apps to push events into statsd.
1504 * Logged from:
1505 * frameworks/base/core/java/android/util/StatsLog.java
1506 */
David Chen0b5c90c2018-01-25 16:51:49 -08001507message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001508 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001509 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001510
1511 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1512 optional int32 label = 2;
1513
1514 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1515 // predicates for the metrics).
1516 enum State {
1517 UNKNOWN = 0;
1518 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1519 STOP = 2;
1520 START = 3;
1521 }
1522 optional State state = 3;
1523}
1524
David Chen9e3808c2017-11-20 17:25:34 -08001525/**
Bookatz7948c872018-09-04 12:58:33 -07001526 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1527 * For example, this could be due to the user manually changing the time.
1528 *
1529 * Logged from:
1530 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1531 */
1532message WallClockTimeShifted {
1533 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1534 optional int64 wall_clock_timestamp_millis = 1;
1535}
1536
1537/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001538 * Logs when statsd detects an anomaly.
1539 *
1540 * Logged from:
1541 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1542 */
1543message AnomalyDetected {
1544 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001545 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001546
Yangster-mac94e197c2018-01-02 16:03:03 -08001547 // Id of the config whose anomaly detection alert fired.
1548 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001549
Yangster-mac94e197c2018-01-02 16:03:03 -08001550 // Id of the alert (i.e. name of the anomaly that was detected).
1551 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001552}
1553
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001554message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001555 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001556 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001557
1558 // The app package name.
1559 optional string pkg_name = 2;
1560
1561 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001562 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001563 WARM = 1;
1564 HOT = 2;
1565 COLD = 3;
1566 }
1567 // The transition type.
1568 optional TransitionType type = 3;
1569
1570 // The activity name.
1571 optional string activity_name = 4;
1572
1573 // The name of the calling app. Empty if not set.
1574 optional string calling_pkg_name = 5;
1575
1576 // Whether the app is an instant app.
1577 optional bool is_instant_app = 6;
1578
1579 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001580 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001581
Bookatz80d11a02018-01-16 10:46:35 -08001582 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001583
David Chen0b5c90c2018-01-25 16:51:49 -08001584 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001585 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001586 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001587 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001588 optional int32 bind_application_delay_millis = 11;
1589 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001590
1591 // Empty if not set.
1592 optional string launch_token = 13;
1593
Calin Juravle759fbda2018-02-20 19:52:30 +00001594 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001595 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001596
1597 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001598 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001599}
1600
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001601message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001602 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001603 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001604
1605 // The app package name.
1606 optional string pkg_name = 2;
1607
1608 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001609 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001610 WARM = 1;
1611 HOT = 2;
1612 COLD = 3;
1613 }
1614 // The transition type.
1615 optional TransitionType type = 3;
1616
1617 // The activity name.
1618 optional string activity_name = 4;
1619}
1620
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001621message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001622 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001623 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001624
1625 // The app package name.
1626 optional string pkg_name = 2;
1627
1628 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001629 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001630 WITH_BUNDLE = 1;
1631 WITHOUT_BUNDLE = 2;
1632 }
1633 // The transition type.
1634 optional TransitionType type = 3;
1635
1636 // The activity name.
1637 optional string activity_name = 4;
1638
1639 optional bool transition_process_running = 5;
1640
1641 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001642 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001643}
1644
Bookatz8fcd09a2017-12-18 13:01:10 -08001645/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001646 * Logs a picture-in-picture action
1647 * Logged from:
1648 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1649 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1650 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1651 */
1652message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001653 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001654 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001655
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001656 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001657
Chenjie Yu52cacc62017-12-08 18:11:45 -08001658 enum State {
1659 ENTERED = 1;
1660 EXPANDED_TO_FULL_SCREEN = 2;
1661 MINIMIZED = 3;
1662 DISMISSED = 4;
1663 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001664 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001665}
1666
1667/**
Chenjie Yue8904192017-12-08 19:12:57 -08001668 * Logs overlay action
1669 * Logged from:
1670 * services/core/java/com/android/server/wm/Session.java
1671 */
1672message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001673 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001674
1675 optional string package_name = 2;
1676
1677 optional bool using_alert_window = 3;
1678
1679 enum State {
1680 ENTERED = 1;
1681 EXITED = 2;
1682 }
1683 optional State state = 4;
1684}
1685
Chenjie Yuccfe6452018-01-30 11:33:21 -08001686/*
1687 * Logs foreground service starts and stops.
1688 * Note that this is not when a service starts or stops, but when it is
1689 * considered foreground.
1690 * Logged from
1691 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1692 */
1693message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001694 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001695 // package_name + "/" + class_name
1696 optional string short_name = 2;
1697
1698 enum State {
1699 ENTER = 1;
1700 EXIT = 2;
1701 }
1702 optional State state = 3;
1703}
1704
Chenjie Yue8904192017-12-08 19:12:57 -08001705/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001706 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1707 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1708 * attributed back to the parent (host) uid. One example is Chrome.
1709 *
1710 * Logged from:
1711 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1712 */
1713message IsolatedUidChanged {
1714 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001715 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001716 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001717 optional int32 parent_uid = 1;
1718
1719 optional int32 isolated_uid = 2;
1720
1721 // We expect an isolated uid to be removed before if it's used for another parent uid.
1722 enum Event {
1723 REMOVED = 0;
1724 CREATED = 1;
1725 }
1726 optional Event event = 3;
1727}
1728
1729/*
1730 * Logs the reception of an incoming network packet causing the main system to wake up for
1731 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1732 * and processed by WakeupController.cpp.
1733 */
1734message PacketWakeupOccurred {
1735 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1736 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001737 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001738 // The interface name on which the packet was received.
1739 optional string iface = 2;
1740 // The ethertype value of the packet.
1741 optional int32 ethertype = 3;
1742 // String representation of the destination MAC address of the packet.
1743 optional string destination_hardware_address = 4;
1744 // String representation of the source address of the packet if this was an IP packet.
1745 optional string source_ip = 5;
1746 // String representation of the destination address of the packet if this was an IP packet.
1747 optional string destination_ip = 6;
1748 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1749 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1750 // families.
1751 optional int32 ip_next_header = 7;
1752 // The source port if this was a TCP or UDP packet.
1753 optional int32 source_port = 8;
1754 // The destination port if this was a TCP or UDP packet.
1755 optional int32 destination_port = 9;
1756}
1757
1758/*
1759 * Logs the memory stats for an app on startup.
1760 * Logged from:
1761 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1762 */
1763message AppStartMemoryStateCaptured {
1764 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001765 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001766
1767 // The process name.
1768 optional string process_name = 2;
1769
1770 // The activity name.
1771 optional string activity_name = 3;
1772
1773 // # of page-faults
1774 optional int64 pgfault = 4;
1775
1776 // # of major page-faults
1777 optional int64 pgmajfault = 5;
1778
1779 // RSS
1780 optional int64 rss_in_bytes = 6;
1781
1782 // CACHE
1783 optional int64 cache_in_bytes = 7;
1784
1785 // SWAP
1786 optional int64 swap_in_bytes = 8;
1787}
1788
1789/*
1790 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1791 * for LMK event.
1792 * Logged from:
1793 * system/core/lmkd/lmkd.c
1794 */
1795message LmkStateChanged {
1796 enum State {
1797 UNKNOWN = 0;
1798 START = 1;
1799 STOP = 2;
1800 }
1801 optional State state = 1;
1802}
1803
1804/*
1805 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1806 * Logged from:
1807 * system/core/lmkd/lmkd.c
1808 */
1809message LmkKillOccurred {
1810 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001811 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001812
1813 // The process name.
1814 optional string process_name = 2;
1815
1816 // oom adj score.
1817 optional int32 oom_score = 3;
1818
1819 // # of page-faults
1820 optional int64 pgfault = 4;
1821
1822 // # of major page-faults
1823 optional int64 pgmajfault = 5;
1824
1825 // RSS
1826 optional int64 rss_in_bytes = 6;
1827
1828 // CACHE
1829 optional int64 cache_in_bytes = 7;
1830
1831 // SWAP
1832 optional int64 swap_in_bytes = 8;
1833}
1834
Rajeev Kumar51b54602018-03-01 12:18:26 -08001835/*
1836 * Logs when the ActivityManagerService detects that an app died.
1837 *
1838 * Logged from:
1839 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1840 */
1841message AppDied {
1842 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001843 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001844}
1845
Howard Ro21a039c2018-08-06 14:55:47 -07001846/**
1847 * An atom for generic metrics logging. Available from Android Q.
1848 */
1849message GenericAtom {
1850 // The uid of the application that sent this custom atom.
1851 optional int32 uid = 1 [(is_uid) = true];
1852
1853 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001854 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001855}
1856
Tej Singhd6d6d772018-09-05 17:41:25 -07001857/**
1858 * Logs when a fingerprint acquire event occurs.
1859 *
1860 * Logged from:
1861 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1862 */
1863message FingerprintAcquired {
1864 // The associated user. Eg: 0 for owners, 10+ for others.
1865 // Defined in android/os/UserHandle.java
1866 optional int32 user = 1;
1867 // If this acquire is for a crypto fingerprint.
1868 // e.g. Secure purchases, unlock password storage.
1869 optional bool is_crypto = 2;
1870}
1871
1872/**
1873 * Logs when a fingerprint authentication event occurs.
1874 *
1875 * Logged from:
1876 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1877 */
1878message FingerprintAuthenticated {
1879 // The associated user. Eg: 0 for owners, 10+ for others.
1880 // Defined in android/os/UserHandle.java
1881 optional int32 user = 1;
1882 // If this authentication is for a crypto fingerprint.
1883 // e.g. Secure purchases, unlock password storage.
1884 optional bool is_crypto = 2;
1885 // Whether or not this authentication was successful.
1886 optional bool is_authenticated = 3;
1887}
1888
1889/**
1890 * Logs when a fingerprint error occurs.
1891 *
1892 * Logged from:
1893 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1894 */
1895message FingerprintErrorOccurred {
1896 // The associated user. Eg: 0 for owners, 10+ for others.
1897 // Defined in android/os/UserHandle.java
1898 optional int32 user = 1;
1899 // If this error is for a crypto fingerprint.
1900 // e.g. Secure purchases, unlock password storage.
1901 optional bool is_crypto = 2;
1902
1903 enum Error {
1904 UNKNOWN = 0;
1905 LOCKOUT = 1;
1906 PERMANENT_LOCKOUT = 2;
1907 }
1908 // The type of error.
1909 optional Error error = 3;
1910}
Howard Ro688ae182018-09-25 00:09:36 -07001911
1912message Notification {
1913
1914 // Type of notification event.
1915 enum Type {
1916 TYPE_UNKNOWN = 0;
1917 // Notification became visible to the user.
1918 TYPE_OPEN = 1;
1919 // Notification became hidden.
1920 TYPE_CLOSE = 2;
1921 // Notification switched to detail mode.
1922 TYPE_DETAIL = 3;
1923 // Notification was clicked.
1924 TYPE_ACTION = 4;
1925 // Notification was dismissed.
1926 TYPE_DISMISS = 5;
1927 // Notification switched to summary mode. The enum value of 14 is to
1928 // match that of metrics_constants.
1929 TYPE_COLLAPSE = 14;
1930 }
1931 optional Type type = 1;
1932
1933 // Package name associated with the notification.
1934 optional string package_name = 2;
1935
1936 // Tag associated with notification.
1937 optional string tag = 3;
1938
1939 // Application-supplied ID associated with the notification.
1940 optional int32 id = 4;
1941
1942 // Index of notification in the notification panel.
1943 optional int32 shade_index = 5;
1944
1945 // The number of notifications in the notification panel.
1946 optional int32 shade_count = 6;
1947
1948 // Importance for the notification.
1949 optional int32 importance = 7;
1950
1951 // ID for the notification channel.
1952 optional int32 channel_id = 8;
1953
1954 // Importance for the notification channel.
1955 optional int32 channel_importance = 9;
1956
1957 // Whether notification was a group summary.
1958 optional bool group_summary = 10;
1959
1960 // Time since notification was created in milliseconds.
1961 optional int64 since_create_millis = 11;
1962
1963 // Time since notification was interrupted in milliseconds.
1964 optional int64 since_interruption_millis = 12;
1965
1966 // Time since notification was updated in milliseconds.
1967 optional int64 since_update_millis = 13;
1968
1969 // Time since notification was visible in milliseconds.
1970 optional int64 since_visible_millis = 14;
1971}
1972
1973
Chenjie Yubbcbc602018-02-05 16:51:52 -08001974//////////////////////////////////////////////////////////////////////
1975// Pulled atoms below this line //
1976//////////////////////////////////////////////////////////////////////
1977
1978/**
David Chenc8a43242017-10-17 16:23:28 -07001979 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1980 *
1981 * Pulled from:
1982 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1983 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001984message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001985 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001986
1987 optional int64 rx_bytes = 2;
1988
1989 optional int64 rx_packets = 3;
1990
1991 optional int64 tx_bytes = 4;
1992
1993 optional int64 tx_packets = 5;
1994}
1995
1996/**
1997 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1998 *
1999 * Pulled from:
2000 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
2001 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002002message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002003 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002004
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002005 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
2006 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002007
2008 optional int64 rx_bytes = 3;
2009
2010 optional int64 rx_packets = 4;
2011
2012 optional int64 tx_bytes = 5;
2013
2014 optional int64 tx_packets = 6;
2015}
2016
2017/**
2018 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
2019 *
2020 * Pulled from:
2021 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2022 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002023message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002024 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002025
2026 optional int64 rx_bytes = 2;
2027
2028 optional int64 rx_packets = 3;
2029
2030 optional int64 tx_bytes = 4;
2031
2032 optional int64 tx_packets = 5;
2033}
2034
2035/**
2036 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
2037 *
2038 * Pulled from:
2039 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
2040 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002041message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07002042 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07002043
Yao Chenc40a19d2018-03-15 16:48:25 -07002044 // 1 denotes foreground and 0 denotes background. This is called Set in
2045 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002046 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07002047
2048 optional int64 rx_bytes = 3;
2049
2050 optional int64 rx_packets = 4;
2051
2052 optional int64 tx_bytes = 5;
2053
2054 optional int64 tx_packets = 6;
2055}
2056
2057/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002058 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
2059 *
2060 * Pulled from:
2061 * StatsCompanionService
2062 */
2063message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07002064 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002065
2066 optional int64 rx_bytes = 2;
2067
2068 optional int64 tx_bytes = 3;
2069}
2070
2071/**
David Chenc8a43242017-10-17 16:23:28 -07002072 * Pulls the kernel wakelock durations. This atom is adapted from
2073 * android/internal/os/KernelWakelockStats.java
2074 *
2075 * Pulled from:
2076 * StatsCompanionService using KernelWakelockReader.
2077 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002078message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07002079 optional string name = 1;
2080
2081 optional int32 count = 2;
2082
2083 optional int32 version = 3;
2084
2085 optional int64 time = 4;
2086}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002087
Chenjie Yu05013b32017-11-21 10:21:41 -08002088/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002089 * Pulls low power state information. This includes platform and subsystem sleep state information,
2090 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002091 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002092 * hardware/interfaces/power/1.1/types.hal
2093 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002094message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002095 // Subsystem name
2096 optional string subsystem_name = 1;
2097 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2098 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2099 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002100 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002101 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002102 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002103 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002104}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002105
Chenjie Yu05013b32017-11-21 10:21:41 -08002106/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002107 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002108 * Pulls the time the cpu spend on the frequency index. Frequency index
2109 * starts from highest to lowest. The value should be monotonically
2110 * increasing since boot. However, if there is a cpu
2111 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002112 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002113message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002114 optional uint32 cluster = 1;
2115 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002116 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002117}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002118
Chenjie Yu05013b32017-11-21 10:21:41 -08002119/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002120 * Pulls Cpu Time Per Uid.
2121 * Note that isolated process uid time should be attributed to host uids.
2122 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002123message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002124 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002125 optional uint64 user_time_millis = 2;
2126 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002127}
2128
2129/**
2130 * Pulls Cpu Time Per Uid per frequency.
2131 * Note that isolated process uid time should be attributed to host uids.
2132 * For each uid, we order the time by descending frequencies.
2133 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002134message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002135 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002136 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002137 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002138}
Hugo Benichi884970e2017-11-14 22:42:46 +09002139
Chenjie Yu05013b32017-11-21 10:21:41 -08002140/**
2141 * Pulls Wifi Controller Activity Energy Info
2142 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002143message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002144 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002145 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002146 // stack reported state
2147 // TODO: replace this with proto enum
2148 optional int32 stack_state = 2;
2149 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002150 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002151 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002152 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002153 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002154 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002155 // product of current(mA), voltage(V) and time(ms)
2156 optional uint64 controller_energy_used = 6;
2157}
2158
2159/**
2160 * Pulls Modem Activity Energy Info
2161 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002162message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002163 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002164 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002165 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002166 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002167 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002168 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002169 /**
2170 * Tx power index
2171 * index 0 = tx_power < 0dBm
2172 * index 1 = 0dBm < tx_power < 5dBm
2173 * index 2 = 5dBm < tx_power < 15dBm
2174 * index 3 = 15dBm < tx_power < 20dBm
2175 * index 4 = tx_power > 20dBm
2176 */
2177 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002178 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002179 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002180 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002181 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002182 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002183 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002184 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002185 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002186 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002187 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002188 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002189 // product of current(mA), voltage(V) and time(ms)
2190 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002191}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002192
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002193/**
2194 * Pulls Bluetooth Activity Energy Info
2195 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2196 */
2197message BluetoothActivityInfo {
2198 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002199 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002200 // bluetooth stack state
2201 optional int32 bluetooth_stack_state = 2;
2202 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002203 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002204 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002205 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002206 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002207 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002208 // product of current(mA), voltage(V) and time(ms)
2209 optional uint64 energy_used = 6;
2210}
2211
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002212/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002213 * Logs the memory stats for a process.
2214 */
2215message ProcessMemoryState {
2216 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002217 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002218
2219 // The process name.
2220 optional string process_name = 2;
2221
2222 // oom adj score.
2223 optional int32 oom_score = 3;
2224
2225 // # of page-faults
2226 optional int64 pgfault = 4;
2227
2228 // # of major page-faults
2229 optional int64 pgmajfault = 5;
2230
Rajeev Kumar90235992018-01-29 11:06:48 -08002231 // RSS
2232 optional int64 rss_in_bytes = 6;
2233
2234 // CACHE
2235 optional int64 cache_in_bytes = 7;
2236
2237 // SWAP
2238 optional int64 swap_in_bytes = 8;
Rafal Slawikaaf60892018-09-12 13:04:30 +01002239
2240 // RSS high watermark.
2241 // Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
2242 // from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
2243 optional int64 rss_high_watermark_in_bytes = 9;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002244}
2245
2246/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002247 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002248 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002249message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002250 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002251}
2252
2253/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002254 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002255 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002256message SystemUptime {
2257 // Milliseconds since the system was booted.
2258 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2259 // for external input).
2260 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002261 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002262}
2263
2264/*
2265 * Reads from /proc/uid_concurrent_active_time which has the format:
2266 * active: X (X is # cores)
2267 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2268 * [uid1]: [time-0] [time-1] [time-2] ... ...
2269 * ...
2270 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2271 * The file contains a monotonically increasing count of time for a single boot.
2272 */
2273message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002274 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002275 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002276}
2277
2278/**
2279 * Reads from /proc/uid_concurrent_policy_time which has the format:
2280 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2281 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2282 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2283 * ...
2284 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2285 * The file contains a monotonically increasing count of time for a single boot.
2286 */
2287message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002288 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002289 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002290 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002291}
2292
2293/*
2294 * Pulls free disk space, for data, system partition and temporary directory.
2295 */
2296message DiskSpace {
2297 // available bytes in data partition
2298 optional uint64 data_available_bytes = 1;
2299 // available bytes in system partition
2300 optional uint64 system_available_bytes = 2;
2301 // available bytes in download cache or temp directories
2302 optional uint64 temp_available_bytes = 3;
2303}
Tej Singhbf972d92018-01-10 20:51:13 -08002304
2305/**
2306 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002307 * Pulled from:
2308 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002309 */
2310message RemainingBatteryCapacity {
2311 optional int32 charge_uAh = 1;
2312}
2313
2314/**
2315 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002316 * Pulled from:
2317 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002318 */
2319message FullBatteryCapacity {
2320 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002321}
2322
2323/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002324 * Pulls battery voltage.
2325 * Pulled from:
2326 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2327 */
2328message BatteryVoltage {
2329 // The voltage of the battery, in millivolts.
2330 optional int32 voltage_mV = 1;
2331}
2332
2333/**
Tej Singhd89137e2018-03-26 14:51:40 -07002334 * Pulls the temperature of various parts of the device.
2335 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002336 *
2337 * Pulled from:
2338 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2339 */
2340message Temperature {
2341 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2342 optional android.os.TemperatureTypeEnum sensor_location = 1;
2343
2344 // The name of the temperature source. Eg. CPU0
2345 optional string sensor_name = 2;
2346
Tej Singhd89137e2018-03-26 14:51:40 -07002347 // Temperature in tenths of a degree C.
2348 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002349}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002350
2351/**
2352 * Pulls the statistics of calls to Binder.
2353 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002354 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2355 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002356 *
2357 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002358 */
2359message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002360 optional int32 uid = 1 [(is_uid) = true];
2361 // Fully qualified class name of the API call.
2362 //
2363 // This is a system server class name.
2364 //
2365 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2366 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2367 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2368 // commonly used APIs.
2369 optional string service_class_name = 2;
2370 // Method name of the API call. It can also be a transaction code if we cannot
2371 // resolve it to a name. See Binder#getTransactionName.
2372 //
2373 // This is a system server method name.
2374 optional string service_method_name = 3;
2375 // Total number of API calls.
2376 optional int64 call_count = 4;
2377 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2378 optional bool screen_interactive = 13;
2379 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2380 // call_count will be equal to recorded_call_count.
2381 //
2382 // If recorded_call_count is different than call_count, it means data collection has been
2383 // sampled. All the fields below will be sampled in this case.
2384 optional int64 recorded_call_count = 12;
2385 // Number of exceptions thrown by the API.
2386 optional int64 recorded_exception_count = 5;
2387 // Total latency of all API calls.
2388 // Average can be computed using total_latency_micros / recorded_call_count.
2389 optional int64 recorded_total_latency_micros = 6;
2390 // Maximum latency of one API call.
2391 optional int64 recorded_max_latency_micros = 7;
2392 // Total CPU usage of all API calls.
2393 // Average can be computed using total_cpu_micros / recorded_call_count.
2394 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2395 optional int64 recorded_total_cpu_micros = 8;
2396 // Maximum CPU usage of one API call.
2397 optional int64 recorded_max_cpu_micros = 9;
2398 // Maximum parcel reply size of one API call.
2399 optional int64 recorded_max_reply_size_bytes = 10;
2400 // Maximum parcel request size of one API call.
2401 optional int64 recorded_max_request_size_bytes = 11;
2402}
2403
2404/**
2405 * Pulls the statistics of exceptions during calls to Binder.
2406 *
2407 * Binder stats are cumulative from boot unless somebody reset the data using
2408 * > adb shell dumpsys binder_calls_stats --reset
2409 */
2410message BinderCallsExceptions {
2411 // Exception class name, e.g. java.lang.IllegalArgumentException.
2412 //
2413 // This is an exception class name thrown by the system server.
2414 optional string exception_class_name = 1;
2415 // Total number of exceptions.
2416 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002417}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002418
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002419/**
2420 * Pulls the statistics of message dispatching on HandlerThreads.
2421 *
2422 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2423 * config on the device.
2424 *
2425 * Next tag: 11
2426 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002427message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002428 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002429 optional int32 uid = 1 [(is_uid) = true];
2430
2431 // Fully qualified class name of the handler target class.
2432 //
2433 // This field does not contain PII. This is a system server class name.
2434 optional string handler_class_name = 2;
2435
2436 // The name of the thread that runs the Looper.
2437 //
2438 // This field does not contain PII. This is a system server thread name.
2439 optional string looper_thread_name = 3;
2440
2441 // The name of the dispatched message.
2442 //
2443 // This field does not contain PII. This is a system server constant or class
2444 // name.
2445 optional string message_name = 4;
2446
2447 // Total number of successfully dispatched messages.
2448 optional int64 message_count = 5;
2449
2450 // Total number of messages that failed dispatching.
2451 optional int64 exception_count = 6;
2452
2453 // Total number of processed messages we have data recorded for. If we
2454 // collected data for all the messages, message_count will be equal to
2455 // recorded_message_count.
2456 //
2457 // If recorded_message_count is different than message_count, it means data
2458 // collection has been sampled. All the fields below will be sampled in this
2459 // case.
2460 optional int64 recorded_message_count = 7;
2461
2462 // Total latency of all processed messages.
2463 // Average can be computed using recorded_total_latency_micros /
2464 // recorded_message_count.
2465 optional int64 recorded_total_latency_micros = 8;
2466
2467 // Total CPU usage of all processed message.
2468 // Average can be computed using recorded_total_cpu_micros /
2469 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002470 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002471 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002472
2473 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2474 optional bool screen_interactive = 10;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002475}
Tej Singh86dc9db2018-09-06 00:39:57 +00002476
2477/**
2478 * Pulls disk information, such as write speed and latency.
2479 */
2480message DiskStats {
2481 // Time taken to open, write 512B to, and close a file.
2482 // -1 if error performing the check.
2483 optional int64 data_write_latency_millis = 1;
2484
2485 optional bool file_based_encryption = 2;
2486
2487 // Recent disk write speed in kB/s.
2488 // -1 if error querying storageed.
2489 // 0 if data is unavailable.
2490 optional int32 recent_disk_write_speed = 3;
2491}
2492
2493
2494/**
2495 * Free and total bytes of the Data, Cache, and System partition.
2496 */
2497message DirectoryUsage {
2498 enum Directory {
2499 UNKNOWN = 0;
2500 DATA = 1;
2501 CACHE = 2;
2502 SYSTEM = 3;
2503 }
2504 optional Directory directory = 1;
2505 optional int64 free_bytes = 2;
2506 optional int64 total_bytes = 3;
2507}
2508
2509
2510/**
2511 * Size of an application: apk size, data size, and cache size.
2512 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2513 * Information is only reported for apps with the primary user (user 0).
2514 * Sizes are aggregated by package name.
2515 */
2516message AppSize {
2517 // Including uids will involve modifying diskstats logic.
2518 optional string package_name = 1;
2519 // App size in bytes. -1 if unavailable.
2520 optional int64 app_size_bytes = 2;
2521 // App data size in bytes. -1 if unavailable.
2522 optional int64 app_data_size_bytes = 3;
2523 // App cache size in bytes. -1 if unavailable.
2524 optional int64 app_cache_size_bytes = 4;
2525 // Time that the cache file was produced.
2526 // Uses System.currentTimeMillis(), which is wall clock time.
2527 optional int64 cache_time_millis = 5;
2528}
2529
2530
2531/**
2532 * Size of a particular category. Eg: photos, videos.
2533 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2534 */
2535message CategorySize {
2536 enum Category {
2537 UNKNOWN = 0;
2538 APP_SIZE = 1;
2539 APP_DATA_SIZE = 2;
2540 APP_CACHE_SIZE = 3;
2541 PHOTOS = 4;
2542 VIDEOS = 5;
2543 AUDIO = 6;
2544 DOWNLOADS = 7;
2545 SYSTEM = 8;
2546 OTHER = 9;
2547 }
2548 optional Category category = 1;
2549 // Category size in bytes.
2550 optional int64 size_bytes = 2;
2551 // Time that the cache file was produced.
2552 // Uses System.currentTimeMillis(), which is wall clock time.
2553 optional int64 cache_time_millis = 3;
2554}
Tej Singhd6d6d772018-09-05 17:41:25 -07002555
2556/**
2557 * Pulls the number of fingerprints for each user.
2558 *
2559 * Pulled from StatsCompanionService, which queries FingerprintManager.
2560 */
2561message NumFingerprints {
2562 // The associated user. Eg: 0 for owners, 10+ for others.
2563 // Defined in android/os/UserHandle.java
2564 optional int32 user = 1;
2565 // Number of fingerprints registered to that user.
2566 optional int32 num_fingerprints = 2;
2567}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002568
2569/**
2570 * Pulled from ProcessStatsService.java
2571 */
2572message ProcStats {
2573 optional android.service.procstats.ProcessStatsSectionProto proc_stats_section = 1;
2574}