blob: 42ae0226228ef803f5c5dd7bda456d0f62808084 [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;
Bookatzc1a050a2017-10-10 15:49:28 -0700107 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +0000108 }
David Chenc8a43242017-10-17 16:23:28 -0700109
David Chen6e3e6cb2018-01-03 16:14:06 -0800110 // Pulled events will start at field 10000.
Tej Singh40298312018-02-16 00:15:09 -0800111 // Next: 10022
David Chenc8a43242017-10-17 16:23:28 -0700112 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -0800113 WifiBytesTransfer wifi_bytes_transfer = 10000;
114 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
115 MobileBytesTransfer mobile_bytes_transfer = 10002;
116 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800117 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006;
David Chen6e3e6cb2018-01-03 16:14:06 -0800118 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -0800119 SubsystemSleepState subsystem_sleep_state = 10005;
David Chen6e3e6cb2018-01-03 16:14:06 -0800120 CpuTimePerFreq cpu_time_per_freq = 10008;
121 CpuTimePerUid cpu_time_per_uid = 10009;
122 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
123 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
124 ModemActivityInfo modem_activity_info = 10012;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800125 BluetoothActivityInfo bluetooth_activity_info = 10007;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -0800126 ProcessMemoryState process_memory_state = 10013;
Chenjie Yu9d7720b2018-01-24 10:34:48 -0800127 SystemElapsedRealtime system_elapsed_realtime = 10014;
128 SystemUptime system_uptime = 10015;
Chenjie Yu9da105b2018-01-13 12:41:08 -0800129 CpuActiveTime cpu_active_time = 10016;
130 CpuClusterTime cpu_cluster_time = 10017;
Chenjie Yu937d7422018-01-10 16:37:53 -0800131 DiskSpace disk_space = 10018;
Tej Singhbf972d92018-01-10 20:51:13 -0800132 RemainingBatteryCapacity remaining_battery_capacity = 10019;
133 FullBatteryCapacity full_battery_capacity = 10020;
Tej Singh40298312018-02-16 00:15:09 -0800134 Temperature temperature = 10021;
David Chenc8a43242017-10-17 16:23:28 -0700135 }
yroa1fe77c2018-02-26 14:22:54 -0800136
137 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
138 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use.
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700139}
140
Yao Chend54f9dd2017-10-17 17:37:48 +0000141/**
Yangster-mac20877162017-12-22 17:19:39 -0800142 * This proto represents a node of an attribution chain.
143 * Note: All attribution chains are represented as a repeated field of type
144 * AttributionNode. It is understood that in such arrays, the order is that
145 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000146 */
Yangster-mac20877162017-12-22 17:19:39 -0800147message AttributionNode {
148 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800149 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800150
Yangster-mac20877162017-12-22 17:19:39 -0800151 // The (optional) string tag for an element in the attribution chain. If the
152 // element has no tag, it is encoded as an empty string.
153 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700154}
155
Yao Chend54f9dd2017-10-17 17:37:48 +0000156/*
157 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800158 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000159 *
160 * RULES:
161 * - The field ids for each atom must start at 1, and count upwards by 1.
162 * Skipping field ids is not allowed.
163 * - These form an API, so renaming, renumbering or removing fields is
164 * not allowed between android releases. (This is not currently enforced,
165 * but there will be a tool to enforce this restriction).
166 * - The types must be built-in protocol buffer types, namely, no sub-messages
167 * are allowed (yet). The bytes type is also not allowed.
168 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800169 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000170 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800171 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 * - A field that is a uid should be a string field, tagged with the [xxx]
173 * annotation. The generated code on android will be represented by UIDs,
174 * and those UIDs will be translated in xxx to those strings.
175 *
176 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700177 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 * - If there is a UID, it goes first. Think in an object-oriented fashion.
179 * *****************************************************************************
180 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700181
Yao Chend54f9dd2017-10-17 17:37:48 +0000182/**
183 * Logs when the screen state changes.
184 *
185 * Logged from:
186 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
187 */
188message ScreenStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800189 // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800190 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700191}
Yao Chend54f9dd2017-10-17 17:37:48 +0000192
193/**
Bookatzc1a050a2017-10-10 15:49:28 -0700194 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000195 *
196 * Logged from:
197 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
198 */
Bookatzc1a050a2017-10-10 15:49:28 -0700199message UidProcessStateChanged {
Yao Chen9c1debe2018-02-19 14:39:19 -0800200 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
Yao Chend54f9dd2017-10-17 17:37:48 +0000201
Bookatzdb026a22018-01-10 19:01:56 -0800202 // The state, from frameworks/base/core/proto/android/app/enums.proto.
Yao Chen9c1debe2018-02-19 14:39:19 -0800203 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
Yao Chend54f9dd2017-10-17 17:37:48 +0000204}
205
206/**
Bookatzc1a050a2017-10-10 15:49:28 -0700207 * Logs that a process started, finished, crashed, or ANRed.
208 *
209 * Logged from:
210 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
211 */
212message ProcessLifeCycleStateChanged {
David Chen0b5c90c2018-01-25 16:51:49 -0800213 // TODO: should be a string tagged w/ uid annotation
214 optional int32 uid = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700215
David Chen0b5c90c2018-01-25 16:51:49 -0800216 // The process name (usually same as the app name).
Bookatzc1a050a2017-10-10 15:49:28 -0700217 optional string name = 2;
218
Bookatzddccf0a2017-11-28 16:48:14 -0800219 // What lifecycle state the process changed to.
220 // This enum is specific to atoms.proto.
221 enum Event {
222 PROCESS_FINISHED = 0;
223 PROCESS_STARTED = 1;
224 PROCESS_CRASHED = 2;
225 PROCESS_ANRED = 3;
226 }
227 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700228}
229
Bookatzc1a050a2017-10-10 15:49:28 -0700230/**
231 * Logs when the ble scan state changes.
232 *
233 * Logged from:
234 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
235 */
236message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800237 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700238
239 enum State {
240 OFF = 0;
241 ON = 1;
242 }
243 optional State state = 2;
244}
245
246/**
247 * Logs when an unoptimized ble scan state changes.
248 *
249 * Logged from:
250 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
251 */
252// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
253message BleUnoptimizedScanStateChanged {
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;
259 }
260 optional State state = 2;
261}
262
263/**
264 * Logs reporting of a ble scan finding results.
265 *
266 * Logged from:
267 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
268 */
269// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
270message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800271 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700272
273 // Number of ble scan results returned.
274 optional int32 num_of_results = 2;
275}
276
277/**
278 * Logs when a sensor state changes.
279 *
280 * Logged from:
281 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
282 */
283message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800284 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700285
286 // TODO: Is there a way to get the actual name of the sensor?
287 // The id (int) of the sensor.
288 optional int32 sensor_id = 2;
289
290 enum State {
291 OFF = 0;
292 ON = 1;
293 }
294 optional State state = 3;
295}
296
297
298/**
299 * Logs when GPS state changes.
300 *
301 * Logged from:
302 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
303 */
304message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800305 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700306
307 enum State {
308 OFF = 0;
309 ON = 1;
310 }
311 optional State state = 2;
312}
313
314
315/**
316 * Logs when a sync manager sync state changes.
317 *
318 * Logged from:
319 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
320 */
321message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800322 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700323
David Chen0b5c90c2018-01-25 16:51:49 -0800324 // Name of the sync (as named in the app). Can be chosen at run-time.
Bookatzc1a050a2017-10-10 15:49:28 -0700325 optional string name = 2;
326
327 enum State {
328 OFF = 0;
329 ON = 1;
330 }
331 optional State state = 3;
332}
333
334/**
335 * Logs when a job scheduler job state changes.
336 *
337 * Logged from:
338 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
339 */
340message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800341 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700342
343 // Name of the job (as named in the app)
344 optional string name = 2;
345
346 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800347 FINISHED = 0;
348 STARTED = 1;
349 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700350 }
351 optional State state = 3;
352
353 // TODO: Consider adding the stopReason (int)
354}
355
356/**
357 * Logs when the audio state changes.
358 *
359 * Logged from:
360 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
361 */
362message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800363 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700364
365 enum State {
366 OFF = 0;
367 ON = 1;
368 }
369 optional State state = 2;
370}
371
372/**
373 * Logs when the video codec state changes.
374 *
375 * Logged from:
376 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
377 */
378message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800379 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700380
381 enum State {
382 OFF = 0;
383 ON = 1;
384 }
385 optional State state = 2;
386}
387
388/**
389 * Logs when the flashlight state changes.
390 *
391 * Logged from:
392 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
393 */
394message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800395 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700396
397 enum State {
398 OFF = 0;
399 ON = 1;
400 }
401 optional State state = 2;
402}
403
404/**
405 * Logs when the camera state changes.
406 *
407 * Logged from:
408 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
409 */
410message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800411 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700412
413 enum State {
414 OFF = 0;
415 ON = 1;
416 }
417 optional State state = 2;
418}
419
420/**
421 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000422 *
423 * Logged from:
424 * TODO
425 */
Bookatzd6746242017-10-24 18:39:35 -0700426message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800427 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000428
Bookatz1a1b0462018-01-12 11:47:03 -0800429 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
430 // From frameworks/base/core/proto/android/os/enums.proto.
431 optional android.os.WakeLockLevelEnum level = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700432
433 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
434 optional string tag = 3;
435
436 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800437 RELEASE = 0;
438 ACQUIRE = 1;
439 CHANGE_RELEASE = 2;
440 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700441 }
442 optional State state = 4;
443}
444
445/**
Bookatzc1a050a2017-10-10 15:49:28 -0700446 * Logs when a partial wakelock is considered 'long' (over 1 min).
447 *
448 * Logged from:
449 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
450 */
451message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800452 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700453
Yao Chend54f9dd2017-10-17 17:37:48 +0000454 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
455 optional string tag = 2;
456
Bookatzc1a050a2017-10-10 15:49:28 -0700457 // TODO: I have no idea what this is.
458 optional string history_tag = 3;
459
460 enum State {
461 OFF = 0;
462 ON = 1;
463 }
464 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000465}
466
Bookatzc1a050a2017-10-10 15:49:28 -0700467/**
468 * Logs Battery Saver state change.
469 *
470 * Logged from:
471 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
472 */
473message BatterySaverModeStateChanged {
474 enum State {
475 OFF = 0;
476 ON = 1;
477 }
478 optional State state = 1;
479}
480
481/**
482 * Logs Doze mode state change.
483 *
484 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800485 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700486 */
487message DeviceIdleModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800488 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800489}
490
491
492/**
493 * Logs state change of Doze mode including maintenance windows.
494 *
495 * Logged from:
496 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
497 */
498message DeviceIdlingModeStateChanged {
Bookatz8bdae8d2018-01-16 11:24:30 -0800499 optional android.server.DeviceIdleModeEnum state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700500}
501
502/**
503 * Logs screen brightness level.
504 *
505 * Logged from:
506 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
507 */
508message ScreenBrightnessChanged {
509 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
510 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700511}
512
513/**
514 * Logs battery level (percent full, from 0 to 100).
515 *
516 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700517 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700518 */
519message BatteryLevelChanged {
520 // Battery level. Should be in [0, 100].
521 optional int32 battery_level = 1;
522}
523
524/**
525 * Logs change in charging status of the device.
526 *
527 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700528 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700529 */
530message ChargingStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800531 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
532 optional android.os.BatteryStatusEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700533}
534
535/**
536 * Logs whether the device is plugged in, and what power source it is using.
537 *
538 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700539 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700540 */
541message PluggedStateChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800542 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
543 optional android.os.BatteryPluggedStateEnum state = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700544}
545
Bookatz8c6571b2017-10-24 15:04:41 -0700546// TODO: Define this more precisely.
547// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
548/**
549 * Logs when the device turns off or on.
550 *
551 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700552 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700553 */
554message DeviceOnStatusChanged {
555 enum State {
556 OFF = 0;
557 ON = 1;
558 }
559 optional State state = 1;
560}
561
562/**
563 * Logs when an app's wakeup alarm fires.
564 *
565 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700566 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700567 */
568message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800569 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800570
571 // Name of the wakeup alarm.
572 optional string tag = 2;
573}
574
575/**
576 * Logs when an an app causes the mobile radio to change state.
577 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
578 *
579 * Logged from:
580 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
581 */
582message MobileRadioPowerStateChanged {
583 // TODO: Add attribution instead of uid?
584 optional int32 uid = 1;
585
Bookatz1a1b0462018-01-12 11:47:03 -0800586 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
587 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatzddccf0a2017-11-28 16:48:14 -0800588}
589
590/**
591 * Logs when an an app causes the wifi radio to change state.
592 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
593 *
594 * Logged from:
595 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
596 */
597message WifiRadioPowerStateChanged {
598 // TODO: Add attribution instead of uid?
599 optional int32 uid = 1;
600
Bookatz1a1b0462018-01-12 11:47:03 -0800601 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
602 optional android.telephony.DataConnectionPowerStateEnum state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700603}
604
605/**
606 * Logs kernel wakeup reasons and aborts.
607 *
608 * Logged from:
609 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
610 */
611message KernelWakeupReported {
612 // Name of the kernel wakeup reason (or abort).
613 optional string wakeup_reason_name = 1;
614
615 // Duration (in microseconds) for the wake-up interrupt to be serviced.
David Chen0b5c90c2018-01-25 16:51:49 -0800616 optional int64 duration_micros = 2;
Bookatze5885242017-10-24 20:10:31 -0700617}
618
619/**
620 * Logs wifi locks held by an app.
621 *
622 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700623 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700624 */
625message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800626 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700627
628 enum State {
629 OFF = 0;
630 ON = 1;
631 }
632 optional State state = 2;
633}
634
635/**
636 * Logs wifi signal strength changes.
637 *
638 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700639 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700640 */
641message WifiSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800642 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
643 optional android.telephony.SignalStrengthEnum signal_strength = 1;
Bookatze5885242017-10-24 20:10:31 -0700644}
645
646/**
647 * Logs wifi scans performed by an app.
648 *
649 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700650 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700651 */
652message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800653 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700654
655 enum State {
656 OFF = 0;
657 ON = 1;
658 }
659 optional State state = 2;
660}
661
662/**
Tej Singh4503e102018-01-04 14:35:01 -0800663 * Logs wifi multicast locks held by an app
664 *
665 * Logged from:
666 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
667 */
668message WifiMulticastLockStateChanged {
669 repeated AttributionNode attribution_node = 1;
670
671 enum State {
672 OFF = 0;
673 ON = 1;
674 }
675 optional State state = 2;
676}
677
678/**
Tej Singh1ea42892018-01-19 09:27:00 -0800679 * Logs shutdown reason and duration on next boot.
680 *
681 * Logged from:
682 * frameworks/base/core/java/com/android/server/BootReceiver.java
683 */
684message ShutdownSequenceReported {
685 // True if shutdown is for a reboot. Default: false if we do not know.
686 optional bool reboot = 1;
687
688 // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
689 optional string reason = 2;
690
691 // Beginning of shutdown time in ms using wall clock time since unix epoch.
692 // Default: 0 if no start time received.
David Chen0b5c90c2018-01-25 16:51:49 -0800693 optional int64 start_time_millis = 3;
Tej Singh1ea42892018-01-19 09:27:00 -0800694
695 // Duration of shutdown in ms. Default: 0 if no duration received.
David Chen0b5c90c2018-01-25 16:51:49 -0800696 optional int64 duration_millis = 4;
Tej Singh1ea42892018-01-19 09:27:00 -0800697}
698
Tej Singh6483ea42018-01-25 17:45:49 -0800699
700/**
701 * Logs boot reason and duration.
702 *
703 * Logged from:
704 * system/core/bootstat/bootstat.cpp
705 */
706message BootSequenceReported {
707 // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
708 // Default: "<EMPTY>" if not available.
709 optional string bootloader_reason = 1;
710
711 // Reason for system boot. Eg. bootloader, reboot,userrequested
712 // Default: "<EMPTY>" if not available.
713 optional string system_reason = 2;
714
715 // End of boot time in ms from unix epoch using system wall clock.
David Chen0b5c90c2018-01-25 16:51:49 -0800716 optional int64 end_time_millis = 3;
Tej Singh6483ea42018-01-25 17:45:49 -0800717
718 // Total boot duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800719 optional int64 total_duration_millis = 4;
Tej Singh6483ea42018-01-25 17:45:49 -0800720
721 // Bootloader duration in ms.
David Chen0b5c90c2018-01-25 16:51:49 -0800722 optional int64 bootloader_duration_millis = 5;
Tej Singh6483ea42018-01-25 17:45:49 -0800723
724 // Time since last boot in ms. Default: 0 if not available.
725 optional int64 time_since_last_boot = 6;
726}
727
Tej Singhc477d9c2018-02-05 18:31:39 -0800728
729/**
730 * Logs call state and disconnect cause (if applicable).
731 *
732 * Logged from:
733 * packages/services/Telecomm/src/com/android/server/telecom/Call.java
734 */
735message CallStateChanged {
736 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
737 // From frameworks/base/core/proto/android/telecomm/enums.proto.
738 optional android.telecom.CallStateEnum call_state = 1;
739
740 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
741 // This value is only applicable when the call_state is DISCONNECTED, and
742 // should always be UNKNOWN if the call_state is not DISCONNECTED.
743 // From frameworks/base/core/proto/android/telecomm/enums.proto.
744 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;
745
746 // True if the call is self-managed, which are apps that use the
747 // telecom infrastructure to make their own calls.
748 optional bool self_managed = 3;
749
750 // True if call is external. External calls are calls on connected Wear
751 // devices but show up in Telecom so the user can pull them onto the device.
752 optional bool external_call = 4;
753}
754
Tej Singh1ea42892018-01-19 09:27:00 -0800755/**
Tej Singhdd7bd352018-02-09 19:33:15 -0800756 * Logs keyguard state. The keyguard is the lock screen.
757 *
758 * Logged from:
759 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
760 */
761message KeyguardStateChanged {
762 enum State {
763 UNKNOWN = 0;
764 // The keyguard is hidden when the phone is unlocked.
765 HIDDEN = 1;
766 // The keyguard is shown when the phone is locked (screen turns off).
767 SHOWN= 2;
768 // The keyguard is occluded when something is overlaying the keyguard.
769 // Eg. Opening the camera while on the lock screen.
770 OCCLUDED = 3;
771 }
772 optional State state = 1;
773}
774
775/**
776 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
777 * prompts the user to enter a password (pattern, pin, etc).
778 *
779 * Logged from:
780 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
781 */
782
783message KeyguardBouncerStateChanged {
784 enum State {
785 UNKNOWN = 0;
786 // Bouncer is hidden, either as a result of successfully entering the
787 // password, screen timing out, or user going back to lock screen.
788 HIDDEN = 1;
789 // This is when the user is being prompted to enter the password.
790 SHOWN = 2;
791 }
792 optional State state = 1;
793}
794
795/**
796 * Logs the result of entering a password into the keyguard bouncer.
797 *
798 * Logged from:
799 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
800 */
801message KeyguardBouncerPasswordEntered {
802 enum BouncerResult {
803 UNKNOWN = 0;
804 // The password entered was incorrect.
805 FAILURE = 1;
806 // The password entered was correct.
807 SUCCESS = 2;
808 }
809 optional BouncerResult result = 1;
810}
811
812/**
Tej Singhbb8554a2018-01-26 11:59:14 -0800813 * Logs the duration of a davey (jank of >=700ms) when it occurs
814 *
815 * Logged from:
816 * frameworks/base/libs/hwui/JankTracker.cpp
817 */
818message DaveyOccurred {
David Chen77ef6712018-02-23 18:23:42 -0800819 // The UID that logged this atom.
820 optional int32 uid = 1;
821
Tej Singhbb8554a2018-01-26 11:59:14 -0800822 // Amount of time it took to render the frame. Should be >=700ms.
David Chen77ef6712018-02-23 18:23:42 -0800823 optional int64 jank_duration_millis = 2;
Tej Singhbb8554a2018-01-26 11:59:14 -0800824}
825
826/**
Bookatze5885242017-10-24 20:10:31 -0700827 * Logs phone signal strength changes.
828 *
829 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700830 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700831 */
832message PhoneSignalStrengthChanged {
Bookatz1a1b0462018-01-12 11:47:03 -0800833 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
834 optional android.telephony.SignalStrengthEnum signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700835}
836
837/**
838 * Logs that a setting was updated.
839 * Logged from:
840 * frameworks/base/core/java/android/provider/Settings.java
841 * The tag and is_default allow resetting of settings to default values based on the specified
842 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
843 */
844message SettingChanged {
845 // The name of the setting.
846 optional string setting = 1;
847
848 // The change being imposed on this setting. May represent a number, eg "3".
849 optional string value = 2;
850
851 // The new value of this setting. For most settings, this is same as value. For some settings,
852 // value is +X or -X where X represents an element in a set. For example, if the previous value
853 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
854 // The +/- feature is currently only used for location_providers_allowed.
855 optional string new_value = 3;
856
857 // The previous value of this setting.
858 optional string prev_value = 4;
859
860 // The tag used with the is_default for resetting sets of settings. This is generally null.
861 optional string tag = 5;
862
Bookatz90867622018-01-31 15:05:57 -0800863 // True if this setting with tag should be resettable.
864 optional bool is_default = 6;
David Chenc28b2bb2017-10-24 12:52:52 -0700865
866 // The user ID associated. Defined in android/os/UserHandle.java
867 optional int32 user = 7;
868}
Chenjie Yub3dda412017-10-24 13:41:59 -0700869
Chenjie Yu05013b32017-11-21 10:21:41 -0800870/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700871 * Logs activity going to foreground or background
872 *
873 * Logged from:
874 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
875 */
876message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800877 optional int32 uid = 1;
878 optional string pkg_name = 2;
879 optional string class_name = 3;
880
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700881 enum Activity {
882 MOVE_TO_BACKGROUND = 0;
883 MOVE_TO_FOREGROUND = 1;
884 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700885 optional Activity activity = 4;
886}
David Chenc8a43242017-10-17 16:23:28 -0700887
888/**
David Chen9e3808c2017-11-20 17:25:34 -0800889 * Logs when an error is written to dropbox.
890 * Logged from:
891 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
892 */
893message DropboxErrorChanged {
894 // The uid if available. -1 means not available.
895 optional int32 uid = 1;
896
897 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
898 optional string tag = 2;
899
900 // The name of the process.
901 optional string process_name = 3;
902
903 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800904 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800905
906 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800907 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800908
909 // The activity name if available.
910 optional string activity_name = 6;
911
David Chen6e3e6cb2018-01-03 16:14:06 -0800912 // The package name if available.
913 optional string package_name = 7;
914
David Chen9e3808c2017-11-20 17:25:34 -0800915 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800916 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800917}
918
David Chen0a368b22017-12-06 16:28:16 -0800919/*
920 * Allows other apps to push events into statsd.
921 * Logged from:
922 * frameworks/base/core/java/android/util/StatsLog.java
923 */
David Chen0b5c90c2018-01-25 16:51:49 -0800924message AppBreadcrumbReported {
David Chen0a368b22017-12-06 16:28:16 -0800925 // The uid of the application that sent this custom atom.
926 optional int32 uid = 1;
927
928 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
929 optional int32 label = 2;
930
931 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
932 // predicates for the metrics).
933 enum State {
934 UNKNOWN = 0;
935 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
936 STOP = 2;
937 START = 3;
938 }
939 optional State state = 3;
940}
941
David Chen9e3808c2017-11-20 17:25:34 -0800942/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800943 * Logs when statsd detects an anomaly.
944 *
945 * Logged from:
946 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
947 */
948message AnomalyDetected {
949 // Uid that owns the config whose anomaly detection alert fired.
950 optional int32 config_uid = 1;
951
Yangster-mac94e197c2018-01-02 16:03:03 -0800952 // Id of the config whose anomaly detection alert fired.
953 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800954
Yangster-mac94e197c2018-01-02 16:03:03 -0800955 // Id of the alert (i.e. name of the anomaly that was detected).
956 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800957}
958
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000959message AppStartChanged {
960 // The uid if available. -1 means not available.
961 optional int32 uid = 1;
962
963 // The app package name.
964 optional string pkg_name = 2;
965
966 enum TransitionType {
967 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
968 WARM = 1;
969 HOT = 2;
970 COLD = 3;
971 }
972 // The transition type.
973 optional TransitionType type = 3;
974
975 // The activity name.
976 optional string activity_name = 4;
977
978 // The name of the calling app. Empty if not set.
979 optional string calling_pkg_name = 5;
980
981 // Whether the app is an instant app.
982 optional bool is_instant_app = 6;
983
984 // Device uptime when activity started.
David Chen0b5c90c2018-01-25 16:51:49 -0800985 optional int64 activity_start_millis = 7;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000986
Bookatz80d11a02018-01-16 10:46:35 -0800987 optional android.app.AppTransitionReasonEnum reason = 8;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000988
David Chen0b5c90c2018-01-25 16:51:49 -0800989 optional int32 transition_delay_millis = 9;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000990 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800991 optional int32 starting_window_delay_millis = 10;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000992 // -1 if not set.
David Chen0b5c90c2018-01-25 16:51:49 -0800993 optional int32 bind_application_delay_millis = 11;
994 optional int32 windows_drawn_delay_millis = 12;
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000995
996 // Empty if not set.
997 optional string launch_token = 13;
998
Calin Juravle759fbda2018-02-20 19:52:30 +0000999 // The compiler filter used when when the package was optimized.
1000 optional string package_optimization_compilation_filter = 14;
1001
1002 // The reason why the package was optimized.
1003 optional string package_optimization_compilation_reason = 15;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001004}
1005
1006message AppStartCancelChanged {
1007 // The uid if available. -1 means not available.
1008 optional int32 uid = 1;
1009
1010 // The app package name.
1011 optional string pkg_name = 2;
1012
1013 enum TransitionType {
1014 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1015 WARM = 1;
1016 HOT = 2;
1017 COLD = 3;
1018 }
1019 // The transition type.
1020 optional TransitionType type = 3;
1021
1022 // The activity name.
1023 optional string activity_name = 4;
1024}
1025
1026message AppStartFullyDrawnChanged {
1027 // The uid if available. -1 means not available.
1028 optional int32 uid = 1;
1029
1030 // The app package name.
1031 optional string pkg_name = 2;
1032
1033 enum TransitionType {
1034 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
1035 WITH_BUNDLE = 1;
1036 WITHOUT_BUNDLE = 2;
1037 }
1038 // The transition type.
1039 optional TransitionType type = 3;
1040
1041 // The activity name.
1042 optional string activity_name = 4;
1043
1044 optional bool transition_process_running = 5;
1045
1046 // App startup time (until call to Activity#reportFullyDrawn()).
David Chen0b5c90c2018-01-25 16:51:49 -08001047 optional int64 app_startup_time_millis = 6;
Olivier Gaillardaed7f122017-12-12 14:26:22 +00001048}
1049
Bookatz8fcd09a2017-12-18 13:01:10 -08001050/**
Chenjie Yu52cacc62017-12-08 18:11:45 -08001051 * Logs a picture-in-picture action
1052 * Logged from:
1053 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1054 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1055 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
1056 */
1057message PictureInPictureStateChanged {
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001058 // -1 if it is not available
Chenjie Yu52cacc62017-12-08 18:11:45 -08001059 optional int32 uid = 1;
1060
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001061 optional string short_name = 2;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001062
Chenjie Yu52cacc62017-12-08 18:11:45 -08001063 enum State {
1064 ENTERED = 1;
1065 EXPANDED_TO_FULL_SCREEN = 2;
1066 MINIMIZED = 3;
1067 DISMISSED = 4;
1068 }
Chenjie Yuae9fdf042018-02-15 10:19:32 -08001069 optional State state = 3;
Chenjie Yu52cacc62017-12-08 18:11:45 -08001070}
1071
1072/**
Chenjie Yue8904192017-12-08 19:12:57 -08001073 * Logs overlay action
1074 * Logged from:
1075 * services/core/java/com/android/server/wm/Session.java
1076 */
1077message OverlayStateChanged {
1078 optional int32 uid = 1;
1079
1080 optional string package_name = 2;
1081
1082 optional bool using_alert_window = 3;
1083
1084 enum State {
1085 ENTERED = 1;
1086 EXITED = 2;
1087 }
1088 optional State state = 4;
1089}
1090
Chenjie Yuccfe6452018-01-30 11:33:21 -08001091/*
1092 * Logs foreground service starts and stops.
1093 * Note that this is not when a service starts or stops, but when it is
1094 * considered foreground.
1095 * Logged from
1096 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
1097 */
1098message ForegroundServiceStateChanged {
1099 optional int32 uid = 1;
1100 // package_name + "/" + class_name
1101 optional string short_name = 2;
1102
1103 enum State {
1104 ENTER = 1;
1105 EXIT = 2;
1106 }
1107 optional State state = 3;
1108}
1109
Chenjie Yue8904192017-12-08 19:12:57 -08001110/**
Chenjie Yubbcbc602018-02-05 16:51:52 -08001111 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1112 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1113 * attributed back to the parent (host) uid. One example is Chrome.
1114 *
1115 * Logged from:
1116 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1117 */
1118message IsolatedUidChanged {
1119 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1120 optional int32 parent_uid = 1;
1121
1122 optional int32 isolated_uid = 2;
1123
1124 // We expect an isolated uid to be removed before if it's used for another parent uid.
1125 enum Event {
1126 REMOVED = 0;
1127 CREATED = 1;
1128 }
1129 optional Event event = 3;
1130}
1131
1132/*
1133 * Logs the reception of an incoming network packet causing the main system to wake up for
1134 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1135 * and processed by WakeupController.cpp.
1136 */
1137message PacketWakeupOccurred {
1138 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1139 // delivered nowhere.
1140 optional int32 uid = 1;
1141 // The interface name on which the packet was received.
1142 optional string iface = 2;
1143 // The ethertype value of the packet.
1144 optional int32 ethertype = 3;
1145 // String representation of the destination MAC address of the packet.
1146 optional string destination_hardware_address = 4;
1147 // String representation of the source address of the packet if this was an IP packet.
1148 optional string source_ip = 5;
1149 // String representation of the destination address of the packet if this was an IP packet.
1150 optional string destination_ip = 6;
1151 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1152 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1153 // families.
1154 optional int32 ip_next_header = 7;
1155 // The source port if this was a TCP or UDP packet.
1156 optional int32 source_port = 8;
1157 // The destination port if this was a TCP or UDP packet.
1158 optional int32 destination_port = 9;
1159}
1160
1161/*
1162 * Logs the memory stats for an app on startup.
1163 * Logged from:
1164 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1165 */
1166message AppStartMemoryStateCaptured {
1167 // The uid if available. -1 means not available.
1168 optional int32 uid = 1;
1169
1170 // The process name.
1171 optional string process_name = 2;
1172
1173 // The activity name.
1174 optional string activity_name = 3;
1175
1176 // # of page-faults
1177 optional int64 pgfault = 4;
1178
1179 // # of major page-faults
1180 optional int64 pgmajfault = 5;
1181
1182 // RSS
1183 optional int64 rss_in_bytes = 6;
1184
1185 // CACHE
1186 optional int64 cache_in_bytes = 7;
1187
1188 // SWAP
1189 optional int64 swap_in_bytes = 8;
1190}
1191
1192/*
1193 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
1194 * for LMK event.
1195 * Logged from:
1196 * system/core/lmkd/lmkd.c
1197 */
1198message LmkStateChanged {
1199 enum State {
1200 UNKNOWN = 0;
1201 START = 1;
1202 STOP = 2;
1203 }
1204 optional State state = 1;
1205}
1206
1207/*
1208 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
1209 * Logged from:
1210 * system/core/lmkd/lmkd.c
1211 */
1212message LmkKillOccurred {
1213 // The uid if available. -1 means not available.
1214 optional int32 uid = 1;
1215
1216 // The process name.
1217 optional string process_name = 2;
1218
1219 // oom adj score.
1220 optional int32 oom_score = 3;
1221
1222 // # of page-faults
1223 optional int64 pgfault = 4;
1224
1225 // # of major page-faults
1226 optional int64 pgmajfault = 5;
1227
1228 // RSS
1229 optional int64 rss_in_bytes = 6;
1230
1231 // CACHE
1232 optional int64 cache_in_bytes = 7;
1233
1234 // SWAP
1235 optional int64 swap_in_bytes = 8;
1236}
1237
1238//////////////////////////////////////////////////////////////////////
1239// Pulled atoms below this line //
1240//////////////////////////////////////////////////////////////////////
1241
1242/**
David Chenc8a43242017-10-17 16:23:28 -07001243 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
1244 *
1245 * Pulled from:
1246 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1247 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001248message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001249 optional int32 uid = 1;
1250
1251 optional int64 rx_bytes = 2;
1252
1253 optional int64 rx_packets = 3;
1254
1255 optional int64 tx_bytes = 4;
1256
1257 optional int64 tx_packets = 5;
1258}
1259
1260/**
1261 * Pulls bytes transferred via wifi (separated by foreground and background usage).
1262 *
1263 * Pulled from:
1264 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
1265 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001266message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001267 optional int32 uid = 1;
1268
1269 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1270 optional int32 is_foreground = 2;
1271
1272 optional int64 rx_bytes = 3;
1273
1274 optional int64 rx_packets = 4;
1275
1276 optional int64 tx_bytes = 5;
1277
1278 optional int64 tx_packets = 6;
1279}
1280
1281/**
1282 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
1283 *
1284 * Pulled from:
1285 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1286 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001287message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -07001288 optional int32 uid = 1;
1289
1290 optional int64 rx_bytes = 2;
1291
1292 optional int64 rx_packets = 3;
1293
1294 optional int64 tx_bytes = 4;
1295
1296 optional int64 tx_packets = 5;
1297}
1298
1299/**
1300 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
1301 *
1302 * Pulled from:
1303 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
1304 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001305message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -07001306 optional int32 uid = 1;
1307
1308 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1309 optional int32 is_foreground = 2;
1310
1311 optional int64 rx_bytes = 3;
1312
1313 optional int64 rx_packets = 4;
1314
1315 optional int64 tx_bytes = 5;
1316
1317 optional int64 tx_packets = 6;
1318}
1319
1320/**
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001321 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
1322 *
1323 * Pulled from:
1324 * StatsCompanionService
1325 */
1326message BluetoothBytesTransfer {
1327 optional int32 uid = 1;
1328
1329 optional int64 rx_bytes = 2;
1330
1331 optional int64 tx_bytes = 3;
1332}
1333
1334/**
David Chenc8a43242017-10-17 16:23:28 -07001335 * Pulls the kernel wakelock durations. This atom is adapted from
1336 * android/internal/os/KernelWakelockStats.java
1337 *
1338 * Pulled from:
1339 * StatsCompanionService using KernelWakelockReader.
1340 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001341message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001342 optional string name = 1;
1343
1344 optional int32 count = 2;
1345
1346 optional int32 version = 3;
1347
1348 optional int64 time = 4;
1349}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001350
Chenjie Yu05013b32017-11-21 10:21:41 -08001351/**
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001352 * Pulls low power state information. This includes platform and subsystem sleep state information,
1353 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001354 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001355 * hardware/interfaces/power/1.1/types.hal
1356 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001357message SubsystemSleepState {
Chenjie Yubbcbc602018-02-05 16:51:52 -08001358 // Subsystem name
1359 optional string subsystem_name = 1;
1360 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
1361 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
1362 optional string subname = 2;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001363 // The number of times it entered, or voted for entering the sleep state
Chenjie Yubbcbc602018-02-05 16:51:52 -08001364 optional uint64 count = 3;
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001365 // The length of time spent in, or spent voting for, the sleep state
David Chen0b5c90c2018-01-25 16:51:49 -08001366 optional uint64 time_millis = 4;
David Chen21582962017-11-01 17:32:46 -07001367}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001368
Chenjie Yu05013b32017-11-21 10:21:41 -08001369/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001370 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001371 * Pulls the time the cpu spend on the frequency index. Frequency index
1372 * starts from highest to lowest. The value should be monotonically
1373 * increasing since boot. However, if there is a cpu
1374 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001375 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001376message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001377 optional uint32 cluster = 1;
1378 optional uint32 freq_index = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001379 optional uint64 time_millis = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001380}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001381
Chenjie Yu05013b32017-11-21 10:21:41 -08001382/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001383 * Pulls Cpu Time Per Uid.
1384 * Note that isolated process uid time should be attributed to host uids.
1385 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001386message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001387 optional uint64 uid = 1;
David Chen0b5c90c2018-01-25 16:51:49 -08001388 optional uint64 user_time_millis = 2;
1389 optional uint64 sys_time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001390}
1391
1392/**
1393 * Pulls Cpu Time Per Uid per frequency.
1394 * Note that isolated process uid time should be attributed to host uids.
1395 * For each uid, we order the time by descending frequencies.
1396 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001397message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001398 optional uint64 uid = 1;
1399 optional uint64 freq_idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001400 optional uint64 time_millis = 3;
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001401}
Hugo Benichi884970e2017-11-14 22:42:46 +09001402
Chenjie Yu05013b32017-11-21 10:21:41 -08001403/**
1404 * Pulls Wifi Controller Activity Energy Info
1405 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001406message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001407 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001408 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001409 // stack reported state
1410 // TODO: replace this with proto enum
1411 optional int32 stack_state = 2;
1412 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001413 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001414 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001415 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001416 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001417 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001418 // product of current(mA), voltage(V) and time(ms)
1419 optional uint64 controller_energy_used = 6;
1420}
1421
1422/**
1423 * Pulls Modem Activity Energy Info
1424 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001425message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001426 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001427 optional uint64 timestamp_millis = 1;
Chenjie Yu05013b32017-11-21 10:21:41 -08001428 // sleep time in ms.
David Chen0b5c90c2018-01-25 16:51:49 -08001429 optional uint64 sleep_time_millis = 2;
Chenjie Yu05013b32017-11-21 10:21:41 -08001430 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001431 optional uint64 controller_idle_time_millis = 3;
Chenjie Yu05013b32017-11-21 10:21:41 -08001432 /**
1433 * Tx power index
1434 * index 0 = tx_power < 0dBm
1435 * index 1 = 0dBm < tx_power < 5dBm
1436 * index 2 = 5dBm < tx_power < 15dBm
1437 * index 3 = 15dBm < tx_power < 20dBm
1438 * index 4 = tx_power > 20dBm
1439 */
1440 // tx time in ms at power level 0
David Chen0b5c90c2018-01-25 16:51:49 -08001441 optional uint64 controller_tx_time_pl0_millis = 4;
Chenjie Yu05013b32017-11-21 10:21:41 -08001442 // tx time in ms at power level 1
David Chen0b5c90c2018-01-25 16:51:49 -08001443 optional uint64 controller_tx_time_pl1_millis = 5;
Chenjie Yu05013b32017-11-21 10:21:41 -08001444 // tx time in ms at power level 2
David Chen0b5c90c2018-01-25 16:51:49 -08001445 optional uint64 controller_tx_time_pl2_millis = 6;
Chenjie Yu05013b32017-11-21 10:21:41 -08001446 // tx time in ms at power level 3
David Chen0b5c90c2018-01-25 16:51:49 -08001447 optional uint64 controller_tx_time_pl3_millis = 7;
Chenjie Yu05013b32017-11-21 10:21:41 -08001448 // tx time in ms at power level 4
David Chen0b5c90c2018-01-25 16:51:49 -08001449 optional uint64 controller_tx_time_pl4_millis = 8;
Chenjie Yu05013b32017-11-21 10:21:41 -08001450 // rx time in ms at power level 5
David Chen0b5c90c2018-01-25 16:51:49 -08001451 optional uint64 controller_rx_time_millis = 9;
Chenjie Yu05013b32017-11-21 10:21:41 -08001452 // product of current(mA), voltage(V) and time(ms)
1453 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001454}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001455
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001456/**
1457 * Pulls Bluetooth Activity Energy Info
1458 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
1459 */
1460message BluetoothActivityInfo {
1461 // timestamp(wall clock) of record creation
David Chen0b5c90c2018-01-25 16:51:49 -08001462 optional uint64 timestamp_millis = 1;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001463 // bluetooth stack state
1464 optional int32 bluetooth_stack_state = 2;
1465 // tx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001466 optional uint64 controller_tx_time_millis = 3;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001467 // rx time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001468 optional uint64 controller_rx_time_millis = 4;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001469 // idle time in ms
David Chen0b5c90c2018-01-25 16:51:49 -08001470 optional uint64 controller_idle_time_millis = 5;
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001471 // product of current(mA), voltage(V) and time(ms)
1472 optional uint64 energy_used = 6;
1473}
1474
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001475/*
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001476 * Logs the memory stats for a process.
1477 */
1478message ProcessMemoryState {
1479 // The uid if available. -1 means not available.
1480 optional int32 uid = 1;
1481
1482 // The process name.
1483 optional string process_name = 2;
1484
1485 // oom adj score.
1486 optional int32 oom_score = 3;
1487
1488 // # of page-faults
1489 optional int64 pgfault = 4;
1490
1491 // # of major page-faults
1492 optional int64 pgmajfault = 5;
1493
Rajeev Kumar90235992018-01-29 11:06:48 -08001494 // RSS
1495 optional int64 rss_in_bytes = 6;
1496
1497 // CACHE
1498 optional int64 cache_in_bytes = 7;
1499
1500 // SWAP
1501 optional int64 swap_in_bytes = 8;
Rajeev Kumar8a9fa052018-01-25 19:03:09 -08001502}
1503
1504/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001505 * Elapsed real time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001506 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001507message SystemElapsedRealtime {
David Chen0b5c90c2018-01-25 16:51:49 -08001508 optional uint64 time_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001509}
1510
1511/*
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001512 * Up time from SystemClock.
Chenjie Yu9da105b2018-01-13 12:41:08 -08001513 */
Chenjie Yu9d7720b2018-01-24 10:34:48 -08001514message SystemUptime {
1515 // Milliseconds since the system was booted.
1516 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
1517 // for external input).
1518 // It is not affected by clock scaling, idle, or other power saving mechanisms.
David Chen0b5c90c2018-01-25 16:51:49 -08001519 optional uint64 uptime_millis = 1;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001520}
1521
1522/*
1523 * Reads from /proc/uid_concurrent_active_time which has the format:
1524 * active: X (X is # cores)
1525 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
1526 * [uid1]: [time-0] [time-1] [time-2] ... ...
1527 * ...
1528 * Time-N means the CPU time a UID spent running concurrently with N other processes.
1529 * The file contains a monotonically increasing count of time for a single boot.
1530 */
1531message CpuActiveTime {
1532 optional uint64 uid = 1;
David Chenb639d142018-02-14 17:29:54 -08001533 optional uint32 cluster_number = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001534 optional uint64 idx = 3;
1535 optional uint64 time_millis = 4;
Chenjie Yu9da105b2018-01-13 12:41:08 -08001536}
1537
1538/**
1539 * Reads from /proc/uid_concurrent_policy_time which has the format:
1540 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
1541 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1542 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
1543 * ...
1544 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
1545 * The file contains a monotonically increasing count of time for a single boot.
1546 */
1547message CpuClusterTime {
1548 optional uint64 uid = 1;
1549 optional uint64 idx = 2;
David Chen0b5c90c2018-01-25 16:51:49 -08001550 optional uint64 time_millis = 3;
Chenjie Yu937d7422018-01-10 16:37:53 -08001551}
1552
1553/*
1554 * Pulls free disk space, for data, system partition and temporary directory.
1555 */
1556message DiskSpace {
1557 // available bytes in data partition
1558 optional uint64 data_available_bytes = 1;
1559 // available bytes in system partition
1560 optional uint64 system_available_bytes = 2;
1561 // available bytes in download cache or temp directories
1562 optional uint64 temp_available_bytes = 3;
1563}
Tej Singhbf972d92018-01-10 20:51:13 -08001564
1565/**
1566 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001567 * Pulled from:
1568 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001569 */
1570message RemainingBatteryCapacity {
1571 optional int32 charge_uAh = 1;
1572}
1573
1574/**
1575 * Pulls battery capacity, which is the battery capacity when full in uAh.
Tej Singh40298312018-02-16 00:15:09 -08001576 * Pulled from:
1577 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
Tej Singhbf972d92018-01-10 20:51:13 -08001578 */
1579message FullBatteryCapacity {
1580 optional int32 capacity_uAh = 1;
Tej Singh40298312018-02-16 00:15:09 -08001581}
1582
1583/**
1584 * Pulls the temperature of various parts of the device, in Celsius.
1585 *
1586 * Pulled from:
1587 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp
1588 */
1589message Temperature {
1590 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY.
1591 optional android.os.TemperatureTypeEnum sensor_location = 1;
1592
1593 // The name of the temperature source. Eg. CPU0
1594 optional string sensor_name = 2;
1595
1596 // Temperature in degrees C.
1597 optional float temperature_C = 3;
yroa1fe77c2018-02-26 14:22:54 -08001598}