blob: c6c10ec7e3d989172922b1e49f6e82742e36abf5 [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;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080083 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070084 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
85 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070086 WifiLockStateChanged wifi_lock_state_changed = 37;
87 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
88 WifiScanStateChanged wifi_scan_state_changed = 39;
89 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070090 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070091 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070092 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090093 PacketWakeupOccurred packet_wakeup_occurred = 44;
Bookatz7948c872018-09-04 12:58:33 -070094 WallClockTimeShifted wall_clock_time_shifted = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080095 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080096 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080097 AppStartOccurred app_start_occurred = 48;
98 AppStartCanceled app_start_canceled = 49;
99 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800100 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800101 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800102 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800103 LmkStateChanged lmk_state_changed = 54;
104 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800105 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800106 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800107 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800108 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800109 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800110 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800111 KeyguardStateChanged keyguard_state_changed = 62;
112 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
113 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800114 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800115 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800116 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
117 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700118 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700119 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800120 SpeakerImpedanceReported speaker_impedance_reported = 71;
121 HardwareFailed hardware_failed = 72;
122 PhysicalDropDetected physical_drop_detected = 73;
123 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800124 MobileConnectionStateChanged mobile_connection_state_changed = 75;
125 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700126 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800127 AppCrashOccurred app_crash_occurred = 78;
128 ANROccurred anr_occurred = 79;
129 WTFOccurred wtf_occurred = 80;
130 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700131 GenericAtom generic_atom = 82;
Yangster-mac48b3d622018-08-18 12:38:11 -0700132 KeyValuePairsAtom key_value_pairs_atom = 83;
Bookatza7020bd2018-08-28 16:29:35 -0700133 VibratorStateChanged vibrator_state_changed = 84;
Yangster-mac96353002018-09-05 11:18:55 -0700134 DeferredJobStatsReported deferred_job_stats_reported = 85;
Yangster-mace16189a2018-08-26 12:20:16 -0700135 ThermalThrottlingStateChanged thermal_throttling = 86;
Tej Singhd6d6d772018-09-05 17:41:25 -0700136 FingerprintAcquired fingerprint_acquired = 87;
137 FingerprintAuthenticated fingerprint_authenticated = 88;
138 FingerprintErrorOccurred fingerprint_error_occurred = 89;
Yao Chend54f9dd2017-10-17 17:37:48 +0000139 }
David Chenc8a43242017-10-17 16:23:28 -0700140
David Chen6e3e6cb2018-01-03 16:14:06 -0800141 // Pulled events will start at field 10000.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100142 // Next: 10025
David Chenc8a43242017-10-17 16:23:28 -0700143 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800144 WifiBytesTransfer wifi_bytes_transfer = 10000;
145 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
146 MobileBytesTransfer mobile_bytes_transfer = 10002;
147 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800148 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800149 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800150 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800151 CpuTimePerFreq cpu_time_per_freq = 10008;
152 CpuTimePerUid cpu_time_per_uid = 10009;
153 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800154 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800155 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800156 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800157 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800158 SystemElapsedRealtime system_elapsed_realtime = 10014;
159 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800160 CpuActiveTime cpu_active_time = 10016;
161 CpuClusterTime cpu_cluster_time = 10017;
Tej Singh86dc9db2018-09-06 00:39:57 +0000162 DiskSpace disk_space = 10018 [deprecated=true];
Tej Singhbf972d92018-01-10 20:51:13 -0800163 RemainingBatteryCapacity remaining_battery_capacity = 10019;
164 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800165 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100166 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100167 BinderCallsExceptions binder_calls_exceptions = 10023;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +0100168 LooperStats looper_stats = 10024;
Tej Singh86dc9db2018-09-06 00:39:57 +0000169 DiskStats disk_stats = 10025;
170 DirectoryUsage directory_usage = 10026;
171 AppSize app_size = 10027;
172 CategorySize category_size = 10028;
Bookatz17f0d8a2018-09-13 12:56:32 -0700173 BatteryVoltage battery_voltage = 10030;
Tej Singhd6d6d772018-09-05 17:41:25 -0700174 NumFingerprints num_fingerprints = 10031;
Chenjie Yu12e5e672018-09-14 15:54:59 -0700175 ProcStats proc_stats = 10029;
David Chenc8a43242017-10-17 16:23:28 -0700176 }
yroa1fe77c2018-02-26 14:22:54 -0800177
178 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
179 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700180}
181
Yao Chend54f9dd2017-10-17 17:37:48 +0000182/**
Yangster-mac20877162017-12-22 17:19:39 -0800183 * This proto represents a node of an attribution chain.
184 * Note: All attribution chains are represented as a repeated field of type
185 * AttributionNode. It is understood that in such arrays, the order is that
186 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000187 */
Yangster-mac20877162017-12-22 17:19:39 -0800188message AttributionNode {
189 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800190 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800191
Yangster-mac20877162017-12-22 17:19:39 -0800192 // The (optional) string tag for an element in the attribution chain. If the
193 // element has no tag, it is encoded as an empty string.
194 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700195}
196
Yangster-mac48b3d622018-08-18 12:38:11 -0700197message KeyValuePair {
198 optional int32 key = 1;
199 oneof value {
200 int64 value_int = 2;
201 string value_str = 3;
202 float value_float = 4;
203 }
204}
205
206message KeyValuePairsAtom {
207 optional int32 uid = 1;
208 repeated KeyValuePair pairs = 2;
209}
210
Yao Chend54f9dd2017-10-17 17:37:48 +0000211/*
212 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800213 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000214 *
215 * RULES:
216 * - The field ids for each atom must start at 1, and count upwards by 1.
217 * Skipping field ids is not allowed.
218 * - These form an API, so renaming, renumbering or removing fields is
219 * not allowed between android releases. (This is not currently enforced,
220 * but there will be a tool to enforce this restriction).
221 * - The types must be built-in protocol buffer types, namely, no sub-messages
222 * are allowed (yet). The bytes type is also not allowed.
223 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800224 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000225 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800226 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000227 * - A field that is a uid should be a string field, tagged with the [xxx]
228 * annotation. The generated code on android will be represented by UIDs,
229 * and those UIDs will be translated in xxx to those strings.
230 *
231 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700232 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000233 * - If there is a UID, it goes first. Think in an object-oriented fashion.
234 * *****************************************************************************
235 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700236
Yao Chend54f9dd2017-10-17 17:37:48 +0000237/**
Yangster-mace16189a2018-08-26 12:20:16 -0700238 * Logs when the Thermal service HAL notifies the throttling start/stop events.
239 *
240 * Logged from:
241 * frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
242 */
243message ThermalThrottlingStateChanged {
244 optional android.os.TemperatureTypeEnum sensor_type = 1;
245
246 enum State {
247 UNKNOWN = 0;
248 START = 1;
249 STOP = 2;
250 }
251
252 optional State state = 2;
253
254 optional float temperature = 3;
255}
256
257/**
Yao Chend54f9dd2017-10-17 17:37:48 +0000258 * Logs when the screen state changes.
259 *
260 * Logged from:
261 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
262 */
263message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800264 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800265 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700266}
Yao Chend54f9dd2017-10-17 17:37:48 +0000267
268/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700269 * Logs that the process state of the uid, as determined by ActivityManager
270 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000271 *
272 * Logged from:
273 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
274 */
Bookatzc1a050a2017-10-10 15:49:28 -0700275message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700276 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000277
Bookatzdb026a22018-01-10 19:01:56 -0800278 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800279 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000280}
281
282/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700283 * Logs process state change of a process, as per the activity manager.
284 *
285 * Logged from:
286 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
287 */
288message ProcessStateChanged {
289 optional int32 uid = 1;
290 optional string process_name = 2;
291 optional string package_name = 3;
292 // TODO: remove this when validation is done
293 optional int64 version = 5;
294 // The state, from frameworks/base/core/proto/android/app/enums.proto.
295 optional android.app.ProcessStateEnum state = 4;
296}
297
298/**
299 * Logs when ActivityManagerService sleep state is changed.
300 *
301 * Logged from:
302 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
303 */
304message ActivityManagerSleepStateChanged {
305 // TODO: import frameworks proto
306 enum State {
307 UNKNOWN = 0;
308 ASLEEP = 1;
309 AWAKE = 2;
310 }
311 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
312}
313
314/**
315 * Logs when system memory state changes.
316 *
317 * Logged from:
318 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
319 */
320message MemoryFactorStateChanged {
321 // TODO: import frameworks proto
322 enum State {
323 MEMORY_UNKNOWN = 0;
324 NORMAL = 1; // normal.
325 MODERATE = 2; // moderate memory pressure.
326 LOW = 3; // low memory.
327 CRITICAL = 4; // critical memory.
328
329 }
330 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
331}
332
333/**
334 * Logs when app is using too much cpu, according to ActivityManagerService.
335 *
336 * Logged from:
337 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
338 */
339message ExcessiveCpuUsageReported {
340 optional int32 uid = 1;
341 optional string process_name = 2;
342 optional string package_name = 3;
343 // package version. TODO: remove this when validation is done
344 optional int64 version = 4;
345}
346
347/**
348 * Logs when a cached process is killed, along with its pss.
349 *
350 * Logged from:
351 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
352 */
353message CachedKillReported {
354 optional int32 uid = 1;
355 optional string process_name = 2;
356 optional string package_name = 3;
357 // TODO: remove this when validation is done
358 optional int64 version = 5;
359 optional int64 pss = 4;
360}
361
362/**
363 * Logs when memory stats of a process is reported.
364 *
365 * Logged from:
366 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
367 */
368message ProcessMemoryStatReported {
369 optional int32 uid = 1;
370 optional string process_name = 2;
371 optional string package_name = 3;
372 //TODO: remove this when validation is done
373 optional int64 version = 9;
374 optional int64 pss = 4;
375 optional int64 uss = 5;
376 optional int64 rss = 6;
377 enum Type {
378 ADD_PSS_INTERNAL_SINGLE = 0;
379 ADD_PSS_INTERNAL_ALL_MEM = 1;
380 ADD_PSS_INTERNAL_ALL_POLL = 2;
381 ADD_PSS_EXTERNAL = 3;
382 ADD_PSS_EXTERNAL_SLOW = 4;
383 }
384 optional Type type = 7;
385 optional int64 duration = 8;
386}
387
388/**
Bookatzc1a050a2017-10-10 15:49:28 -0700389 * Logs that a process started, finished, crashed, or ANRed.
390 *
391 * Logged from:
392 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
393 */
394message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700395 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700396
David Chen0b5c90c2018-01-25 16:51:49 -0800397 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800398 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700399
Bookatzddccf0a2017-11-28 16:48:14 -0800400 // What lifecycle state the process changed to.
401 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800402 enum State {
403 FINISHED = 0;
404 STARTED = 1;
405 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800406 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800407 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700408}
409
Bookatzc1a050a2017-10-10 15:49:28 -0700410/**
411 * Logs when the ble scan state changes.
412 *
413 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700414 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700415 */
416message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800417 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700418
419 enum State {
420 OFF = 0;
421 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700422 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
423 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700424 }
425 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700426
Bookatze5ec0b42018-03-26 13:34:56 -0700427 // Does the scan have a filter.
428 optional bool is_filtered = 3;
429 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
430 optional bool is_first_match = 4;
431 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
432 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700433}
434
435/**
436 * Logs reporting of a ble scan finding results.
437 *
438 * Logged from:
Bookatzae6738e2018-09-13 11:38:56 -0700439 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700440 */
Bookatzae6738e2018-09-13 11:38:56 -0700441// TODO: Consider also tracking per-scanner-id.
Bookatzc1a050a2017-10-10 15:49:28 -0700442message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800443 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700444
445 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800446 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700447}
448
449/**
450 * Logs when a sensor state changes.
451 *
452 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700453 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700454 */
455message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800456 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700457
Bookatzc1a050a2017-10-10 15:49:28 -0700458 // The id (int) of the sensor.
459 optional int32 sensor_id = 2;
460
461 enum State {
462 OFF = 0;
463 ON = 1;
464 }
465 optional State state = 3;
466}
467
468
469/**
470 * Logs when GPS state changes.
471 *
472 * Logged from:
473 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
474 */
475message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800476 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700477
478 enum State {
479 OFF = 0;
480 ON = 1;
481 }
482 optional State state = 2;
483}
484
485
486/**
487 * Logs when a sync manager sync state changes.
488 *
489 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700490 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700491 */
492message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800493 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700494
David Chen0b5c90c2018-01-25 16:51:49 -0800495 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800496 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700497
498 enum State {
499 OFF = 0;
500 ON = 1;
501 }
502 optional State state = 3;
503}
504
Yangster-mac96353002018-09-05 11:18:55 -0700505/*
506 * Deferred job stats.
507 *
508 * Logged from:
509 * frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
510*/
511message DeferredJobStatsReported {
512 repeated AttributionNode attribution_node = 1;
513
514 // Number of jobs deferred.
515 optional int32 num_jobs_deferred = 2;
516
517 // Time since the last job runs.
518 optional int64 time_since_last_job_millis = 3;
519}
520
Bookatzc1a050a2017-10-10 15:49:28 -0700521/**
522 * Logs when a job scheduler job state changes.
523 *
524 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700525 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700526 */
527message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800528 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700529
530 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800531 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700532
533 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800534 FINISHED = 0;
535 STARTED = 1;
536 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700537 }
538 optional State state = 3;
539
Tej Singh33a412b2018-03-16 18:43:59 -0700540 // The reason a job has stopped.
541 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700542 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700543 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700544}
545
546/**
547 * Logs when the audio state changes.
548 *
549 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700550 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700551 */
552message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800553 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700554
555 enum State {
556 OFF = 0;
557 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700558 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
559 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700560 }
561 optional State state = 2;
562}
563
564/**
565 * Logs when the video codec state changes.
566 *
567 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700568 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700569 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800570message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800571 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700572
573 enum State {
574 OFF = 0;
575 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700576 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
577 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700578 }
579 optional State state = 2;
580}
581
582/**
583 * Logs when the flashlight state changes.
584 *
585 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700586 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700587 */
588message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800589 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700590
591 enum State {
592 OFF = 0;
593 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700594 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
595 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700596 }
597 optional State state = 2;
598}
599
600/**
601 * Logs when the camera state changes.
602 *
603 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700604 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700605 */
606message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800607 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700608
609 enum State {
610 OFF = 0;
611 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700612 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
613 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700614 }
615 optional State state = 2;
616}
617
618/**
619 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000620 *
621 * Logged from:
622 * TODO
623 */
Bookatzd6746242017-10-24 18:39:35 -0700624message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800625 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000626
Bookatz1a1b0462018-01-12 11:47:03 -0800627 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
628 // From frameworks/base/core/proto/android/os/enums.proto.
629 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700630
631 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
632 optional string tag = 3;
633
634 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800635 RELEASE = 0;
636 ACQUIRE = 1;
637 CHANGE_RELEASE = 2;
638 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700639 }
640 optional State state = 4;
641}
642
643/**
Bookatzc1a050a2017-10-10 15:49:28 -0700644 * Logs when a partial wakelock is considered 'long' (over 1 min).
645 *
646 * Logged from:
647 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
648 */
649message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800650 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700651
Yao Chend54f9dd2017-10-17 17:37:48 +0000652 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
653 optional string tag = 2;
654
Bookatzc1a050a2017-10-10 15:49:28 -0700655 // TODO: I have no idea what this is.
656 optional string history_tag = 3;
657
658 enum State {
659 OFF = 0;
660 ON = 1;
661 }
662 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000663}
664
Bookatzc1a050a2017-10-10 15:49:28 -0700665/**
666 * Logs Battery Saver state change.
667 *
668 * Logged from:
669 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
670 */
671message BatterySaverModeStateChanged {
672 enum State {
673 OFF = 0;
674 ON = 1;
675 }
676 optional State state = 1;
677}
678
679/**
680 * Logs Doze mode state change.
681 *
682 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800683 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700684 */
685message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800686 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800687}
688
689
690/**
691 * Logs state change of Doze mode including maintenance windows.
692 *
693 * Logged from:
694 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
695 */
696message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800697 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700698}
699
700/**
701 * Logs screen brightness level.
702 *
703 * Logged from:
704 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
705 */
706message ScreenBrightnessChanged {
707 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
708 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700709}
710
711/**
712 * Logs battery level (percent full, from 0 to 100).
713 *
714 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700715 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700716 */
717message BatteryLevelChanged {
718 // Battery level. Should be in [0, 100].
719 optional int32 battery_level = 1;
720}
721
722/**
723 * Logs change in charging status of the device.
724 *
725 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700726 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700727 */
728message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800729 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
730 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700731}
732
733/**
734 * Logs whether the device is plugged in, and what power source it is using.
735 *
736 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700737 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700738 */
739message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800740 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
741 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700742}
743
Bookatz8c6571b2017-10-24 15:04:41 -0700744/**
745 * Logs when an app's wakeup alarm fires.
746 *
747 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700748 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700749 */
750message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800751 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800752
753 // Name of the wakeup alarm.
754 optional string tag = 2;
755}
756
757/**
758 * Logs when an an app causes the mobile radio to change state.
759 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
760 *
761 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700762 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800763 */
764message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800765 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800766
Bookatz1a1b0462018-01-12 11:47:03 -0800767 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
768 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800769}
770
771/**
772 * Logs when an an app causes the wifi radio to change state.
773 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
774 *
775 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700776 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800777 */
778message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800779 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800780
Bookatz1a1b0462018-01-12 11:47:03 -0800781 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
782 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700783}
784
785/**
786 * Logs kernel wakeup reasons and aborts.
787 *
788 * Logged from:
Bookatz56585ca2018-09-07 11:38:45 -0700789 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700790 */
791message KernelWakeupReported {
792 // Name of the kernel wakeup reason (or abort).
793 optional string wakeup_reason_name = 1;
794
795 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800796 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700797}
798
799/**
800 * Logs wifi locks held by an app.
801 *
802 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700803 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700804 */
805message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800806 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700807
808 enum State {
809 OFF = 0;
810 ON = 1;
811 }
812 optional State state = 2;
813}
814
815/**
816 * Logs wifi signal strength changes.
817 *
818 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700819 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700820 */
821message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800822 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
823 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700824}
825
826/**
827 * Logs wifi scans performed by an app.
828 *
829 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700830 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700831 */
832message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800833 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700834
835 enum State {
836 OFF = 0;
837 ON = 1;
838 }
839 optional State state = 2;
840}
841
842/**
Tej Singh4503e102018-01-04 14:35:01 -0800843 * Logs wifi multicast locks held by an app
844 *
845 * Logged from:
846 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
847 */
848message WifiMulticastLockStateChanged {
849 repeated AttributionNode attribution_node = 1;
850
851 enum State {
852 OFF = 0;
853 ON = 1;
854 }
855 optional State state = 2;
856}
857
858/**
Tej Singh1ea42892018-01-19 09:27:00 -0800859 * Logs shutdown reason and duration on next boot.
860 *
861 * Logged from:
862 * frameworks/base/core/java/com/android/server/BootReceiver.java
863 */
864message ShutdownSequenceReported {
865 // True if shutdown is for a reboot. Default: false if we do not know.
866 optional bool reboot = 1;
867
868 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
869 optional string reason = 2;
870
871 // Beginning of shutdown time in ms using wall clock time since unix epoch.
872 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800873 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800874
875 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800876 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800877}
878
Tej Singh6483ea42018-01-25 17:45:49 -0800879
880/**
881 * Logs boot reason and duration.
882 *
883 * Logged from:
884 * system/core/bootstat/bootstat.cpp
885 */
886message BootSequenceReported {
887 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
888 // Default: "<EMPTY>" if not available.
889 optional string bootloader_reason = 1;
890
891 // Reason for system boot. Eg. bootloader, reboot,userrequested
892 // Default: "<EMPTY>" if not available.
893 optional string system_reason = 2;
894
895 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800896 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800897
898 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800899 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800900
901 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800902 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800903
904 // Time since last boot in ms. Default: 0 if not available.
905 optional int64 time_since_last_boot = 6;
906}
907
Tej Singhc477d9c2018-02-05 18:31:39 -0800908
909/**
910 * Logs call state and disconnect cause (if applicable).
911 *
912 * Logged from:
913 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
914 */
915message CallStateChanged {
916 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
917 // From frameworks/base/core/proto/android/telecomm/enums.proto.
918 optional android.telecom.CallStateEnum call_state = 1;
919
920 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
921 // This value is only applicable when the call_state is DISCONNECTED, and
922 // should always be UNKNOWN if the call_state is not DISCONNECTED.
923 // From frameworks/base/core/proto/android/telecomm/enums.proto.
924 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
925
926 // True if the call is self-managed, which are apps that use the
927 // telecom infrastructure to make their own calls.
928 optional bool self_managed = 3;
929
930 // True if call is external. External calls are calls on connected Wear
931 // devices but show up in Telecom so the user can pull them onto the device.
932 optional bool external_call = 4;
933}
934
Tej Singh1ea42892018-01-19 09:27:00 -0800935/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800936 * Logs keyguard state. The keyguard is the lock screen.
937 *
938 * Logged from:
939 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
940 */
941message KeyguardStateChanged {
942 enum State {
943 UNKNOWN = 0;
944 // The keyguard is hidden when the phone is unlocked.
945 HIDDEN = 1;
946 // The keyguard is shown when the phone is locked (screen turns off).
947 SHOWN= 2;
948 // The keyguard is occluded when something is overlaying the keyguard.
949 // Eg. Opening the camera while on the lock screen.
950 OCCLUDED = 3;
951 }
952 optional State state = 1;
953}
954
955/**
956 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
957 * prompts the user to enter a password (pattern, pin, etc).
958 *
959 * Logged from:
960 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
961 */
962
963message KeyguardBouncerStateChanged {
964 enum State {
965 UNKNOWN = 0;
966 // Bouncer is hidden, either as a result of successfully entering the
967 // password, screen timing out, or user going back to lock screen.
968 HIDDEN = 1;
969 // This is when the user is being prompted to enter the password.
970 SHOWN = 2;
971 }
972 optional State state = 1;
973}
974
975/**
976 * Logs the result of entering a password into the keyguard bouncer.
977 *
978 * Logged from:
979 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
980 */
981message KeyguardBouncerPasswordEntered {
982 enum BouncerResult {
983 UNKNOWN = 0;
984 // The password entered was incorrect.
985 FAILURE = 1;
986 // The password entered was correct.
987 SUCCESS = 2;
988 }
989 optional BouncerResult result = 1;
990}
991
Tej Singha883b372018-02-15 11:30:01 -0800992/*
993 * Logs changes to the configuration of the device. The configuration is defined
994 * in frameworks/base/core/java/android/content/res/Configuration.java
995 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
996 * Please go there to interpret the possible values each field can be.
997 *
998 * Logged from:
999 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1000 */
1001message ResourceConfigurationChanged {
1002 // Bit mask of color capabilities of the screen.
1003 // Contains information about the color gamut and hdr mode of the screen.
1004 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
1005 optional int32 colorMode = 1;
1006
1007 // The target screen density being rendered to.
1008 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
1009 optional int32 densityDpi = 2;
1010
1011 // Current user preference for the scaling factor for fonts,
1012 // relative to the base density scaling.
1013 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
1014 optional float fontScale = 3;
1015
1016 // Flag indicating whether the hard keyboard is hidden.
1017 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
1018 optional int32 hardKeyboardHidden = 4;
1019
1020 // The type of keyboard attached to the device.
1021 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
1022 optional int32 keyboard = 5;
1023
1024 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
1025 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
1026 optional int32 keyboardHideen = 6;
1027
1028 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
1029 // 0 if undefined.
1030 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
1031 optional int32 mcc = 7;
1032
1033 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
1034 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
1035 // MNC_ZERO symbol defined in Configuration.java.
1036 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
1037 optional int32 mnc = 8;
1038
1039 // The kind of navigation available on the device.
1040 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
1041 optional int32 navigation = 9;
1042
1043 // Flag indicating whether the navigation is available.
1044 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
1045 optional int32 navigationHidden = 10;
1046
1047 // Overall orientation of the screen.
1048 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
1049 optional int32 orientation = 11;
1050
1051 // The current height of the available screen space, in dp units.
1052 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
1053 optional int32 screenHeightDp = 12;
1054
1055 // Bit mask of overall layout of the screen.
1056 // Contains information about screen size, whether the screen is wider/taller
1057 // than normal, whether the screen layout is right-tl-left or left-to-right,
1058 // and whether the screen has a rounded shape.
1059 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
1060 optional int32 screenLayout = 13;
1061
1062 // Current width of the available screen space, in dp units.
1063 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
1064 optional int32 screenWidthDp = 14;
1065
1066 // The smallest screen size an application will see in normal operation.
1067 // This is the smallest value of both screenWidthDp and screenHeightDp
1068 // in portrait and landscape.
1069 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1070 optional int32 smallestScreenWidthDp = 15;
1071
1072 // The type of touch screen attached to the device.
1073 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1074 optional int32 touchscreen = 16;
1075
1076 // Bit mask of the ui mode.
1077 // Contains information about the overall ui mode of the device.
1078 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1079 // Also contains information about whether the device is in night mode.
1080 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1081 optional int32 uiMode = 17;
1082}
1083
Tej Singheee317b2018-03-07 19:28:05 -08001084
1085/**
1086 * Logs changes in the connection state of the mobile radio.
1087 *
1088 * Logged from:
1089 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1090 */
1091message MobileConnectionStateChanged {
1092 // States are from the state machine DataConnection.java.
1093 enum State {
1094 UNKNOWN = 0;
1095 // The connection is inactive, or disconnected.
1096 INACTIVE = 1;
1097 // The connection is being activated, or connecting.
1098 ACTIVATING = 2;
1099 // The connection is active, or connected.
1100 ACTIVE = 3;
1101 // The connection is disconnecting.
1102 DISCONNECTING = 4;
1103 // The connection is disconnecting after creating a connection.
1104 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1105 }
1106 optional State state = 1;
1107 // For multi-sim phones, this distinguishes between the sim cards.
1108 optional int32 sim_slot_index = 2;
1109 // Used to identify the connection. Starts at 0 and increments by 1 for
1110 // every new network created. Resets whenever the device reboots.
1111 optional int32 data_connection_id = 3;
1112 // A bitmask for the capabilities of this connection.
1113 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1114 // Default value (if we have no information): 0
1115 optional int64 capabilities = 4;
1116 // If this connection has internet.
1117 // This just checks if the DEFAULT bit of capabilities is set.
1118 optional bool has_internet = 5;
1119}
1120
1121/**
1122 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1123 *
1124 * Logged from:
1125 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1126 */
1127message MobileRadioTechnologyChanged {
1128 optional android.telephony.NetworkTypeEnum state = 1;
1129 // For multi-sim phones, this distinguishes between the sim cards.
1130 optional int32 sim_slot_index = 2;
1131}
1132
Andrew Chantb56388b2018-03-22 21:07:33 -07001133/**
1134 * Logs the VID and PID of any connected USB devices.
1135 *
1136 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1137 *
1138 * Logged by Vendor.
1139 */
1140message UsbDeviceAttached {
1141 optional int32 vid = 1;
1142 optional int32 pid = 2;
1143 optional bool has_audio = 3;
1144 optional bool has_hid = 4;
1145 optional bool has_storage = 5;
1146}
1147
Tej Singheee317b2018-03-07 19:28:05 -08001148
Tej Singhdd7bd352018-02-09 19:33:15 -08001149/**
Tej Singh5d991e12018-03-09 19:48:11 -08001150 * Logs when Bluetooth is enabled and disabled.
1151 *
1152 * Logged from:
1153 * services/core/java/com/android/server/BluetoothManagerService.java
1154 */
1155message BluetoothEnabledStateChanged {
1156 repeated AttributionNode attribution_node = 1;
1157 // Whether or not bluetooth is enabled on the device.
1158 enum State {
1159 UNKNOWN = 0;
1160 ENABLED = 1;
1161 DISABLED = 2;
1162 }
1163 optional State state = 2;
1164 // The reason for being enabled/disabled.
1165 // Eg. Airplane mode, crash, application request.
1166 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1167 // If the reason is an application request, this will be the package name.
1168 optional string pkgName = 4;
1169}
1170
1171/**
1172 * Logs when a Bluetooth device connects and disconnects.
1173 *
1174 * Logged from:
1175 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1176 */
1177message BluetoothConnectionStateChanged {
1178 // The state of the connection.
1179 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1180 optional android.bluetooth.ConnectionStateEnum state = 1;
1181 // An identifier that can be used to match connect and disconnect events.
1182 // Currently is last two bytes of a hash of a device level ID and
1183 // the mac address of the bluetooth device that is connected.
1184 optional int32 obfuscated_id = 2;
1185 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1186 // From android.bluetooth.BluetoothAdapter.java
1187 optional int32 bt_profile = 3;
1188}
1189
1190/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001191 * Logs when something is plugged into or removed from the USB-C connector.
1192 *
1193 * Logged from:
1194 * Vendor USB HAL.
1195 */
1196message UsbConnectorStateChanged {
1197 enum State {
1198 DISCONNECTED = 0;
1199 CONNECTED = 1;
1200 }
1201 optional State state = 1;
1202}
1203
1204/**
1205 * Logs the reported speaker impedance.
1206 *
1207 * Logged from:
1208 * Vendor audio implementation.
1209 */
1210message SpeakerImpedanceReported {
1211 optional int32 speaker_location = 1;
1212 optional int32 impedance = 2;
1213}
1214
1215/**
1216 * Logs the report of a failed hardware.
1217 *
1218 * Logged from:
1219 * Vendor HALs.
1220 *
1221 */
1222message HardwareFailed {
1223 enum HardwareType {
1224 HARDWARE_FAILED_UNKNOWN = 0;
1225 HARDWARE_FAILED_MICROPHONE = 1;
1226 HARDWARE_FAILED_CODEC = 2;
1227 HARDWARE_FAILED_SPEAKER = 3;
1228 HARDWARE_FAILED_FINGERPRINT = 4;
1229 }
1230 optional HardwareType hardware_type = 1;
1231
1232 /* hardware_location allows vendors to differentiate between multiple instances of
1233 * the same hardware_type. The specific locations are vendor defined integers,
1234 * referring to board-specific numbering schemes.
1235 */
1236 optional int32 hardware_location = 2;
1237
1238 /* failure_code is specific to the HardwareType of the failed hardware.
1239 * It should use the enum values defined below.
1240 */
1241 enum MicrophoneFailureCode {
1242 MICROPHONE_FAILURE_COMPLETE = 0;
1243 }
1244 enum CodecFailureCode {
1245 CODEC_FAILURE_COMPLETE = 0;
1246 }
1247 enum SpeakerFailureCode {
1248 SPEAKER_FAILURE_COMPLETE = 0;
1249 SPEAKER_FAILURE_HIGH_Z = 1;
1250 SPEAKER_FAILURE_SHORT = 2;
1251 }
1252 enum FingerprintFailureCode {
1253 FINGERPRINT_FAILURE_COMPLETE = 0;
1254 FINGERPRINT_SENSOR_BROKEN = 1;
1255 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1256 }
1257 optional int32 failure_code = 3;
1258}
1259
1260/**
1261 * Log an event when the device has been physically dropped.
1262 * Reported from the /vendor partition.
1263 */
1264message PhysicalDropDetected {
1265 // Confidence that the event was actually a drop, 0 -> 100
1266 optional int32 confidence_pctg = 1;
1267 // Peak acceleration of the drop, in 1/1000s of a g.
1268 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001269 // Duration of freefall in ms
1270 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001271}
1272
1273/**
1274 * Log bucketed battery charge cycles.
1275 *
1276 * Each bucket represents cycles of the battery past
1277 * a given charge point. For example, bucket 1 is the
1278 * lowest 1/8th of the battery, and bucket 8 is 100%.
1279 *
1280 * Logged from:
1281 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1282 */
1283message ChargeCyclesReported {
1284 optional int32 cycle_bucket_1 = 1;
1285 optional int32 cycle_bucket_2 = 2;
1286 optional int32 cycle_bucket_3 = 3;
1287 optional int32 cycle_bucket_4 = 4;
1288 optional int32 cycle_bucket_5 = 5;
1289 optional int32 cycle_bucket_6 = 6;
1290 optional int32 cycle_bucket_7 = 7;
1291 optional int32 cycle_bucket_8 = 8;
1292}
1293
1294/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001295 * Logs the duration of a davey (jank of >=700ms) when it occurs
1296 *
1297 * Logged from:
1298 * frameworks/base/libs/hwui/JankTracker.cpp
1299 */
1300message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001301 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001302 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001303
Tej Singhbb8554a2018-01-26 11:59:14 -08001304 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001305 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001306}
1307
1308/**
Bookatze5885242017-10-24 20:10:31 -07001309 * Logs phone signal strength changes.
1310 *
1311 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001312 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001313 */
1314message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001315 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1316 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001317}
1318
1319/**
1320 * Logs that a setting was updated.
1321 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001322 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001323 * The tag and is_default allow resetting of settings to default values based on the specified
1324 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1325 */
1326message SettingChanged {
1327 // The name of the setting.
1328 optional string setting = 1;
1329
1330 // The change being imposed on this setting. May represent a number, eg "3".
1331 optional string value = 2;
1332
1333 // The new value of this setting. For most settings, this is same as value. For some settings,
1334 // value is +X or -X where X represents an element in a set. For example, if the previous value
1335 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1336 // The +/- feature is currently only used for location_providers_allowed.
1337 optional string new_value = 3;
1338
1339 // The previous value of this setting.
1340 optional string prev_value = 4;
1341
1342 // The tag used with the is_default for resetting sets of settings. This is generally null.
1343 optional string tag = 5;
1344
Bookatz90867622018-01-31 15:05:57 -08001345 // True if this setting with tag should be resettable.
1346 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001347
David Chenbd789912018-03-16 17:19:55 -07001348 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001349 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001350
1351 enum ChangeReason {
1352 UPDATED = 1; // Updated can be an insertion or an update.
1353 DELETED = 2;
1354 }
1355 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001356}
Chenjie Yub3dda412017-10-24 13:41:59 -07001357
Chenjie Yu05013b32017-11-21 10:21:41 -08001358/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001359 * Logs activity going to foreground or background
1360 *
1361 * Logged from:
1362 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1363 */
1364message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001365 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001366 optional string pkg_name = 2;
1367 optional string class_name = 3;
1368
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001369 enum State {
1370 BACKGROUND = 0;
1371 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001372 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001373 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001374}
David Chenc8a43242017-10-17 16:23:28 -07001375
1376/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001377 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001378 * Logged from:
1379 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1380 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001381message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001382 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001383
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001384 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001385
1386 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001387 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001388 optional string process_name = 3;
1389
1390 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001391 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001392
1393 optional string package_name = 5;
1394
1395 enum InstantApp {
1396 UNAVAILABLE = 0;
1397 FALSE = 1;
1398 TRUE = 2;
1399 }
1400 optional InstantApp is_instant_app = 6;
1401
1402 enum ForegroundState {
1403 UNKNOWN = 0;
1404 BACKGROUND = 1;
1405 FOREGROUND = 2;
1406 }
1407 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001408}
David Chen9e3808c2017-11-20 17:25:34 -08001409
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001410/**
1411 * Logs when a WTF (What a Terrible Failure) happened.
1412 * Logged from:
1413 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1414 */
1415message WTFOccurred {
1416 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001417
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001418 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001419
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001420 // The name of the process.
1421 // system_server if it is not by an app
1422 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001423
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001424 // The pid if available. -1 means not available.
1425 optional sint32 pid = 4;
1426}
1427
1428/**
1429 * Logs when system server reports low memory.
1430 * Logged from:
1431 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1432 */
1433message LowMemReported {
1434}
1435
1436/**
1437 * Logs when an app ANR (App Not Responding) occurs.
1438 * Logged from:
1439 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1440 */
1441message ANROccurred {
1442 optional int32 uid = 1 [(is_uid) = true];
1443
1444 optional string process_name = 2;
1445
1446 optional string short_component_name = 3;
1447
1448 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001449
1450 enum InstantApp {
1451 UNAVAILABLE = 0;
1452 FALSE = 1;
1453 TRUE = 2;
1454 }
1455 optional InstantApp is_instant_app = 5;
1456
1457 enum ForegroundState {
1458 UNKNOWN = 0;
1459 BACKGROUND = 1;
1460 FOREGROUND = 2;
1461 }
1462 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001463}
1464
Bookatza7020bd2018-08-28 16:29:35 -07001465/**
1466 * Logs when the vibrator state changes.
1467 * Logged from:
1468 * frameworks/base/services/core/java/com/android/server/VibratorService.java
1469 */
1470message VibratorStateChanged {
1471 repeated AttributionNode attribution_node = 1;
1472
1473 enum State {
1474 OFF = 0;
1475 ON = 1;
1476 }
1477 optional State state = 2;
1478
1479 // Duration (in milliseconds) requested to keep the vibrator on.
1480 // Only applicable for State == ON.
1481 optional int64 duration_millis = 3;
1482}
1483
David Chen0a368b22017-12-06 16:28:16 -08001484/*
1485 * Allows other apps to push events into statsd.
1486 * Logged from:
1487 * frameworks/base/core/java/android/util/StatsLog.java
1488 */
David Chen0b5c90c2018-01-25 16:51:49 -08001489message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001490 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001491 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001492
1493 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1494 optional int32 label = 2;
1495
1496 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1497 // predicates for the metrics).
1498 enum State {
1499 UNKNOWN = 0;
1500 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1501 STOP = 2;
1502 START = 3;
1503 }
1504 optional State state = 3;
1505}
1506
David Chen9e3808c2017-11-20 17:25:34 -08001507/**
Bookatz7948c872018-09-04 12:58:33 -07001508 * Logs the wall-clock time when a significant wall-clock time shift occurs.
1509 * For example, this could be due to the user manually changing the time.
1510 *
1511 * Logged from:
1512 * frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
1513 */
1514message WallClockTimeShifted {
1515 // New wall-clock time in milliseconds, according to System.currentTimeMillis().
1516 optional int64 wall_clock_timestamp_millis = 1;
1517}
1518
1519/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001520 * Logs when statsd detects an anomaly.
1521 *
1522 * Logged from:
1523 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1524 */
1525message AnomalyDetected {
1526 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001527 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001528
Yangster-mac94e197c2018-01-02 16:03:03 -08001529 // Id of the config whose anomaly detection alert fired.
1530 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001531
Yangster-mac94e197c2018-01-02 16:03:03 -08001532 // Id of the alert (i.e. name of the anomaly that was detected).
1533 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001534}
1535
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001536message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001537 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001538 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001539
1540 // The app package name.
1541 optional string pkg_name = 2;
1542
1543 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001544 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001545 WARM = 1;
1546 HOT = 2;
1547 COLD = 3;
1548 }
1549 // The transition type.
1550 optional TransitionType type = 3;
1551
1552 // The activity name.
1553 optional string activity_name = 4;
1554
1555 // The name of the calling app. Empty if not set.
1556 optional string calling_pkg_name = 5;
1557
1558 // Whether the app is an instant app.
1559 optional bool is_instant_app = 6;
1560
1561 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001562 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001563
Bookatz80d11a02018-01-16 10:46:35 -08001564 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001565
David Chen0b5c90c2018-01-25 16:51:49 -08001566 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001567 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001568 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001569 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001570 optional int32 bind_application_delay_millis = 11;
1571 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001572
1573 // Empty if not set.
1574 optional string launch_token = 13;
1575
Calin Juravle759fbda2018-02-20 19:52:30 +00001576 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001577 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001578
1579 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001580 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001581}
1582
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001583message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001584 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001585 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001586
1587 // The app package name.
1588 optional string pkg_name = 2;
1589
1590 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001591 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001592 WARM = 1;
1593 HOT = 2;
1594 COLD = 3;
1595 }
1596 // The transition type.
1597 optional TransitionType type = 3;
1598
1599 // The activity name.
1600 optional string activity_name = 4;
1601}
1602
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001603message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001604 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001605 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001606
1607 // The app package name.
1608 optional string pkg_name = 2;
1609
1610 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001611 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001612 WITH_BUNDLE = 1;
1613 WITHOUT_BUNDLE = 2;
1614 }
1615 // The transition type.
1616 optional TransitionType type = 3;
1617
1618 // The activity name.
1619 optional string activity_name = 4;
1620
1621 optional bool transition_process_running = 5;
1622
1623 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001624 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001625}
1626
Bookatz8fcd09a2017-12-18 13:01:10 -08001627/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001628 * Logs a picture-in-picture action
1629 * Logged from:
1630 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1631 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1632 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1633 */
1634message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001635 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001636 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001637
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001638 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001639
Chenjie Yu52cacc62017-12-08 18:11:45 -08001640 enum State {
1641 ENTERED = 1;
1642 EXPANDED_TO_FULL_SCREEN = 2;
1643 MINIMIZED = 3;
1644 DISMISSED = 4;
1645 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001646 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001647}
1648
1649/**
Chenjie Yue8904192017-12-08 19:12:57 -08001650 * Logs overlay action
1651 * Logged from:
1652 * services/core/java/com/android/server/wm/Session.java
1653 */
1654message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001655 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001656
1657 optional string package_name = 2;
1658
1659 optional bool using_alert_window = 3;
1660
1661 enum State {
1662 ENTERED = 1;
1663 EXITED = 2;
1664 }
1665 optional State state = 4;
1666}
1667
Chenjie Yuccfe6452018-01-30 11:33:21 -08001668/*
1669 * Logs foreground service starts and stops.
1670 * Note that this is not when a service starts or stops, but when it is
1671 * considered foreground.
1672 * Logged from
1673 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1674 */
1675message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001676 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001677 // package_name + "/" + class_name
1678 optional string short_name = 2;
1679
1680 enum State {
1681 ENTER = 1;
1682 EXIT = 2;
1683 }
1684 optional State state = 3;
1685}
1686
Chenjie Yue8904192017-12-08 19:12:57 -08001687/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001688 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1689 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1690 * attributed back to the parent (host) uid. One example is Chrome.
1691 *
1692 * Logged from:
1693 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1694 */
1695message IsolatedUidChanged {
1696 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001697 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001698 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001699 optional int32 parent_uid = 1;
1700
1701 optional int32 isolated_uid = 2;
1702
1703 // We expect an isolated uid to be removed before if it's used for another parent uid.
1704 enum Event {
1705 REMOVED = 0;
1706 CREATED = 1;
1707 }
1708 optional Event event = 3;
1709}
1710
1711/*
1712 * Logs the reception of an incoming network packet causing the main system to wake up for
1713 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1714 * and processed by WakeupController.cpp.
1715 */
1716message PacketWakeupOccurred {
1717 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1718 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001719 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001720 // The interface name on which the packet was received.
1721 optional string iface = 2;
1722 // The ethertype value of the packet.
1723 optional int32 ethertype = 3;
1724 // String representation of the destination MAC address of the packet.
1725 optional string destination_hardware_address = 4;
1726 // String representation of the source address of the packet if this was an IP packet.
1727 optional string source_ip = 5;
1728 // String representation of the destination address of the packet if this was an IP packet.
1729 optional string destination_ip = 6;
1730 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1731 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1732 // families.
1733 optional int32 ip_next_header = 7;
1734 // The source port if this was a TCP or UDP packet.
1735 optional int32 source_port = 8;
1736 // The destination port if this was a TCP or UDP packet.
1737 optional int32 destination_port = 9;
1738}
1739
1740/*
1741 * Logs the memory stats for an app on startup.
1742 * Logged from:
1743 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1744 */
1745message AppStartMemoryStateCaptured {
1746 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001747 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001748
1749 // The process name.
1750 optional string process_name = 2;
1751
1752 // The activity name.
1753 optional string activity_name = 3;
1754
1755 // # of page-faults
1756 optional int64 pgfault = 4;
1757
1758 // # of major page-faults
1759 optional int64 pgmajfault = 5;
1760
1761 // RSS
1762 optional int64 rss_in_bytes = 6;
1763
1764 // CACHE
1765 optional int64 cache_in_bytes = 7;
1766
1767 // SWAP
1768 optional int64 swap_in_bytes = 8;
1769}
1770
1771/*
1772 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1773 * for LMK event.
1774 * Logged from:
1775 * system/core/lmkd/lmkd.c
1776 */
1777message LmkStateChanged {
1778 enum State {
1779 UNKNOWN = 0;
1780 START = 1;
1781 STOP = 2;
1782 }
1783 optional State state = 1;
1784}
1785
1786/*
1787 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1788 * Logged from:
1789 * system/core/lmkd/lmkd.c
1790 */
1791message LmkKillOccurred {
1792 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001793 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001794
1795 // The process name.
1796 optional string process_name = 2;
1797
1798 // oom adj score.
1799 optional int32 oom_score = 3;
1800
1801 // # of page-faults
1802 optional int64 pgfault = 4;
1803
1804 // # of major page-faults
1805 optional int64 pgmajfault = 5;
1806
1807 // RSS
1808 optional int64 rss_in_bytes = 6;
1809
1810 // CACHE
1811 optional int64 cache_in_bytes = 7;
1812
1813 // SWAP
1814 optional int64 swap_in_bytes = 8;
1815}
1816
Rajeev Kumar51b54602018-03-01 12:18:26 -08001817/*
1818 * Logs when the ActivityManagerService detects that an app died.
1819 *
1820 * Logged from:
1821 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1822 */
1823message AppDied {
1824 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001825 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001826}
1827
Howard Ro21a039c2018-08-06 14:55:47 -07001828/**
1829 * An atom for generic metrics logging. Available from Android Q.
1830 */
1831message GenericAtom {
1832 // The uid of the application that sent this custom atom.
1833 optional int32 uid = 1 [(is_uid) = true];
1834
1835 // An event_id indicates the type of event.
Howard Ro0546d542018-08-30 16:23:44 -07001836 optional android.os.statsd.EventType event_id = 2;
Howard Ro21a039c2018-08-06 14:55:47 -07001837}
1838
Tej Singhd6d6d772018-09-05 17:41:25 -07001839/**
1840 * Logs when a fingerprint acquire event occurs.
1841 *
1842 * Logged from:
1843 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1844 */
1845message FingerprintAcquired {
1846 // The associated user. Eg: 0 for owners, 10+ for others.
1847 // Defined in android/os/UserHandle.java
1848 optional int32 user = 1;
1849 // If this acquire is for a crypto fingerprint.
1850 // e.g. Secure purchases, unlock password storage.
1851 optional bool is_crypto = 2;
1852}
1853
1854/**
1855 * Logs when a fingerprint authentication event occurs.
1856 *
1857 * Logged from:
1858 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1859 */
1860message FingerprintAuthenticated {
1861 // The associated user. Eg: 0 for owners, 10+ for others.
1862 // Defined in android/os/UserHandle.java
1863 optional int32 user = 1;
1864 // If this authentication is for a crypto fingerprint.
1865 // e.g. Secure purchases, unlock password storage.
1866 optional bool is_crypto = 2;
1867 // Whether or not this authentication was successful.
1868 optional bool is_authenticated = 3;
1869}
1870
1871/**
1872 * Logs when a fingerprint error occurs.
1873 *
1874 * Logged from:
1875 * frameworks/base/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java
1876 */
1877message FingerprintErrorOccurred {
1878 // The associated user. Eg: 0 for owners, 10+ for others.
1879 // Defined in android/os/UserHandle.java
1880 optional int32 user = 1;
1881 // If this error is for a crypto fingerprint.
1882 // e.g. Secure purchases, unlock password storage.
1883 optional bool is_crypto = 2;
1884
1885 enum Error {
1886 UNKNOWN = 0;
1887 LOCKOUT = 1;
1888 PERMANENT_LOCKOUT = 2;
1889 }
1890 // The type of error.
1891 optional Error error = 3;
1892}
Chenjie Yubbcbc602018-02-05 16:51:52 -08001893//////////////////////////////////////////////////////////////////////
1894// Pulled atoms below this line //
1895//////////////////////////////////////////////////////////////////////
1896
1897/**
David Chenc8a43242017-10-17 16:23:28 -07001898 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1899 *
1900 * Pulled from:
1901 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1902 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001903message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001904 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001905
1906 optional int64 rx_bytes = 2;
1907
1908 optional int64 rx_packets = 3;
1909
1910 optional int64 tx_bytes = 4;
1911
1912 optional int64 tx_packets = 5;
1913}
1914
1915/**
1916 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1917 *
1918 * Pulled from:
1919 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1920 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001921message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001922 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001923
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001924 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1925 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001926
1927 optional int64 rx_bytes = 3;
1928
1929 optional int64 rx_packets = 4;
1930
1931 optional int64 tx_bytes = 5;
1932
1933 optional int64 tx_packets = 6;
1934}
1935
1936/**
1937 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1938 *
1939 * Pulled from:
1940 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1941 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001942message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001943 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001944
1945 optional int64 rx_bytes = 2;
1946
1947 optional int64 rx_packets = 3;
1948
1949 optional int64 tx_bytes = 4;
1950
1951 optional int64 tx_packets = 5;
1952}
1953
1954/**
1955 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1956 *
1957 * Pulled from:
1958 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1959 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001960message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001961 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001962
Yao Chenc40a19d2018-03-15 16:48:25 -07001963 // 1 denotes foreground and 0 denotes background. This is called Set in
1964 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001965 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001966
1967 optional int64 rx_bytes = 3;
1968
1969 optional int64 rx_packets = 4;
1970
1971 optional int64 tx_bytes = 5;
1972
1973 optional int64 tx_packets = 6;
1974}
1975
1976/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001977 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1978 *
1979 * Pulled from:
1980 * StatsCompanionService
1981 */
1982message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001983 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001984
1985 optional int64 rx_bytes = 2;
1986
1987 optional int64 tx_bytes = 3;
1988}
1989
1990/**
David Chenc8a43242017-10-17 16:23:28 -07001991 * Pulls the kernel wakelock durations. This atom is adapted from
1992 * android/internal/os/KernelWakelockStats.java
1993 *
1994 * Pulled from:
1995 * StatsCompanionService using KernelWakelockReader.
1996 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001997message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001998 optional string name = 1;
1999
2000 optional int32 count = 2;
2001
2002 optional int32 version = 3;
2003
2004 optional int64 time = 4;
2005}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002006
Chenjie Yu05013b32017-11-21 10:21:41 -08002007/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002008 * Pulls low power state information. This includes platform and subsystem sleep state information,
2009 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002010 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07002011 * hardware/interfaces/power/1.1/types.hal
2012 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002013message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08002014 // Subsystem name
2015 optional string subsystem_name = 1;
2016 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
2017 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
2018 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002019 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08002020 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08002021 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08002022 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07002023}
Chenjie Yu7f8def92017-11-03 09:33:15 -07002024
Chenjie Yu05013b32017-11-21 10:21:41 -08002025/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07002026 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08002027 * Pulls the time the cpu spend on the frequency index. Frequency index
2028 * starts from highest to lowest. The value should be monotonically
2029 * increasing since boot. However, if there is a cpu
2030 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07002031 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002032message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07002033 optional uint32 cluster = 1;
2034 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002035 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07002036}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002037
Chenjie Yu05013b32017-11-21 10:21:41 -08002038/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002039 * Pulls Cpu Time Per Uid.
2040 * Note that isolated process uid time should be attributed to host uids.
2041 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002042message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07002043 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08002044 optional uint64 user_time_millis = 2;
2045 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002046}
2047
2048/**
2049 * Pulls Cpu Time Per Uid per frequency.
2050 * Note that isolated process uid time should be attributed to host uids.
2051 * For each uid, we order the time by descending frequencies.
2052 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002053message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07002054 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002055 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002056 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08002057}
Hugo Benichi884970e2017-11-14 22:42:46 +09002058
Chenjie Yu05013b32017-11-21 10:21:41 -08002059/**
2060 * Pulls Wifi Controller Activity Energy Info
2061 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08002062message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002063 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002064 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002065 // stack reported state
2066 // TODO: replace this with proto enum
2067 optional int32 stack_state = 2;
2068 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002069 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002070 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002071 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002072 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002073 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002074 // product of current(mA), voltage(V) and time(ms)
2075 optional uint64 controller_energy_used = 6;
2076}
2077
2078/**
2079 * Pulls Modem Activity Energy Info
2080 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08002081message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08002082 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002083 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08002084 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08002085 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08002086 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002087 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08002088 /**
2089 * Tx power index
2090 * index 0 = tx_power < 0dBm
2091 * index 1 = 0dBm < tx_power < 5dBm
2092 * index 2 = 5dBm < tx_power < 15dBm
2093 * index 3 = 15dBm < tx_power < 20dBm
2094 * index 4 = tx_power > 20dBm
2095 */
2096 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08002097 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08002098 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08002099 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08002100 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08002101 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08002102 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08002103 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08002104 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08002105 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08002106 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08002107 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08002108 // product of current(mA), voltage(V) and time(ms)
2109 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08002110}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002111
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002112/**
2113 * Pulls Bluetooth Activity Energy Info
2114 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
2115 */
2116message BluetoothActivityInfo {
2117 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08002118 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002119 // bluetooth stack state
2120 optional int32 bluetooth_stack_state = 2;
2121 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002122 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002123 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002124 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002125 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08002126 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002127 // product of current(mA), voltage(V) and time(ms)
2128 optional uint64 energy_used = 6;
2129}
2130
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08002131/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002132 * Logs the memory stats for a process.
2133 */
2134message ProcessMemoryState {
2135 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07002136 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002137
2138 // The process name.
2139 optional string process_name = 2;
2140
2141 // oom adj score.
2142 optional int32 oom_score = 3;
2143
2144 // # of page-faults
2145 optional int64 pgfault = 4;
2146
2147 // # of major page-faults
2148 optional int64 pgmajfault = 5;
2149
Rajeev Kumar90235992018-01-29 11:06:48 -08002150 // RSS
2151 optional int64 rss_in_bytes = 6;
2152
2153 // CACHE
2154 optional int64 cache_in_bytes = 7;
2155
2156 // SWAP
2157 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002158}
2159
2160/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002161 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002162 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002163message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002164 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002165}
2166
2167/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002168 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002169 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002170message SystemUptime {
2171 // Milliseconds since the system was booted.
2172 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2173 // for external input).
2174 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002175 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002176}
2177
2178/*
2179 * Reads from /proc/uid_concurrent_active_time which has the format:
2180 * active: X (X is # cores)
2181 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2182 * [uid1]: [time-0] [time-1] [time-2] ... ...
2183 * ...
2184 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2185 * The file contains a monotonically increasing count of time for a single boot.
2186 */
2187message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002188 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002189 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002190}
2191
2192/**
2193 * Reads from /proc/uid_concurrent_policy_time which has the format:
2194 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2195 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2196 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2197 * ...
2198 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2199 * The file contains a monotonically increasing count of time for a single boot.
2200 */
2201message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002202 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002203 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002204 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002205}
2206
2207/*
2208 * Pulls free disk space, for data, system partition and temporary directory.
2209 */
2210message DiskSpace {
2211 // available bytes in data partition
2212 optional uint64 data_available_bytes = 1;
2213 // available bytes in system partition
2214 optional uint64 system_available_bytes = 2;
2215 // available bytes in download cache or temp directories
2216 optional uint64 temp_available_bytes = 3;
2217}
Tej Singhbf972d92018-01-10 20:51:13 -08002218
2219/**
2220 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002221 * Pulled from:
2222 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002223 */
2224message RemainingBatteryCapacity {
2225 optional int32 charge_uAh = 1;
2226}
2227
2228/**
2229 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002230 * Pulled from:
2231 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002232 */
2233message FullBatteryCapacity {
2234 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002235}
2236
2237/**
Bookatz17f0d8a2018-09-13 12:56:32 -07002238 * Pulls battery voltage.
2239 * Pulled from:
2240 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
2241 */
2242message BatteryVoltage {
2243 // The voltage of the battery, in millivolts.
2244 optional int32 voltage_mV = 1;
2245}
2246
2247/**
Tej Singhd89137e2018-03-26 14:51:40 -07002248 * Pulls the temperature of various parts of the device.
2249 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002250 *
2251 * Pulled from:
2252 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2253 */
2254message Temperature {
2255 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2256 optional android.os.TemperatureTypeEnum sensor_location = 1;
2257
2258 // The name of the temperature source. Eg. CPU0
2259 optional string sensor_name = 2;
2260
Tej Singhd89137e2018-03-26 14:51:40 -07002261 // Temperature in tenths of a degree C.
2262 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002263}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002264
2265/**
2266 * Pulls the statistics of calls to Binder.
2267 *
Olivier Gaillardd25f7a82018-09-12 14:28:48 +01002268 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
2269 * config on the device.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002270 *
2271 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002272 */
2273message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002274 optional int32 uid = 1 [(is_uid) = true];
2275 // Fully qualified class name of the API call.
2276 //
2277 // This is a system server class name.
2278 //
2279 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2280 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2281 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2282 // commonly used APIs.
2283 optional string service_class_name = 2;
2284 // Method name of the API call. It can also be a transaction code if we cannot
2285 // resolve it to a name. See Binder#getTransactionName.
2286 //
2287 // This is a system server method name.
2288 optional string service_method_name = 3;
2289 // Total number of API calls.
2290 optional int64 call_count = 4;
2291 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2292 optional bool screen_interactive = 13;
2293 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2294 // call_count will be equal to recorded_call_count.
2295 //
2296 // If recorded_call_count is different than call_count, it means data collection has been
2297 // sampled. All the fields below will be sampled in this case.
2298 optional int64 recorded_call_count = 12;
2299 // Number of exceptions thrown by the API.
2300 optional int64 recorded_exception_count = 5;
2301 // Total latency of all API calls.
2302 // Average can be computed using total_latency_micros / recorded_call_count.
2303 optional int64 recorded_total_latency_micros = 6;
2304 // Maximum latency of one API call.
2305 optional int64 recorded_max_latency_micros = 7;
2306 // Total CPU usage of all API calls.
2307 // Average can be computed using total_cpu_micros / recorded_call_count.
2308 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2309 optional int64 recorded_total_cpu_micros = 8;
2310 // Maximum CPU usage of one API call.
2311 optional int64 recorded_max_cpu_micros = 9;
2312 // Maximum parcel reply size of one API call.
2313 optional int64 recorded_max_reply_size_bytes = 10;
2314 // Maximum parcel request size of one API call.
2315 optional int64 recorded_max_request_size_bytes = 11;
2316}
2317
2318/**
2319 * Pulls the statistics of exceptions during calls to Binder.
2320 *
2321 * Binder stats are cumulative from boot unless somebody reset the data using
2322 * > adb shell dumpsys binder_calls_stats --reset
2323 */
2324message BinderCallsExceptions {
2325 // Exception class name, e.g. java.lang.IllegalArgumentException.
2326 //
2327 // This is an exception class name thrown by the system server.
2328 optional string exception_class_name = 1;
2329 // Total number of exceptions.
2330 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002331}
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002332
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002333/**
2334 * Pulls the statistics of message dispatching on HandlerThreads.
2335 *
2336 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
2337 * config on the device.
2338 *
2339 * Next tag: 11
2340 */
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002341message LooperStats {
Marcin Oczeretkoec758722018-09-12 12:53:47 +01002342 // The uid that made a call to the System Server and caused the message to be enqueued.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002343 optional int32 uid = 1 [(is_uid) = true];
2344
2345 // Fully qualified class name of the handler target class.
2346 //
2347 // This field does not contain PII. This is a system server class name.
2348 optional string handler_class_name = 2;
2349
2350 // The name of the thread that runs the Looper.
2351 //
2352 // This field does not contain PII. This is a system server thread name.
2353 optional string looper_thread_name = 3;
2354
2355 // The name of the dispatched message.
2356 //
2357 // This field does not contain PII. This is a system server constant or class
2358 // name.
2359 optional string message_name = 4;
2360
2361 // Total number of successfully dispatched messages.
2362 optional int64 message_count = 5;
2363
2364 // Total number of messages that failed dispatching.
2365 optional int64 exception_count = 6;
2366
2367 // Total number of processed messages we have data recorded for. If we
2368 // collected data for all the messages, message_count will be equal to
2369 // recorded_message_count.
2370 //
2371 // If recorded_message_count is different than message_count, it means data
2372 // collection has been sampled. All the fields below will be sampled in this
2373 // case.
2374 optional int64 recorded_message_count = 7;
2375
2376 // Total latency of all processed messages.
2377 // Average can be computed using recorded_total_latency_micros /
2378 // recorded_message_count.
2379 optional int64 recorded_total_latency_micros = 8;
2380
2381 // Total CPU usage of all processed message.
2382 // Average can be computed using recorded_total_cpu_micros /
2383 // recorded_message_count. Total can be computed using
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002384 // recorded_total_cpu_micros / recorded_message_count * message_count.
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002385 optional int64 recorded_total_cpu_micros = 9;
Marcin Oczeretko3e6494e2018-09-10 18:06:52 +01002386
2387 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2388 optional bool screen_interactive = 10;
Marcin Oczeretkod8cc8592018-08-22 16:07:36 +01002389}
Tej Singh86dc9db2018-09-06 00:39:57 +00002390
2391/**
2392 * Pulls disk information, such as write speed and latency.
2393 */
2394message DiskStats {
2395 // Time taken to open, write 512B to, and close a file.
2396 // -1 if error performing the check.
2397 optional int64 data_write_latency_millis = 1;
2398
2399 optional bool file_based_encryption = 2;
2400
2401 // Recent disk write speed in kB/s.
2402 // -1 if error querying storageed.
2403 // 0 if data is unavailable.
2404 optional int32 recent_disk_write_speed = 3;
2405}
2406
2407
2408/**
2409 * Free and total bytes of the Data, Cache, and System partition.
2410 */
2411message DirectoryUsage {
2412 enum Directory {
2413 UNKNOWN = 0;
2414 DATA = 1;
2415 CACHE = 2;
2416 SYSTEM = 3;
2417 }
2418 optional Directory directory = 1;
2419 optional int64 free_bytes = 2;
2420 optional int64 total_bytes = 3;
2421}
2422
2423
2424/**
2425 * Size of an application: apk size, data size, and cache size.
2426 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2427 * Information is only reported for apps with the primary user (user 0).
2428 * Sizes are aggregated by package name.
2429 */
2430message AppSize {
2431 // Including uids will involve modifying diskstats logic.
2432 optional string package_name = 1;
2433 // App size in bytes. -1 if unavailable.
2434 optional int64 app_size_bytes = 2;
2435 // App data size in bytes. -1 if unavailable.
2436 optional int64 app_data_size_bytes = 3;
2437 // App cache size in bytes. -1 if unavailable.
2438 optional int64 app_cache_size_bytes = 4;
2439 // Time that the cache file was produced.
2440 // Uses System.currentTimeMillis(), which is wall clock time.
2441 optional int64 cache_time_millis = 5;
2442}
2443
2444
2445/**
2446 * Size of a particular category. Eg: photos, videos.
2447 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
2448 */
2449message CategorySize {
2450 enum Category {
2451 UNKNOWN = 0;
2452 APP_SIZE = 1;
2453 APP_DATA_SIZE = 2;
2454 APP_CACHE_SIZE = 3;
2455 PHOTOS = 4;
2456 VIDEOS = 5;
2457 AUDIO = 6;
2458 DOWNLOADS = 7;
2459 SYSTEM = 8;
2460 OTHER = 9;
2461 }
2462 optional Category category = 1;
2463 // Category size in bytes.
2464 optional int64 size_bytes = 2;
2465 // Time that the cache file was produced.
2466 // Uses System.currentTimeMillis(), which is wall clock time.
2467 optional int64 cache_time_millis = 3;
2468}
Tej Singhd6d6d772018-09-05 17:41:25 -07002469
2470/**
2471 * Pulls the number of fingerprints for each user.
2472 *
2473 * Pulled from StatsCompanionService, which queries FingerprintManager.
2474 */
2475message NumFingerprints {
2476 // The associated user. Eg: 0 for owners, 10+ for others.
2477 // Defined in android/os/UserHandle.java
2478 optional int32 user = 1;
2479 // Number of fingerprints registered to that user.
2480 optional int32 num_fingerprints = 2;
2481}
Chenjie Yu12e5e672018-09-14 15:54:59 -07002482
2483/**
2484 * Pulled from ProcessStatsService.java
2485 */
2486message ProcStats {
2487 optional android.service.procstats.ProcessStatsSectionProto proc_stats_section = 1;
2488}