blob: d7a926ffa28ec1fa6b4d0f67eb831844750980d9 [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";
Joe Onorato62c220b2017-11-18 20:32:56 -080032
Yao Chend54f9dd2017-10-17 17:37:48 +000033/**
Stefan Lafonae2df012017-11-14 09:17:21 -080034 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000035 * raw stats log events from the Android system, also known as "atoms."
36 *
37 * This field contains a single oneof with all of the available messages.
38 * The stats-log-api-gen tool runs as part of the Android build and
39 * generates the android.util.StatsLog class, which contains the constants
40 * and methods that Android uses to log.
41 *
Stefan Lafonae2df012017-11-14 09:17:21 -080042 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000043 * Instead, statsd on Android constructs these messages synthetically,
44 * in the format defined here and in stats_log.proto.
45 */
Stefan Lafonae2df012017-11-14 09:17:21 -080046message Atom {
47 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070048 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070049 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
50 BleScanStateChanged ble_scan_state_changed = 2;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070051 ProcessStateChanged process_state_changed = 3;
Bookatzc1a050a2017-10-10 15:49:28 -070052 BleScanResultReceived ble_scan_result_received = 4;
53 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080054 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070055 SyncStateChanged sync_state_changed = 7;
56 ScheduledJobStateChanged scheduled_job_state_changed = 8;
57 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070058 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080059 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
Chenjie Yubd1a28f2018-07-17 14:55:19 -070062 ActivityManagerSleepStateChanged activity_manager_sleep_state_changed = 14;
63 MemoryFactorStateChanged memory_factor_state_changed = 15;
64 ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
65 CachedKillReported cached_kill_reported = 17;
66 ProcessMemoryStatReported process_memory_stat_reported = 18;
67 // 19 is available
Bookatzddccf0a2017-11-28 16:48:14 -080068 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
69 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
70 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070071 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080072 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070073 CameraStateChanged camera_state_changed = 25;
74 FlashlightStateChanged flashlight_state_changed = 26;
75 UidProcessStateChanged uid_process_state_changed = 27;
76 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
77 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070078 BatteryLevelChanged battery_level_changed = 30;
79 ChargingStateChanged charging_state_changed = 31;
80 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080081 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070082 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
83 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070084 WifiLockStateChanged wifi_lock_state_changed = 37;
85 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
86 WifiScanStateChanged wifi_scan_state_changed = 39;
87 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070088 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070089 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070090 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090091 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080092 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080093 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080094 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080095 AppStartOccurred app_start_occurred = 48;
96 AppStartCanceled app_start_canceled = 49;
97 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080098 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080099 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -0800100 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800101 LmkStateChanged lmk_state_changed = 54;
102 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -0800103 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -0800104 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800105 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800106 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800107 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800108 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800109 KeyguardStateChanged keyguard_state_changed = 62;
110 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
111 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800112 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800113 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800114 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
115 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700116 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700117 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800118 SpeakerImpedanceReported speaker_impedance_reported = 71;
119 HardwareFailed hardware_failed = 72;
120 PhysicalDropDetected physical_drop_detected = 73;
121 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800122 MobileConnectionStateChanged mobile_connection_state_changed = 75;
123 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700124 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800125 AppCrashOccurred app_crash_occurred = 78;
126 ANROccurred anr_occurred = 79;
127 WTFOccurred wtf_occurred = 80;
128 LowMemReported low_mem_reported = 81;
Howard Rocb767f62018-06-19 19:58:05 -0700129 GenericAtom generic_atom = 82;
Yao Chend54f9dd2017-10-17 17:37:48 +0000130 }
David Chenc8a43242017-10-17 16:23:28 -0700131
David Chen6e3e6cb2018-01-03 16:14:06 -0800132 // Pulled events will start at field 10000.
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100133 // Next: 10024
David Chenc8a43242017-10-17 16:23:28 -0700134 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800135 WifiBytesTransfer wifi_bytes_transfer = 10000;
136 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
137 MobileBytesTransfer mobile_bytes_transfer = 10002;
138 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800139 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800140 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800141 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800142 CpuTimePerFreq cpu_time_per_freq = 10008;
143 CpuTimePerUid cpu_time_per_uid = 10009;
144 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800145 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800146 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800147 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800148 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800149 SystemElapsedRealtime system_elapsed_realtime = 10014;
150 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800151 CpuActiveTime cpu_active_time = 10016;
152 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800153 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800154 RemainingBatteryCapacity remaining_battery_capacity = 10019;
155 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800156 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100157 BinderCalls binder_calls = 10022;
Olivier Gaillard9ea238d2018-07-24 10:26:31 +0100158 BinderCallsExceptions binder_calls_exceptions = 10023;
David Chenc8a43242017-10-17 16:23:28 -0700159 }
yroa1fe77c2018-02-26 14:22:54 -0800160
161 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
162 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700163}
164
Yao Chend54f9dd2017-10-17 17:37:48 +0000165/**
Yangster-mac20877162017-12-22 17:19:39 -0800166 * This proto represents a node of an attribution chain.
167 * Note: All attribution chains are represented as a repeated field of type
168 * AttributionNode. It is understood that in such arrays, the order is that
169 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 */
Yangster-mac20877162017-12-22 17:19:39 -0800171message AttributionNode {
172 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800173 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800174
Yangster-mac20877162017-12-22 17:19:39 -0800175 // The (optional) string tag for an element in the attribution chain. If the
176 // element has no tag, it is encoded as an empty string.
177 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700178}
179
Yao Chend54f9dd2017-10-17 17:37:48 +0000180/*
181 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800182 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000183 *
184 * RULES:
185 * - The field ids for each atom must start at 1, and count upwards by 1.
186 * Skipping field ids is not allowed.
187 * - These form an API, so renaming, renumbering or removing fields is
188 * not allowed between android releases. (This is not currently enforced,
189 * but there will be a tool to enforce this restriction).
190 * - The types must be built-in protocol buffer types, namely, no sub-messages
191 * are allowed (yet). The bytes type is also not allowed.
192 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800193 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000194 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800195 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000196 * - A field that is a uid should be a string field, tagged with the [xxx]
197 * annotation. The generated code on android will be represented by UIDs,
198 * and those UIDs will be translated in xxx to those strings.
199 *
200 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700201 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000202 * - If there is a UID, it goes first. Think in an object-oriented fashion.
203 * *****************************************************************************
204 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700205
Yao Chend54f9dd2017-10-17 17:37:48 +0000206/**
207 * Logs when the screen state changes.
208 *
209 * Logged from:
210 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
211 */
212message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800213 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800214 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700215}
Yao Chend54f9dd2017-10-17 17:37:48 +0000216
217/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700218 * Logs that the process state of the uid, as determined by ActivityManager
219 * (i.e. the highest process state of that uid's processes) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000220 *
221 * Logged from:
222 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
223 */
Bookatzc1a050a2017-10-10 15:49:28 -0700224message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700225 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000226
Bookatzdb026a22018-01-10 19:01:56 -0800227 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800228 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000229}
230
231/**
Chenjie Yubd1a28f2018-07-17 14:55:19 -0700232 * Logs process state change of a process, as per the activity manager.
233 *
234 * Logged from:
235 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
236 */
237message ProcessStateChanged {
238 optional int32 uid = 1;
239 optional string process_name = 2;
240 optional string package_name = 3;
241 // TODO: remove this when validation is done
242 optional int64 version = 5;
243 // The state, from frameworks/base/core/proto/android/app/enums.proto.
244 optional android.app.ProcessStateEnum state = 4;
245}
246
247/**
248 * Logs when ActivityManagerService sleep state is changed.
249 *
250 * Logged from:
251 * frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
252 */
253message ActivityManagerSleepStateChanged {
254 // TODO: import frameworks proto
255 enum State {
256 UNKNOWN = 0;
257 ASLEEP = 1;
258 AWAKE = 2;
259 }
260 optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
261}
262
263/**
264 * Logs when system memory state changes.
265 *
266 * Logged from:
267 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
268 */
269message MemoryFactorStateChanged {
270 // TODO: import frameworks proto
271 enum State {
272 MEMORY_UNKNOWN = 0;
273 NORMAL = 1; // normal.
274 MODERATE = 2; // moderate memory pressure.
275 LOW = 3; // low memory.
276 CRITICAL = 4; // critical memory.
277
278 }
279 optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
280}
281
282/**
283 * Logs when app is using too much cpu, according to ActivityManagerService.
284 *
285 * Logged from:
286 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
287 */
288message ExcessiveCpuUsageReported {
289 optional int32 uid = 1;
290 optional string process_name = 2;
291 optional string package_name = 3;
292 // package version. TODO: remove this when validation is done
293 optional int64 version = 4;
294}
295
296/**
297 * Logs when a cached process is killed, along with its pss.
298 *
299 * Logged from:
300 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
301 */
302message CachedKillReported {
303 optional int32 uid = 1;
304 optional string process_name = 2;
305 optional string package_name = 3;
306 // TODO: remove this when validation is done
307 optional int64 version = 5;
308 optional int64 pss = 4;
309}
310
311/**
312 * Logs when memory stats of a process is reported.
313 *
314 * Logged from:
315 * frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
316 */
317message ProcessMemoryStatReported {
318 optional int32 uid = 1;
319 optional string process_name = 2;
320 optional string package_name = 3;
321 //TODO: remove this when validation is done
322 optional int64 version = 9;
323 optional int64 pss = 4;
324 optional int64 uss = 5;
325 optional int64 rss = 6;
326 enum Type {
327 ADD_PSS_INTERNAL_SINGLE = 0;
328 ADD_PSS_INTERNAL_ALL_MEM = 1;
329 ADD_PSS_INTERNAL_ALL_POLL = 2;
330 ADD_PSS_EXTERNAL = 3;
331 ADD_PSS_EXTERNAL_SLOW = 4;
332 }
333 optional Type type = 7;
334 optional int64 duration = 8;
335}
336
337/**
Bookatzc1a050a2017-10-10 15:49:28 -0700338 * Logs that a process started, finished, crashed, or ANRed.
339 *
340 * Logged from:
341 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
342 */
343message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700344 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700345
David Chen0b5c90c2018-01-25 16:51:49 -0800346 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800347 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700348
Bookatzddccf0a2017-11-28 16:48:14 -0800349 // What lifecycle state the process changed to.
350 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800351 enum State {
352 FINISHED = 0;
353 STARTED = 1;
354 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800355 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800356 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700357}
358
Bookatzc1a050a2017-10-10 15:49:28 -0700359/**
360 * Logs when the ble scan state changes.
361 *
362 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700363 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700364 */
365message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800366 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700367
368 enum State {
369 OFF = 0;
370 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700371 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
372 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700373 }
374 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700375
Bookatze5ec0b42018-03-26 13:34:56 -0700376 // Does the scan have a filter.
377 optional bool is_filtered = 3;
378 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
379 optional bool is_first_match = 4;
380 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
381 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700382}
383
384/**
385 * Logs reporting of a ble scan finding results.
386 *
387 * Logged from:
388 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
389 */
390// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
391message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800392 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700393
394 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800395 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700396}
397
398/**
399 * Logs when a sensor state changes.
400 *
401 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700402 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700403 */
404message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800405 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700406
Bookatzc1a050a2017-10-10 15:49:28 -0700407 // The id (int) of the sensor.
408 optional int32 sensor_id = 2;
409
410 enum State {
411 OFF = 0;
412 ON = 1;
413 }
414 optional State state = 3;
415}
416
417
418/**
419 * Logs when GPS state changes.
420 *
421 * Logged from:
422 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
423 */
424message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800425 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700426
427 enum State {
428 OFF = 0;
429 ON = 1;
430 }
431 optional State state = 2;
432}
433
434
435/**
436 * Logs when a sync manager sync state changes.
437 *
438 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700439 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700440 */
441message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800442 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700443
David Chen0b5c90c2018-01-25 16:51:49 -0800444 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800445 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700446
447 enum State {
448 OFF = 0;
449 ON = 1;
450 }
451 optional State state = 3;
452}
453
454/**
455 * Logs when a job scheduler job state changes.
456 *
457 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700458 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700459 */
460message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800461 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700462
463 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800464 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700465
466 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800467 FINISHED = 0;
468 STARTED = 1;
469 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700470 }
471 optional State state = 3;
472
Tej Singh33a412b2018-03-16 18:43:59 -0700473 // The reason a job has stopped.
474 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700475 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700476 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700477}
478
479/**
480 * Logs when the audio state changes.
481 *
482 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700483 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700484 */
485message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800486 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700487
488 enum State {
489 OFF = 0;
490 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700491 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
492 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700493 }
494 optional State state = 2;
495}
496
497/**
498 * Logs when the video codec state changes.
499 *
500 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700501 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700502 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800503message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800504 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700505
506 enum State {
507 OFF = 0;
508 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700509 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
510 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700511 }
512 optional State state = 2;
513}
514
515/**
516 * Logs when the flashlight state changes.
517 *
518 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700519 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700520 */
521message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800522 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700523
524 enum State {
525 OFF = 0;
526 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700527 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
528 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700529 }
530 optional State state = 2;
531}
532
533/**
534 * Logs when the camera state changes.
535 *
536 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700537 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700538 */
539message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800540 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700541
542 enum State {
543 OFF = 0;
544 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700545 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
546 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700547 }
548 optional State state = 2;
549}
550
551/**
552 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000553 *
554 * Logged from:
555 * TODO
556 */
Bookatzd6746242017-10-24 18:39:35 -0700557message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800558 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000559
Bookatz1a1b0462018-01-12 11:47:03 -0800560 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
561 // From frameworks/base/core/proto/android/os/enums.proto.
562 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700563
564 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
565 optional string tag = 3;
566
567 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800568 RELEASE = 0;
569 ACQUIRE = 1;
570 CHANGE_RELEASE = 2;
571 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700572 }
573 optional State state = 4;
574}
575
576/**
Bookatzc1a050a2017-10-10 15:49:28 -0700577 * Logs when a partial wakelock is considered 'long' (over 1 min).
578 *
579 * Logged from:
580 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
581 */
582message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800583 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700584
Yao Chend54f9dd2017-10-17 17:37:48 +0000585 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
586 optional string tag = 2;
587
Bookatzc1a050a2017-10-10 15:49:28 -0700588 // TODO: I have no idea what this is.
589 optional string history_tag = 3;
590
591 enum State {
592 OFF = 0;
593 ON = 1;
594 }
595 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000596}
597
Bookatzc1a050a2017-10-10 15:49:28 -0700598/**
599 * Logs Battery Saver state change.
600 *
601 * Logged from:
602 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
603 */
604message BatterySaverModeStateChanged {
605 enum State {
606 OFF = 0;
607 ON = 1;
608 }
609 optional State state = 1;
610}
611
612/**
613 * Logs Doze mode state change.
614 *
615 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800616 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700617 */
618message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800619 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800620}
621
622
623/**
624 * Logs state change of Doze mode including maintenance windows.
625 *
626 * Logged from:
627 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
628 */
629message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800630 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700631}
632
633/**
634 * Logs screen brightness level.
635 *
636 * Logged from:
637 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
638 */
639message ScreenBrightnessChanged {
640 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
641 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700642}
643
644/**
645 * Logs battery level (percent full, from 0 to 100).
646 *
647 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700648 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700649 */
650message BatteryLevelChanged {
651 // Battery level. Should be in [0, 100].
652 optional int32 battery_level = 1;
653}
654
655/**
656 * Logs change in charging status of the device.
657 *
658 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700659 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700660 */
661message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800662 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
663 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700664}
665
666/**
667 * Logs whether the device is plugged in, and what power source it is using.
668 *
669 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700670 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700671 */
672message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800673 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
674 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700675}
676
Bookatz8c6571b2017-10-24 15:04:41 -0700677/**
678 * Logs when an app's wakeup alarm fires.
679 *
680 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700681 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700682 */
683message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800684 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800685
686 // Name of the wakeup alarm.
687 optional string tag = 2;
688}
689
690/**
691 * Logs when an an app causes the mobile radio to change state.
692 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
693 *
694 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700695 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800696 */
697message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800698 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800699
Bookatz1a1b0462018-01-12 11:47:03 -0800700 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
701 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800702}
703
704/**
705 * Logs when an an app causes the wifi radio to change state.
706 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
707 *
708 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700709 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800710 */
711message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800712 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800713
Bookatz1a1b0462018-01-12 11:47:03 -0800714 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
715 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700716}
717
718/**
719 * Logs kernel wakeup reasons and aborts.
720 *
721 * Logged from:
722 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
723 */
724message KernelWakeupReported {
725 // Name of the kernel wakeup reason (or abort).
726 optional string wakeup_reason_name = 1;
727
728 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800729 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700730}
731
732/**
733 * Logs wifi locks held by an app.
734 *
735 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700736 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700737 */
738message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800739 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700740
741 enum State {
742 OFF = 0;
743 ON = 1;
744 }
745 optional State state = 2;
746}
747
748/**
749 * Logs wifi signal strength changes.
750 *
751 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700752 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700753 */
754message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800755 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
756 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700757}
758
759/**
760 * Logs wifi scans performed by an app.
761 *
762 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700763 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700764 */
765message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800766 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700767
768 enum State {
769 OFF = 0;
770 ON = 1;
771 }
772 optional State state = 2;
773}
774
775/**
Tej Singh4503e102018-01-04 14:35:01 -0800776 * Logs wifi multicast locks held by an app
777 *
778 * Logged from:
779 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
780 */
781message WifiMulticastLockStateChanged {
782 repeated AttributionNode attribution_node = 1;
783
784 enum State {
785 OFF = 0;
786 ON = 1;
787 }
788 optional State state = 2;
789}
790
791/**
Tej Singh1ea42892018-01-19 09:27:00 -0800792 * Logs shutdown reason and duration on next boot.
793 *
794 * Logged from:
795 * frameworks/base/core/java/com/android/server/BootReceiver.java
796 */
797message ShutdownSequenceReported {
798 // True if shutdown is for a reboot. Default: false if we do not know.
799 optional bool reboot = 1;
800
801 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
802 optional string reason = 2;
803
804 // Beginning of shutdown time in ms using wall clock time since unix epoch.
805 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800806 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800807
808 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800809 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800810}
811
Tej Singh6483ea42018-01-25 17:45:49 -0800812
813/**
814 * Logs boot reason and duration.
815 *
816 * Logged from:
817 * system/core/bootstat/bootstat.cpp
818 */
819message BootSequenceReported {
820 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
821 // Default: "<EMPTY>" if not available.
822 optional string bootloader_reason = 1;
823
824 // Reason for system boot. Eg. bootloader, reboot,userrequested
825 // Default: "<EMPTY>" if not available.
826 optional string system_reason = 2;
827
828 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800829 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800830
831 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800832 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800833
834 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800835 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800836
837 // Time since last boot in ms. Default: 0 if not available.
838 optional int64 time_since_last_boot = 6;
839}
840
Tej Singhc477d9c2018-02-05 18:31:39 -0800841
842/**
843 * Logs call state and disconnect cause (if applicable).
844 *
845 * Logged from:
846 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
847 */
848message CallStateChanged {
849 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
850 // From frameworks/base/core/proto/android/telecomm/enums.proto.
851 optional android.telecom.CallStateEnum call_state = 1;
852
853 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
854 // This value is only applicable when the call_state is DISCONNECTED, and
855 // should always be UNKNOWN if the call_state is not DISCONNECTED.
856 // From frameworks/base/core/proto/android/telecomm/enums.proto.
857 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
858
859 // True if the call is self-managed, which are apps that use the
860 // telecom infrastructure to make their own calls.
861 optional bool self_managed = 3;
862
863 // True if call is external. External calls are calls on connected Wear
864 // devices but show up in Telecom so the user can pull them onto the device.
865 optional bool external_call = 4;
866}
867
Tej Singh1ea42892018-01-19 09:27:00 -0800868/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800869 * Logs keyguard state. The keyguard is the lock screen.
870 *
871 * Logged from:
872 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
873 */
874message KeyguardStateChanged {
875 enum State {
876 UNKNOWN = 0;
877 // The keyguard is hidden when the phone is unlocked.
878 HIDDEN = 1;
879 // The keyguard is shown when the phone is locked (screen turns off).
880 SHOWN= 2;
881 // The keyguard is occluded when something is overlaying the keyguard.
882 // Eg. Opening the camera while on the lock screen.
883 OCCLUDED = 3;
884 }
885 optional State state = 1;
886}
887
888/**
889 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
890 * prompts the user to enter a password (pattern, pin, etc).
891 *
892 * Logged from:
893 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
894 */
895
896message KeyguardBouncerStateChanged {
897 enum State {
898 UNKNOWN = 0;
899 // Bouncer is hidden, either as a result of successfully entering the
900 // password, screen timing out, or user going back to lock screen.
901 HIDDEN = 1;
902 // This is when the user is being prompted to enter the password.
903 SHOWN = 2;
904 }
905 optional State state = 1;
906}
907
908/**
909 * Logs the result of entering a password into the keyguard bouncer.
910 *
911 * Logged from:
912 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
913 */
914message KeyguardBouncerPasswordEntered {
915 enum BouncerResult {
916 UNKNOWN = 0;
917 // The password entered was incorrect.
918 FAILURE = 1;
919 // The password entered was correct.
920 SUCCESS = 2;
921 }
922 optional BouncerResult result = 1;
923}
924
Tej Singha883b372018-02-15 11:30:01 -0800925/*
926 * Logs changes to the configuration of the device. The configuration is defined
927 * in frameworks/base/core/java/android/content/res/Configuration.java
928 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
929 * Please go there to interpret the possible values each field can be.
930 *
931 * Logged from:
932 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
933 */
934message ResourceConfigurationChanged {
935 // Bit mask of color capabilities of the screen.
936 // Contains information about the color gamut and hdr mode of the screen.
937 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
938 optional int32 colorMode = 1;
939
940 // The target screen density being rendered to.
941 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
942 optional int32 densityDpi = 2;
943
944 // Current user preference for the scaling factor for fonts,
945 // relative to the base density scaling.
946 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
947 optional float fontScale = 3;
948
949 // Flag indicating whether the hard keyboard is hidden.
950 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
951 optional int32 hardKeyboardHidden = 4;
952
953 // The type of keyboard attached to the device.
954 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
955 optional int32 keyboard = 5;
956
957 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
958 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
959 optional int32 keyboardHideen = 6;
960
961 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
962 // 0 if undefined.
963 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
964 optional int32 mcc = 7;
965
966 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
967 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
968 // MNC_ZERO symbol defined in Configuration.java.
969 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
970 optional int32 mnc = 8;
971
972 // The kind of navigation available on the device.
973 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
974 optional int32 navigation = 9;
975
976 // Flag indicating whether the navigation is available.
977 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
978 optional int32 navigationHidden = 10;
979
980 // Overall orientation of the screen.
981 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
982 optional int32 orientation = 11;
983
984 // The current height of the available screen space, in dp units.
985 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
986 optional int32 screenHeightDp = 12;
987
988 // Bit mask of overall layout of the screen.
989 // Contains information about screen size, whether the screen is wider/taller
990 // than normal, whether the screen layout is right-tl-left or left-to-right,
991 // and whether the screen has a rounded shape.
992 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
993 optional int32 screenLayout = 13;
994
995 // Current width of the available screen space, in dp units.
996 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
997 optional int32 screenWidthDp = 14;
998
999 // The smallest screen size an application will see in normal operation.
1000 // This is the smallest value of both screenWidthDp and screenHeightDp
1001 // in portrait and landscape.
1002 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
1003 optional int32 smallestScreenWidthDp = 15;
1004
1005 // The type of touch screen attached to the device.
1006 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
1007 optional int32 touchscreen = 16;
1008
1009 // Bit mask of the ui mode.
1010 // Contains information about the overall ui mode of the device.
1011 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
1012 // Also contains information about whether the device is in night mode.
1013 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
1014 optional int32 uiMode = 17;
1015}
1016
Tej Singheee317b2018-03-07 19:28:05 -08001017
1018/**
1019 * Logs changes in the connection state of the mobile radio.
1020 *
1021 * Logged from:
1022 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
1023 */
1024message MobileConnectionStateChanged {
1025 // States are from the state machine DataConnection.java.
1026 enum State {
1027 UNKNOWN = 0;
1028 // The connection is inactive, or disconnected.
1029 INACTIVE = 1;
1030 // The connection is being activated, or connecting.
1031 ACTIVATING = 2;
1032 // The connection is active, or connected.
1033 ACTIVE = 3;
1034 // The connection is disconnecting.
1035 DISCONNECTING = 4;
1036 // The connection is disconnecting after creating a connection.
1037 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
1038 }
1039 optional State state = 1;
1040 // For multi-sim phones, this distinguishes between the sim cards.
1041 optional int32 sim_slot_index = 2;
1042 // Used to identify the connection. Starts at 0 and increments by 1 for
1043 // every new network created. Resets whenever the device reboots.
1044 optional int32 data_connection_id = 3;
1045 // A bitmask for the capabilities of this connection.
1046 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
1047 // Default value (if we have no information): 0
1048 optional int64 capabilities = 4;
1049 // If this connection has internet.
1050 // This just checks if the DEFAULT bit of capabilities is set.
1051 optional bool has_internet = 5;
1052}
1053
1054/**
1055 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
1056 *
1057 * Logged from:
1058 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
1059 */
1060message MobileRadioTechnologyChanged {
1061 optional android.telephony.NetworkTypeEnum state = 1;
1062 // For multi-sim phones, this distinguishes between the sim cards.
1063 optional int32 sim_slot_index = 2;
1064}
1065
Andrew Chantb56388b2018-03-22 21:07:33 -07001066/**
1067 * Logs the VID and PID of any connected USB devices.
1068 *
1069 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
1070 *
1071 * Logged by Vendor.
1072 */
1073message UsbDeviceAttached {
1074 optional int32 vid = 1;
1075 optional int32 pid = 2;
1076 optional bool has_audio = 3;
1077 optional bool has_hid = 4;
1078 optional bool has_storage = 5;
1079}
1080
Tej Singheee317b2018-03-07 19:28:05 -08001081
Tej Singhdd7bd352018-02-09 19:33:15 -08001082/**
Tej Singh5d991e12018-03-09 19:48:11 -08001083 * Logs when Bluetooth is enabled and disabled.
1084 *
1085 * Logged from:
1086 * services/core/java/com/android/server/BluetoothManagerService.java
1087 */
1088message BluetoothEnabledStateChanged {
1089 repeated AttributionNode attribution_node = 1;
1090 // Whether or not bluetooth is enabled on the device.
1091 enum State {
1092 UNKNOWN = 0;
1093 ENABLED = 1;
1094 DISABLED = 2;
1095 }
1096 optional State state = 2;
1097 // The reason for being enabled/disabled.
1098 // Eg. Airplane mode, crash, application request.
1099 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
1100 // If the reason is an application request, this will be the package name.
1101 optional string pkgName = 4;
1102}
1103
1104/**
1105 * Logs when a Bluetooth device connects and disconnects.
1106 *
1107 * Logged from:
1108 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
1109 */
1110message BluetoothConnectionStateChanged {
1111 // The state of the connection.
1112 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1113 optional android.bluetooth.ConnectionStateEnum state = 1;
1114 // An identifier that can be used to match connect and disconnect events.
1115 // Currently is last two bytes of a hash of a device level ID and
1116 // the mac address of the bluetooth device that is connected.
1117 optional int32 obfuscated_id = 2;
1118 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1119 // From android.bluetooth.BluetoothAdapter.java
1120 optional int32 bt_profile = 3;
1121}
1122
1123/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001124 * Logs when something is plugged into or removed from the USB-C connector.
1125 *
1126 * Logged from:
1127 * Vendor USB HAL.
1128 */
1129message UsbConnectorStateChanged {
1130 enum State {
1131 DISCONNECTED = 0;
1132 CONNECTED = 1;
1133 }
1134 optional State state = 1;
1135}
1136
1137/**
1138 * Logs the reported speaker impedance.
1139 *
1140 * Logged from:
1141 * Vendor audio implementation.
1142 */
1143message SpeakerImpedanceReported {
1144 optional int32 speaker_location = 1;
1145 optional int32 impedance = 2;
1146}
1147
1148/**
1149 * Logs the report of a failed hardware.
1150 *
1151 * Logged from:
1152 * Vendor HALs.
1153 *
1154 */
1155message HardwareFailed {
1156 enum HardwareType {
1157 HARDWARE_FAILED_UNKNOWN = 0;
1158 HARDWARE_FAILED_MICROPHONE = 1;
1159 HARDWARE_FAILED_CODEC = 2;
1160 HARDWARE_FAILED_SPEAKER = 3;
1161 HARDWARE_FAILED_FINGERPRINT = 4;
1162 }
1163 optional HardwareType hardware_type = 1;
1164
1165 /* hardware_location allows vendors to differentiate between multiple instances of
1166 * the same hardware_type. The specific locations are vendor defined integers,
1167 * referring to board-specific numbering schemes.
1168 */
1169 optional int32 hardware_location = 2;
1170
1171 /* failure_code is specific to the HardwareType of the failed hardware.
1172 * It should use the enum values defined below.
1173 */
1174 enum MicrophoneFailureCode {
1175 MICROPHONE_FAILURE_COMPLETE = 0;
1176 }
1177 enum CodecFailureCode {
1178 CODEC_FAILURE_COMPLETE = 0;
1179 }
1180 enum SpeakerFailureCode {
1181 SPEAKER_FAILURE_COMPLETE = 0;
1182 SPEAKER_FAILURE_HIGH_Z = 1;
1183 SPEAKER_FAILURE_SHORT = 2;
1184 }
1185 enum FingerprintFailureCode {
1186 FINGERPRINT_FAILURE_COMPLETE = 0;
1187 FINGERPRINT_SENSOR_BROKEN = 1;
1188 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1189 }
1190 optional int32 failure_code = 3;
1191}
1192
1193/**
1194 * Log an event when the device has been physically dropped.
1195 * Reported from the /vendor partition.
1196 */
1197message PhysicalDropDetected {
1198 // Confidence that the event was actually a drop, 0 -> 100
1199 optional int32 confidence_pctg = 1;
1200 // Peak acceleration of the drop, in 1/1000s of a g.
1201 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001202 // Duration of freefall in ms
1203 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001204}
1205
1206/**
1207 * Log bucketed battery charge cycles.
1208 *
1209 * Each bucket represents cycles of the battery past
1210 * a given charge point. For example, bucket 1 is the
1211 * lowest 1/8th of the battery, and bucket 8 is 100%.
1212 *
1213 * Logged from:
1214 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1215 */
1216message ChargeCyclesReported {
1217 optional int32 cycle_bucket_1 = 1;
1218 optional int32 cycle_bucket_2 = 2;
1219 optional int32 cycle_bucket_3 = 3;
1220 optional int32 cycle_bucket_4 = 4;
1221 optional int32 cycle_bucket_5 = 5;
1222 optional int32 cycle_bucket_6 = 6;
1223 optional int32 cycle_bucket_7 = 7;
1224 optional int32 cycle_bucket_8 = 8;
1225}
1226
1227/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001228 * Logs the duration of a davey (jank of >=700ms) when it occurs
1229 *
1230 * Logged from:
1231 * frameworks/base/libs/hwui/JankTracker.cpp
1232 */
1233message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001234 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001235 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001236
Tej Singhbb8554a2018-01-26 11:59:14 -08001237 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001238 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001239}
1240
1241/**
Bookatze5885242017-10-24 20:10:31 -07001242 * Logs phone signal strength changes.
1243 *
1244 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001245 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001246 */
1247message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001248 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1249 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001250}
1251
1252/**
1253 * Logs that a setting was updated.
1254 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001255 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001256 * The tag and is_default allow resetting of settings to default values based on the specified
1257 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1258 */
1259message SettingChanged {
1260 // The name of the setting.
1261 optional string setting = 1;
1262
1263 // The change being imposed on this setting. May represent a number, eg "3".
1264 optional string value = 2;
1265
1266 // The new value of this setting. For most settings, this is same as value. For some settings,
1267 // value is +X or -X where X represents an element in a set. For example, if the previous value
1268 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1269 // The +/- feature is currently only used for location_providers_allowed.
1270 optional string new_value = 3;
1271
1272 // The previous value of this setting.
1273 optional string prev_value = 4;
1274
1275 // The tag used with the is_default for resetting sets of settings. This is generally null.
1276 optional string tag = 5;
1277
Bookatz90867622018-01-31 15:05:57 -08001278 // True if this setting with tag should be resettable.
1279 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001280
David Chenbd789912018-03-16 17:19:55 -07001281 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001282 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001283
1284 enum ChangeReason {
1285 UPDATED = 1; // Updated can be an insertion or an update.
1286 DELETED = 2;
1287 }
1288 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001289}
Chenjie Yub3dda412017-10-24 13:41:59 -07001290
Chenjie Yu05013b32017-11-21 10:21:41 -08001291/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001292 * Logs activity going to foreground or background
1293 *
1294 * Logged from:
1295 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1296 */
1297message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001298 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001299 optional string pkg_name = 2;
1300 optional string class_name = 3;
1301
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001302 enum State {
1303 BACKGROUND = 0;
1304 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001305 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001306 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001307}
David Chenc8a43242017-10-17 16:23:28 -07001308
1309/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001310 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001311 * Logged from:
1312 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1313 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001314message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001315 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001316
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001317 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001318
1319 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001320 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001321 optional string process_name = 3;
1322
1323 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001324 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001325
1326 optional string package_name = 5;
1327
1328 enum InstantApp {
1329 UNAVAILABLE = 0;
1330 FALSE = 1;
1331 TRUE = 2;
1332 }
1333 optional InstantApp is_instant_app = 6;
1334
1335 enum ForegroundState {
1336 UNKNOWN = 0;
1337 BACKGROUND = 1;
1338 FOREGROUND = 2;
1339 }
1340 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001341}
David Chen9e3808c2017-11-20 17:25:34 -08001342
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001343/**
1344 * Logs when a WTF (What a Terrible Failure) happened.
1345 * Logged from:
1346 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1347 */
1348message WTFOccurred {
1349 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001350
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001351 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001352
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001353 // The name of the process.
1354 // system_server if it is not by an app
1355 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001356
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001357 // The pid if available. -1 means not available.
1358 optional sint32 pid = 4;
1359}
1360
1361/**
1362 * Logs when system server reports low memory.
1363 * Logged from:
1364 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1365 */
1366message LowMemReported {
1367}
1368
1369/**
1370 * Logs when an app ANR (App Not Responding) occurs.
1371 * Logged from:
1372 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1373 */
1374message ANROccurred {
1375 optional int32 uid = 1 [(is_uid) = true];
1376
1377 optional string process_name = 2;
1378
1379 optional string short_component_name = 3;
1380
1381 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001382
1383 enum InstantApp {
1384 UNAVAILABLE = 0;
1385 FALSE = 1;
1386 TRUE = 2;
1387 }
1388 optional InstantApp is_instant_app = 5;
1389
1390 enum ForegroundState {
1391 UNKNOWN = 0;
1392 BACKGROUND = 1;
1393 FOREGROUND = 2;
1394 }
1395 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001396}
1397
David Chen0a368b22017-12-06 16:28:16 -08001398/*
1399 * Allows other apps to push events into statsd.
1400 * Logged from:
1401 * frameworks/base/core/java/android/util/StatsLog.java
1402 */
David Chen0b5c90c2018-01-25 16:51:49 -08001403message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001404 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001405 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001406
1407 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1408 optional int32 label = 2;
1409
1410 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1411 // predicates for the metrics).
1412 enum State {
1413 UNKNOWN = 0;
1414 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1415 STOP = 2;
1416 START = 3;
1417 }
1418 optional State state = 3;
1419}
1420
David Chen9e3808c2017-11-20 17:25:34 -08001421/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001422 * Logs when statsd detects an anomaly.
1423 *
1424 * Logged from:
1425 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1426 */
1427message AnomalyDetected {
1428 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001429 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001430
Yangster-mac94e197c2018-01-02 16:03:03 -08001431 // Id of the config whose anomaly detection alert fired.
1432 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001433
Yangster-mac94e197c2018-01-02 16:03:03 -08001434 // Id of the alert (i.e. name of the anomaly that was detected).
1435 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001436}
1437
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001438message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001439 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001440 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001441
1442 // The app package name.
1443 optional string pkg_name = 2;
1444
1445 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001446 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001447 WARM = 1;
1448 HOT = 2;
1449 COLD = 3;
1450 }
1451 // The transition type.
1452 optional TransitionType type = 3;
1453
1454 // The activity name.
1455 optional string activity_name = 4;
1456
1457 // The name of the calling app. Empty if not set.
1458 optional string calling_pkg_name = 5;
1459
1460 // Whether the app is an instant app.
1461 optional bool is_instant_app = 6;
1462
1463 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001464 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001465
Bookatz80d11a02018-01-16 10:46:35 -08001466 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001467
David Chen0b5c90c2018-01-25 16:51:49 -08001468 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001469 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001470 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001471 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001472 optional int32 bind_application_delay_millis = 11;
1473 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001474
1475 // Empty if not set.
1476 optional string launch_token = 13;
1477
Calin Juravle759fbda2018-02-20 19:52:30 +00001478 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001479 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001480
1481 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001482 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001483}
1484
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001485message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001486 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001487 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001488
1489 // The app package name.
1490 optional string pkg_name = 2;
1491
1492 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001493 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001494 WARM = 1;
1495 HOT = 2;
1496 COLD = 3;
1497 }
1498 // The transition type.
1499 optional TransitionType type = 3;
1500
1501 // The activity name.
1502 optional string activity_name = 4;
1503}
1504
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001505message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001506 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001507 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001508
1509 // The app package name.
1510 optional string pkg_name = 2;
1511
1512 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001513 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001514 WITH_BUNDLE = 1;
1515 WITHOUT_BUNDLE = 2;
1516 }
1517 // The transition type.
1518 optional TransitionType type = 3;
1519
1520 // The activity name.
1521 optional string activity_name = 4;
1522
1523 optional bool transition_process_running = 5;
1524
1525 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001526 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001527}
1528
Bookatz8fcd09a2017-12-18 13:01:10 -08001529/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001530 * Logs a picture-in-picture action
1531 * Logged from:
1532 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1533 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1534 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1535 */
1536message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001537 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001538 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001539
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001540 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001541
Chenjie Yu52cacc62017-12-08 18:11:45 -08001542 enum State {
1543 ENTERED = 1;
1544 EXPANDED_TO_FULL_SCREEN = 2;
1545 MINIMIZED = 3;
1546 DISMISSED = 4;
1547 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001548 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001549}
1550
1551/**
Chenjie Yue8904192017-12-08 19:12:57 -08001552 * Logs overlay action
1553 * Logged from:
1554 * services/core/java/com/android/server/wm/Session.java
1555 */
1556message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001557 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001558
1559 optional string package_name = 2;
1560
1561 optional bool using_alert_window = 3;
1562
1563 enum State {
1564 ENTERED = 1;
1565 EXITED = 2;
1566 }
1567 optional State state = 4;
1568}
1569
Chenjie Yuccfe6452018-01-30 11:33:21 -08001570/*
1571 * Logs foreground service starts and stops.
1572 * Note that this is not when a service starts or stops, but when it is
1573 * considered foreground.
1574 * Logged from
1575 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1576 */
1577message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001578 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001579 // package_name + "/" + class_name
1580 optional string short_name = 2;
1581
1582 enum State {
1583 ENTER = 1;
1584 EXIT = 2;
1585 }
1586 optional State state = 3;
1587}
1588
Chenjie Yue8904192017-12-08 19:12:57 -08001589/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001590 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1591 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1592 * attributed back to the parent (host) uid. One example is Chrome.
1593 *
1594 * Logged from:
1595 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1596 */
1597message IsolatedUidChanged {
1598 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001599 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001600 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001601 optional int32 parent_uid = 1;
1602
1603 optional int32 isolated_uid = 2;
1604
1605 // We expect an isolated uid to be removed before if it's used for another parent uid.
1606 enum Event {
1607 REMOVED = 0;
1608 CREATED = 1;
1609 }
1610 optional Event event = 3;
1611}
1612
1613/*
1614 * Logs the reception of an incoming network packet causing the main system to wake up for
1615 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1616 * and processed by WakeupController.cpp.
1617 */
1618message PacketWakeupOccurred {
1619 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1620 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001621 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001622 // The interface name on which the packet was received.
1623 optional string iface = 2;
1624 // The ethertype value of the packet.
1625 optional int32 ethertype = 3;
1626 // String representation of the destination MAC address of the packet.
1627 optional string destination_hardware_address = 4;
1628 // String representation of the source address of the packet if this was an IP packet.
1629 optional string source_ip = 5;
1630 // String representation of the destination address of the packet if this was an IP packet.
1631 optional string destination_ip = 6;
1632 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1633 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1634 // families.
1635 optional int32 ip_next_header = 7;
1636 // The source port if this was a TCP or UDP packet.
1637 optional int32 source_port = 8;
1638 // The destination port if this was a TCP or UDP packet.
1639 optional int32 destination_port = 9;
1640}
1641
1642/*
1643 * Logs the memory stats for an app on startup.
1644 * Logged from:
1645 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1646 */
1647message AppStartMemoryStateCaptured {
1648 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001649 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001650
1651 // The process name.
1652 optional string process_name = 2;
1653
1654 // The activity name.
1655 optional string activity_name = 3;
1656
1657 // # of page-faults
1658 optional int64 pgfault = 4;
1659
1660 // # of major page-faults
1661 optional int64 pgmajfault = 5;
1662
1663 // RSS
1664 optional int64 rss_in_bytes = 6;
1665
1666 // CACHE
1667 optional int64 cache_in_bytes = 7;
1668
1669 // SWAP
1670 optional int64 swap_in_bytes = 8;
1671}
1672
1673/*
1674 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1675 * for LMK event.
1676 * Logged from:
1677 * system/core/lmkd/lmkd.c
1678 */
1679message LmkStateChanged {
1680 enum State {
1681 UNKNOWN = 0;
1682 START = 1;
1683 STOP = 2;
1684 }
1685 optional State state = 1;
1686}
1687
1688/*
1689 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1690 * Logged from:
1691 * system/core/lmkd/lmkd.c
1692 */
1693message LmkKillOccurred {
1694 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001695 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001696
1697 // The process name.
1698 optional string process_name = 2;
1699
1700 // oom adj score.
1701 optional int32 oom_score = 3;
1702
1703 // # of page-faults
1704 optional int64 pgfault = 4;
1705
1706 // # of major page-faults
1707 optional int64 pgmajfault = 5;
1708
1709 // RSS
1710 optional int64 rss_in_bytes = 6;
1711
1712 // CACHE
1713 optional int64 cache_in_bytes = 7;
1714
1715 // SWAP
1716 optional int64 swap_in_bytes = 8;
1717}
1718
Rajeev Kumar51b54602018-03-01 12:18:26 -08001719/*
1720 * Logs when the ActivityManagerService detects that an app died.
1721 *
1722 * Logged from:
1723 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1724 */
1725message AppDied {
1726 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001727 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001728}
1729
Howard Ro21a039c2018-08-06 14:55:47 -07001730/**
1731 * An atom for generic metrics logging. Available from Android Q.
1732 */
1733message GenericAtom {
1734 // The uid of the application that sent this custom atom.
1735 optional int32 uid = 1 [(is_uid) = true];
1736
1737 // An event_id indicates the type of event.
1738 optional int32 event_id = 2;
1739}
1740
Chenjie Yubbcbc602018-02-05 16:51:52 -08001741//////////////////////////////////////////////////////////////////////
1742// Pulled atoms below this line //
1743//////////////////////////////////////////////////////////////////////
1744
1745/**
David Chenc8a43242017-10-17 16:23:28 -07001746 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1747 *
1748 * Pulled from:
1749 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1750 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001751message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001752 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001753
1754 optional int64 rx_bytes = 2;
1755
1756 optional int64 rx_packets = 3;
1757
1758 optional int64 tx_bytes = 4;
1759
1760 optional int64 tx_packets = 5;
1761}
1762
1763/**
1764 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1765 *
1766 * Pulled from:
1767 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1768 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001769message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001770 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001771
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001772 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1773 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001774
1775 optional int64 rx_bytes = 3;
1776
1777 optional int64 rx_packets = 4;
1778
1779 optional int64 tx_bytes = 5;
1780
1781 optional int64 tx_packets = 6;
1782}
1783
1784/**
1785 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1786 *
1787 * Pulled from:
1788 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1789 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001790message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001791 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001792
1793 optional int64 rx_bytes = 2;
1794
1795 optional int64 rx_packets = 3;
1796
1797 optional int64 tx_bytes = 4;
1798
1799 optional int64 tx_packets = 5;
1800}
1801
1802/**
1803 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1804 *
1805 * Pulled from:
1806 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1807 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001808message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001809 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001810
Yao Chenc40a19d2018-03-15 16:48:25 -07001811 // 1 denotes foreground and 0 denotes background. This is called Set in
1812 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001813 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001814
1815 optional int64 rx_bytes = 3;
1816
1817 optional int64 rx_packets = 4;
1818
1819 optional int64 tx_bytes = 5;
1820
1821 optional int64 tx_packets = 6;
1822}
1823
1824/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001825 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1826 *
1827 * Pulled from:
1828 * StatsCompanionService
1829 */
1830message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001831 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001832
1833 optional int64 rx_bytes = 2;
1834
1835 optional int64 tx_bytes = 3;
1836}
1837
1838/**
David Chenc8a43242017-10-17 16:23:28 -07001839 * Pulls the kernel wakelock durations. This atom is adapted from
1840 * android/internal/os/KernelWakelockStats.java
1841 *
1842 * Pulled from:
1843 * StatsCompanionService using KernelWakelockReader.
1844 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001845message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001846 optional string name = 1;
1847
1848 optional int32 count = 2;
1849
1850 optional int32 version = 3;
1851
1852 optional int64 time = 4;
1853}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001854
Chenjie Yu05013b32017-11-21 10:21:41 -08001855/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001856 * Pulls low power state information. This includes platform and subsystem sleep state information,
1857 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001858 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001859 * hardware/interfaces/power/1.1/types.hal
1860 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001861message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001862 // Subsystem name
1863 optional string subsystem_name = 1;
1864 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1865 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1866 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001867 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001868 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001869 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001870 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001871}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001872
Chenjie Yu05013b32017-11-21 10:21:41 -08001873/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001874 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001875 * Pulls the time the cpu spend on the frequency index. Frequency index
1876 * starts from highest to lowest. The value should be monotonically
1877 * increasing since boot. However, if there is a cpu
1878 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001879 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001880message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001881 optional uint32 cluster = 1;
1882 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001883 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001884}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001885
Chenjie Yu05013b32017-11-21 10:21:41 -08001886/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001887 * Pulls Cpu Time Per Uid.
1888 * Note that isolated process uid time should be attributed to host uids.
1889 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001890message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001891 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001892 optional uint64 user_time_millis = 2;
1893 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001894}
1895
1896/**
1897 * Pulls Cpu Time Per Uid per frequency.
1898 * Note that isolated process uid time should be attributed to host uids.
1899 * For each uid, we order the time by descending frequencies.
1900 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001901message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001902 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001903 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001904 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001905}
Hugo Benichi884970e2017-11-14 22:42:46 +09001906
Chenjie Yu05013b32017-11-21 10:21:41 -08001907/**
1908 * Pulls Wifi Controller Activity Energy Info
1909 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001910message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001911 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001912 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001913 // stack reported state
1914 // TODO: replace this with proto enum
1915 optional int32 stack_state = 2;
1916 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001917 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001918 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001919 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001920 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001921 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001922 // product of current(mA), voltage(V) and time(ms)
1923 optional uint64 controller_energy_used = 6;
1924}
1925
1926/**
1927 * Pulls Modem Activity Energy Info
1928 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001929message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001930 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001931 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001932 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001933 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001934 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001935 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001936 /**
1937 * Tx power index
1938 * index 0 = tx_power < 0dBm
1939 * index 1 = 0dBm < tx_power < 5dBm
1940 * index 2 = 5dBm < tx_power < 15dBm
1941 * index 3 = 15dBm < tx_power < 20dBm
1942 * index 4 = tx_power > 20dBm
1943 */
1944 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001945 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001946 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001947 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001948 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001949 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001950 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001951 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001952 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001953 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001954 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001955 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001956 // product of current(mA), voltage(V) and time(ms)
1957 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001958}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001959
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001960/**
1961 * Pulls Bluetooth Activity Energy Info
1962 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1963 */
1964message BluetoothActivityInfo {
1965 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001966 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001967 // bluetooth stack state
1968 optional int32 bluetooth_stack_state = 2;
1969 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001970 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001971 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001972 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001973 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001974 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001975 // product of current(mA), voltage(V) and time(ms)
1976 optional uint64 energy_used = 6;
1977}
1978
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001979/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001980 * Logs the memory stats for a process.
1981 */
1982message ProcessMemoryState {
1983 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001984 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001985
1986 // The process name.
1987 optional string process_name = 2;
1988
1989 // oom adj score.
1990 optional int32 oom_score = 3;
1991
1992 // # of page-faults
1993 optional int64 pgfault = 4;
1994
1995 // # of major page-faults
1996 optional int64 pgmajfault = 5;
1997
Rajeev Kumar90235992018-01-29 11:06:48 -08001998 // RSS
1999 optional int64 rss_in_bytes = 6;
2000
2001 // CACHE
2002 optional int64 cache_in_bytes = 7;
2003
2004 // SWAP
2005 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08002006}
2007
2008/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002009 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002010 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002011message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08002012 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002013}
2014
2015/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002016 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08002017 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08002018message SystemUptime {
2019 // Milliseconds since the system was booted.
2020 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
2021 // for external input).
2022 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08002023 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002024}
2025
2026/*
2027 * Reads from /proc/uid_concurrent_active_time which has the format:
2028 * active: X (X is # cores)
2029 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
2030 * [uid1]: [time-0] [time-1] [time-2] ... ...
2031 * ...
2032 * Time-N means the CPU time a UID spent running concurrently with N other processes.
2033 * The file contains a monotonically increasing count of time for a single boot.
2034 */
2035message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002036 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002037 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08002038}
2039
2040/**
2041 * Reads from /proc/uid_concurrent_policy_time which has the format:
2042 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
2043 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2044 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
2045 * ...
2046 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
2047 * The file contains a monotonically increasing count of time for a single boot.
2048 */
2049message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07002050 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08002051 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08002052 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08002053}
2054
2055/*
2056 * Pulls free disk space, for data, system partition and temporary directory.
2057 */
2058message DiskSpace {
2059 // available bytes in data partition
2060 optional uint64 data_available_bytes = 1;
2061 // available bytes in system partition
2062 optional uint64 system_available_bytes = 2;
2063 // available bytes in download cache or temp directories
2064 optional uint64 temp_available_bytes = 3;
2065}
Tej Singhbf972d92018-01-10 20:51:13 -08002066
2067/**
2068 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002069 * Pulled from:
2070 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002071 */
2072message RemainingBatteryCapacity {
2073 optional int32 charge_uAh = 1;
2074}
2075
2076/**
2077 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08002078 * Pulled from:
2079 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08002080 */
2081message FullBatteryCapacity {
2082 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08002083}
2084
2085/**
Tej Singhd89137e2018-03-26 14:51:40 -07002086 * Pulls the temperature of various parts of the device.
2087 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08002088 *
2089 * Pulled from:
2090 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
2091 */
2092message Temperature {
2093 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
2094 optional android.os.TemperatureTypeEnum sensor_location = 1;
2095
2096 // The name of the temperature source. Eg. CPU0
2097 optional string sensor_name = 2;
2098
Tej Singhd89137e2018-03-26 14:51:40 -07002099 // Temperature in tenths of a degree C.
2100 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08002101}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002102
2103/**
2104 * Pulls the statistics of calls to Binder.
2105 *
2106 * Binder stats are cumulative from boot unless somebody reset the data using
2107 * > adb shell dumpsys binder_calls_stats --reset
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002108 *
2109 * Next tag: 14
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002110 */
2111message BinderCalls {
Olivier Gaillard9ea238d2018-07-24 10:26:31 +01002112 optional int32 uid = 1 [(is_uid) = true];
2113 // Fully qualified class name of the API call.
2114 //
2115 // This is a system server class name.
2116 //
2117 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
2118 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
2119 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
2120 // commonly used APIs.
2121 optional string service_class_name = 2;
2122 // Method name of the API call. It can also be a transaction code if we cannot
2123 // resolve it to a name. See Binder#getTransactionName.
2124 //
2125 // This is a system server method name.
2126 optional string service_method_name = 3;
2127 // Total number of API calls.
2128 optional int64 call_count = 4;
2129 // True if the screen was interactive PowerManager#isInteractive at the end of the call.
2130 optional bool screen_interactive = 13;
2131 // Total number of API calls we have data recorded for. If we collected data for all the calls,
2132 // call_count will be equal to recorded_call_count.
2133 //
2134 // If recorded_call_count is different than call_count, it means data collection has been
2135 // sampled. All the fields below will be sampled in this case.
2136 optional int64 recorded_call_count = 12;
2137 // Number of exceptions thrown by the API.
2138 optional int64 recorded_exception_count = 5;
2139 // Total latency of all API calls.
2140 // Average can be computed using total_latency_micros / recorded_call_count.
2141 optional int64 recorded_total_latency_micros = 6;
2142 // Maximum latency of one API call.
2143 optional int64 recorded_max_latency_micros = 7;
2144 // Total CPU usage of all API calls.
2145 // Average can be computed using total_cpu_micros / recorded_call_count.
2146 // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
2147 optional int64 recorded_total_cpu_micros = 8;
2148 // Maximum CPU usage of one API call.
2149 optional int64 recorded_max_cpu_micros = 9;
2150 // Maximum parcel reply size of one API call.
2151 optional int64 recorded_max_reply_size_bytes = 10;
2152 // Maximum parcel request size of one API call.
2153 optional int64 recorded_max_request_size_bytes = 11;
2154}
2155
2156/**
2157 * Pulls the statistics of exceptions during calls to Binder.
2158 *
2159 * Binder stats are cumulative from boot unless somebody reset the data using
2160 * > adb shell dumpsys binder_calls_stats --reset
2161 */
2162message BinderCallsExceptions {
2163 // Exception class name, e.g. java.lang.IllegalArgumentException.
2164 //
2165 // This is an exception class name thrown by the system server.
2166 optional string exception_class_name = 1;
2167 // Total number of exceptions.
2168 optional int64 exception_count = 2;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01002169}