blob: bf033a7f382640f84d40c169138ad36dd5cceec0 [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 Rocb767f62018-06-19 19:58:05 -070032import "frameworks/base/proto/src/metrics_constants.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080033
Yao Chend54f9dd2017-10-17 17:37:48 +000034/**
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * raw stats log events from the Android system, also known as "atoms."
37 *
38 * This field contains a single oneof with all of the available messages.
39 * The stats-log-api-gen tool runs as part of the Android build and
40 * generates the android.util.StatsLog class, which contains the constants
41 * and methods that Android uses to log.
42 *
Stefan Lafonae2df012017-11-14 09:17:21 -080043 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000044 * Instead, statsd on Android constructs these messages synthetically,
45 * in the format defined here and in stats_log.proto.
46 */
Stefan Lafonae2df012017-11-14 09:17:21 -080047message Atom {
48 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070049 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070050 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
51 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070052 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070053 BleScanResultReceived ble_scan_result_received = 4;
54 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080055 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070056 SyncStateChanged sync_state_changed = 7;
57 ScheduledJobStateChanged scheduled_job_state_changed = 8;
58 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070059 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080060 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
61 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
62 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070063 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
64 MemoryFactorStateChanged memory_factor_state_changed = 15;
65 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
66 CachedKillReported cached_kill_reported = 17;
67 ProcessMemoryStatReported process_memory_stat_reported = 18;
68 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080069 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
70 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
71 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070072 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080073 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070074 CameraStateChanged camera_state_changed = 25;
75 FlashlightStateChanged flashlight_state_changed = 26;
76 UidProcessStateChanged uid_process_state_changed = 27;
77 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
78 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070079 BatteryLevelChanged battery_level_changed = 30;
80 ChargingStateChanged charging_state_changed = 31;
81 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080082 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070083 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
84 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070085 WifiLockStateChanged wifi_lock_state_changed = 37;
86 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
87 WifiScanStateChanged wifi_scan_state_changed = 39;
88 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070089 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070090 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070091 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090092 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080093 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080094 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080095 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080096 AppStartOccurred app_start_occurred = 48;
97 AppStartCanceled app_start_canceled = 49;
98 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080099 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -0800100 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800101 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800102 LmkStateChanged lmk_state_changed = 54;
103 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800104 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800105 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800106 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800107 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800108 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800109 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800110 KeyguardStateChanged keyguard_state_changed = 62;
111 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
112 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800113 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800114 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800115 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
116 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700117 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700118 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800119 SpeakerImpedanceReported speaker_impedance_reported = 71;
120 HardwareFailed hardware_failed = 72;
121 PhysicalDropDetected physical_drop_detected = 73;
122 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800123 MobileConnectionStateChanged mobile_connection_state_changed = 75;
124 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700125 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800126 AppCrashOccurred app_crash_occurred = 78;
127 ANROccurred anr_occurred = 79;
128 WTFOccurred wtf_occurred = 80;
129 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700130 GenericAtom generic_atom = 82;
Yao Chend54f9dd2017-10-17 17:37:48 +0000131 }
David Chenc8a43242017-10-17 16:23:28 -0700132
David Chen6e3e6cb2018-01-03 16:14:06 -0800133 // Pulled events will start at field 10000.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100134 // Next: 10024
David Chenc8a43242017-10-17 16:23:28 -0700135 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 WifiBytesTransfer wifi_bytes_transfer = 10000;
137 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
138 MobileBytesTransfer mobile_bytes_transfer = 10002;
139 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800140 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800141 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800142 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800143 CpuTimePerFreq cpu_time_per_freq = 10008;
144 CpuTimePerUid cpu_time_per_uid = 10009;
145 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800146 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800147 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800148 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800149 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800150 SystemElapsedRealtime system_elapsed_realtime = 10014;
151 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800152 CpuActiveTime cpu_active_time = 10016;
153 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800154 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800155 RemainingBatteryCapacity remaining_battery_capacity = 10019;
156 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800157 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100158 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100159 BinderCallsExceptions binder_calls_exceptions = 10023;
David Chenc8a43242017-10-17 16:23:28 -0700160 }
yroa1fe77c2018-02-26 14:22:54 -0800161
162 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
163 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700164}
165
Yao Chend54f9dd2017-10-17 17:37:48 +0000166/**
Yangster-mac20877162017-12-22 17:19:39 -0800167 * This proto represents a node of an attribution chain.
168 * Note: All attribution chains are represented as a repeated field of type
169 * AttributionNode. It is understood that in such arrays, the order is that
170 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000171 */
Yangster-mac20877162017-12-22 17:19:39 -0800172message AttributionNode {
173 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800174 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800175
Yangster-mac20877162017-12-22 17:19:39 -0800176 // The (optional) string tag for an element in the attribution chain. If the
177 // element has no tag, it is encoded as an empty string.
178 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700179}
180
Yao Chend54f9dd2017-10-17 17:37:48 +0000181/*
182 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800183 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000184 *
185 * RULES:
186 * - The field ids for each atom must start at 1, and count upwards by 1.
187 * Skipping field ids is not allowed.
188 * - These form an API, so renaming, renumbering or removing fields is
189 * not allowed between android releases. (This is not currently enforced,
190 * but there will be a tool to enforce this restriction).
191 * - The types must be built-in protocol buffer types, namely, no sub-messages
192 * are allowed (yet). The bytes type is also not allowed.
193 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800194 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000195 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800196 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000197 * - A field that is a uid should be a string field, tagged with the [xxx]
198 * annotation. The generated code on android will be represented by UIDs,
199 * and those UIDs will be translated in xxx to those strings.
200 *
201 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700202 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000203 * - If there is a UID, it goes first. Think in an object-oriented fashion.
204 * *****************************************************************************
205 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700206
Yao Chend54f9dd2017-10-17 17:37:48 +0000207/**
208 * Logs when the screen state changes.
209 *
210 * Logged from:
211 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
212 */
213message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800214 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800215 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700216}
Yao Chend54f9dd2017-10-17 17:37:48 +0000217
218/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700219 * Logs that the process state of the uid, as determined by ActivityManager
220 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000221 *
222 * Logged from:
223 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
224 */
Bookatzc1a050a2017-10-10 15:49:28 -0700225message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700226 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000227
Bookatzdb026a22018-01-10 19:01:56 -0800228 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800229 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000230}
231
232/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700233 * Logs process state change of a process, as per the activity manager.
234 *
235 * Logged from:
236 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
237 */
238message ProcessStateChanged {
239 optional int32 uid = 1;
240 optional string process_name = 2;
241 optional string package_name = 3;
242 // TODO: remove this when validation is done
243 optional int64 version = 5;
244 // The state, from frameworks/base/core/proto/android/app/enums.proto.
245 optional android.app.ProcessStateEnum state = 4;
246}
247
248/**
249 * Logs when ActivityManagerService sleep state is changed.
250 *
251 * Logged from:
252 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
253 */
254message ActivityManagerSleepStateChanged {
255 // TODO: import frameworks proto
256 enum State {
257 UNKNOWN = 0;
258 ASLEEP = 1;
259 AWAKE = 2;
260 }
261 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
262}
263
264/**
265 * Logs when system memory state changes.
266 *
267 * Logged from:
268 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
269 */
270message MemoryFactorStateChanged {
271 // TODO: import frameworks proto
272 enum State {
273 MEMORY_UNKNOWN = 0;
274 NORMAL = 1; // normal.
275 MODERATE = 2; // moderate memory pressure.
276 LOW = 3; // low memory.
277 CRITICAL = 4; // critical memory.
278
279 }
280 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
281}
282
283/**
284 * Logs when app is using too much cpu, according to ActivityManagerService.
285 *
286 * Logged from:
287 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
288 */
289message ExcessiveCpuUsageReported {
290 optional int32 uid = 1;
291 optional string process_name = 2;
292 optional string package_name = 3;
293 // package version. TODO: remove this when validation is done
294 optional int64 version = 4;
295}
296
297/**
298 * Logs when a cached process is killed, along with its pss.
299 *
300 * Logged from:
301 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
302 */
303message CachedKillReported {
304 optional int32 uid = 1;
305 optional string process_name = 2;
306 optional string package_name = 3;
307 // TODO: remove this when validation is done
308 optional int64 version = 5;
309 optional int64 pss = 4;
310}
311
312/**
313 * Logs when memory stats of a process is reported.
314 *
315 * Logged from:
316 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
317 */
318message ProcessMemoryStatReported {
319 optional int32 uid = 1;
320 optional string process_name = 2;
321 optional string package_name = 3;
322 //TODO: remove this when validation is done
323 optional int64 version = 9;
324 optional int64 pss = 4;
325 optional int64 uss = 5;
326 optional int64 rss = 6;
327 enum Type {
328 ADD_PSS_INTERNAL_SINGLE = 0;
329 ADD_PSS_INTERNAL_ALL_MEM = 1;
330 ADD_PSS_INTERNAL_ALL_POLL = 2;
331 ADD_PSS_EXTERNAL = 3;
332 ADD_PSS_EXTERNAL_SLOW = 4;
333 }
334 optional Type type = 7;
335 optional int64 duration = 8;
336}
337
338/**
Bookatzc1a050a2017-10-10 15:49:28 -0700339 * Logs that a process started, finished, crashed, or ANRed.
340 *
341 * Logged from:
342 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
343 */
344message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700345 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700346
David Chen0b5c90c2018-01-25 16:51:49 -0800347 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800348 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700349
Bookatzddccf0a2017-11-28 16:48:14 -0800350 // What lifecycle state the process changed to.
351 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800352 enum State {
353 FINISHED = 0;
354 STARTED = 1;
355 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800356 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800357 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700358}
359
Bookatzc1a050a2017-10-10 15:49:28 -0700360/**
361 * Logs when the ble scan state changes.
362 *
363 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700364 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700365 */
366message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800367 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700368
369 enum State {
370 OFF = 0;
371 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700372 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
373 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700374 }
375 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700376
Bookatze5ec0b42018-03-26 13:34:56 -0700377 // Does the scan have a filter.
378 optional bool is_filtered = 3;
379 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
380 optional bool is_first_match = 4;
381 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
382 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700383}
384
385/**
386 * Logs reporting of a ble scan finding results.
387 *
388 * Logged from:
389 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
390 */
391// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
392message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800393 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700394
395 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800396 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700397}
398
399/**
400 * Logs when a sensor state changes.
401 *
402 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700403 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700404 */
405message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800406 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700407
Bookatzc1a050a2017-10-10 15:49:28 -0700408 // The id (int) of the sensor.
409 optional int32 sensor_id = 2;
410
411 enum State {
412 OFF = 0;
413 ON = 1;
414 }
415 optional State state = 3;
416}
417
418
419/**
420 * Logs when GPS state changes.
421 *
422 * Logged from:
423 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
424 */
425message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800426 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700427
428 enum State {
429 OFF = 0;
430 ON = 1;
431 }
432 optional State state = 2;
433}
434
435
436/**
437 * Logs when a sync manager sync state changes.
438 *
439 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700440 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700441 */
442message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800443 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700444
David Chen0b5c90c2018-01-25 16:51:49 -0800445 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800446 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700447
448 enum State {
449 OFF = 0;
450 ON = 1;
451 }
452 optional State state = 3;
453}
454
455/**
456 * Logs when a job scheduler job state changes.
457 *
458 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700459 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700460 */
461message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800462 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700463
464 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800465 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700466
467 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800468 FINISHED = 0;
469 STARTED = 1;
470 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700471 }
472 optional State state = 3;
473
Tej Singh33a412b2018-03-16 18:43:59 -0700474 // The reason a job has stopped.
475 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700476 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700477 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700478}
479
480/**
481 * Logs when the audio state changes.
482 *
483 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700484 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700485 */
486message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800487 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700488
489 enum State {
490 OFF = 0;
491 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700492 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
493 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700494 }
495 optional State state = 2;
496}
497
498/**
499 * Logs when the video codec state changes.
500 *
501 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700502 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700503 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800504message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800505 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700506
507 enum State {
508 OFF = 0;
509 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700510 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
511 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700512 }
513 optional State state = 2;
514}
515
516/**
517 * Logs when the flashlight state changes.
518 *
519 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700520 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700521 */
522message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800523 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700524
525 enum State {
526 OFF = 0;
527 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700528 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
529 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700530 }
531 optional State state = 2;
532}
533
534/**
535 * Logs when the camera state changes.
536 *
537 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700538 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700539 */
540message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800541 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700542
543 enum State {
544 OFF = 0;
545 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700546 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
547 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700548 }
549 optional State state = 2;
550}
551
552/**
553 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000554 *
555 * Logged from:
556 * TODO
557 */
Bookatzd6746242017-10-24 18:39:35 -0700558message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800559 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000560
Bookatz1a1b0462018-01-12 11:47:03 -0800561 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
562 // From frameworks/base/core/proto/android/os/enums.proto.
563 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700564
565 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
566 optional string tag = 3;
567
568 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800569 RELEASE = 0;
570 ACQUIRE = 1;
571 CHANGE_RELEASE = 2;
572 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700573 }
574 optional State state = 4;
575}
576
577/**
Bookatzc1a050a2017-10-10 15:49:28 -0700578 * Logs when a partial wakelock is considered 'long' (over 1 min).
579 *
580 * Logged from:
581 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
582 */
583message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800584 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700585
Yao Chend54f9dd2017-10-17 17:37:48 +0000586 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
587 optional string tag = 2;
588
Bookatzc1a050a2017-10-10 15:49:28 -0700589 // TODO: I have no idea what this is.
590 optional string history_tag = 3;
591
592 enum State {
593 OFF = 0;
594 ON = 1;
595 }
596 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000597}
598
Bookatzc1a050a2017-10-10 15:49:28 -0700599/**
600 * Logs Battery Saver state change.
601 *
602 * Logged from:
603 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
604 */
605message BatterySaverModeStateChanged {
606 enum State {
607 OFF = 0;
608 ON = 1;
609 }
610 optional State state = 1;
611}
612
613/**
614 * Logs Doze mode state change.
615 *
616 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800617 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700618 */
619message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800620 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800621}
622
623
624/**
625 * Logs state change of Doze mode including maintenance windows.
626 *
627 * Logged from:
628 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
629 */
630message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800631 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700632}
633
634/**
635 * Logs screen brightness level.
636 *
637 * Logged from:
638 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
639 */
640message ScreenBrightnessChanged {
641 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
642 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700643}
644
645/**
646 * Logs battery level (percent full, from 0 to 100).
647 *
648 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700649 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700650 */
651message BatteryLevelChanged {
652 // Battery level. Should be in [0, 100].
653 optional int32 battery_level = 1;
654}
655
656/**
657 * Logs change in charging status of the device.
658 *
659 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700660 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700661 */
662message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800663 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
664 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700665}
666
667/**
668 * Logs whether the device is plugged in, and what power source it is using.
669 *
670 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700671 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700672 */
673message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800674 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
675 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700676}
677
Bookatz8c6571b2017-10-24 15:04:41 -0700678/**
679 * Logs when an app's wakeup alarm fires.
680 *
681 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700682 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700683 */
684message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800685 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800686
687 // Name of the wakeup alarm.
688 optional string tag = 2;
689}
690
691/**
692 * Logs when an an app causes the mobile radio to change state.
693 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
694 *
695 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700696 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800697 */
698message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800699 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800700
Bookatz1a1b0462018-01-12 11:47:03 -0800701 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
702 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800703}
704
705/**
706 * Logs when an an app causes the wifi radio to change state.
707 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
708 *
709 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700710 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800711 */
712message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800713 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800714
Bookatz1a1b0462018-01-12 11:47:03 -0800715 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
716 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700717}
718
719/**
720 * Logs kernel wakeup reasons and aborts.
721 *
722 * Logged from:
723 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
724 */
725message KernelWakeupReported {
726 // Name of the kernel wakeup reason (or abort).
727 optional string wakeup_reason_name = 1;
728
729 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800730 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700731}
732
733/**
734 * Logs wifi locks held by an app.
735 *
736 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700737 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700738 */
739message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800740 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700741
742 enum State {
743 OFF = 0;
744 ON = 1;
745 }
746 optional State state = 2;
747}
748
749/**
750 * Logs wifi signal strength changes.
751 *
752 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700753 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700754 */
755message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800756 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
757 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700758}
759
760/**
761 * Logs wifi scans performed by an app.
762 *
763 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700764 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700765 */
766message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800767 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700768
769 enum State {
770 OFF = 0;
771 ON = 1;
772 }
773 optional State state = 2;
774}
775
776/**
Tej Singh4503e102018-01-04 14:35:01 -0800777 * Logs wifi multicast locks held by an app
778 *
779 * Logged from:
780 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
781 */
782message WifiMulticastLockStateChanged {
783 repeated AttributionNode attribution_node = 1;
784
785 enum State {
786 OFF = 0;
787 ON = 1;
788 }
789 optional State state = 2;
790}
791
792/**
Tej Singh1ea42892018-01-19 09:27:00 -0800793 * Logs shutdown reason and duration on next boot.
794 *
795 * Logged from:
796 * frameworks/base/core/java/com/android/server/BootReceiver.java
797 */
798message ShutdownSequenceReported {
799 // True if shutdown is for a reboot. Default: false if we do not know.
800 optional bool reboot = 1;
801
802 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
803 optional string reason = 2;
804
805 // Beginning of shutdown time in ms using wall clock time since unix epoch.
806 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800807 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800808
809 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800810 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800811}
812
Tej Singh6483ea42018-01-25 17:45:49 -0800813
814/**
815 * Logs boot reason and duration.
816 *
817 * Logged from:
818 * system/core/bootstat/bootstat.cpp
819 */
820message BootSequenceReported {
821 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
822 // Default: "<EMPTY>" if not available.
823 optional string bootloader_reason = 1;
824
825 // Reason for system boot. Eg. bootloader, reboot,userrequested
826 // Default: "<EMPTY>" if not available.
827 optional string system_reason = 2;
828
829 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800830 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800831
832 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800833 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800834
835 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800836 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800837
838 // Time since last boot in ms. Default: 0 if not available.
839 optional int64 time_since_last_boot = 6;
840}
841
Tej Singhc477d9c2018-02-05 18:31:39 -0800842
843/**
844 * Logs call state and disconnect cause (if applicable).
845 *
846 * Logged from:
847 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
848 */
849message CallStateChanged {
850 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
851 // From frameworks/base/core/proto/android/telecomm/enums.proto.
852 optional android.telecom.CallStateEnum call_state = 1;
853
854 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
855 // This value is only applicable when the call_state is DISCONNECTED, and
856 // should always be UNKNOWN if the call_state is not DISCONNECTED.
857 // From frameworks/base/core/proto/android/telecomm/enums.proto.
858 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
859
860 // True if the call is self-managed, which are apps that use the
861 // telecom infrastructure to make their own calls.
862 optional bool self_managed = 3;
863
864 // True if call is external. External calls are calls on connected Wear
865 // devices but show up in Telecom so the user can pull them onto the device.
866 optional bool external_call = 4;
867}
868
Tej Singh1ea42892018-01-19 09:27:00 -0800869/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800870 * Logs keyguard state. The keyguard is the lock screen.
871 *
872 * Logged from:
873 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
874 */
875message KeyguardStateChanged {
876 enum State {
877 UNKNOWN = 0;
878 // The keyguard is hidden when the phone is unlocked.
879 HIDDEN = 1;
880 // The keyguard is shown when the phone is locked (screen turns off).
881 SHOWN= 2;
882 // The keyguard is occluded when something is overlaying the keyguard.
883 // Eg. Opening the camera while on the lock screen.
884 OCCLUDED = 3;
885 }
886 optional State state = 1;
887}
888
889/**
890 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
891 * prompts the user to enter a password (pattern, pin, etc).
892 *
893 * Logged from:
894 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
895 */
896
897message KeyguardBouncerStateChanged {
898 enum State {
899 UNKNOWN = 0;
900 // Bouncer is hidden, either as a result of successfully entering the
901 // password, screen timing out, or user going back to lock screen.
902 HIDDEN = 1;
903 // This is when the user is being prompted to enter the password.
904 SHOWN = 2;
905 }
906 optional State state = 1;
907}
908
909/**
910 * Logs the result of entering a password into the keyguard bouncer.
911 *
912 * Logged from:
913 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
914 */
915message KeyguardBouncerPasswordEntered {
916 enum BouncerResult {
917 UNKNOWN = 0;
918 // The password entered was incorrect.
919 FAILURE = 1;
920 // The password entered was correct.
921 SUCCESS = 2;
922 }
923 optional BouncerResult result = 1;
924}
925
Tej Singha883b372018-02-15 11:30:01 -0800926/*
927 * Logs changes to the configuration of the device. The configuration is defined
928 * in frameworks/base/core/java/android/content/res/Configuration.java
929 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
930 * Please go there to interpret the possible values each field can be.
931 *
932 * Logged from:
933 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
934 */
935message ResourceConfigurationChanged {
936 // Bit mask of color capabilities of the screen.
937 // Contains information about the color gamut and hdr mode of the screen.
938 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
939 optional int32 colorMode = 1;
940
941 // The target screen density being rendered to.
942 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
943 optional int32 densityDpi = 2;
944
945 // Current user preference for the scaling factor for fonts,
946 // relative to the base density scaling.
947 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
948 optional float fontScale = 3;
949
950 // Flag indicating whether the hard keyboard is hidden.
951 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
952 optional int32 hardKeyboardHidden = 4;
953
954 // The type of keyboard attached to the device.
955 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
956 optional int32 keyboard = 5;
957
958 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
959 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
960 optional int32 keyboardHideen = 6;
961
962 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
963 // 0 if undefined.
964 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
965 optional int32 mcc = 7;
966
967 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
968 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
969 // MNC_ZERO symbol defined in Configuration.java.
970 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
971 optional int32 mnc = 8;
972
973 // The kind of navigation available on the device.
974 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
975 optional int32 navigation = 9;
976
977 // Flag indicating whether the navigation is available.
978 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
979 optional int32 navigationHidden = 10;
980
981 // Overall orientation of the screen.
982 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
983 optional int32 orientation = 11;
984
985 // The current height of the available screen space, in dp units.
986 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
987 optional int32 screenHeightDp = 12;
988
989 // Bit mask of overall layout of the screen.
990 // Contains information about screen size, whether the screen is wider/taller
991 // than normal, whether the screen layout is right-tl-left or left-to-right,
992 // and whether the screen has a rounded shape.
993 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
994 optional int32 screenLayout = 13;
995
996 // Current width of the available screen space, in dp units.
997 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
998 optional int32 screenWidthDp = 14;
999
1000 // The smallest screen size an application will see in normal operation.
1001 // This is the smallest value of both screenWidthDp and screenHeightDp
1002 // in portrait and landscape.
1003 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1004 optional int32 smallestScreenWidthDp = 15;
1005
1006 // The type of touch screen attached to the device.
1007 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1008 optional int32 touchscreen = 16;
1009
1010 // Bit mask of the ui mode.
1011 // Contains information about the overall ui mode of the device.
1012 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1013 // Also contains information about whether the device is in night mode.
1014 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1015 optional int32 uiMode = 17;
1016}
1017
Tej Singheee317b2018-03-07 19:28:05 -08001018
1019/**
1020 * Logs changes in the connection state of the mobile radio.
1021 *
1022 * Logged from:
1023 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1024 */
1025message MobileConnectionStateChanged {
1026 // States are from the state machine DataConnection.java.
1027 enum State {
1028 UNKNOWN = 0;
1029 // The connection is inactive, or disconnected.
1030 INACTIVE = 1;
1031 // The connection is being activated, or connecting.
1032 ACTIVATING = 2;
1033 // The connection is active, or connected.
1034 ACTIVE = 3;
1035 // The connection is disconnecting.
1036 DISCONNECTING = 4;
1037 // The connection is disconnecting after creating a connection.
1038 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1039 }
1040 optional State state = 1;
1041 // For multi-sim phones, this distinguishes between the sim cards.
1042 optional int32 sim_slot_index = 2;
1043 // Used to identify the connection. Starts at 0 and increments by 1 for
1044 // every new network created. Resets whenever the device reboots.
1045 optional int32 data_connection_id = 3;
1046 // A bitmask for the capabilities of this connection.
1047 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1048 // Default value (if we have no information): 0
1049 optional int64 capabilities = 4;
1050 // If this connection has internet.
1051 // This just checks if the DEFAULT bit of capabilities is set.
1052 optional bool has_internet = 5;
1053}
1054
1055/**
1056 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1057 *
1058 * Logged from:
1059 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1060 */
1061message MobileRadioTechnologyChanged {
1062 optional android.telephony.NetworkTypeEnum state = 1;
1063 // For multi-sim phones, this distinguishes between the sim cards.
1064 optional int32 sim_slot_index = 2;
1065}
1066
Andrew Chantb56388b2018-03-22 21:07:33 -07001067/**
1068 * Logs the VID and PID of any connected USB devices.
1069 *
1070 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1071 *
1072 * Logged by Vendor.
1073 */
1074message UsbDeviceAttached {
1075 optional int32 vid = 1;
1076 optional int32 pid = 2;
1077 optional bool has_audio = 3;
1078 optional bool has_hid = 4;
1079 optional bool has_storage = 5;
1080}
1081
Tej Singheee317b2018-03-07 19:28:05 -08001082
Tej Singhdd7bd352018-02-09 19:33:15 -08001083/**
Tej Singh5d991e12018-03-09 19:48:11 -08001084 * Logs when Bluetooth is enabled and disabled.
1085 *
1086 * Logged from:
1087 * services/core/java/com/android/server/BluetoothManagerService.java
1088 */
1089message BluetoothEnabledStateChanged {
1090 repeated AttributionNode attribution_node = 1;
1091 // Whether or not bluetooth is enabled on the device.
1092 enum State {
1093 UNKNOWN = 0;
1094 ENABLED = 1;
1095 DISABLED = 2;
1096 }
1097 optional State state = 2;
1098 // The reason for being enabled/disabled.
1099 // Eg. Airplane mode, crash, application request.
1100 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1101 // If the reason is an application request, this will be the package name.
1102 optional string pkgName = 4;
1103}
1104
1105/**
1106 * Logs when a Bluetooth device connects and disconnects.
1107 *
1108 * Logged from:
1109 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1110 */
1111message BluetoothConnectionStateChanged {
1112 // The state of the connection.
1113 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1114 optional android.bluetooth.ConnectionStateEnum state = 1;
1115 // An identifier that can be used to match connect and disconnect events.
1116 // Currently is last two bytes of a hash of a device level ID and
1117 // the mac address of the bluetooth device that is connected.
1118 optional int32 obfuscated_id = 2;
1119 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1120 // From android.bluetooth.BluetoothAdapter.java
1121 optional int32 bt_profile = 3;
1122}
1123
1124/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001125 * Logs when something is plugged into or removed from the USB-C connector.
1126 *
1127 * Logged from:
1128 * Vendor USB HAL.
1129 */
1130message UsbConnectorStateChanged {
1131 enum State {
1132 DISCONNECTED = 0;
1133 CONNECTED = 1;
1134 }
1135 optional State state = 1;
1136}
1137
1138/**
1139 * Logs the reported speaker impedance.
1140 *
1141 * Logged from:
1142 * Vendor audio implementation.
1143 */
1144message SpeakerImpedanceReported {
1145 optional int32 speaker_location = 1;
1146 optional int32 impedance = 2;
1147}
1148
1149/**
1150 * Logs the report of a failed hardware.
1151 *
1152 * Logged from:
1153 * Vendor HALs.
1154 *
1155 */
1156message HardwareFailed {
1157 enum HardwareType {
1158 HARDWARE_FAILED_UNKNOWN = 0;
1159 HARDWARE_FAILED_MICROPHONE = 1;
1160 HARDWARE_FAILED_CODEC = 2;
1161 HARDWARE_FAILED_SPEAKER = 3;
1162 HARDWARE_FAILED_FINGERPRINT = 4;
1163 }
1164 optional HardwareType hardware_type = 1;
1165
1166 /* hardware_location allows vendors to differentiate between multiple instances of
1167 * the same hardware_type. The specific locations are vendor defined integers,
1168 * referring to board-specific numbering schemes.
1169 */
1170 optional int32 hardware_location = 2;
1171
1172 /* failure_code is specific to the HardwareType of the failed hardware.
1173 * It should use the enum values defined below.
1174 */
1175 enum MicrophoneFailureCode {
1176 MICROPHONE_FAILURE_COMPLETE = 0;
1177 }
1178 enum CodecFailureCode {
1179 CODEC_FAILURE_COMPLETE = 0;
1180 }
1181 enum SpeakerFailureCode {
1182 SPEAKER_FAILURE_COMPLETE = 0;
1183 SPEAKER_FAILURE_HIGH_Z = 1;
1184 SPEAKER_FAILURE_SHORT = 2;
1185 }
1186 enum FingerprintFailureCode {
1187 FINGERPRINT_FAILURE_COMPLETE = 0;
1188 FINGERPRINT_SENSOR_BROKEN = 1;
1189 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1190 }
1191 optional int32 failure_code = 3;
1192}
1193
1194/**
1195 * Log an event when the device has been physically dropped.
1196 * Reported from the /vendor partition.
1197 */
1198message PhysicalDropDetected {
1199 // Confidence that the event was actually a drop, 0 -> 100
1200 optional int32 confidence_pctg = 1;
1201 // Peak acceleration of the drop, in 1/1000s of a g.
1202 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001203 // Duration of freefall in ms
1204 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001205}
1206
1207/**
1208 * Log bucketed battery charge cycles.
1209 *
1210 * Each bucket represents cycles of the battery past
1211 * a given charge point. For example, bucket 1 is the
1212 * lowest 1/8th of the battery, and bucket 8 is 100%.
1213 *
1214 * Logged from:
1215 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1216 */
1217message ChargeCyclesReported {
1218 optional int32 cycle_bucket_1 = 1;
1219 optional int32 cycle_bucket_2 = 2;
1220 optional int32 cycle_bucket_3 = 3;
1221 optional int32 cycle_bucket_4 = 4;
1222 optional int32 cycle_bucket_5 = 5;
1223 optional int32 cycle_bucket_6 = 6;
1224 optional int32 cycle_bucket_7 = 7;
1225 optional int32 cycle_bucket_8 = 8;
1226}
1227
1228/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001229 * Logs the duration of a davey (jank of >=700ms) when it occurs
1230 *
1231 * Logged from:
1232 * frameworks/base/libs/hwui/JankTracker.cpp
1233 */
1234message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001235 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001236 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001237
Tej Singhbb8554a2018-01-26 11:59:14 -08001238 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001239 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001240}
1241
1242/**
Bookatze5885242017-10-24 20:10:31 -07001243 * Logs phone signal strength changes.
1244 *
1245 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001246 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001247 */
1248message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001249 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1250 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001251}
1252
1253/**
1254 * Logs that a setting was updated.
1255 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001256 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001257 * The tag and is_default allow resetting of settings to default values based on the specified
1258 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1259 */
1260message SettingChanged {
1261 // The name of the setting.
1262 optional string setting = 1;
1263
1264 // The change being imposed on this setting. May represent a number, eg "3".
1265 optional string value = 2;
1266
1267 // The new value of this setting. For most settings, this is same as value. For some settings,
1268 // value is +X or -X where X represents an element in a set. For example, if the previous value
1269 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1270 // The +/- feature is currently only used for location_providers_allowed.
1271 optional string new_value = 3;
1272
1273 // The previous value of this setting.
1274 optional string prev_value = 4;
1275
1276 // The tag used with the is_default for resetting sets of settings. This is generally null.
1277 optional string tag = 5;
1278
Bookatz90867622018-01-31 15:05:57 -08001279 // True if this setting with tag should be resettable.
1280 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001281
David Chenbd789912018-03-16 17:19:55 -07001282 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001283 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001284
1285 enum ChangeReason {
1286 UPDATED = 1; // Updated can be an insertion or an update.
1287 DELETED = 2;
1288 }
1289 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001290}
Chenjie Yub3dda412017-10-24 13:41:59 -07001291
Chenjie Yu05013b32017-11-21 10:21:41 -08001292/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001293 * Logs activity going to foreground or background
1294 *
1295 * Logged from:
1296 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1297 */
1298message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001299 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001300 optional string pkg_name = 2;
1301 optional string class_name = 3;
1302
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001303 enum State {
1304 BACKGROUND = 0;
1305 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001306 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001307 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001308}
David Chenc8a43242017-10-17 16:23:28 -07001309
1310/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001311 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001312 * Logged from:
1313 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1314 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001315message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001316 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001317
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001318 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001319
1320 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001321 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001322 optional string process_name = 3;
1323
1324 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001325 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001326
1327 optional string package_name = 5;
1328
1329 enum InstantApp {
1330 UNAVAILABLE = 0;
1331 FALSE = 1;
1332 TRUE = 2;
1333 }
1334 optional InstantApp is_instant_app = 6;
1335
1336 enum ForegroundState {
1337 UNKNOWN = 0;
1338 BACKGROUND = 1;
1339 FOREGROUND = 2;
1340 }
1341 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001342}
David Chen9e3808c2017-11-20 17:25:34 -08001343
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001344/**
1345 * Logs when a WTF (What a Terrible Failure) happened.
1346 * Logged from:
1347 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1348 */
1349message WTFOccurred {
1350 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001351
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001352 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001353
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001354 // The name of the process.
1355 // system_server if it is not by an app
1356 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001357
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001358 // The pid if available. -1 means not available.
1359 optional sint32 pid = 4;
1360}
1361
1362/**
1363 * Logs when system server reports low memory.
1364 * Logged from:
1365 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1366 */
1367message LowMemReported {
1368}
1369
1370/**
1371 * Logs when an app ANR (App Not Responding) occurs.
1372 * Logged from:
1373 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1374 */
1375message ANROccurred {
1376 optional int32 uid = 1 [(is_uid) = true];
1377
1378 optional string process_name = 2;
1379
1380 optional string short_component_name = 3;
1381
1382 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001383
1384 enum InstantApp {
1385 UNAVAILABLE = 0;
1386 FALSE = 1;
1387 TRUE = 2;
1388 }
1389 optional InstantApp is_instant_app = 5;
1390
1391 enum ForegroundState {
1392 UNKNOWN = 0;
1393 BACKGROUND = 1;
1394 FOREGROUND = 2;
1395 }
1396 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001397}
1398
David Chen0a368b22017-12-06 16:28:16 -08001399/*
1400 * Allows other apps to push events into statsd.
1401 * Logged from:
1402 * frameworks/base/core/java/android/util/StatsLog.java
1403 */
David Chen0b5c90c2018-01-25 16:51:49 -08001404message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001405 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001406 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001407
1408 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1409 optional int32 label = 2;
1410
1411 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1412 // predicates for the metrics).
1413 enum State {
1414 UNKNOWN = 0;
1415 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1416 STOP = 2;
1417 START = 3;
1418 }
1419 optional State state = 3;
1420}
1421
David Chen9e3808c2017-11-20 17:25:34 -08001422/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001423 * Logs when statsd detects an anomaly.
1424 *
1425 * Logged from:
1426 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1427 */
1428message AnomalyDetected {
1429 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001430 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001431
Yangster-mac94e197c2018-01-02 16:03:03 -08001432 // Id of the config whose anomaly detection alert fired.
1433 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001434
Yangster-mac94e197c2018-01-02 16:03:03 -08001435 // Id of the alert (i.e. name of the anomaly that was detected).
1436 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001437}
1438
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001439message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001440 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001441 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001442
1443 // The app package name.
1444 optional string pkg_name = 2;
1445
1446 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001447 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001448 WARM = 1;
1449 HOT = 2;
1450 COLD = 3;
1451 }
1452 // The transition type.
1453 optional TransitionType type = 3;
1454
1455 // The activity name.
1456 optional string activity_name = 4;
1457
1458 // The name of the calling app. Empty if not set.
1459 optional string calling_pkg_name = 5;
1460
1461 // Whether the app is an instant app.
1462 optional bool is_instant_app = 6;
1463
1464 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001465 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001466
Bookatz80d11a02018-01-16 10:46:35 -08001467 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001468
David Chen0b5c90c2018-01-25 16:51:49 -08001469 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001470 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001471 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001472 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001473 optional int32 bind_application_delay_millis = 11;
1474 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001475
1476 // Empty if not set.
1477 optional string launch_token = 13;
1478
Calin Juravle759fbda2018-02-20 19:52:30 +00001479 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001480 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001481
1482 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001483 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001484}
1485
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001486message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001487 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001488 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001489
1490 // The app package name.
1491 optional string pkg_name = 2;
1492
1493 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001494 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001495 WARM = 1;
1496 HOT = 2;
1497 COLD = 3;
1498 }
1499 // The transition type.
1500 optional TransitionType type = 3;
1501
1502 // The activity name.
1503 optional string activity_name = 4;
1504}
1505
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001506message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001507 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001508 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001509
1510 // The app package name.
1511 optional string pkg_name = 2;
1512
1513 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001514 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001515 WITH_BUNDLE = 1;
1516 WITHOUT_BUNDLE = 2;
1517 }
1518 // The transition type.
1519 optional TransitionType type = 3;
1520
1521 // The activity name.
1522 optional string activity_name = 4;
1523
1524 optional bool transition_process_running = 5;
1525
1526 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001527 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001528}
1529
Bookatz8fcd09a2017-12-18 13:01:10 -08001530/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001531 * Logs a picture-in-picture action
1532 * Logged from:
1533 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1534 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1535 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1536 */
1537message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001538 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001539 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001540
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001541 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001542
Chenjie Yu52cacc62017-12-08 18:11:45 -08001543 enum State {
1544 ENTERED = 1;
1545 EXPANDED_TO_FULL_SCREEN = 2;
1546 MINIMIZED = 3;
1547 DISMISSED = 4;
1548 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001549 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001550}
1551
1552/**
Chenjie Yue8904192017-12-08 19:12:57 -08001553 * Logs overlay action
1554 * Logged from:
1555 * services/core/java/com/android/server/wm/Session.java
1556 */
1557message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001558 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001559
1560 optional string package_name = 2;
1561
1562 optional bool using_alert_window = 3;
1563
1564 enum State {
1565 ENTERED = 1;
1566 EXITED = 2;
1567 }
1568 optional State state = 4;
1569}
1570
Chenjie Yuccfe6452018-01-30 11:33:21 -08001571/*
1572 * Logs foreground service starts and stops.
1573 * Note that this is not when a service starts or stops, but when it is
1574 * considered foreground.
1575 * Logged from
1576 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1577 */
1578message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001579 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001580 // package_name + "/" + class_name
1581 optional string short_name = 2;
1582
1583 enum State {
1584 ENTER = 1;
1585 EXIT = 2;
1586 }
1587 optional State state = 3;
1588}
1589
Chenjie Yue8904192017-12-08 19:12:57 -08001590/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001591 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1592 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1593 * attributed back to the parent (host) uid. One example is Chrome.
1594 *
1595 * Logged from:
1596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1597 */
1598message IsolatedUidChanged {
1599 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001600 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001601 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001602 optional int32 parent_uid = 1;
1603
1604 optional int32 isolated_uid = 2;
1605
1606 // We expect an isolated uid to be removed before if it's used for another parent uid.
1607 enum Event {
1608 REMOVED = 0;
1609 CREATED = 1;
1610 }
1611 optional Event event = 3;
1612}
1613
1614/*
1615 * Logs the reception of an incoming network packet causing the main system to wake up for
1616 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1617 * and processed by WakeupController.cpp.
1618 */
1619message PacketWakeupOccurred {
1620 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1621 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001622 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001623 // The interface name on which the packet was received.
1624 optional string iface = 2;
1625 // The ethertype value of the packet.
1626 optional int32 ethertype = 3;
1627 // String representation of the destination MAC address of the packet.
1628 optional string destination_hardware_address = 4;
1629 // String representation of the source address of the packet if this was an IP packet.
1630 optional string source_ip = 5;
1631 // String representation of the destination address of the packet if this was an IP packet.
1632 optional string destination_ip = 6;
1633 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1634 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1635 // families.
1636 optional int32 ip_next_header = 7;
1637 // The source port if this was a TCP or UDP packet.
1638 optional int32 source_port = 8;
1639 // The destination port if this was a TCP or UDP packet.
1640 optional int32 destination_port = 9;
1641}
1642
1643/*
1644 * Logs the memory stats for an app on startup.
1645 * Logged from:
1646 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1647 */
1648message AppStartMemoryStateCaptured {
1649 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001650 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001651
1652 // The process name.
1653 optional string process_name = 2;
1654
1655 // The activity name.
1656 optional string activity_name = 3;
1657
1658 // # of page-faults
1659 optional int64 pgfault = 4;
1660
1661 // # of major page-faults
1662 optional int64 pgmajfault = 5;
1663
1664 // RSS
1665 optional int64 rss_in_bytes = 6;
1666
1667 // CACHE
1668 optional int64 cache_in_bytes = 7;
1669
1670 // SWAP
1671 optional int64 swap_in_bytes = 8;
1672}
1673
1674/*
1675 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1676 * for LMK event.
1677 * Logged from:
1678 * system/core/lmkd/lmkd.c
1679 */
1680message LmkStateChanged {
1681 enum State {
1682 UNKNOWN = 0;
1683 START = 1;
1684 STOP = 2;
1685 }
1686 optional State state = 1;
1687}
1688
1689/*
1690 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1691 * Logged from:
1692 * system/core/lmkd/lmkd.c
1693 */
1694message LmkKillOccurred {
1695 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001696 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001697
1698 // The process name.
1699 optional string process_name = 2;
1700
1701 // oom adj score.
1702 optional int32 oom_score = 3;
1703
1704 // # of page-faults
1705 optional int64 pgfault = 4;
1706
1707 // # of major page-faults
1708 optional int64 pgmajfault = 5;
1709
1710 // RSS
1711 optional int64 rss_in_bytes = 6;
1712
1713 // CACHE
1714 optional int64 cache_in_bytes = 7;
1715
1716 // SWAP
1717 optional int64 swap_in_bytes = 8;
1718}
1719
Rajeev Kumar51b54602018-03-01 12:18:26 -08001720/*
1721 * Logs when the ActivityManagerService detects that an app died.
1722 *
1723 * Logged from:
1724 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1725 */
1726message AppDied {
1727 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001728 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001729}
1730
Chenjie Yubbcbc602018-02-05 16:51:52 -08001731//////////////////////////////////////////////////////////////////////
1732// Pulled atoms below this line //
1733//////////////////////////////////////////////////////////////////////
1734
1735/**
David Chenc8a43242017-10-17 16:23:28 -07001736 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1737 *
1738 * Pulled from:
1739 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1740 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001741message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001742 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001743
1744 optional int64 rx_bytes = 2;
1745
1746 optional int64 rx_packets = 3;
1747
1748 optional int64 tx_bytes = 4;
1749
1750 optional int64 tx_packets = 5;
1751}
1752
1753/**
1754 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1755 *
1756 * Pulled from:
1757 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1758 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001759message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001760 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001761
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001762 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1763 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001764
1765 optional int64 rx_bytes = 3;
1766
1767 optional int64 rx_packets = 4;
1768
1769 optional int64 tx_bytes = 5;
1770
1771 optional int64 tx_packets = 6;
1772}
1773
1774/**
1775 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1776 *
1777 * Pulled from:
1778 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1779 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001780message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001781 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001782
1783 optional int64 rx_bytes = 2;
1784
1785 optional int64 rx_packets = 3;
1786
1787 optional int64 tx_bytes = 4;
1788
1789 optional int64 tx_packets = 5;
1790}
1791
1792/**
1793 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1794 *
1795 * Pulled from:
1796 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1797 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001798message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001799 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001800
Yao Chenc40a19d2018-03-15 16:48:25 -07001801 // 1 denotes foreground and 0 denotes background. This is called Set in
1802 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001803 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001804
1805 optional int64 rx_bytes = 3;
1806
1807 optional int64 rx_packets = 4;
1808
1809 optional int64 tx_bytes = 5;
1810
1811 optional int64 tx_packets = 6;
1812}
1813
1814/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001815 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1816 *
1817 * Pulled from:
1818 * StatsCompanionService
1819 */
1820message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001821 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001822
1823 optional int64 rx_bytes = 2;
1824
1825 optional int64 tx_bytes = 3;
1826}
1827
1828/**
David Chenc8a43242017-10-17 16:23:28 -07001829 * Pulls the kernel wakelock durations. This atom is adapted from
1830 * android/internal/os/KernelWakelockStats.java
1831 *
1832 * Pulled from:
1833 * StatsCompanionService using KernelWakelockReader.
1834 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001835message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001836 optional string name = 1;
1837
1838 optional int32 count = 2;
1839
1840 optional int32 version = 3;
1841
1842 optional int64 time = 4;
1843}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001844
Chenjie Yu05013b32017-11-21 10:21:41 -08001845/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001846 * Pulls low power state information. This includes platform and subsystem sleep state information,
1847 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001848 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001849 * hardware/interfaces/power/1.1/types.hal
1850 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001851message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001852 // Subsystem name
1853 optional string subsystem_name = 1;
1854 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1855 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1856 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001857 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001858 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001859 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001860 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001861}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001862
Chenjie Yu05013b32017-11-21 10:21:41 -08001863/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001864 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001865 * Pulls the time the cpu spend on the frequency index. Frequency index
1866 * starts from highest to lowest. The value should be monotonically
1867 * increasing since boot. However, if there is a cpu
1868 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001869 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001870message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001871 optional uint32 cluster = 1;
1872 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001873 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001874}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001875
Chenjie Yu05013b32017-11-21 10:21:41 -08001876/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001877 * Pulls Cpu Time Per Uid.
1878 * Note that isolated process uid time should be attributed to host uids.
1879 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001880message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001881 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001882 optional uint64 user_time_millis = 2;
1883 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001884}
1885
1886/**
1887 * Pulls Cpu Time Per Uid per frequency.
1888 * Note that isolated process uid time should be attributed to host uids.
1889 * For each uid, we order the time by descending frequencies.
1890 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001891message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001892 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001893 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001894 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001895}
Hugo Benichi884970e2017-11-14 22:42:46 +09001896
Chenjie Yu05013b32017-11-21 10:21:41 -08001897/**
1898 * Pulls Wifi Controller Activity Energy Info
1899 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001900message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001901 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001902 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001903 // stack reported state
1904 // TODO: replace this with proto enum
1905 optional int32 stack_state = 2;
1906 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001907 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001908 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001909 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001910 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001911 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001912 // product of current(mA), voltage(V) and time(ms)
1913 optional uint64 controller_energy_used = 6;
1914}
1915
1916/**
1917 * Pulls Modem Activity Energy Info
1918 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001919message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001920 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001921 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001922 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001923 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001924 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001925 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001926 /**
1927 * Tx power index
1928 * index 0 = tx_power < 0dBm
1929 * index 1 = 0dBm < tx_power < 5dBm
1930 * index 2 = 5dBm < tx_power < 15dBm
1931 * index 3 = 15dBm < tx_power < 20dBm
1932 * index 4 = tx_power > 20dBm
1933 */
1934 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001935 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001936 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001937 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001938 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001939 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001940 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001941 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001942 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001943 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001944 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001945 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001946 // product of current(mA), voltage(V) and time(ms)
1947 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001948}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001949
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001950/**
1951 * Pulls Bluetooth Activity Energy Info
1952 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1953 */
1954message BluetoothActivityInfo {
1955 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001956 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001957 // bluetooth stack state
1958 optional int32 bluetooth_stack_state = 2;
1959 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001960 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001961 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001962 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001963 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001964 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001965 // product of current(mA), voltage(V) and time(ms)
1966 optional uint64 energy_used = 6;
1967}
1968
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001969/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001970 * Logs the memory stats for a process.
1971 */
1972message ProcessMemoryState {
1973 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001974 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001975
1976 // The process name.
1977 optional string process_name = 2;
1978
1979 // oom adj score.
1980 optional int32 oom_score = 3;
1981
1982 // # of page-faults
1983 optional int64 pgfault = 4;
1984
1985 // # of major page-faults
1986 optional int64 pgmajfault = 5;
1987
Rajeev Kumar90235992018-01-29 11:06:48 -08001988 // RSS
1989 optional int64 rss_in_bytes = 6;
1990
1991 // CACHE
1992 optional int64 cache_in_bytes = 7;
1993
1994 // SWAP
1995 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001996}
1997
1998/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001999 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002000 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002001message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002002 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002003}
2004
2005/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002006 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002007 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002008message SystemUptime {
2009 // Milliseconds since the system was booted.
2010 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2011 // for external input).
2012 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002013 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002014}
2015
2016/*
2017 * Reads from /proc/uid_concurrent_active_time which has the format:
2018 * active: X (X is # cores)
2019 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2020 * [uid1]: [time-0] [time-1] [time-2] ... ...
2021 * ...
2022 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2023 * The file contains a monotonically increasing count of time for a single boot.
2024 */
2025message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002026 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002027 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002028}
2029
2030/**
2031 * Reads from /proc/uid_concurrent_policy_time which has the format:
2032 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2033 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2034 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2035 * ...
2036 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2037 * The file contains a monotonically increasing count of time for a single boot.
2038 */
2039message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002040 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002041 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002042 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002043}
2044
2045/*
2046 * Pulls free disk space, for data, system partition and temporary directory.
2047 */
2048message DiskSpace {
2049 // available bytes in data partition
2050 optional uint64 data_available_bytes = 1;
2051 // available bytes in system partition
2052 optional uint64 system_available_bytes = 2;
2053 // available bytes in download cache or temp directories
2054 optional uint64 temp_available_bytes = 3;
2055}
Tej Singhbf972d92018-01-10 20:51:13 -08002056
2057/**
2058 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002059 * Pulled from:
2060 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002061 */
2062message RemainingBatteryCapacity {
2063 optional int32 charge_uAh = 1;
2064}
2065
2066/**
2067 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002068 * Pulled from:
2069 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002070 */
2071message FullBatteryCapacity {
2072 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002073}
2074
2075/**
Tej Singhd89137e2018-03-26 14:51:40 -07002076 * Pulls the temperature of various parts of the device.
2077 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002078 *
2079 * Pulled from:
2080 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2081 */
2082message Temperature {
2083 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2084 optional android.os.TemperatureTypeEnum sensor_location = 1;
2085
2086 // The name of the temperature source. Eg. CPU0
2087 optional string sensor_name = 2;
2088
Tej Singhd89137e2018-03-26 14:51:40 -07002089 // Temperature in tenths of a degree C.
2090 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002091}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002092
2093/**
2094 * Pulls the statistics of calls to Binder.
2095 *
2096 * Binder stats are cumulative from boot unless somebody reset the data using
2097 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002098 *
2099 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002100 */
2101message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002102 optional int32 uid = 1 [(is_uid) = true];
2103 // Fully qualified class name of the API call.
2104 //
2105 // This is a system server class name.
2106 //
2107 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2108 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2109 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2110 // commonly used APIs.
2111 optional string service_class_name = 2;
2112 // Method name of the API call. It can also be a transaction code if we cannot
2113 // resolve it to a name. See Binder#getTransactionName.
2114 //
2115 // This is a system server method name.
2116 optional string service_method_name = 3;
2117 // Total number of API calls.
2118 optional int64 call_count = 4;
2119 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2120 optional bool screen_interactive = 13;
2121 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2122 // call_count will be equal to recorded_call_count.
2123 //
2124 // If recorded_call_count is different than call_count, it means data collection has been
2125 // sampled. All the fields below will be sampled in this case.
2126 optional int64 recorded_call_count = 12;
2127 // Number of exceptions thrown by the API.
2128 optional int64 recorded_exception_count = 5;
2129 // Total latency of all API calls.
2130 // Average can be computed using total_latency_micros / recorded_call_count.
2131 optional int64 recorded_total_latency_micros = 6;
2132 // Maximum latency of one API call.
2133 optional int64 recorded_max_latency_micros = 7;
2134 // Total CPU usage of all API calls.
2135 // Average can be computed using total_cpu_micros / recorded_call_count.
2136 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2137 optional int64 recorded_total_cpu_micros = 8;
2138 // Maximum CPU usage of one API call.
2139 optional int64 recorded_max_cpu_micros = 9;
2140 // Maximum parcel reply size of one API call.
2141 optional int64 recorded_max_reply_size_bytes = 10;
2142 // Maximum parcel request size of one API call.
2143 optional int64 recorded_max_request_size_bytes = 11;
2144}
2145
2146/**
2147 * Pulls the statistics of exceptions during calls to Binder.
2148 *
2149 * Binder stats are cumulative from boot unless somebody reset the data using
2150 * > adb shell dumpsys binder_calls_stats --reset
2151 */
2152message BinderCallsExceptions {
2153 // Exception class name, e.g. java.lang.IllegalArgumentException.
2154 //
2155 // This is an exception class name thrown by the system server.
2156 optional string exception_class_name = 1;
2157 // Total number of exceptions.
2158 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002159}
Howard Rocb767f62018-06-19 19:58:05 -07002160
2161/**
2162 * An atom for generic metrics logging. Available from Android Q.
2163 * One has to add an enum to frameworks/base/proto/src/metrics_constants.proto
2164 * to extend another metric.
2165 */
2166message GenericAtom {
2167 // Type of event. Previously it only indicated visual elements but now it
2168 // is expanded to describe any type of event.
2169 optional com_android_internal_logging.MetricsEvent.View view = 1;
2170}