blob: e23676f961510f13428ed31e98d94de3b41c08bb [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 Yu5caaa9d2018-03-06 15:48:54 -080051 // 3 is available for use
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 Yu5caaa9d2018-03-06 15:48:54 -080062 // 14 - 19 are available
Bookatzddccf0a2017-11-28 16:48:14 -080063 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
64 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
65 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070066 AudioStateChanged audio_state_changed = 23;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080067 MediaCodecStateChanged media_codec_state_changed = 24;
Bookatzc1a050a2017-10-10 15:49:28 -070068 CameraStateChanged camera_state_changed = 25;
69 FlashlightStateChanged flashlight_state_changed = 26;
70 UidProcessStateChanged uid_process_state_changed = 27;
71 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
72 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070073 BatteryLevelChanged battery_level_changed = 30;
74 ChargingStateChanged charging_state_changed = 31;
75 PluggedStateChanged plugged_state_changed = 32;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080076 // 33 - 34 are available
Bookatz8c6571b2017-10-24 15:04:41 -070077 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
78 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070079 WifiLockStateChanged wifi_lock_state_changed = 37;
80 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
81 WifiScanStateChanged wifi_scan_state_changed = 39;
82 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070083 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070084 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070085 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090086 PacketWakeupOccurred packet_wakeup_occurred = 44;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080087 // 45 is available
Bookatz8fcd09a2017-12-18 13:01:10 -080088 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080089 AppBreadcrumbReported app_breadcrumb_reported = 47;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -080090 AppStartOccurred app_start_occurred = 48;
91 AppStartCanceled app_start_canceled = 49;
92 AppStartFullyDrawn app_start_fully_drawn = 50;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080093 LmkKillOccurred lmk_kill_occurred = 51;
Chenjie Yu52cacc62017-12-08 18:11:45 -080094 PictureInPictureStateChanged picture_in_picture_state_changed = 52;
Tej Singh4503e102018-01-04 14:35:01 -080095 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -080096 LmkStateChanged lmk_state_changed = 54;
97 AppStartMemoryStateCaptured app_start_memory_state_captured = 55;
Tej Singh1ea42892018-01-19 09:27:00 -080098 ShutdownSequenceReported shutdown_sequence_reported = 56;
Tej Singh6483ea42018-01-25 17:45:49 -080099 BootSequenceReported boot_sequence_reported = 57;
Tej Singhbb8554a2018-01-26 11:59:14 -0800100 DaveyOccurred davey_occurred = 58;
Chenjie Yue8904192017-12-08 19:12:57 -0800101 OverlayStateChanged overlay_state_changed = 59;
Chenjie Yuccfe6452018-01-30 11:33:21 -0800102 ForegroundServiceStateChanged foreground_service_state_changed = 60;
Tej Singhc477d9c2018-02-05 18:31:39 -0800103 CallStateChanged call_state_changed = 61;
Tej Singhdd7bd352018-02-09 19:33:15 -0800104 KeyguardStateChanged keyguard_state_changed = 62;
105 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
106 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800107 AppDied app_died = 65;
Tej Singha883b372018-02-15 11:30:01 -0800108 ResourceConfigurationChanged resource_configuration_changed = 66;
Tej Singh5d991e12018-03-09 19:48:11 -0800109 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
110 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68;
Tej Singh02200f92018-04-02 19:37:59 -0700111 // 69 is blank but need not be.
Andrew Chantb56388b2018-03-22 21:07:33 -0700112 UsbConnectorStateChanged usb_connector_state_changed = 70;
Andrew Chant28d627e2018-02-22 15:17:05 -0800113 SpeakerImpedanceReported speaker_impedance_reported = 71;
114 HardwareFailed hardware_failed = 72;
115 PhysicalDropDetected physical_drop_detected = 73;
116 ChargeCyclesReported charge_cycles_reported = 74;
Tej Singheee317b2018-03-07 19:28:05 -0800117 MobileConnectionStateChanged mobile_connection_state_changed = 75;
118 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76;
Andrew Chantb56388b2018-03-22 21:07:33 -0700119 UsbDeviceAttached usb_device_attached = 77;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800120 AppCrashOccurred app_crash_occurred = 78;
121 ANROccurred anr_occurred = 79;
122 WTFOccurred wtf_occurred = 80;
123 LowMemReported low_mem_reported = 81;
124
125
Yao Chend54f9dd2017-10-17 17:37:48 +0000126 }
David Chenc8a43242017-10-17 16:23:28 -0700127
David Chen6e3e6cb2018-01-03 16:14:06 -0800128 // Pulled events will start at field 10000.
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100129 // Next: 10023
David Chenc8a43242017-10-17 16:23:28 -0700130 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800131 WifiBytesTransfer wifi_bytes_transfer = 10000;
132 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
133 MobileBytesTransfer mobile_bytes_transfer = 10002;
134 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800135 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800136 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800137 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800138 CpuTimePerFreq cpu_time_per_freq = 10008;
139 CpuTimePerUid cpu_time_per_uid = 10009;
140 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800141 WifiActivityInfo wifi_activity_info = 10011;
David Chen6e3e6cb2018-01-03 16:14:06 -0800142 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800143 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800144 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800145 SystemElapsedRealtime system_elapsed_realtime = 10014;
146 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800147 CpuActiveTime cpu_active_time = 10016;
148 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800149 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800150 RemainingBatteryCapacity remaining_battery_capacity = 10019;
151 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800152 Temperature temperature = 10021;
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +0100153 BinderCalls binder_calls = 10022;
David Chenc8a43242017-10-17 16:23:28 -0700154 }
yroa1fe77c2018-02-26 14:22:54 -0800155
156 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
157 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700158}
159
Yao Chend54f9dd2017-10-17 17:37:48 +0000160/**
Yangster-mac20877162017-12-22 17:19:39 -0800161 * This proto represents a node of an attribution chain.
162 * Note: All attribution chains are represented as a repeated field of type
163 * AttributionNode. It is understood that in such arrays, the order is that
164 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000165 */
Yangster-mac20877162017-12-22 17:19:39 -0800166message AttributionNode {
167 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800168 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800169
Yangster-mac20877162017-12-22 17:19:39 -0800170 // The (optional) string tag for an element in the attribution chain. If the
171 // element has no tag, it is encoded as an empty string.
172 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700173}
174
Yao Chend54f9dd2017-10-17 17:37:48 +0000175/*
176 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800177 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 *
179 * RULES:
180 * - The field ids for each atom must start at 1, and count upwards by 1.
181 * Skipping field ids is not allowed.
182 * - These form an API, so renaming, renumbering or removing fields is
183 * not allowed between android releases. (This is not currently enforced,
184 * but there will be a tool to enforce this restriction).
185 * - The types must be built-in protocol buffer types, namely, no sub-messages
186 * are allowed (yet). The bytes type is also not allowed.
187 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800188 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000189 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800190 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000191 * - A field that is a uid should be a string field, tagged with the [xxx]
192 * annotation. The generated code on android will be represented by UIDs,
193 * and those UIDs will be translated in xxx to those strings.
194 *
195 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700196 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000197 * - If there is a UID, it goes first. Think in an object-oriented fashion.
198 * *****************************************************************************
199 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700200
Yao Chend54f9dd2017-10-17 17:37:48 +0000201/**
202 * Logs when the screen state changes.
203 *
204 * Logged from:
205 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
206 */
207message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800208 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800209 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700210}
Yao Chend54f9dd2017-10-17 17:37:48 +0000211
212/**
Bookatzc1a050a2017-10-10 15:49:28 -0700213 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000214 *
215 * Logged from:
216 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
217 */
Bookatzc1a050a2017-10-10 15:49:28 -0700218message UidProcessStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700219 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
Yao Chend54f9dd2017-10-17 17:37:48 +0000220
Bookatzdb026a22018-01-10 19:01:56 -0800221 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800222 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000223}
224
225/**
Bookatzc1a050a2017-10-10 15:49:28 -0700226 * Logs that a process started, finished, crashed, or ANRed.
227 *
228 * Logged from:
229 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
230 */
231message ProcessLifeCycleStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -0700232 optional int32 uid = 1 [(is_uid) = true];
Bookatzc1a050a2017-10-10 15:49:28 -0700233
David Chen0b5c90c2018-01-25 16:51:49 -0800234 // The process name (usually same as the app name).
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800235 optional string process_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700236
Bookatzddccf0a2017-11-28 16:48:14 -0800237 // What lifecycle state the process changed to.
238 // This enum is specific to atoms.proto.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800239 enum State {
240 FINISHED = 0;
241 STARTED = 1;
242 CRASHED = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800243 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800244 optional State state = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700245}
246
Bookatzc1a050a2017-10-10 15:49:28 -0700247/**
248 * Logs when the ble scan state changes.
249 *
250 * Logged from:
Bookatz17a879d2018-03-28 15:05:28 -0700251 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Bookatzc1a050a2017-10-10 15:49:28 -0700252 */
253message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800254 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700255
256 enum State {
257 OFF = 0;
258 ON = 1;
Bookatze5ec0b42018-03-26 13:34:56 -0700259 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
260 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700261 }
262 optional State state = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700263
Bookatze5ec0b42018-03-26 13:34:56 -0700264 // Does the scan have a filter.
265 optional bool is_filtered = 3;
266 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
267 optional bool is_first_match = 4;
268 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
269 optional bool is_opportunistic = 5;
Bookatzc1a050a2017-10-10 15:49:28 -0700270}
271
272/**
273 * Logs reporting of a ble scan finding results.
274 *
275 * Logged from:
276 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
277 */
278// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
279message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800280 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700281
282 // Number of ble scan results returned.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800283 optional int32 num_results = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700284}
285
286/**
287 * Logs when a sensor state changes.
288 *
289 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700290 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700291 */
292message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800293 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700294
Bookatzc1a050a2017-10-10 15:49:28 -0700295 // The id (int) of the sensor.
296 optional int32 sensor_id = 2;
297
298 enum State {
299 OFF = 0;
300 ON = 1;
301 }
302 optional State state = 3;
303}
304
305
306/**
307 * Logs when GPS state changes.
308 *
309 * Logged from:
310 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
311 */
312message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800313 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700314
315 enum State {
316 OFF = 0;
317 ON = 1;
318 }
319 optional State state = 2;
320}
321
322
323/**
324 * Logs when a sync manager sync state changes.
325 *
326 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700327 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700328 */
329message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800330 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700331
David Chen0b5c90c2018-01-25 16:51:49 -0800332 // Name of the sync (as named in the app). Can be chosen at run-time.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800333 optional string sync_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700334
335 enum State {
336 OFF = 0;
337 ON = 1;
338 }
339 optional State state = 3;
340}
341
342/**
343 * Logs when a job scheduler job state changes.
344 *
345 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700346 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700347 */
348message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800349 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700350
351 // Name of the job (as named in the app)
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800352 optional string job_name = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700353
354 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800355 FINISHED = 0;
356 STARTED = 1;
357 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700358 }
359 optional State state = 3;
360
Tej Singh33a412b2018-03-16 18:43:59 -0700361 // The reason a job has stopped.
362 // This is only applicable when the state is FINISHED.
Bookatz235343d2018-03-26 13:03:50 -0700363 // The default value is STOP_REASON_UNKNOWN.
Tej Singh33a412b2018-03-16 18:43:59 -0700364 optional android.app.job.StopReasonEnum stop_reason = 4;
Bookatzc1a050a2017-10-10 15:49:28 -0700365}
366
367/**
368 * Logs when the audio state changes.
369 *
370 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700371 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700372 */
373message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800374 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700375
376 enum State {
377 OFF = 0;
378 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700379 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
380 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700381 }
382 optional State state = 2;
383}
384
385/**
386 * Logs when the video codec state changes.
387 *
388 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700389 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700390 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800391message MediaCodecStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800392 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700393
394 enum State {
395 OFF = 0;
396 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700397 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
398 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700399 }
400 optional State state = 2;
401}
402
403/**
404 * Logs when the flashlight state changes.
405 *
406 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700407 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700408 */
409message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800410 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700411
412 enum State {
413 OFF = 0;
414 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700415 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
416 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700417 }
418 optional State state = 2;
419}
420
421/**
422 * Logs when the camera state changes.
423 *
424 * Logged from:
Bookatz235343d2018-03-26 13:03:50 -0700425 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
Bookatzc1a050a2017-10-10 15:49:28 -0700426 */
427message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800428 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700429
430 enum State {
431 OFF = 0;
432 ON = 1;
Bookatz235343d2018-03-26 13:03:50 -0700433 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
434 RESET = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700435 }
436 optional State state = 2;
437}
438
439/**
440 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000441 *
442 * Logged from:
443 * TODO
444 */
Bookatzd6746242017-10-24 18:39:35 -0700445message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800446 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000447
Bookatz1a1b0462018-01-12 11:47:03 -0800448 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
449 // From frameworks/base/core/proto/android/os/enums.proto.
450 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700451
452 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
453 optional string tag = 3;
454
455 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800456 RELEASE = 0;
457 ACQUIRE = 1;
458 CHANGE_RELEASE = 2;
459 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700460 }
461 optional State state = 4;
462}
463
464/**
Bookatzc1a050a2017-10-10 15:49:28 -0700465 * Logs when a partial wakelock is considered 'long' (over 1 min).
466 *
467 * Logged from:
468 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
469 */
470message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800471 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700472
Yao Chend54f9dd2017-10-17 17:37:48 +0000473 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
474 optional string tag = 2;
475
Bookatzc1a050a2017-10-10 15:49:28 -0700476 // TODO: I have no idea what this is.
477 optional string history_tag = 3;
478
479 enum State {
480 OFF = 0;
481 ON = 1;
482 }
483 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000484}
485
Bookatzc1a050a2017-10-10 15:49:28 -0700486/**
487 * Logs Battery Saver state change.
488 *
489 * Logged from:
490 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
491 */
492message BatterySaverModeStateChanged {
493 enum State {
494 OFF = 0;
495 ON = 1;
496 }
497 optional State state = 1;
498}
499
500/**
501 * Logs Doze mode state change.
502 *
503 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800504 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700505 */
506message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800507 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800508}
509
510
511/**
512 * Logs state change of Doze mode including maintenance windows.
513 *
514 * Logged from:
515 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
516 */
517message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800518 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700519}
520
521/**
522 * Logs screen brightness level.
523 *
524 * Logged from:
525 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
526 */
527message ScreenBrightnessChanged {
528 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
529 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700530}
531
532/**
533 * Logs battery level (percent full, from 0 to 100).
534 *
535 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700536 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700537 */
538message BatteryLevelChanged {
539 // Battery level. Should be in [0, 100].
540 optional int32 battery_level = 1;
541}
542
543/**
544 * Logs change in charging status of the device.
545 *
546 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700547 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700548 */
549message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800550 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
551 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700552}
553
554/**
555 * Logs whether the device is plugged in, and what power source it is using.
556 *
557 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700558 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700559 */
560message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800561 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
562 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700563}
564
Bookatz8c6571b2017-10-24 15:04:41 -0700565/**
566 * Logs when an app's wakeup alarm fires.
567 *
568 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700569 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700570 */
571message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800572 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800573
574 // Name of the wakeup alarm.
575 optional string tag = 2;
576}
577
578/**
579 * Logs when an an app causes the mobile radio to change state.
580 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
581 *
582 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700583 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800584 */
585message MobileRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800586 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800587
Bookatz1a1b0462018-01-12 11:47:03 -0800588 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
589 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800590}
591
592/**
593 * Logs when an an app causes the wifi radio to change state.
594 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
595 *
596 * Logged from:
Bookatz0b028b12018-05-31 16:51:17 -0700597 * frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Bookatzddccf0a2017-11-28 16:48:14 -0800598 */
599message WifiRadioPowerStateChanged {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -0800600 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800601
Bookatz1a1b0462018-01-12 11:47:03 -0800602 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
603 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700604}
605
606/**
607 * Logs kernel wakeup reasons and aborts.
608 *
609 * Logged from:
610 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
611 */
612message KernelWakeupReported {
613 // Name of the kernel wakeup reason (or abort).
614 optional string wakeup_reason_name = 1;
615
616 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800617 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700618}
619
620/**
621 * Logs wifi locks held by an app.
622 *
623 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700624 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700625 */
626message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800627 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700628
629 enum State {
630 OFF = 0;
631 ON = 1;
632 }
633 optional State state = 2;
634}
635
636/**
637 * Logs wifi signal strength changes.
638 *
639 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700640 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700641 */
642message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800643 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
644 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700645}
646
647/**
648 * Logs wifi scans performed by an app.
649 *
650 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700651 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700652 */
653message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800654 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700655
656 enum State {
657 OFF = 0;
658 ON = 1;
659 }
660 optional State state = 2;
661}
662
663/**
Tej Singh4503e102018-01-04 14:35:01 -0800664 * Logs wifi multicast locks held by an app
665 *
666 * Logged from:
667 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
668 */
669message WifiMulticastLockStateChanged {
670 repeated AttributionNode attribution_node = 1;
671
672 enum State {
673 OFF = 0;
674 ON = 1;
675 }
676 optional State state = 2;
677}
678
679/**
Tej Singh1ea42892018-01-19 09:27:00 -0800680 * Logs shutdown reason and duration on next boot.
681 *
682 * Logged from:
683 * frameworks/base/core/java/com/android/server/BootReceiver.java
684 */
685message ShutdownSequenceReported {
686 // True if shutdown is for a reboot. Default: false if we do not know.
687 optional bool reboot = 1;
688
689 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
690 optional string reason = 2;
691
692 // Beginning of shutdown time in ms using wall clock time since unix epoch.
693 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800694 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800695
696 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800697 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800698}
699
Tej Singh6483ea42018-01-25 17:45:49 -0800700
701/**
702 * Logs boot reason and duration.
703 *
704 * Logged from:
705 * system/core/bootstat/bootstat.cpp
706 */
707message BootSequenceReported {
708 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
709 // Default: "<EMPTY>" if not available.
710 optional string bootloader_reason = 1;
711
712 // Reason for system boot. Eg. bootloader, reboot,userrequested
713 // Default: "<EMPTY>" if not available.
714 optional string system_reason = 2;
715
716 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800717 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800718
719 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800720 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800721
722 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800723 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800724
725 // Time since last boot in ms. Default: 0 if not available.
726 optional int64 time_since_last_boot = 6;
727}
728
Tej Singhc477d9c2018-02-05 18:31:39 -0800729
730/**
731 * Logs call state and disconnect cause (if applicable).
732 *
733 * Logged from:
734 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
735 */
736message CallStateChanged {
737 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
738 // From frameworks/base/core/proto/android/telecomm/enums.proto.
739 optional android.telecom.CallStateEnum call_state = 1;
740
741 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
742 // This value is only applicable when the call_state is DISCONNECTED, and
743 // should always be UNKNOWN if the call_state is not DISCONNECTED.
744 // From frameworks/base/core/proto/android/telecomm/enums.proto.
745 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
746
747 // True if the call is self-managed, which are apps that use the
748 // telecom infrastructure to make their own calls.
749 optional bool self_managed = 3;
750
751 // True if call is external. External calls are calls on connected Wear
752 // devices but show up in Telecom so the user can pull them onto the device.
753 optional bool external_call = 4;
754}
755
Tej Singh1ea42892018-01-19 09:27:00 -0800756/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800757 * Logs keyguard state. The keyguard is the lock screen.
758 *
759 * Logged from:
760 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
761 */
762message KeyguardStateChanged {
763 enum State {
764 UNKNOWN = 0;
765 // The keyguard is hidden when the phone is unlocked.
766 HIDDEN = 1;
767 // The keyguard is shown when the phone is locked (screen turns off).
768 SHOWN= 2;
769 // The keyguard is occluded when something is overlaying the keyguard.
770 // Eg. Opening the camera while on the lock screen.
771 OCCLUDED = 3;
772 }
773 optional State state = 1;
774}
775
776/**
777 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
778 * prompts the user to enter a password (pattern, pin, etc).
779 *
780 * Logged from:
781 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
782 */
783
784message KeyguardBouncerStateChanged {
785 enum State {
786 UNKNOWN = 0;
787 // Bouncer is hidden, either as a result of successfully entering the
788 // password, screen timing out, or user going back to lock screen.
789 HIDDEN = 1;
790 // This is when the user is being prompted to enter the password.
791 SHOWN = 2;
792 }
793 optional State state = 1;
794}
795
796/**
797 * Logs the result of entering a password into the keyguard bouncer.
798 *
799 * Logged from:
800 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
801 */
802message KeyguardBouncerPasswordEntered {
803 enum BouncerResult {
804 UNKNOWN = 0;
805 // The password entered was incorrect.
806 FAILURE = 1;
807 // The password entered was correct.
808 SUCCESS = 2;
809 }
810 optional BouncerResult result = 1;
811}
812
Tej Singha883b372018-02-15 11:30:01 -0800813/*
814 * Logs changes to the configuration of the device. The configuration is defined
815 * in frameworks/base/core/java/android/content/res/Configuration.java
816 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
817 * Please go there to interpret the possible values each field can be.
818 *
819 * Logged from:
820 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
821 */
822message ResourceConfigurationChanged {
823 // Bit mask of color capabilities of the screen.
824 // Contains information about the color gamut and hdr mode of the screen.
825 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
826 optional int32 colorMode = 1;
827
828 // The target screen density being rendered to.
829 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
830 optional int32 densityDpi = 2;
831
832 // Current user preference for the scaling factor for fonts,
833 // relative to the base density scaling.
834 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
835 optional float fontScale = 3;
836
837 // Flag indicating whether the hard keyboard is hidden.
838 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
839 optional int32 hardKeyboardHidden = 4;
840
841 // The type of keyboard attached to the device.
842 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
843 optional int32 keyboard = 5;
844
845 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
846 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
847 optional int32 keyboardHideen = 6;
848
849 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
850 // 0 if undefined.
851 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
852 optional int32 mcc = 7;
853
854 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
855 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
856 // MNC_ZERO symbol defined in Configuration.java.
857 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
858 optional int32 mnc = 8;
859
860 // The kind of navigation available on the device.
861 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
862 optional int32 navigation = 9;
863
864 // Flag indicating whether the navigation is available.
865 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
866 optional int32 navigationHidden = 10;
867
868 // Overall orientation of the screen.
869 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
870 optional int32 orientation = 11;
871
872 // The current height of the available screen space, in dp units.
873 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
874 optional int32 screenHeightDp = 12;
875
876 // Bit mask of overall layout of the screen.
877 // Contains information about screen size, whether the screen is wider/taller
878 // than normal, whether the screen layout is right-tl-left or left-to-right,
879 // and whether the screen has a rounded shape.
880 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
881 optional int32 screenLayout = 13;
882
883 // Current width of the available screen space, in dp units.
884 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
885 optional int32 screenWidthDp = 14;
886
887 // The smallest screen size an application will see in normal operation.
888 // This is the smallest value of both screenWidthDp and screenHeightDp
889 // in portrait and landscape.
890 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
891 optional int32 smallestScreenWidthDp = 15;
892
893 // The type of touch screen attached to the device.
894 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
895 optional int32 touchscreen = 16;
896
897 // Bit mask of the ui mode.
898 // Contains information about the overall ui mode of the device.
899 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
900 // Also contains information about whether the device is in night mode.
901 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
902 optional int32 uiMode = 17;
903}
904
Tej Singheee317b2018-03-07 19:28:05 -0800905
906/**
907 * Logs changes in the connection state of the mobile radio.
908 *
909 * Logged from:
910 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
911 */
912message MobileConnectionStateChanged {
913 // States are from the state machine DataConnection.java.
914 enum State {
915 UNKNOWN = 0;
916 // The connection is inactive, or disconnected.
917 INACTIVE = 1;
918 // The connection is being activated, or connecting.
919 ACTIVATING = 2;
920 // The connection is active, or connected.
921 ACTIVE = 3;
922 // The connection is disconnecting.
923 DISCONNECTING = 4;
924 // The connection is disconnecting after creating a connection.
925 DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
926 }
927 optional State state = 1;
928 // For multi-sim phones, this distinguishes between the sim cards.
929 optional int32 sim_slot_index = 2;
930 // Used to identify the connection. Starts at 0 and increments by 1 for
931 // every new network created. Resets whenever the device reboots.
932 optional int32 data_connection_id = 3;
933 // A bitmask for the capabilities of this connection.
934 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
935 // Default value (if we have no information): 0
936 optional int64 capabilities = 4;
937 // If this connection has internet.
938 // This just checks if the DEFAULT bit of capabilities is set.
939 optional bool has_internet = 5;
940}
941
942/**
943 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
944 *
945 * Logged from:
946 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
947 */
948message MobileRadioTechnologyChanged {
949 optional android.telephony.NetworkTypeEnum state = 1;
950 // For multi-sim phones, this distinguishes between the sim cards.
951 optional int32 sim_slot_index = 2;
952}
953
Andrew Chantb56388b2018-03-22 21:07:33 -0700954/**
955 * Logs the VID and PID of any connected USB devices.
956 *
957 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
958 *
959 * Logged by Vendor.
960 */
961message UsbDeviceAttached {
962 optional int32 vid = 1;
963 optional int32 pid = 2;
964 optional bool has_audio = 3;
965 optional bool has_hid = 4;
966 optional bool has_storage = 5;
967}
968
Tej Singheee317b2018-03-07 19:28:05 -0800969
Tej Singhdd7bd352018-02-09 19:33:15 -0800970/**
Tej Singh5d991e12018-03-09 19:48:11 -0800971 * Logs when Bluetooth is enabled and disabled.
972 *
973 * Logged from:
974 * services/core/java/com/android/server/BluetoothManagerService.java
975 */
976message BluetoothEnabledStateChanged {
977 repeated AttributionNode attribution_node = 1;
978 // Whether or not bluetooth is enabled on the device.
979 enum State {
980 UNKNOWN = 0;
981 ENABLED = 1;
982 DISABLED = 2;
983 }
984 optional State state = 2;
985 // The reason for being enabled/disabled.
986 // Eg. Airplane mode, crash, application request.
987 optional android.bluetooth.EnableDisableReasonEnum reason = 3;
988 // If the reason is an application request, this will be the package name.
989 optional string pkgName = 4;
990}
991
992/**
993 * Logs when a Bluetooth device connects and disconnects.
994 *
995 * Logged from:
996 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
997 */
998message BluetoothConnectionStateChanged {
999 // The state of the connection.
1000 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
1001 optional android.bluetooth.ConnectionStateEnum state = 1;
1002 // An identifier that can be used to match connect and disconnect events.
1003 // Currently is last two bytes of a hash of a device level ID and
1004 // the mac address of the bluetooth device that is connected.
1005 optional int32 obfuscated_id = 2;
1006 // The profile that is connected. Eg. GATT, A2DP, HEADSET.
1007 // From android.bluetooth.BluetoothAdapter.java
1008 optional int32 bt_profile = 3;
1009}
1010
1011/**
Andrew Chant28d627e2018-02-22 15:17:05 -08001012 * Logs when something is plugged into or removed from the USB-C connector.
1013 *
1014 * Logged from:
1015 * Vendor USB HAL.
1016 */
1017message UsbConnectorStateChanged {
1018 enum State {
1019 DISCONNECTED = 0;
1020 CONNECTED = 1;
1021 }
1022 optional State state = 1;
1023}
1024
1025/**
1026 * Logs the reported speaker impedance.
1027 *
1028 * Logged from:
1029 * Vendor audio implementation.
1030 */
1031message SpeakerImpedanceReported {
1032 optional int32 speaker_location = 1;
1033 optional int32 impedance = 2;
1034}
1035
1036/**
1037 * Logs the report of a failed hardware.
1038 *
1039 * Logged from:
1040 * Vendor HALs.
1041 *
1042 */
1043message HardwareFailed {
1044 enum HardwareType {
1045 HARDWARE_FAILED_UNKNOWN = 0;
1046 HARDWARE_FAILED_MICROPHONE = 1;
1047 HARDWARE_FAILED_CODEC = 2;
1048 HARDWARE_FAILED_SPEAKER = 3;
1049 HARDWARE_FAILED_FINGERPRINT = 4;
1050 }
1051 optional HardwareType hardware_type = 1;
1052
1053 /* hardware_location allows vendors to differentiate between multiple instances of
1054 * the same hardware_type. The specific locations are vendor defined integers,
1055 * referring to board-specific numbering schemes.
1056 */
1057 optional int32 hardware_location = 2;
1058
1059 /* failure_code is specific to the HardwareType of the failed hardware.
1060 * It should use the enum values defined below.
1061 */
1062 enum MicrophoneFailureCode {
1063 MICROPHONE_FAILURE_COMPLETE = 0;
1064 }
1065 enum CodecFailureCode {
1066 CODEC_FAILURE_COMPLETE = 0;
1067 }
1068 enum SpeakerFailureCode {
1069 SPEAKER_FAILURE_COMPLETE = 0;
1070 SPEAKER_FAILURE_HIGH_Z = 1;
1071 SPEAKER_FAILURE_SHORT = 2;
1072 }
1073 enum FingerprintFailureCode {
1074 FINGERPRINT_FAILURE_COMPLETE = 0;
1075 FINGERPRINT_SENSOR_BROKEN = 1;
1076 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2;
1077 }
1078 optional int32 failure_code = 3;
1079}
1080
1081/**
1082 * Log an event when the device has been physically dropped.
1083 * Reported from the /vendor partition.
1084 */
1085message PhysicalDropDetected {
1086 // Confidence that the event was actually a drop, 0 -> 100
1087 optional int32 confidence_pctg = 1;
1088 // Peak acceleration of the drop, in 1/1000s of a g.
1089 optional int32 accel_peak_thousandths_g = 2;
Andrew Chantb56388b2018-03-22 21:07:33 -07001090 // Duration of freefall in ms
1091 optional int32 freefall_time_millis = 3;
Andrew Chant28d627e2018-02-22 15:17:05 -08001092}
1093
1094/**
1095 * Log bucketed battery charge cycles.
1096 *
1097 * Each bucket represents cycles of the battery past
1098 * a given charge point. For example, bucket 1 is the
1099 * lowest 1/8th of the battery, and bucket 8 is 100%.
1100 *
1101 * Logged from:
1102 * /sys/class/power_supply/bms/cycle_count, via Vendor.
1103 */
1104message ChargeCyclesReported {
1105 optional int32 cycle_bucket_1 = 1;
1106 optional int32 cycle_bucket_2 = 2;
1107 optional int32 cycle_bucket_3 = 3;
1108 optional int32 cycle_bucket_4 = 4;
1109 optional int32 cycle_bucket_5 = 5;
1110 optional int32 cycle_bucket_6 = 6;
1111 optional int32 cycle_bucket_7 = 7;
1112 optional int32 cycle_bucket_8 = 8;
1113}
1114
1115/**
Tej Singhbb8554a2018-01-26 11:59:14 -08001116 * Logs the duration of a davey (jank of >=700ms) when it occurs
1117 *
1118 * Logged from:
1119 * frameworks/base/libs/hwui/JankTracker.cpp
1120 */
1121message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -08001122 // The UID that logged this atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001123 optional int32 uid = 1 [(is_uid) = true];
David Chen77ef6712018-02-23 18:23:42 -08001124
Tej Singhbb8554a2018-01-26 11:59:14 -08001125 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -08001126 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -08001127}
1128
1129/**
Bookatze5885242017-10-24 20:10:31 -07001130 * Logs phone signal strength changes.
1131 *
1132 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -07001133 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -07001134 */
1135message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -08001136 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
1137 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -07001138}
1139
1140/**
1141 * Logs that a setting was updated.
1142 * Logged from:
David Chenbd789912018-03-16 17:19:55 -07001143 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
David Chenc28b2bb2017-10-24 12:52:52 -07001144 * The tag and is_default allow resetting of settings to default values based on the specified
1145 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
1146 */
1147message SettingChanged {
1148 // The name of the setting.
1149 optional string setting = 1;
1150
1151 // The change being imposed on this setting. May represent a number, eg "3".
1152 optional string value = 2;
1153
1154 // The new value of this setting. For most settings, this is same as value. For some settings,
1155 // value is +X or -X where X represents an element in a set. For example, if the previous value
1156 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
1157 // The +/- feature is currently only used for location_providers_allowed.
1158 optional string new_value = 3;
1159
1160 // The previous value of this setting.
1161 optional string prev_value = 4;
1162
1163 // The tag used with the is_default for resetting sets of settings. This is generally null.
1164 optional string tag = 5;
1165
Bookatz90867622018-01-31 15:05:57 -08001166 // True if this setting with tag should be resettable.
1167 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -07001168
David Chenbd789912018-03-16 17:19:55 -07001169 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
David Chenc28b2bb2017-10-24 12:52:52 -07001170 optional int32 user = 7;
David Chenbd789912018-03-16 17:19:55 -07001171
1172 enum ChangeReason {
1173 UPDATED = 1; // Updated can be an insertion or an update.
1174 DELETED = 2;
1175 }
1176 optional ChangeReason reason = 8;
David Chenc28b2bb2017-10-24 12:52:52 -07001177}
Chenjie Yub3dda412017-10-24 13:41:59 -07001178
Chenjie Yu05013b32017-11-21 10:21:41 -08001179/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001180 * Logs activity going to foreground or background
1181 *
1182 * Logged from:
1183 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
1184 */
1185message ActivityForegroundStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001186 optional int32 uid = 1 [(is_uid) = true];
Yangster-mac20877162017-12-22 17:19:39 -08001187 optional string pkg_name = 2;
1188 optional string class_name = 3;
1189
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001190 enum State {
1191 BACKGROUND = 0;
1192 FOREGROUND = 1;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001193 }
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001194 optional State state = 4;
Chenjie Yu3d4f6042017-10-27 15:39:34 -07001195}
David Chenc8a43242017-10-17 16:23:28 -07001196
1197/**
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001198 * Logs when an app crashes.
David Chen9e3808c2017-11-20 17:25:34 -08001199 * Logged from:
1200 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1201 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001202message AppCrashOccurred {
Yao Chenc40a19d2018-03-15 16:48:25 -07001203 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001204
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001205 optional string event_type = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001206
1207 // The name of the process.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001208 // system_server if it is not by an app
David Chen9e3808c2017-11-20 17:25:34 -08001209 optional string process_name = 3;
1210
1211 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001212 optional sint32 pid = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001213
1214 optional string package_name = 5;
1215
1216 enum InstantApp {
1217 UNAVAILABLE = 0;
1218 FALSE = 1;
1219 TRUE = 2;
1220 }
1221 optional InstantApp is_instant_app = 6;
1222
1223 enum ForegroundState {
1224 UNKNOWN = 0;
1225 BACKGROUND = 1;
1226 FOREGROUND = 2;
1227 }
1228 optional ForegroundState foreground_state = 7;
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001229}
David Chen9e3808c2017-11-20 17:25:34 -08001230
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001231/**
1232 * Logs when a WTF (What a Terrible Failure) happened.
1233 * Logged from:
1234 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1235 */
1236message WTFOccurred {
1237 optional int32 uid = 1 [(is_uid) = true];
David Chen9e3808c2017-11-20 17:25:34 -08001238
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001239 optional string tag = 2;
David Chen9e3808c2017-11-20 17:25:34 -08001240
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001241 // The name of the process.
1242 // system_server if it is not by an app
1243 optional string process_name = 3;
David Chen6e3e6cb2018-01-03 16:14:06 -08001244
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001245 // The pid if available. -1 means not available.
1246 optional sint32 pid = 4;
1247}
1248
1249/**
1250 * Logs when system server reports low memory.
1251 * Logged from:
1252 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1253 */
1254message LowMemReported {
1255}
1256
1257/**
1258 * Logs when an app ANR (App Not Responding) occurs.
1259 * Logged from:
1260 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
1261 */
1262message ANROccurred {
1263 optional int32 uid = 1 [(is_uid) = true];
1264
1265 optional string process_name = 2;
1266
1267 optional string short_component_name = 3;
1268
1269 optional string reason = 4;
Chenjie Yuf17bf622018-04-02 14:22:19 -07001270
1271 enum InstantApp {
1272 UNAVAILABLE = 0;
1273 FALSE = 1;
1274 TRUE = 2;
1275 }
1276 optional InstantApp is_instant_app = 5;
1277
1278 enum ForegroundState {
1279 UNKNOWN = 0;
1280 BACKGROUND = 1;
1281 FOREGROUND = 2;
1282 }
1283 optional ForegroundState foreground_state = 6;
David Chen9e3808c2017-11-20 17:25:34 -08001284}
1285
David Chen0a368b22017-12-06 16:28:16 -08001286/*
1287 * Allows other apps to push events into statsd.
1288 * Logged from:
1289 * frameworks/base/core/java/android/util/StatsLog.java
1290 */
David Chen0b5c90c2018-01-25 16:51:49 -08001291message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001292 // The uid of the application that sent this custom atom.
Yao Chenc40a19d2018-03-15 16:48:25 -07001293 optional int32 uid = 1 [(is_uid) = true];
David Chen0a368b22017-12-06 16:28:16 -08001294
1295 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1296 optional int32 label = 2;
1297
1298 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1299 // predicates for the metrics).
1300 enum State {
1301 UNKNOWN = 0;
1302 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1303 STOP = 2;
1304 START = 3;
1305 }
1306 optional State state = 3;
1307}
1308
David Chen9e3808c2017-11-20 17:25:34 -08001309/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001310 * Logs when statsd detects an anomaly.
1311 *
1312 * Logged from:
1313 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1314 */
1315message AnomalyDetected {
1316 // Uid that owns the config whose anomaly detection alert fired.
Yao Chenc40a19d2018-03-15 16:48:25 -07001317 optional int32 config_uid = 1 [(is_uid) = true];
Bookatz8fcd09a2017-12-18 13:01:10 -08001318
Yangster-mac94e197c2018-01-02 16:03:03 -08001319 // Id of the config whose anomaly detection alert fired.
1320 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001321
Yangster-mac94e197c2018-01-02 16:03:03 -08001322 // Id of the alert (i.e. name of the anomaly that was detected).
1323 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001324}
1325
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001326message AppStartOccurred {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001327 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001328 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001329
1330 // The app package name.
1331 optional string pkg_name = 2;
1332
1333 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001334 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001335 WARM = 1;
1336 HOT = 2;
1337 COLD = 3;
1338 }
1339 // The transition type.
1340 optional TransitionType type = 3;
1341
1342 // The activity name.
1343 optional string activity_name = 4;
1344
1345 // The name of the calling app. Empty if not set.
1346 optional string calling_pkg_name = 5;
1347
1348 // Whether the app is an instant app.
1349 optional bool is_instant_app = 6;
1350
1351 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001352 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001353
Bookatz80d11a02018-01-16 10:46:35 -08001354 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001355
David Chen0b5c90c2018-01-25 16:51:49 -08001356 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001357 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001358 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001359 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001360 optional int32 bind_application_delay_millis = 11;
1361 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001362
1363 // Empty if not set.
1364 optional string launch_token = 13;
1365
Calin Juravle759fbda2018-02-20 19:52:30 +00001366 // The compiler filter used when when the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001367 optional int32 package_optimization_compilation_filter = 14;
Calin Juravle759fbda2018-02-20 19:52:30 +00001368
1369 // The reason why the package was optimized.
Calin Juravlea86783b2018-03-21 14:25:59 -07001370 optional int32 package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001371}
1372
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001373message AppStartCanceled {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001374 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001375 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001376
1377 // The app package name.
1378 optional string pkg_name = 2;
1379
1380 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001381 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001382 WARM = 1;
1383 HOT = 2;
1384 COLD = 3;
1385 }
1386 // The transition type.
1387 optional TransitionType type = 3;
1388
1389 // The activity name.
1390 optional string activity_name = 4;
1391}
1392
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001393message AppStartFullyDrawn {
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001394 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001395 optional int32 uid = 1 [(is_uid) = true];
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001396
1397 // The app package name.
1398 optional string pkg_name = 2;
1399
1400 enum TransitionType {
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001401 UNKNOWN = 0;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001402 WITH_BUNDLE = 1;
1403 WITHOUT_BUNDLE = 2;
1404 }
1405 // The transition type.
1406 optional TransitionType type = 3;
1407
1408 // The activity name.
1409 optional string activity_name = 4;
1410
1411 optional bool transition_process_running = 5;
1412
1413 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001414 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001415}
1416
Bookatz8fcd09a2017-12-18 13:01:10 -08001417/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001418 * Logs a picture-in-picture action
1419 * Logged from:
1420 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1421 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1422 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1423 */
1424message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001425 // -1 if it is not available
Yao Chenc40a19d2018-03-15 16:48:25 -07001426 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu52cacc62017-12-08 18:11:45 -08001427
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001428 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001429
Chenjie Yu52cacc62017-12-08 18:11:45 -08001430 enum State {
1431 ENTERED = 1;
1432 EXPANDED_TO_FULL_SCREEN = 2;
1433 MINIMIZED = 3;
1434 DISMISSED = 4;
1435 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001436 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001437}
1438
1439/**
Chenjie Yue8904192017-12-08 19:12:57 -08001440 * Logs overlay action
1441 * Logged from:
1442 * services/core/java/com/android/server/wm/Session.java
1443 */
1444message OverlayStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001445 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yue8904192017-12-08 19:12:57 -08001446
1447 optional string package_name = 2;
1448
1449 optional bool using_alert_window = 3;
1450
1451 enum State {
1452 ENTERED = 1;
1453 EXITED = 2;
1454 }
1455 optional State state = 4;
1456}
1457
Chenjie Yuccfe6452018-01-30 11:33:21 -08001458/*
1459 * Logs foreground service starts and stops.
1460 * Note that this is not when a service starts or stops, but when it is
1461 * considered foreground.
1462 * Logged from
1463 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1464 */
1465message ForegroundServiceStateChanged {
Yao Chenc40a19d2018-03-15 16:48:25 -07001466 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuccfe6452018-01-30 11:33:21 -08001467 // package_name + "/" + class_name
1468 optional string short_name = 2;
1469
1470 enum State {
1471 ENTER = 1;
1472 EXIT = 2;
1473 }
1474 optional State state = 3;
1475}
1476
Chenjie Yue8904192017-12-08 19:12:57 -08001477/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001478 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1479 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1480 * attributed back to the parent (host) uid. One example is Chrome.
1481 *
1482 * Logged from:
1483 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1484 */
1485message IsolatedUidChanged {
1486 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001487 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
Bookatz3c648862018-05-25 13:32:43 -07001488 // This field is ignored when event == REMOVED.
Chenjie Yubbcbc602018-02-05 16:51:52 -08001489 optional int32 parent_uid = 1;
1490
1491 optional int32 isolated_uid = 2;
1492
1493 // We expect an isolated uid to be removed before if it's used for another parent uid.
1494 enum Event {
1495 REMOVED = 0;
1496 CREATED = 1;
1497 }
1498 optional Event event = 3;
1499}
1500
1501/*
1502 * Logs the reception of an incoming network packet causing the main system to wake up for
1503 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1504 * and processed by WakeupController.cpp.
1505 */
1506message PacketWakeupOccurred {
1507 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1508 // delivered nowhere.
Yao Chenc40a19d2018-03-15 16:48:25 -07001509 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001510 // The interface name on which the packet was received.
1511 optional string iface = 2;
1512 // The ethertype value of the packet.
1513 optional int32 ethertype = 3;
1514 // String representation of the destination MAC address of the packet.
1515 optional string destination_hardware_address = 4;
1516 // String representation of the source address of the packet if this was an IP packet.
1517 optional string source_ip = 5;
1518 // String representation of the destination address of the packet if this was an IP packet.
1519 optional string destination_ip = 6;
1520 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1521 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1522 // families.
1523 optional int32 ip_next_header = 7;
1524 // The source port if this was a TCP or UDP packet.
1525 optional int32 source_port = 8;
1526 // The destination port if this was a TCP or UDP packet.
1527 optional int32 destination_port = 9;
1528}
1529
1530/*
1531 * Logs the memory stats for an app on startup.
1532 * Logged from:
1533 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1534 */
1535message AppStartMemoryStateCaptured {
1536 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001537 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001538
1539 // The process name.
1540 optional string process_name = 2;
1541
1542 // The activity name.
1543 optional string activity_name = 3;
1544
1545 // # of page-faults
1546 optional int64 pgfault = 4;
1547
1548 // # of major page-faults
1549 optional int64 pgmajfault = 5;
1550
1551 // RSS
1552 optional int64 rss_in_bytes = 6;
1553
1554 // CACHE
1555 optional int64 cache_in_bytes = 7;
1556
1557 // SWAP
1558 optional int64 swap_in_bytes = 8;
1559}
1560
1561/*
1562 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1563 * for LMK event.
1564 * Logged from:
1565 * system/core/lmkd/lmkd.c
1566 */
1567message LmkStateChanged {
1568 enum State {
1569 UNKNOWN = 0;
1570 START = 1;
1571 STOP = 2;
1572 }
1573 optional State state = 1;
1574}
1575
1576/*
1577 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1578 * Logged from:
1579 * system/core/lmkd/lmkd.c
1580 */
1581message LmkKillOccurred {
1582 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001583 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yubbcbc602018-02-05 16:51:52 -08001584
1585 // The process name.
1586 optional string process_name = 2;
1587
1588 // oom adj score.
1589 optional int32 oom_score = 3;
1590
1591 // # of page-faults
1592 optional int64 pgfault = 4;
1593
1594 // # of major page-faults
1595 optional int64 pgmajfault = 5;
1596
1597 // RSS
1598 optional int64 rss_in_bytes = 6;
1599
1600 // CACHE
1601 optional int64 cache_in_bytes = 7;
1602
1603 // SWAP
1604 optional int64 swap_in_bytes = 8;
1605}
1606
Rajeev Kumar51b54602018-03-01 12:18:26 -08001607/*
1608 * Logs when the ActivityManagerService detects that an app died.
1609 *
1610 * Logged from:
1611 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1612 */
1613message AppDied {
1614 // timestamp(elapsedRealtime) of record creation
Yao Chenc40a19d2018-03-15 16:48:25 -07001615 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
Rajeev Kumar51b54602018-03-01 12:18:26 -08001616}
1617
Chenjie Yubbcbc602018-02-05 16:51:52 -08001618//////////////////////////////////////////////////////////////////////
1619// Pulled atoms below this line //
1620//////////////////////////////////////////////////////////////////////
1621
1622/**
David Chenc8a43242017-10-17 16:23:28 -07001623 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1624 *
1625 * Pulled from:
1626 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1627 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001628message WifiBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001629 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001630
1631 optional int64 rx_bytes = 2;
1632
1633 optional int64 rx_packets = 3;
1634
1635 optional int64 tx_bytes = 4;
1636
1637 optional int64 tx_packets = 5;
1638}
1639
1640/**
1641 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1642 *
1643 * Pulled from:
1644 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1645 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001646message WifiBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001647 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001648
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001649 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1650 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001651
1652 optional int64 rx_bytes = 3;
1653
1654 optional int64 rx_packets = 4;
1655
1656 optional int64 tx_bytes = 5;
1657
1658 optional int64 tx_packets = 6;
1659}
1660
1661/**
1662 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1663 *
1664 * Pulled from:
1665 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1666 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001667message MobileBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001668 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001669
1670 optional int64 rx_bytes = 2;
1671
1672 optional int64 rx_packets = 3;
1673
1674 optional int64 tx_bytes = 4;
1675
1676 optional int64 tx_packets = 5;
1677}
1678
1679/**
1680 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1681 *
1682 * Pulled from:
1683 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1684 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001685message MobileBytesTransferByFgBg {
Yao Chenc40a19d2018-03-15 16:48:25 -07001686 optional int32 uid = 1 [(is_uid) = true];
David Chenc8a43242017-10-17 16:23:28 -07001687
Yao Chenc40a19d2018-03-15 16:48:25 -07001688 // 1 denotes foreground and 0 denotes background. This is called Set in
1689 // NetworkStats.
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001690 optional bool is_foreground = 2;
David Chenc8a43242017-10-17 16:23:28 -07001691
1692 optional int64 rx_bytes = 3;
1693
1694 optional int64 rx_packets = 4;
1695
1696 optional int64 tx_bytes = 5;
1697
1698 optional int64 tx_packets = 6;
1699}
1700
1701/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001702 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1703 *
1704 * Pulled from:
1705 * StatsCompanionService
1706 */
1707message BluetoothBytesTransfer {
Yao Chenc40a19d2018-03-15 16:48:25 -07001708 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001709
1710 optional int64 rx_bytes = 2;
1711
1712 optional int64 tx_bytes = 3;
1713}
1714
1715/**
David Chenc8a43242017-10-17 16:23:28 -07001716 * Pulls the kernel wakelock durations. This atom is adapted from
1717 * android/internal/os/KernelWakelockStats.java
1718 *
1719 * Pulled from:
1720 * StatsCompanionService using KernelWakelockReader.
1721 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001722message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001723 optional string name = 1;
1724
1725 optional int32 count = 2;
1726
1727 optional int32 version = 3;
1728
1729 optional int64 time = 4;
1730}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001731
Chenjie Yu05013b32017-11-21 10:21:41 -08001732/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001733 * Pulls low power state information. This includes platform and subsystem sleep state information,
1734 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001735 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001736 * hardware/interfaces/power/1.1/types.hal
1737 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001738message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001739 // Subsystem name
1740 optional string subsystem_name = 1;
1741 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1742 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1743 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001744 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001745 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001746 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001747 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001748}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001749
Chenjie Yu05013b32017-11-21 10:21:41 -08001750/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001751 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001752 * Pulls the time the cpu spend on the frequency index. Frequency index
1753 * starts from highest to lowest. The value should be monotonically
1754 * increasing since boot. However, if there is a cpu
1755 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001756 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001757message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001758 optional uint32 cluster = 1;
1759 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001760 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001761}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001762
Chenjie Yu05013b32017-11-21 10:21:41 -08001763/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001764 * Pulls Cpu Time Per Uid.
1765 * Note that isolated process uid time should be attributed to host uids.
1766 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001767message CpuTimePerUid {
Yao Chenc40a19d2018-03-15 16:48:25 -07001768 optional int32 uid = 1 [(is_uid) = true];
David Chen0b5c90c2018-01-25 16:51:49 -08001769 optional uint64 user_time_millis = 2;
1770 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001771}
1772
1773/**
1774 * Pulls Cpu Time Per Uid per frequency.
1775 * Note that isolated process uid time should be attributed to host uids.
1776 * For each uid, we order the time by descending frequencies.
1777 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001778message CpuTimePerUidFreq {
Yao Chenc40a19d2018-03-15 16:48:25 -07001779 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001780 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001781 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001782}
Hugo Benichi884970e2017-11-14 22:42:46 +09001783
Chenjie Yu05013b32017-11-21 10:21:41 -08001784/**
1785 * Pulls Wifi Controller Activity Energy Info
1786 */
Chenjie Yu5caaa9d2018-03-06 15:48:54 -08001787message WifiActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001788 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001789 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001790 // stack reported state
1791 // TODO: replace this with proto enum
1792 optional int32 stack_state = 2;
1793 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001794 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001795 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001796 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001797 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001798 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001799 // product of current(mA), voltage(V) and time(ms)
1800 optional uint64 controller_energy_used = 6;
1801}
1802
1803/**
1804 * Pulls Modem Activity Energy Info
1805 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001806message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001807 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001808 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001809 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001810 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001811 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001812 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001813 /**
1814 * Tx power index
1815 * index 0 = tx_power < 0dBm
1816 * index 1 = 0dBm < tx_power < 5dBm
1817 * index 2 = 5dBm < tx_power < 15dBm
1818 * index 3 = 15dBm < tx_power < 20dBm
1819 * index 4 = tx_power > 20dBm
1820 */
1821 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001822 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001823 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001824 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001825 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001826 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001827 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001828 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001829 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001830 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001831 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001832 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001833 // product of current(mA), voltage(V) and time(ms)
1834 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001835}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001836
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001837/**
1838 * Pulls Bluetooth Activity Energy Info
1839 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1840 */
1841message BluetoothActivityInfo {
1842 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001843 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001844 // bluetooth stack state
1845 optional int32 bluetooth_stack_state = 2;
1846 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001847 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001848 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001849 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001850 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001851 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001852 // product of current(mA), voltage(V) and time(ms)
1853 optional uint64 energy_used = 6;
1854}
1855
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001856/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001857 * Logs the memory stats for a process.
1858 */
1859message ProcessMemoryState {
1860 // The uid if available. -1 means not available.
Yao Chenc40a19d2018-03-15 16:48:25 -07001861 optional int32 uid = 1 [(is_uid) = true];
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001862
1863 // The process name.
1864 optional string process_name = 2;
1865
1866 // oom adj score.
1867 optional int32 oom_score = 3;
1868
1869 // # of page-faults
1870 optional int64 pgfault = 4;
1871
1872 // # of major page-faults
1873 optional int64 pgmajfault = 5;
1874
Rajeev Kumar90235992018-01-29 11:06:48 -08001875 // RSS
1876 optional int64 rss_in_bytes = 6;
1877
1878 // CACHE
1879 optional int64 cache_in_bytes = 7;
1880
1881 // SWAP
1882 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001883}
1884
1885/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001886 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001887 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001888message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001889 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001890}
1891
1892/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001893 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001894 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001895message SystemUptime {
1896 // Milliseconds since the system was booted.
1897 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1898 // for external input).
1899 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001900 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001901}
1902
1903/*
1904 * Reads from /proc/uid_concurrent_active_time which has the format:
1905 * active: X (X is # cores)
1906 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1907 * [uid1]: [time-0] [time-1] [time-2] ... ...
1908 * ...
1909 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1910 * The file contains a monotonically increasing count of time for a single boot.
1911 */
1912message CpuActiveTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001913 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001914 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001915}
1916
1917/**
1918 * Reads from /proc/uid_concurrent_policy_time which has the format:
1919 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1920 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1921 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1922 * ...
1923 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1924 * The file contains a monotonically increasing count of time for a single boot.
1925 */
1926message CpuClusterTime {
Yao Chenc40a19d2018-03-15 16:48:25 -07001927 optional int32 uid = 1 [(is_uid) = true];
Chenjie Yuec676612018-03-07 09:19:17 -08001928 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001929 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001930}
1931
1932/*
1933 * Pulls free disk space, for data, system partition and temporary directory.
1934 */
1935message DiskSpace {
1936 // available bytes in data partition
1937 optional uint64 data_available_bytes = 1;
1938 // available bytes in system partition
1939 optional uint64 system_available_bytes = 2;
1940 // available bytes in download cache or temp directories
1941 optional uint64 temp_available_bytes = 3;
1942}
Tej Singhbf972d92018-01-10 20:51:13 -08001943
1944/**
1945 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001946 * Pulled from:
1947 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001948 */
1949message RemainingBatteryCapacity {
1950 optional int32 charge_uAh = 1;
1951}
1952
1953/**
1954 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001955 * Pulled from:
1956 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001957 */
1958message FullBatteryCapacity {
1959 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001960}
1961
1962/**
Tej Singhd89137e2018-03-26 14:51:40 -07001963 * Pulls the temperature of various parts of the device.
1964 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
Tej Singh40298312018-02-16 00:15:09 -08001965 *
1966 * Pulled from:
1967 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1968 */
1969message Temperature {
1970 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1971 optional android.os.TemperatureTypeEnum sensor_location = 1;
1972
1973 // The name of the temperature source. Eg. CPU0
1974 optional string sensor_name = 2;
1975
Tej Singhd89137e2018-03-26 14:51:40 -07001976 // Temperature in tenths of a degree C.
1977 optional int32 temperature_dC = 3;
yroa1fe77c2018-02-26 14:22:54 -08001978}
Olivier Gaillard00bfb1b2018-07-10 11:25:09 +01001979
1980/**
1981 * Pulls the statistics of calls to Binder.
1982 *
1983 * Binder stats are cumulative from boot unless somebody reset the data using
1984 * > adb shell dumpsys binder_calls_stats --reset
1985 */
1986message BinderCalls {
1987 // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
1988 // gets recycled and we have isolated uids, we might attribute the data incorrectly.
1989 // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
1990 // commonly used APIs.
1991 optional int32 uid = 1 [(is_uid) = true];
1992 // Fully qualified class name of the API call.
1993 optional string service_class_name = 2;
1994 // Method name of the API call. It can also be a transaction code if we cannot resolve it to a
1995 // name. See Binder#getTransactionName.
1996 optional string service_method_name = 3;
1997 // Total number of API calls.
1998 optional int64 call_count = 4;
1999 // Number of exceptions thrown by the API.
2000 optional int64 exception_count = 5;
2001 // Total latency of all API calls.
2002 // Average can be computed using total_latency_micros / call_count.
2003 optional int64 total_latency_micros = 6;
2004 // Maximum latency of one API call.
2005 optional int64 max_latency_micros = 7;
2006 // Total CPU usage of all API calls.
2007 optional int64 total_cpu_micros = 8;
2008 // Maximum CPU usage of one API call.
2009 optional int64 max_cpu_micros = 9;
2010 // Maximum parcel reply size of one API call.
2011 optional int64 max_reply_size_bytes = 10;
2012 // Maximum parcel request size of one API call.
2013 optional int64 max_request_size_bytes = 11;
2014}