blob: 9bfbd38f89323a5ddc76c69ca6d7d47e097efef0 [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
Yao Chend54f9dd2017-10-17 17:37:48 +000019// TODO: Not the right package and class name
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070021option java_package = "com.android.os";
Stefan Lafonae2df012017-11-14 09:17:21 -080022option java_outer_classname = "AtomsProto";
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070023
Yao Chen9c1debe2018-02-19 14:39:19 -080024import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
Bookatzdb026a22018-01-10 19:01:56 -080025import "frameworks/base/core/proto/android/app/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080026import "frameworks/base/core/proto/android/os/enums.proto";
Bookatz8bdae8d2018-01-16 11:24:30 -080027import "frameworks/base/core/proto/android/server/enums.proto";
Tej Singhc477d9c2018-02-05 18:31:39 -080028import "frameworks/base/core/proto/android/telecomm/enums.proto";
Bookatz1a1b0462018-01-12 11:47:03 -080029import "frameworks/base/core/proto/android/telephony/enums.proto";
30import "frameworks/base/core/proto/android/view/enums.proto";
Joe Onorato62c220b2017-11-18 20:32:56 -080031
Yao Chend54f9dd2017-10-17 17:37:48 +000032/**
Stefan Lafonae2df012017-11-14 09:17:21 -080033 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000034 * raw stats log events from the Android system, also known as "atoms."
35 *
36 * This field contains a single oneof with all of the available messages.
37 * The stats-log-api-gen tool runs as part of the Android build and
38 * generates the android.util.StatsLog class, which contains the constants
39 * and methods that Android uses to log.
40 *
Stefan Lafonae2df012017-11-14 09:17:21 -080041 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000042 * Instead, statsd on Android constructs these messages synthetically,
43 * in the format defined here and in stats_log.proto.
44 */
Stefan Lafonae2df012017-11-14 09:17:21 -080045message Atom {
46 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070047 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070048 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
49 BleScanStateChanged ble_scan_state_changed = 2;
50 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
51 BleScanResultReceived ble_scan_result_received = 4;
52 SensorStateChanged sensor_state_changed = 5;
Bookatzdb026a22018-01-10 19:01:56 -080053 GpsScanStateChanged gps_scan_state_changed = 6;
Bookatzc1a050a2017-10-10 15:49:28 -070054 SyncStateChanged sync_state_changed = 7;
55 ScheduledJobStateChanged scheduled_job_state_changed = 8;
56 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070057 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080058 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
59 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
60 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
61 // TODO: 14-19 are blank, but need not be
62 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
63 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
64 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070065 AudioStateChanged audio_state_changed = 23;
66 MediaCodecActivityChanged media_codec_activity_changed = 24;
67 CameraStateChanged camera_state_changed = 25;
68 FlashlightStateChanged flashlight_state_changed = 26;
69 UidProcessStateChanged uid_process_state_changed = 27;
70 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
71 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070072 BatteryLevelChanged battery_level_changed = 30;
73 ChargingStateChanged charging_state_changed = 31;
74 PluggedStateChanged plugged_state_changed = 32;
Tej Singh40298312018-02-16 00:15:09 -080075 // TODO: 33 is blank, but is available for use.
Bookatz8c6571b2017-10-24 15:04:41 -070076 DeviceOnStatusChanged device_on_status_changed = 34;
77 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;
David Chen9e3808c2017-11-20 17:25:34 -080087 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080088 AnomalyDetected anomaly_detected = 46;
David Chen0b5c90c2018-01-25 16:51:49 -080089 AppBreadcrumbReported app_breadcrumb_reported = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000090 AppStartChanged app_start_changed = 48;
91 AppStartCancelChanged app_start_cancel_changed = 49;
92 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 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;
Rajeev Kumar51b54602018-03-01 12:18:26 -0800107 AppDied app_died=65;
Tej Singha883b372018-02-15 11:30:01 -0800108 ResourceConfigurationChanged resource_configuration_changed = 66;
Bookatzc1a050a2017-10-10 15:49:28 -0700109 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000110 }
David Chenc8a43242017-10-17 16:23:28 -0700111
David Chen6e3e6cb2018-01-03 16:14:06 -0800112 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800113 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700114 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800115 WifiBytesTransfer wifi_bytes_transfer = 10000;
116 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
117 MobileBytesTransfer mobile_bytes_transfer = 10002;
118 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800119 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800120 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800121 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800122 CpuTimePerFreq cpu_time_per_freq = 10008;
123 CpuTimePerUid cpu_time_per_uid = 10009;
124 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
125 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
126 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800127 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800128 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800129 SystemElapsedRealtime system_elapsed_realtime = 10014;
130 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800131 CpuActiveTime cpu_active_time = 10016;
132 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800133 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800134 RemainingBatteryCapacity remaining_battery_capacity = 10019;
135 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800136 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700137 }
yroa1fe77c2018-02-26 14:22:54 -0800138
139 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
140 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700141}
142
Yao Chend54f9dd2017-10-17 17:37:48 +0000143/**
Yangster-mac20877162017-12-22 17:19:39 -0800144 * This proto represents a node of an attribution chain.
145 * Note: All attribution chains are represented as a repeated field of type
146 * AttributionNode. It is understood that in such arrays, the order is that
147 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000148 */
Yangster-mac20877162017-12-22 17:19:39 -0800149message AttributionNode {
150 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800151 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800152
Yangster-mac20877162017-12-22 17:19:39 -0800153 // The (optional) string tag for an element in the attribution chain. If the
154 // element has no tag, it is encoded as an empty string.
155 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700156}
157
Yao Chend54f9dd2017-10-17 17:37:48 +0000158/*
159 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800160 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000161 *
162 * RULES:
163 * - The field ids for each atom must start at 1, and count upwards by 1.
164 * Skipping field ids is not allowed.
165 * - These form an API, so renaming, renumbering or removing fields is
166 * not allowed between android releases. (This is not currently enforced,
167 * but there will be a tool to enforce this restriction).
168 * - The types must be built-in protocol buffer types, namely, no sub-messages
169 * are allowed (yet). The bytes type is also not allowed.
170 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800171 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800173 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000174 * - A field that is a uid should be a string field, tagged with the [xxx]
175 * annotation. The generated code on android will be represented by UIDs,
176 * and those UIDs will be translated in xxx to those strings.
177 *
178 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700179 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000180 * - If there is a UID, it goes first. Think in an object-oriented fashion.
181 * *****************************************************************************
182 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700183
Yao Chend54f9dd2017-10-17 17:37:48 +0000184/**
185 * Logs when the screen state changes.
186 *
187 * Logged from:
188 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
189 */
190message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800191 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800192 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700193}
Yao Chend54f9dd2017-10-17 17:37:48 +0000194
195/**
Bookatzc1a050a2017-10-10 15:49:28 -0700196 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000197 *
198 * Logged from:
199 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
200 */
Bookatzc1a050a2017-10-10 15:49:28 -0700201message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800202 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000203
Bookatzdb026a22018-01-10 19:01:56 -0800204 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800205 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000206}
207
208/**
Bookatzc1a050a2017-10-10 15:49:28 -0700209 * Logs that a process started, finished, crashed, or ANRed.
210 *
211 * Logged from:
212 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
213 */
214message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800215 // TODO: should be a string tagged w/ uid annotation
216 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700217
David Chen0b5c90c2018-01-25 16:51:49 -0800218 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700219 optional string name = 2;
220
Bookatzddccf0a2017-11-28 16:48:14 -0800221 // What lifecycle state the process changed to.
222 // This enum is specific to atoms.proto.
223 enum Event {
224 PROCESS_FINISHED = 0;
225 PROCESS_STARTED = 1;
226 PROCESS_CRASHED = 2;
227 PROCESS_ANRED = 3;
228 }
229 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700230}
231
Bookatzc1a050a2017-10-10 15:49:28 -0700232/**
233 * Logs when the ble scan state changes.
234 *
235 * Logged from:
236 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
237 */
238message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800239 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700240
241 enum State {
242 OFF = 0;
243 ON = 1;
244 }
245 optional State state = 2;
246}
247
248/**
249 * Logs when an unoptimized ble scan state changes.
250 *
251 * Logged from:
252 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
253 */
254// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
255message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800256 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700257
258 enum State {
259 OFF = 0;
260 ON = 1;
261 }
262 optional State state = 2;
263}
264
265/**
266 * Logs reporting of a ble scan finding results.
267 *
268 * Logged from:
269 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
270 */
271// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
272message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800273 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700274
275 // Number of ble scan results returned.
276 optional int32 num_of_results = 2;
277}
278
279/**
280 * Logs when a sensor state changes.
281 *
282 * Logged from:
283 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
284 */
285message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800286 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700287
288 // TODO: Is there a way to get the actual name of the sensor?
289 // The id (int) of the sensor.
290 optional int32 sensor_id = 2;
291
292 enum State {
293 OFF = 0;
294 ON = 1;
295 }
296 optional State state = 3;
297}
298
299
300/**
301 * Logs when GPS state changes.
302 *
303 * Logged from:
304 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
305 */
306message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800307 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700308
309 enum State {
310 OFF = 0;
311 ON = 1;
312 }
313 optional State state = 2;
314}
315
316
317/**
318 * Logs when a sync manager sync state changes.
319 *
320 * Logged from:
321 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
322 */
323message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800324 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700325
David Chen0b5c90c2018-01-25 16:51:49 -0800326 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700327 optional string name = 2;
328
329 enum State {
330 OFF = 0;
331 ON = 1;
332 }
333 optional State state = 3;
334}
335
336/**
337 * Logs when a job scheduler job state changes.
338 *
339 * Logged from:
340 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
341 */
342message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800343 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700344
345 // Name of the job (as named in the app)
346 optional string name = 2;
347
348 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800349 FINISHED = 0;
350 STARTED = 1;
351 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700352 }
353 optional State state = 3;
354
355 // TODO: Consider adding the stopReason (int)
356}
357
358/**
359 * Logs when the audio state changes.
360 *
361 * Logged from:
362 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
363 */
364message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800365 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700366
367 enum State {
368 OFF = 0;
369 ON = 1;
370 }
371 optional State state = 2;
372}
373
374/**
375 * Logs when the video codec state changes.
376 *
377 * Logged from:
378 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
379 */
380message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800381 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700382
383 enum State {
384 OFF = 0;
385 ON = 1;
386 }
387 optional State state = 2;
388}
389
390/**
391 * Logs when the flashlight state changes.
392 *
393 * Logged from:
394 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
395 */
396message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800397 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700398
399 enum State {
400 OFF = 0;
401 ON = 1;
402 }
403 optional State state = 2;
404}
405
406/**
407 * Logs when the camera state changes.
408 *
409 * Logged from:
410 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
411 */
412message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800413 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700414
415 enum State {
416 OFF = 0;
417 ON = 1;
418 }
419 optional State state = 2;
420}
421
422/**
423 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000424 *
425 * Logged from:
426 * TODO
427 */
Bookatzd6746242017-10-24 18:39:35 -0700428message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800429 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000430
Bookatz1a1b0462018-01-12 11:47:03 -0800431 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
432 // From frameworks/base/core/proto/android/os/enums.proto.
433 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700434
435 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
436 optional string tag = 3;
437
438 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800439 RELEASE = 0;
440 ACQUIRE = 1;
441 CHANGE_RELEASE = 2;
442 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700443 }
444 optional State state = 4;
445}
446
447/**
Bookatzc1a050a2017-10-10 15:49:28 -0700448 * Logs when a partial wakelock is considered 'long' (over 1 min).
449 *
450 * Logged from:
451 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
452 */
453message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800454 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700455
Yao Chend54f9dd2017-10-17 17:37:48 +0000456 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
457 optional string tag = 2;
458
Bookatzc1a050a2017-10-10 15:49:28 -0700459 // TODO: I have no idea what this is.
460 optional string history_tag = 3;
461
462 enum State {
463 OFF = 0;
464 ON = 1;
465 }
466 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000467}
468
Bookatzc1a050a2017-10-10 15:49:28 -0700469/**
470 * Logs Battery Saver state change.
471 *
472 * Logged from:
473 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
474 */
475message BatterySaverModeStateChanged {
476 enum State {
477 OFF = 0;
478 ON = 1;
479 }
480 optional State state = 1;
481}
482
483/**
484 * Logs Doze mode state change.
485 *
486 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800487 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700488 */
489message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800490 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800491}
492
493
494/**
495 * Logs state change of Doze mode including maintenance windows.
496 *
497 * Logged from:
498 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
499 */
500message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800501 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700502}
503
504/**
505 * Logs screen brightness level.
506 *
507 * Logged from:
508 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
509 */
510message ScreenBrightnessChanged {
511 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
512 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700513}
514
515/**
516 * Logs battery level (percent full, from 0 to 100).
517 *
518 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700519 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700520 */
521message BatteryLevelChanged {
522 // Battery level. Should be in [0, 100].
523 optional int32 battery_level = 1;
524}
525
526/**
527 * Logs change in charging status of the device.
528 *
529 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700530 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700531 */
532message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800533 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
534 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700535}
536
537/**
538 * Logs whether the device is plugged in, and what power source it is using.
539 *
540 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700541 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700542 */
543message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800544 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
545 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700546}
547
Bookatz8c6571b2017-10-24 15:04:41 -0700548// TODO: Define this more precisely.
549// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
550/**
551 * Logs when the device turns off or on.
552 *
553 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700554 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700555 */
556message DeviceOnStatusChanged {
557 enum State {
558 OFF = 0;
559 ON = 1;
560 }
561 optional State state = 1;
562}
563
564/**
565 * Logs when an app's wakeup alarm fires.
566 *
567 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700568 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700569 */
570message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800571 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800572
573 // Name of the wakeup alarm.
574 optional string tag = 2;
575}
576
577/**
578 * Logs when an an app causes the mobile radio to change state.
579 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
580 *
581 * Logged from:
582 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
583 */
584message MobileRadioPowerStateChanged {
585 // TODO: Add attribution instead of uid?
586 optional int32 uid = 1;
587
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:
597 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
598 */
599message WifiRadioPowerStateChanged {
600 // TODO: Add attribution instead of uid?
601 optional int32 uid = 1;
602
Bookatz1a1b0462018-01-12 11:47:03 -0800603 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
604 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700605}
606
607/**
608 * Logs kernel wakeup reasons and aborts.
609 *
610 * Logged from:
611 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
612 */
613message KernelWakeupReported {
614 // Name of the kernel wakeup reason (or abort).
615 optional string wakeup_reason_name = 1;
616
617 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800618 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700619}
620
621/**
622 * Logs wifi locks held by an app.
623 *
624 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700625 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700626 */
627message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800628 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700629
630 enum State {
631 OFF = 0;
632 ON = 1;
633 }
634 optional State state = 2;
635}
636
637/**
638 * Logs wifi signal strength changes.
639 *
640 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700641 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700642 */
643message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800644 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
645 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700646}
647
648/**
649 * Logs wifi scans performed by an app.
650 *
651 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700652 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700653 */
654message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800655 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700656
657 enum State {
658 OFF = 0;
659 ON = 1;
660 }
661 optional State state = 2;
662}
663
664/**
Tej Singh4503e102018-01-04 14:35:01 -0800665 * Logs wifi multicast locks held by an app
666 *
667 * Logged from:
668 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
669 */
670message WifiMulticastLockStateChanged {
671 repeated AttributionNode attribution_node = 1;
672
673 enum State {
674 OFF = 0;
675 ON = 1;
676 }
677 optional State state = 2;
678}
679
680/**
Tej Singh1ea42892018-01-19 09:27:00 -0800681 * Logs shutdown reason and duration on next boot.
682 *
683 * Logged from:
684 * frameworks/base/core/java/com/android/server/BootReceiver.java
685 */
686message ShutdownSequenceReported {
687 // True if shutdown is for a reboot. Default: false if we do not know.
688 optional bool reboot = 1;
689
690 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
691 optional string reason = 2;
692
693 // Beginning of shutdown time in ms using wall clock time since unix epoch.
694 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800695 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800696
697 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800698 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800699}
700
Tej Singh6483ea42018-01-25 17:45:49 -0800701
702/**
703 * Logs boot reason and duration.
704 *
705 * Logged from:
706 * system/core/bootstat/bootstat.cpp
707 */
708message BootSequenceReported {
709 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
710 // Default: "<EMPTY>" if not available.
711 optional string bootloader_reason = 1;
712
713 // Reason for system boot. Eg. bootloader, reboot,userrequested
714 // Default: "<EMPTY>" if not available.
715 optional string system_reason = 2;
716
717 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800718 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800719
720 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800721 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800722
723 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800724 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800725
726 // Time since last boot in ms. Default: 0 if not available.
727 optional int64 time_since_last_boot = 6;
728}
729
Tej Singhc477d9c2018-02-05 18:31:39 -0800730
731/**
732 * Logs call state and disconnect cause (if applicable).
733 *
734 * Logged from:
735 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
736 */
737message CallStateChanged {
738 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
739 // From frameworks/base/core/proto/android/telecomm/enums.proto.
740 optional android.telecom.CallStateEnum call_state = 1;
741
742 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
743 // This value is only applicable when the call_state is DISCONNECTED, and
744 // should always be UNKNOWN if the call_state is not DISCONNECTED.
745 // From frameworks/base/core/proto/android/telecomm/enums.proto.
746 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
747
748 // True if the call is self-managed, which are apps that use the
749 // telecom infrastructure to make their own calls.
750 optional bool self_managed = 3;
751
752 // True if call is external. External calls are calls on connected Wear
753 // devices but show up in Telecom so the user can pull them onto the device.
754 optional bool external_call = 4;
755}
756
Tej Singh1ea42892018-01-19 09:27:00 -0800757/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800758 * Logs keyguard state. The keyguard is the lock screen.
759 *
760 * Logged from:
761 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
762 */
763message KeyguardStateChanged {
764 enum State {
765 UNKNOWN = 0;
766 // The keyguard is hidden when the phone is unlocked.
767 HIDDEN = 1;
768 // The keyguard is shown when the phone is locked (screen turns off).
769 SHOWN= 2;
770 // The keyguard is occluded when something is overlaying the keyguard.
771 // Eg. Opening the camera while on the lock screen.
772 OCCLUDED = 3;
773 }
774 optional State state = 1;
775}
776
777/**
778 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
779 * prompts the user to enter a password (pattern, pin, etc).
780 *
781 * Logged from:
782 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
783 */
784
785message KeyguardBouncerStateChanged {
786 enum State {
787 UNKNOWN = 0;
788 // Bouncer is hidden, either as a result of successfully entering the
789 // password, screen timing out, or user going back to lock screen.
790 HIDDEN = 1;
791 // This is when the user is being prompted to enter the password.
792 SHOWN = 2;
793 }
794 optional State state = 1;
795}
796
797/**
798 * Logs the result of entering a password into the keyguard bouncer.
799 *
800 * Logged from:
801 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
802 */
803message KeyguardBouncerPasswordEntered {
804 enum BouncerResult {
805 UNKNOWN = 0;
806 // The password entered was incorrect.
807 FAILURE = 1;
808 // The password entered was correct.
809 SUCCESS = 2;
810 }
811 optional BouncerResult result = 1;
812}
813
Tej Singha883b372018-02-15 11:30:01 -0800814/*
815 * Logs changes to the configuration of the device. The configuration is defined
816 * in frameworks/base/core/java/android/content/res/Configuration.java
817 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
818 * Please go there to interpret the possible values each field can be.
819 *
820 * Logged from:
821 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
822 */
823message ResourceConfigurationChanged {
824 // Bit mask of color capabilities of the screen.
825 // Contains information about the color gamut and hdr mode of the screen.
826 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
827 optional int32 colorMode = 1;
828
829 // The target screen density being rendered to.
830 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
831 optional int32 densityDpi = 2;
832
833 // Current user preference for the scaling factor for fonts,
834 // relative to the base density scaling.
835 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
836 optional float fontScale = 3;
837
838 // Flag indicating whether the hard keyboard is hidden.
839 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
840 optional int32 hardKeyboardHidden = 4;
841
842 // The type of keyboard attached to the device.
843 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
844 optional int32 keyboard = 5;
845
846 // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
847 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
848 optional int32 keyboardHideen = 6;
849
850 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
851 // 0 if undefined.
852 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
853 optional int32 mcc = 7;
854
855 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
856 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
857 // MNC_ZERO symbol defined in Configuration.java.
858 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
859 optional int32 mnc = 8;
860
861 // The kind of navigation available on the device.
862 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
863 optional int32 navigation = 9;
864
865 // Flag indicating whether the navigation is available.
866 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
867 optional int32 navigationHidden = 10;
868
869 // Overall orientation of the screen.
870 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
871 optional int32 orientation = 11;
872
873 // The current height of the available screen space, in dp units.
874 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
875 optional int32 screenHeightDp = 12;
876
877 // Bit mask of overall layout of the screen.
878 // Contains information about screen size, whether the screen is wider/taller
879 // than normal, whether the screen layout is right-tl-left or left-to-right,
880 // and whether the screen has a rounded shape.
881 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
882 optional int32 screenLayout = 13;
883
884 // Current width of the available screen space, in dp units.
885 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
886 optional int32 screenWidthDp = 14;
887
888 // The smallest screen size an application will see in normal operation.
889 // This is the smallest value of both screenWidthDp and screenHeightDp
890 // in portrait and landscape.
891 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
892 optional int32 smallestScreenWidthDp = 15;
893
894 // The type of touch screen attached to the device.
895 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
896 optional int32 touchscreen = 16;
897
898 // Bit mask of the ui mode.
899 // Contains information about the overall ui mode of the device.
900 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
901 // Also contains information about whether the device is in night mode.
902 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
903 optional int32 uiMode = 17;
904}
905
Tej Singhdd7bd352018-02-09 19:33:15 -0800906/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800907 * Logs the duration of a davey (jank of >=700ms) when it occurs
908 *
909 * Logged from:
910 * frameworks/base/libs/hwui/JankTracker.cpp
911 */
912message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -0800913 // The UID that logged this atom.
914 optional int32 uid = 1;
915
Tej Singhbb8554a2018-01-26 11:59:14 -0800916 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -0800917 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -0800918}
919
920/**
Bookatze5885242017-10-24 20:10:31 -0700921 * Logs phone signal strength changes.
922 *
923 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700924 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700925 */
926message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800927 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
928 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700929}
930
931/**
932 * Logs that a setting was updated.
933 * Logged from:
934 * frameworks/base/core/java/android/provider/Settings.java
935 * The tag and is_default allow resetting of settings to default values based on the specified
936 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
937 */
938message SettingChanged {
939 // The name of the setting.
940 optional string setting = 1;
941
942 // The change being imposed on this setting. May represent a number, eg "3".
943 optional string value = 2;
944
945 // The new value of this setting. For most settings, this is same as value. For some settings,
946 // value is +X or -X where X represents an element in a set. For example, if the previous value
947 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
948 // The +/- feature is currently only used for location_providers_allowed.
949 optional string new_value = 3;
950
951 // The previous value of this setting.
952 optional string prev_value = 4;
953
954 // The tag used with the is_default for resetting sets of settings. This is generally null.
955 optional string tag = 5;
956
Bookatz90867622018-01-31 15:05:57 -0800957 // True if this setting with tag should be resettable.
958 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700959
960 // The user ID associated. Defined in android/os/UserHandle.java
961 optional int32 user = 7;
962}
Chenjie Yub3dda412017-10-24 13:41:59 -0700963
Chenjie Yu05013b32017-11-21 10:21:41 -0800964/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700965 * Logs activity going to foreground or background
966 *
967 * Logged from:
968 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
969 */
970message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800971 optional int32 uid = 1;
972 optional string pkg_name = 2;
973 optional string class_name = 3;
974
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700975 enum Activity {
976 MOVE_TO_BACKGROUND = 0;
977 MOVE_TO_FOREGROUND = 1;
978 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700979 optional Activity activity = 4;
980}
David Chenc8a43242017-10-17 16:23:28 -0700981
982/**
David Chen9e3808c2017-11-20 17:25:34 -0800983 * Logs when an error is written to dropbox.
984 * Logged from:
985 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
986 */
987message DropboxErrorChanged {
988 // The uid if available. -1 means not available.
989 optional int32 uid = 1;
990
991 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
992 optional string tag = 2;
993
994 // The name of the process.
995 optional string process_name = 3;
996
997 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800998 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800999
1000 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -08001001 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -08001002
1003 // The activity name if available.
1004 optional string activity_name = 6;
1005
David Chen6e3e6cb2018-01-03 16:14:06 -08001006 // The package name if available.
1007 optional string package_name = 7;
1008
David Chen9e3808c2017-11-20 17:25:34 -08001009 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -08001010 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -08001011}
1012
David Chen0a368b22017-12-06 16:28:16 -08001013/*
1014 * Allows other apps to push events into statsd.
1015 * Logged from:
1016 * frameworks/base/core/java/android/util/StatsLog.java
1017 */
David Chen0b5c90c2018-01-25 16:51:49 -08001018message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -08001019 // The uid of the application that sent this custom atom.
1020 optional int32 uid = 1;
1021
1022 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
1023 optional int32 label = 2;
1024
1025 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
1026 // predicates for the metrics).
1027 enum State {
1028 UNKNOWN = 0;
1029 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
1030 STOP = 2;
1031 START = 3;
1032 }
1033 optional State state = 3;
1034}
1035
David Chen9e3808c2017-11-20 17:25:34 -08001036/**
Bookatz8fcd09a2017-12-18 13:01:10 -08001037 * Logs when statsd detects an anomaly.
1038 *
1039 * Logged from:
1040 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
1041 */
1042message AnomalyDetected {
1043 // Uid that owns the config whose anomaly detection alert fired.
1044 optional int32 config_uid = 1;
1045
Yangster-mac94e197c2018-01-02 16:03:03 -08001046 // Id of the config whose anomaly detection alert fired.
1047 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -08001048
Yangster-mac94e197c2018-01-02 16:03:03 -08001049 // Id of the alert (i.e. name of the anomaly that was detected).
1050 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -08001051}
1052
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001053message AppStartChanged {
1054 // The uid if available. -1 means not available.
1055 optional int32 uid = 1;
1056
1057 // The app package name.
1058 optional string pkg_name = 2;
1059
1060 enum TransitionType {
1061 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1062 WARM = 1;
1063 HOT = 2;
1064 COLD = 3;
1065 }
1066 // The transition type.
1067 optional TransitionType type = 3;
1068
1069 // The activity name.
1070 optional string activity_name = 4;
1071
1072 // The name of the calling app. Empty if not set.
1073 optional string calling_pkg_name = 5;
1074
1075 // Whether the app is an instant app.
1076 optional bool is_instant_app = 6;
1077
1078 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -08001079 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001080
Bookatz80d11a02018-01-16 10:46:35 -08001081 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001082
David Chen0b5c90c2018-01-25 16:51:49 -08001083 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001084 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001085 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001086 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -08001087 optional int32 bind_application_delay_millis = 11;
1088 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001089
1090 // Empty if not set.
1091 optional string launch_token = 13;
1092
Calin Juravle759fbda2018-02-20 19:52:30 +00001093 // The compiler filter used when when the package was optimized.
1094 optional string package_optimization_compilation_filter = 14;
1095
1096 // The reason why the package was optimized.
1097 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001098}
1099
1100message AppStartCancelChanged {
1101 // The uid if available. -1 means not available.
1102 optional int32 uid = 1;
1103
1104 // The app package name.
1105 optional string pkg_name = 2;
1106
1107 enum TransitionType {
1108 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1109 WARM = 1;
1110 HOT = 2;
1111 COLD = 3;
1112 }
1113 // The transition type.
1114 optional TransitionType type = 3;
1115
1116 // The activity name.
1117 optional string activity_name = 4;
1118}
1119
1120message AppStartFullyDrawnChanged {
1121 // The uid if available. -1 means not available.
1122 optional int32 uid = 1;
1123
1124 // The app package name.
1125 optional string pkg_name = 2;
1126
1127 enum TransitionType {
1128 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1129 WITH_BUNDLE = 1;
1130 WITHOUT_BUNDLE = 2;
1131 }
1132 // The transition type.
1133 optional TransitionType type = 3;
1134
1135 // The activity name.
1136 optional string activity_name = 4;
1137
1138 optional bool transition_process_running = 5;
1139
1140 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001141 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001142}
1143
Bookatz8fcd09a2017-12-18 13:01:10 -08001144/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001145 * Logs a picture-in-picture action
1146 * Logged from:
1147 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1148 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1149 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1150 */
1151message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001152 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001153 optional int32 uid = 1;
1154
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001155 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001156
Chenjie Yu52cacc62017-12-08 18:11:45 -08001157 enum State {
1158 ENTERED = 1;
1159 EXPANDED_TO_FULL_SCREEN = 2;
1160 MINIMIZED = 3;
1161 DISMISSED = 4;
1162 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001163 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001164}
1165
1166/**
Chenjie Yue8904192017-12-08 19:12:57 -08001167 * Logs overlay action
1168 * Logged from:
1169 * services/core/java/com/android/server/wm/Session.java
1170 */
1171message OverlayStateChanged {
1172 optional int32 uid = 1;
1173
1174 optional string package_name = 2;
1175
1176 optional bool using_alert_window = 3;
1177
1178 enum State {
1179 ENTERED = 1;
1180 EXITED = 2;
1181 }
1182 optional State state = 4;
1183}
1184
Chenjie Yuccfe6452018-01-30 11:33:21 -08001185/*
1186 * Logs foreground service starts and stops.
1187 * Note that this is not when a service starts or stops, but when it is
1188 * considered foreground.
1189 * Logged from
1190 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1191 */
1192message ForegroundServiceStateChanged {
1193 optional int32 uid = 1;
1194 // package_name + "/" + class_name
1195 optional string short_name = 2;
1196
1197 enum State {
1198 ENTER = 1;
1199 EXIT = 2;
1200 }
1201 optional State state = 3;
1202}
1203
Chenjie Yue8904192017-12-08 19:12:57 -08001204/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001205 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1206 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1207 * attributed back to the parent (host) uid. One example is Chrome.
1208 *
1209 * Logged from:
1210 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1211 */
1212message IsolatedUidChanged {
1213 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1214 optional int32 parent_uid = 1;
1215
1216 optional int32 isolated_uid = 2;
1217
1218 // We expect an isolated uid to be removed before if it's used for another parent uid.
1219 enum Event {
1220 REMOVED = 0;
1221 CREATED = 1;
1222 }
1223 optional Event event = 3;
1224}
1225
1226/*
1227 * Logs the reception of an incoming network packet causing the main system to wake up for
1228 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1229 * and processed by WakeupController.cpp.
1230 */
1231message PacketWakeupOccurred {
1232 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1233 // delivered nowhere.
1234 optional int32 uid = 1;
1235 // The interface name on which the packet was received.
1236 optional string iface = 2;
1237 // The ethertype value of the packet.
1238 optional int32 ethertype = 3;
1239 // String representation of the destination MAC address of the packet.
1240 optional string destination_hardware_address = 4;
1241 // String representation of the source address of the packet if this was an IP packet.
1242 optional string source_ip = 5;
1243 // String representation of the destination address of the packet if this was an IP packet.
1244 optional string destination_ip = 6;
1245 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1246 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1247 // families.
1248 optional int32 ip_next_header = 7;
1249 // The source port if this was a TCP or UDP packet.
1250 optional int32 source_port = 8;
1251 // The destination port if this was a TCP or UDP packet.
1252 optional int32 destination_port = 9;
1253}
1254
1255/*
1256 * Logs the memory stats for an app on startup.
1257 * Logged from:
1258 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1259 */
1260message AppStartMemoryStateCaptured {
1261 // The uid if available. -1 means not available.
1262 optional int32 uid = 1;
1263
1264 // The process name.
1265 optional string process_name = 2;
1266
1267 // The activity name.
1268 optional string activity_name = 3;
1269
1270 // # of page-faults
1271 optional int64 pgfault = 4;
1272
1273 // # of major page-faults
1274 optional int64 pgmajfault = 5;
1275
1276 // RSS
1277 optional int64 rss_in_bytes = 6;
1278
1279 // CACHE
1280 optional int64 cache_in_bytes = 7;
1281
1282 // SWAP
1283 optional int64 swap_in_bytes = 8;
1284}
1285
1286/*
1287 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1288 * for LMK event.
1289 * Logged from:
1290 * system/core/lmkd/lmkd.c
1291 */
1292message LmkStateChanged {
1293 enum State {
1294 UNKNOWN = 0;
1295 START = 1;
1296 STOP = 2;
1297 }
1298 optional State state = 1;
1299}
1300
1301/*
1302 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1303 * Logged from:
1304 * system/core/lmkd/lmkd.c
1305 */
1306message LmkKillOccurred {
1307 // The uid if available. -1 means not available.
1308 optional int32 uid = 1;
1309
1310 // The process name.
1311 optional string process_name = 2;
1312
1313 // oom adj score.
1314 optional int32 oom_score = 3;
1315
1316 // # of page-faults
1317 optional int64 pgfault = 4;
1318
1319 // # of major page-faults
1320 optional int64 pgmajfault = 5;
1321
1322 // RSS
1323 optional int64 rss_in_bytes = 6;
1324
1325 // CACHE
1326 optional int64 cache_in_bytes = 7;
1327
1328 // SWAP
1329 optional int64 swap_in_bytes = 8;
1330}
1331
Rajeev Kumar51b54602018-03-01 12:18:26 -08001332/*
1333 * Logs when the ActivityManagerService detects that an app died.
1334 *
1335 * Logged from:
1336 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1337 */
1338message AppDied {
1339 // timestamp(elapsedRealtime) of record creation
1340 optional uint64 timestamp_millis = 1;
1341}
1342
Chenjie Yubbcbc602018-02-05 16:51:52 -08001343//////////////////////////////////////////////////////////////////////
1344// Pulled atoms below this line //
1345//////////////////////////////////////////////////////////////////////
1346
1347/**
David Chenc8a43242017-10-17 16:23:28 -07001348 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1349 *
1350 * Pulled from:
1351 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1352 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001353message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001354 optional int32 uid = 1;
1355
1356 optional int64 rx_bytes = 2;
1357
1358 optional int64 rx_packets = 3;
1359
1360 optional int64 tx_bytes = 4;
1361
1362 optional int64 tx_packets = 5;
1363}
1364
1365/**
1366 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1367 *
1368 * Pulled from:
1369 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1370 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001371message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001372 optional int32 uid = 1;
1373
1374 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1375 optional int32 is_foreground = 2;
1376
1377 optional int64 rx_bytes = 3;
1378
1379 optional int64 rx_packets = 4;
1380
1381 optional int64 tx_bytes = 5;
1382
1383 optional int64 tx_packets = 6;
1384}
1385
1386/**
1387 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1388 *
1389 * Pulled from:
1390 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1391 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001392message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001393 optional int32 uid = 1;
1394
1395 optional int64 rx_bytes = 2;
1396
1397 optional int64 rx_packets = 3;
1398
1399 optional int64 tx_bytes = 4;
1400
1401 optional int64 tx_packets = 5;
1402}
1403
1404/**
1405 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1406 *
1407 * Pulled from:
1408 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1409 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001410message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001411 optional int32 uid = 1;
1412
1413 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1414 optional int32 is_foreground = 2;
1415
1416 optional int64 rx_bytes = 3;
1417
1418 optional int64 rx_packets = 4;
1419
1420 optional int64 tx_bytes = 5;
1421
1422 optional int64 tx_packets = 6;
1423}
1424
1425/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001426 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1427 *
1428 * Pulled from:
1429 * StatsCompanionService
1430 */
1431message BluetoothBytesTransfer {
1432 optional int32 uid = 1;
1433
1434 optional int64 rx_bytes = 2;
1435
1436 optional int64 tx_bytes = 3;
1437}
1438
1439/**
David Chenc8a43242017-10-17 16:23:28 -07001440 * Pulls the kernel wakelock durations. This atom is adapted from
1441 * android/internal/os/KernelWakelockStats.java
1442 *
1443 * Pulled from:
1444 * StatsCompanionService using KernelWakelockReader.
1445 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001446message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001447 optional string name = 1;
1448
1449 optional int32 count = 2;
1450
1451 optional int32 version = 3;
1452
1453 optional int64 time = 4;
1454}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001455
Chenjie Yu05013b32017-11-21 10:21:41 -08001456/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001457 * Pulls low power state information. This includes platform and subsystem sleep state information,
1458 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001459 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001460 * hardware/interfaces/power/1.1/types.hal
1461 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001462message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001463 // Subsystem name
1464 optional string subsystem_name = 1;
1465 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1466 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1467 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001468 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001469 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001470 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001471 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001472}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001473
Chenjie Yu05013b32017-11-21 10:21:41 -08001474/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001475 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001476 * Pulls the time the cpu spend on the frequency index. Frequency index
1477 * starts from highest to lowest. The value should be monotonically
1478 * increasing since boot. However, if there is a cpu
1479 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001480 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001481message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001482 optional uint32 cluster = 1;
1483 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001484 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001485}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001486
Chenjie Yu05013b32017-11-21 10:21:41 -08001487/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001488 * Pulls Cpu Time Per Uid.
1489 * Note that isolated process uid time should be attributed to host uids.
1490 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001491message CpuTimePerUid {
Chenjie Yuec676612018-03-07 09:19:17 -08001492 optional int32 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001493 optional uint64 user_time_millis = 2;
1494 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001495}
1496
1497/**
1498 * Pulls Cpu Time Per Uid per frequency.
1499 * Note that isolated process uid time should be attributed to host uids.
1500 * For each uid, we order the time by descending frequencies.
1501 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001502message CpuTimePerUidFreq {
Chenjie Yuec676612018-03-07 09:19:17 -08001503 optional int32 uid = 1;
1504 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001505 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001506}
Hugo Benichi884970e2017-11-14 22:42:46 +09001507
Chenjie Yu05013b32017-11-21 10:21:41 -08001508/**
1509 * Pulls Wifi Controller Activity Energy Info
1510 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001511message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001512 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001513 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001514 // stack reported state
1515 // TODO: replace this with proto enum
1516 optional int32 stack_state = 2;
1517 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001518 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001519 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001520 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001521 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001522 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001523 // product of current(mA), voltage(V) and time(ms)
1524 optional uint64 controller_energy_used = 6;
1525}
1526
1527/**
1528 * Pulls Modem Activity Energy Info
1529 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001530message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001531 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001532 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001533 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001534 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001535 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001536 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001537 /**
1538 * Tx power index
1539 * index 0 = tx_power < 0dBm
1540 * index 1 = 0dBm < tx_power < 5dBm
1541 * index 2 = 5dBm < tx_power < 15dBm
1542 * index 3 = 15dBm < tx_power < 20dBm
1543 * index 4 = tx_power > 20dBm
1544 */
1545 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001546 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001547 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001548 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001549 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001550 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001551 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001552 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001553 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001554 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001555 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001556 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001557 // product of current(mA), voltage(V) and time(ms)
1558 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001559}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001560
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001561/**
1562 * Pulls Bluetooth Activity Energy Info
1563 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1564 */
1565message BluetoothActivityInfo {
1566 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001567 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001568 // bluetooth stack state
1569 optional int32 bluetooth_stack_state = 2;
1570 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001571 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001572 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001573 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001574 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001575 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001576 // product of current(mA), voltage(V) and time(ms)
1577 optional uint64 energy_used = 6;
1578}
1579
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001580/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001581 * Logs the memory stats for a process.
1582 */
1583message ProcessMemoryState {
1584 // The uid if available. -1 means not available.
1585 optional int32 uid = 1;
1586
1587 // The process name.
1588 optional string process_name = 2;
1589
1590 // oom adj score.
1591 optional int32 oom_score = 3;
1592
1593 // # of page-faults
1594 optional int64 pgfault = 4;
1595
1596 // # of major page-faults
1597 optional int64 pgmajfault = 5;
1598
Rajeev Kumar90235992018-01-29 11:06:48 -08001599 // RSS
1600 optional int64 rss_in_bytes = 6;
1601
1602 // CACHE
1603 optional int64 cache_in_bytes = 7;
1604
1605 // SWAP
1606 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001607}
1608
1609/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001610 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001611 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001612message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001613 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001614}
1615
1616/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001617 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001618 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001619message SystemUptime {
1620 // Milliseconds since the system was booted.
1621 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1622 // for external input).
1623 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001624 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001625}
1626
1627/*
1628 * Reads from /proc/uid_concurrent_active_time which has the format:
1629 * active: X (X is # cores)
1630 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1631 * [uid1]: [time-0] [time-1] [time-2] ... ...
1632 * ...
1633 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1634 * The file contains a monotonically increasing count of time for a single boot.
1635 */
1636message CpuActiveTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001637 optional int32 uid = 1;
1638 optional uint64 time_millis = 2;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001639}
1640
1641/**
1642 * Reads from /proc/uid_concurrent_policy_time which has the format:
1643 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1644 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1645 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1646 * ...
1647 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1648 * The file contains a monotonically increasing count of time for a single boot.
1649 */
1650message CpuClusterTime {
Chenjie Yuec676612018-03-07 09:19:17 -08001651 optional int32 uid = 1;
1652 optional int32 cluster_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001653 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001654}
1655
1656/*
1657 * Pulls free disk space, for data, system partition and temporary directory.
1658 */
1659message DiskSpace {
1660 // available bytes in data partition
1661 optional uint64 data_available_bytes = 1;
1662 // available bytes in system partition
1663 optional uint64 system_available_bytes = 2;
1664 // available bytes in download cache or temp directories
1665 optional uint64 temp_available_bytes = 3;
1666}
Tej Singhbf972d92018-01-10 20:51:13 -08001667
1668/**
1669 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001670 * Pulled from:
1671 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001672 */
1673message RemainingBatteryCapacity {
1674 optional int32 charge_uAh = 1;
1675}
1676
1677/**
1678 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001679 * Pulled from:
1680 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001681 */
1682message FullBatteryCapacity {
1683 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001684}
1685
1686/**
1687 * Pulls the temperature of various parts of the device, in Celsius.
1688 *
1689 * Pulled from:
1690 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1691 */
1692message Temperature {
1693 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1694 optional android.os.TemperatureTypeEnum sensor_location = 1;
1695
1696 // The name of the temperature source. Eg. CPU0
1697 optional string sensor_name = 2;
1698
1699 // Temperature in degrees C.
1700 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001701}