blob: cc98b982906254eccde4aaa3b3ca5e882e8e8736 [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
Joe Onorato62c220b2017-11-18 20:32:56 -080024import "frameworks/base/core/proto/android/app/activitymanager.proto";
25
Yao Chend54f9dd2017-10-17 17:37:48 +000026/**
Stefan Lafonae2df012017-11-14 09:17:21 -080027 * The master atom class. This message defines all of the available
Yao Chend54f9dd2017-10-17 17:37:48 +000028 * raw stats log events from the Android system, also known as "atoms."
29 *
30 * This field contains a single oneof with all of the available messages.
31 * The stats-log-api-gen tool runs as part of the Android build and
32 * generates the android.util.StatsLog class, which contains the constants
33 * and methods that Android uses to log.
34 *
Stefan Lafonae2df012017-11-14 09:17:21 -080035 * This Atom class is not actually built into the Android system.
Yao Chend54f9dd2017-10-17 17:37:48 +000036 * Instead, statsd on Android constructs these messages synthetically,
37 * in the format defined here and in stats_log.proto.
38 */
Stefan Lafonae2df012017-11-14 09:17:21 -080039message Atom {
40 // Pushed atoms start at 2.
David Chenc8a43242017-10-17 16:23:28 -070041 oneof pushed {
Bookatzc1a050a2017-10-10 15:49:28 -070042 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
43 BleScanStateChanged ble_scan_state_changed = 2;
44 BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3;
45 BleScanResultReceived ble_scan_result_received = 4;
46 SensorStateChanged sensor_state_changed = 5;
47 GpsScanStateChanged gps_scan_state_changed = 6; // TODO: untested
48 SyncStateChanged sync_state_changed = 7;
49 ScheduledJobStateChanged scheduled_job_state_changed = 8;
50 ScreenBrightnessChanged screen_brightness_changed = 9;
Bookatzd6746242017-10-24 18:39:35 -070051 WakelockStateChanged wakelock_state_changed = 10;
Bookatzddccf0a2017-11-28 16:48:14 -080052 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11;
53 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12;
54 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13;
55 // TODO: 14-19 are blank, but need not be
56 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
57 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
58 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
Bookatzc1a050a2017-10-10 15:49:28 -070059 AudioStateChanged audio_state_changed = 23;
60 MediaCodecActivityChanged media_codec_activity_changed = 24;
61 CameraStateChanged camera_state_changed = 25;
62 FlashlightStateChanged flashlight_state_changed = 26;
63 UidProcessStateChanged uid_process_state_changed = 27;
64 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28;
65 ScreenStateChanged screen_state_changed = 29;
Bookatz8c6571b2017-10-24 15:04:41 -070066 BatteryLevelChanged battery_level_changed = 30;
67 ChargingStateChanged charging_state_changed = 31;
68 PluggedStateChanged plugged_state_changed = 32;
69 DeviceTemperatureReported device_temperature_reported = 33;
70 DeviceOnStatusChanged device_on_status_changed = 34;
71 WakeupAlarmOccurred wakeup_alarm_occurred = 35;
72 KernelWakeupReported kernel_wakeup_reported = 36;
Bookatze5885242017-10-24 20:10:31 -070073 WifiLockStateChanged wifi_lock_state_changed = 37;
74 WifiSignalStrengthChanged wifi_signal_strength_changed = 38;
75 WifiScanStateChanged wifi_scan_state_changed = 39;
76 PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
David Chenc28b2bb2017-10-24 12:52:52 -070077 SettingChanged setting_changed = 41;
David Chenc8a43242017-10-17 16:23:28 -070078 ActivityForegroundStateChanged activity_foreground_state_changed = 42;
David Chen21582962017-11-01 17:32:46 -070079 IsolatedUidChanged isolated_uid_changed = 43;
Hugo Benichi884970e2017-11-14 22:42:46 +090080 PacketWakeupOccurred packet_wakeup_occurred = 44;
David Chen9e3808c2017-11-20 17:25:34 -080081 DropboxErrorChanged dropbox_error_changed = 45;
Bookatz8fcd09a2017-12-18 13:01:10 -080082 AnomalyDetected anomaly_detected = 46;
83 AppHook app_hook = 47;
Olivier Gaillardaed7f122017-12-12 14:26:22 +000084 AppStartChanged app_start_changed = 48;
85 AppStartCancelChanged app_start_cancel_changed = 49;
86 AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50;
Bookatzc1a050a2017-10-10 15:49:28 -070087 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000088 }
David Chenc8a43242017-10-17 16:23:28 -070089
David Chen6e3e6cb2018-01-03 16:14:06 -080090 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070091 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080092 WifiBytesTransfer wifi_bytes_transfer = 10000;
93 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
94 MobileBytesTransfer mobile_bytes_transfer = 10002;
95 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
96 KernelWakelock kernel_wakelock = 10004;
97 PlatformSleepState platform_sleep_state = 10005;
98 SleepStateVoter sleep_state_voter = 10006;
99 SubsystemSleepState subsystem_sleep_state = 10007;
100 CpuTimePerFreq cpu_time_per_freq = 10008;
101 CpuTimePerUid cpu_time_per_uid = 10009;
102 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010;
103 WifiActivityEnergyInfo wifi_activity_energy_info = 10011;
104 ModemActivityInfo modem_activity_info = 10012;
David Chenc8a43242017-10-17 16:23:28 -0700105 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700106}
107
Yao Chend54f9dd2017-10-17 17:37:48 +0000108/**
Yangster-mac20877162017-12-22 17:19:39 -0800109 * This proto represents a node of an attribution chain.
110 * Note: All attribution chains are represented as a repeated field of type
111 * AttributionNode. It is understood that in such arrays, the order is that
112 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000113 */
Yangster-mac20877162017-12-22 17:19:39 -0800114message AttributionNode {
115 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800116 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800117
Yangster-mac20877162017-12-22 17:19:39 -0800118 // The (optional) string tag for an element in the attribution chain. If the
119 // element has no tag, it is encoded as an empty string.
120 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700121}
122
Yao Chend54f9dd2017-10-17 17:37:48 +0000123/*
124 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800125 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000126 *
127 * RULES:
128 * - The field ids for each atom must start at 1, and count upwards by 1.
129 * Skipping field ids is not allowed.
130 * - These form an API, so renaming, renumbering or removing fields is
131 * not allowed between android releases. (This is not currently enforced,
132 * but there will be a tool to enforce this restriction).
133 * - The types must be built-in protocol buffer types, namely, no sub-messages
134 * are allowed (yet). The bytes type is also not allowed.
135 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800136 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000137 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800138 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000139 * - A field that is a uid should be a string field, tagged with the [xxx]
140 * annotation. The generated code on android will be represented by UIDs,
141 * and those UIDs will be translated in xxx to those strings.
142 *
143 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700144 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000145 * - If there is a UID, it goes first. Think in an object-oriented fashion.
146 * *****************************************************************************
147 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700148
Yao Chend54f9dd2017-10-17 17:37:48 +0000149/**
150 * Logs when the screen state changes.
151 *
152 * Logged from:
153 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
154 */
155message ScreenStateChanged {
156 // TODO: Use the real screen state.
157 enum State {
158 STATE_UNKNOWN = 0;
159 STATE_OFF = 1;
160 STATE_ON = 2;
161 STATE_DOZE = 3;
162 STATE_DOZE_SUSPEND = 4;
163 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800164 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000165 }
166 // New screen state.
167 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700168}
Yao Chend54f9dd2017-10-17 17:37:48 +0000169
170/**
Bookatzc1a050a2017-10-10 15:49:28 -0700171 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000172 *
173 * Logged from:
174 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
175 */
Bookatzc1a050a2017-10-10 15:49:28 -0700176message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000177 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
178
179 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700180 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800181 optional android.app.ProcessState state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000182}
183
184/**
Bookatzc1a050a2017-10-10 15:49:28 -0700185 * Logs that a process started, finished, crashed, or ANRed.
186 *
187 * Logged from:
188 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
189 */
190message ProcessLifeCycleStateChanged {
191 // TODO: Use the real (mapped) process states.
192 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
193
194 // TODO: What is this?
195 optional string name = 2;
196
Bookatzddccf0a2017-11-28 16:48:14 -0800197 // What lifecycle state the process changed to.
198 // This enum is specific to atoms.proto.
199 enum Event {
200 PROCESS_FINISHED = 0;
201 PROCESS_STARTED = 1;
202 PROCESS_CRASHED = 2;
203 PROCESS_ANRED = 3;
204 }
205 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700206}
207
Bookatzc1a050a2017-10-10 15:49:28 -0700208/**
209 * Logs when the ble scan state changes.
210 *
211 * Logged from:
212 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
213 */
214message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800215 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700216
217 enum State {
218 OFF = 0;
219 ON = 1;
220 }
221 optional State state = 2;
222}
223
224/**
225 * Logs when an unoptimized ble scan state changes.
226 *
227 * Logged from:
228 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
229 */
230// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
231message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800232 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700233
234 enum State {
235 OFF = 0;
236 ON = 1;
237 }
238 optional State state = 2;
239}
240
241/**
242 * Logs reporting of a ble scan finding results.
243 *
244 * Logged from:
245 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
246 */
247// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
248message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800249 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700250
251 // Number of ble scan results returned.
252 optional int32 num_of_results = 2;
253}
254
255/**
256 * Logs when a sensor state changes.
257 *
258 * Logged from:
259 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
260 */
261message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800262 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700263
264 // TODO: Is there a way to get the actual name of the sensor?
265 // The id (int) of the sensor.
266 optional int32 sensor_id = 2;
267
268 enum State {
269 OFF = 0;
270 ON = 1;
271 }
272 optional State state = 3;
273}
274
275
276/**
277 * Logs when GPS state changes.
278 *
279 * Logged from:
280 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
281 */
282message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800283 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700284
285 enum State {
286 OFF = 0;
287 ON = 1;
288 }
289 optional State state = 2;
290}
291
292
293/**
294 * Logs when a sync manager sync state changes.
295 *
296 * Logged from:
297 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
298 */
299message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800300 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700301
302 // Name of the sync (as named in the app)
303 optional string name = 2;
304
305 enum State {
306 OFF = 0;
307 ON = 1;
308 }
309 optional State state = 3;
310}
311
312/**
313 * Logs when a job scheduler job state changes.
314 *
315 * Logged from:
316 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
317 */
318message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800319 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700320
321 // Name of the job (as named in the app)
322 optional string name = 2;
323
324 enum State {
Tej Singhd5747a62018-01-08 20:57:35 -0800325 FINISHED = 0;
326 STARTED = 1;
327 SCHEDULED = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700328 }
329 optional State state = 3;
330
331 // TODO: Consider adding the stopReason (int)
332}
333
334/**
335 * Logs when the audio state changes.
336 *
337 * Logged from:
338 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
339 */
340message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800341 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700342
343 enum State {
344 OFF = 0;
345 ON = 1;
346 }
347 optional State state = 2;
348}
349
350/**
351 * Logs when the video codec state changes.
352 *
353 * Logged from:
354 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
355 */
356message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800357 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700358
359 enum State {
360 OFF = 0;
361 ON = 1;
362 }
363 optional State state = 2;
364}
365
366/**
367 * Logs when the flashlight state changes.
368 *
369 * Logged from:
370 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
371 */
372message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800373 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700374
375 enum State {
376 OFF = 0;
377 ON = 1;
378 }
379 optional State state = 2;
380}
381
382/**
383 * Logs when the camera state changes.
384 *
385 * Logged from:
386 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
387 */
388message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800389 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700390
391 enum State {
392 OFF = 0;
393 ON = 1;
394 }
395 optional State state = 2;
396}
397
398/**
399 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000400 *
401 * Logged from:
402 * TODO
403 */
Bookatzd6746242017-10-24 18:39:35 -0700404message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800405 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000406
Bookatzc1a050a2017-10-10 15:49:28 -0700407 // Type of wakelock.
408 enum Type {
409 PARTIAL = 0;
410 FULL = 1;
411 WINDOW = 2;
412 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800413 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700414
415 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
416 optional string tag = 3;
417
418 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800419 RELEASE = 0;
420 ACQUIRE = 1;
421 CHANGE_RELEASE = 2;
422 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700423 }
424 optional State state = 4;
425}
426
427/**
Bookatzc1a050a2017-10-10 15:49:28 -0700428 * Logs when a partial wakelock is considered 'long' (over 1 min).
429 *
430 * Logged from:
431 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
432 */
433message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800434 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700435
Yao Chend54f9dd2017-10-17 17:37:48 +0000436 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
437 optional string tag = 2;
438
Bookatzc1a050a2017-10-10 15:49:28 -0700439 // TODO: I have no idea what this is.
440 optional string history_tag = 3;
441
442 enum State {
443 OFF = 0;
444 ON = 1;
445 }
446 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000447}
448
Bookatzc1a050a2017-10-10 15:49:28 -0700449/**
450 * Logs Battery Saver state change.
451 *
452 * Logged from:
453 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
454 */
455message BatterySaverModeStateChanged {
456 enum State {
457 OFF = 0;
458 ON = 1;
459 }
460 optional State state = 1;
461}
462
463/**
464 * Logs Doze mode state change.
465 *
466 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800467 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700468 */
469message DeviceIdleModeStateChanged {
470 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800471 enum State {
472 DEVICE_IDLE_MODE_OFF = 0;
473 DEVICE_IDLE_MODE_LIGHT = 1;
474 DEVICE_IDLE_MODE_DEEP = 2;
475 }
476 optional State state = 1;
477}
478
479
480/**
481 * Logs state change of Doze mode including maintenance windows.
482 *
483 * Logged from:
484 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
485 */
486message DeviceIdlingModeStateChanged {
487 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
488 enum State {
489 DEVICE_IDLE_MODE_OFF = 0;
490 DEVICE_IDLE_MODE_LIGHT = 1;
491 DEVICE_IDLE_MODE_DEEP = 2;
492 }
493 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700494}
495
496/**
497 * Logs screen brightness level.
498 *
499 * Logged from:
500 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
501 */
502message ScreenBrightnessChanged {
503 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
504 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700505}
506
507/**
508 * Logs battery level (percent full, from 0 to 100).
509 *
510 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700511 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700512 */
513message BatteryLevelChanged {
514 // Battery level. Should be in [0, 100].
515 optional int32 battery_level = 1;
516}
517
518/**
519 * Logs change in charging status of the device.
520 *
521 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700522 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700523 */
524message ChargingStateChanged {
525 // TODO: Link directly to BatteryManager.java's constants (via a proto).
526 enum State {
527 BATTERY_STATUS_UNKNOWN = 1;
528 BATTERY_STATUS_CHARGING = 2;
529 BATTERY_STATUS_DISCHARGING = 3;
530 BATTERY_STATUS_NOT_CHARGING = 4;
531 BATTERY_STATUS_FULL = 5;
532 }
533 optional State charging_state = 1;
534}
535
536/**
537 * Logs whether the device is plugged in, and what power source it is using.
538 *
539 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700540 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700541 */
542message PluggedStateChanged {
543 // TODO: Link directly to BatteryManager.java's constants (via a proto).
544 enum State {
545 // Note that NONE is not in BatteryManager.java's constants.
546 BATTERY_PLUGGED_NONE = 0;
547 // Power source is an AC charger.
548 BATTERY_PLUGGED_AC = 1;
549 // Power source is a USB port.
550 BATTERY_PLUGGED_USB = 2;
551 // Power source is wireless.
552 BATTERY_PLUGGED_WIRELESS = 4;
553 }
554 optional State plugged_state = 1;
555}
556
557/**
558 * Logs the temperature of the device, in tenths of a degree Celsius.
559 *
560 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700561 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700562 */
563message DeviceTemperatureReported {
564 // Temperature in tenths of a degree C.
565 optional int32 temperature = 1;
566}
567
568// TODO: Define this more precisely.
569// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
570/**
571 * Logs when the device turns off or on.
572 *
573 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700574 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700575 */
576message DeviceOnStatusChanged {
577 enum State {
578 OFF = 0;
579 ON = 1;
580 }
581 optional State state = 1;
582}
583
584/**
585 * Logs when an app's wakeup alarm fires.
586 *
587 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700588 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700589 */
590message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800591 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800592
593 // Name of the wakeup alarm.
594 optional string tag = 2;
595}
596
597/**
598 * Logs when an an app causes the mobile radio to change state.
599 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
600 *
601 * Logged from:
602 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
603 */
604message MobileRadioPowerStateChanged {
605 // TODO: Add attribution instead of uid?
606 optional int32 uid = 1;
607
608 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
609 enum PowerState {
610 DC_POWER_STATE_LOW = 1;
611 DC_POWER_STATE_MEDIUM = 2;
612 DC_POWER_STATE_HIGH = 3;
613 }
614 optional PowerState power_state = 2;
615}
616
617/**
618 * Logs when an an app causes the wifi radio to change state.
619 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
620 *
621 * Logged from:
622 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
623 */
624message WifiRadioPowerStateChanged {
625 // TODO: Add attribution instead of uid?
626 optional int32 uid = 1;
627
628 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
629 enum PowerState {
630 DC_POWER_STATE_LOW = 1;
631 DC_POWER_STATE_MEDIUM = 2;
632 DC_POWER_STATE_HIGH = 3;
633 }
634 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700635}
636
637/**
638 * Logs kernel wakeup reasons and aborts.
639 *
640 * Logged from:
641 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
642 */
643message KernelWakeupReported {
644 // Name of the kernel wakeup reason (or abort).
645 optional string wakeup_reason_name = 1;
646
647 // Duration (in microseconds) for the wake-up interrupt to be serviced.
648 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700649}
650
651/**
652 * Logs wifi locks held by an app.
653 *
654 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700655 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700656 */
657message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800658 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700659
660 enum State {
661 OFF = 0;
662 ON = 1;
663 }
664 optional State state = 2;
665}
666
667/**
668 * Logs wifi signal strength changes.
669 *
670 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700671 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700672 */
673message WifiSignalStrengthChanged {
674 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
675 enum SignalStrength {
676 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
677 SIGNAL_STRENGTH_POOR = 1;
678 SIGNAL_STRENGTH_MODERATE = 2;
679 SIGNAL_STRENGTH_GOOD = 3;
680 SIGNAL_STRENGTH_GREAT = 4;
681 }
682 optional SignalStrength signal_strength = 1;
683}
684
685/**
686 * Logs wifi scans performed by an app.
687 *
688 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700689 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700690 */
691message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800692 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700693
694 enum State {
695 OFF = 0;
696 ON = 1;
697 }
698 optional State state = 2;
699}
700
701/**
702 * Logs phone signal strength changes.
703 *
704 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700705 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700706 */
707message PhoneSignalStrengthChanged {
708 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
709 enum SignalStrength {
710 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
711 SIGNAL_STRENGTH_POOR = 1;
712 SIGNAL_STRENGTH_MODERATE = 2;
713 SIGNAL_STRENGTH_GOOD = 3;
714 SIGNAL_STRENGTH_GREAT = 4;
715 }
716 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700717}
718
719/**
720 * Logs that a setting was updated.
721 * Logged from:
722 * frameworks/base/core/java/android/provider/Settings.java
723 * The tag and is_default allow resetting of settings to default values based on the specified
724 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
725 */
726message SettingChanged {
727 // The name of the setting.
728 optional string setting = 1;
729
730 // The change being imposed on this setting. May represent a number, eg "3".
731 optional string value = 2;
732
733 // The new value of this setting. For most settings, this is same as value. For some settings,
734 // value is +X or -X where X represents an element in a set. For example, if the previous value
735 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
736 // The +/- feature is currently only used for location_providers_allowed.
737 optional string new_value = 3;
738
739 // The previous value of this setting.
740 optional string prev_value = 4;
741
742 // The tag used with the is_default for resetting sets of settings. This is generally null.
743 optional string tag = 5;
744
745 // 1 indicates that this setting with tag should be resettable.
746 optional int32 is_default = 6;
747
748 // The user ID associated. Defined in android/os/UserHandle.java
749 optional int32 user = 7;
750}
Chenjie Yub3dda412017-10-24 13:41:59 -0700751
Chenjie Yu05013b32017-11-21 10:21:41 -0800752/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700753 * Logs activity going to foreground or background
754 *
755 * Logged from:
756 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
757 */
758message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800759 optional int32 uid = 1;
760 optional string pkg_name = 2;
761 optional string class_name = 3;
762
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700763 enum Activity {
764 MOVE_TO_BACKGROUND = 0;
765 MOVE_TO_FOREGROUND = 1;
766 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700767 optional Activity activity = 4;
768}
David Chenc8a43242017-10-17 16:23:28 -0700769
770/**
David Chen9e3808c2017-11-20 17:25:34 -0800771 * Logs when an error is written to dropbox.
772 * Logged from:
773 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
774 */
775message DropboxErrorChanged {
776 // The uid if available. -1 means not available.
777 optional int32 uid = 1;
778
779 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
780 optional string tag = 2;
781
782 // The name of the process.
783 optional string process_name = 3;
784
785 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800786 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800787
788 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800789 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800790
791 // The activity name if available.
792 optional string activity_name = 6;
793
David Chen6e3e6cb2018-01-03 16:14:06 -0800794 // The package name if available.
795 optional string package_name = 7;
796
David Chen9e3808c2017-11-20 17:25:34 -0800797 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800798 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800799}
800
David Chen0a368b22017-12-06 16:28:16 -0800801/*
802 * Allows other apps to push events into statsd.
803 * Logged from:
804 * frameworks/base/core/java/android/util/StatsLog.java
805 */
806message AppHook {
807 // The uid of the application that sent this custom atom.
808 optional int32 uid = 1;
809
810 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
811 optional int32 label = 2;
812
813 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
814 // predicates for the metrics).
815 enum State {
816 UNKNOWN = 0;
817 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
818 STOP = 2;
819 START = 3;
820 }
821 optional State state = 3;
822}
823
David Chen9e3808c2017-11-20 17:25:34 -0800824/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800825 * Logs when statsd detects an anomaly.
826 *
827 * Logged from:
828 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
829 */
830message AnomalyDetected {
831 // Uid that owns the config whose anomaly detection alert fired.
832 optional int32 config_uid = 1;
833
Yangster-mac94e197c2018-01-02 16:03:03 -0800834 // Id of the config whose anomaly detection alert fired.
835 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800836
Yangster-mac94e197c2018-01-02 16:03:03 -0800837 // Id of the alert (i.e. name of the anomaly that was detected).
838 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800839}
840
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000841message AppStartChanged {
842 // The uid if available. -1 means not available.
843 optional int32 uid = 1;
844
845 // The app package name.
846 optional string pkg_name = 2;
847
848 enum TransitionType {
849 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
850 WARM = 1;
851 HOT = 2;
852 COLD = 3;
853 }
854 // The transition type.
855 optional TransitionType type = 3;
856
857 // The activity name.
858 optional string activity_name = 4;
859
860 // The name of the calling app. Empty if not set.
861 optional string calling_pkg_name = 5;
862
863 // Whether the app is an instant app.
864 optional bool is_instant_app = 6;
865
866 // Device uptime when activity started.
867 optional int64 activity_start_msec = 7;
868
869 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
870 enum TransitionReason {
871 APP_START_TRANSITION_REASON_UNKNOWN = 0;
872 SPLASH_SCREEN = 1;
873 WINDOWS_DRAWN = 2;
874 TIMEOUT = 3;
875 SNAPSHOT = 4;
876 }
877 optional TransitionReason reason = 8;
878
879 optional int32 transition_delay_msec = 9;
880 // -1 if not set.
881 optional int32 starting_window_delay_msec = 10;
882 // -1 if not set.
883 optional int32 bind_application_delay_msec = 11;
884 optional int32 windows_drawn_delay_msec = 12;
885
886 // Empty if not set.
887 optional string launch_token = 13;
888
889}
890
891message AppStartCancelChanged {
892 // The uid if available. -1 means not available.
893 optional int32 uid = 1;
894
895 // The app package name.
896 optional string pkg_name = 2;
897
898 enum TransitionType {
899 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
900 WARM = 1;
901 HOT = 2;
902 COLD = 3;
903 }
904 // The transition type.
905 optional TransitionType type = 3;
906
907 // The activity name.
908 optional string activity_name = 4;
909}
910
911message AppStartFullyDrawnChanged {
912 // The uid if available. -1 means not available.
913 optional int32 uid = 1;
914
915 // The app package name.
916 optional string pkg_name = 2;
917
918 enum TransitionType {
919 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
920 WITH_BUNDLE = 1;
921 WITHOUT_BUNDLE = 2;
922 }
923 // The transition type.
924 optional TransitionType type = 3;
925
926 // The activity name.
927 optional string activity_name = 4;
928
929 optional bool transition_process_running = 5;
930
931 // App startup time (until call to Activity#reportFullyDrawn()).
932 optional int64 app_startup_time_ms = 6;
933}
934
Bookatz8fcd09a2017-12-18 13:01:10 -0800935/**
David Chenc8a43242017-10-17 16:23:28 -0700936 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
937 *
938 * Pulled from:
939 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
940 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800941message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700942 optional int32 uid = 1;
943
944 optional int64 rx_bytes = 2;
945
946 optional int64 rx_packets = 3;
947
948 optional int64 tx_bytes = 4;
949
950 optional int64 tx_packets = 5;
951}
952
953/**
954 * Pulls bytes transferred via wifi (separated by foreground and background usage).
955 *
956 * Pulled from:
957 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
958 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800959message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700960 optional int32 uid = 1;
961
962 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
963 optional int32 is_foreground = 2;
964
965 optional int64 rx_bytes = 3;
966
967 optional int64 rx_packets = 4;
968
969 optional int64 tx_bytes = 5;
970
971 optional int64 tx_packets = 6;
972}
973
974/**
975 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
976 *
977 * Pulled from:
978 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
979 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800980message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700981 optional int32 uid = 1;
982
983 optional int64 rx_bytes = 2;
984
985 optional int64 rx_packets = 3;
986
987 optional int64 tx_bytes = 4;
988
989 optional int64 tx_packets = 5;
990}
991
992/**
993 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
994 *
995 * Pulled from:
996 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
997 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800998message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700999 optional int32 uid = 1;
1000
1001 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1002 optional int32 is_foreground = 2;
1003
1004 optional int64 rx_bytes = 3;
1005
1006 optional int64 rx_packets = 4;
1007
1008 optional int64 tx_bytes = 5;
1009
1010 optional int64 tx_packets = 6;
1011}
1012
1013/**
1014 * Pulls the kernel wakelock durations. This atom is adapted from
1015 * android/internal/os/KernelWakelockStats.java
1016 *
1017 * Pulled from:
1018 * StatsCompanionService using KernelWakelockReader.
1019 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001020message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001021 optional string name = 1;
1022
1023 optional int32 count = 2;
1024
1025 optional int32 version = 3;
1026
1027 optional int64 time = 4;
1028}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001029
Chenjie Yu05013b32017-11-21 10:21:41 -08001030/**
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001031 * Pulls PowerStatePlatformSleepState.
1032 *
1033 * Definition here:
1034 * hardware/interfaces/power/1.0/types.hal
1035 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001036message PlatformSleepState {
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001037 optional string name = 1;
1038 optional uint64 residency_in_msec_since_boot = 2;
1039 optional uint64 total_transitions = 3;
1040 optional bool supported_only_in_suspend = 4;
1041}
1042
1043/**
1044 * Pulls PowerStateVoter.
1045 *
1046 * Definition here:
1047 * hardware/interfaces/power/1.0/types.hal
1048 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001049message SleepStateVoter {
1050 optional string platform_sleep_state_name = 1;
1051 optional string voter_name = 2;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001052 optional uint64 total_time_in_msec_voted_for_since_boot = 3;
1053 optional uint64 total_number_of_times_voted_since_boot = 4;
1054}
1055
1056/**
1057 * Pulls PowerStateSubsystemSleepState.
1058 *
1059 * Definition here:
1060 * hardware/interfaces/power/1.1/types.hal
1061 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001062message SubsystemSleepState {
1063 optional string subsystem_name = 1;
1064 optional string subsystem_sleep_state_name = 2;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001065 optional uint64 residency_in_msec_since_boot = 3;
1066 optional uint64 total_transitions = 4;
1067 optional uint64 last_entry_timestamp_ms = 5;
1068 optional bool supported_only_in_suspend = 6;
1069}
David Chen21582962017-11-01 17:32:46 -07001070
1071/**
1072 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1073 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1074 * attributed back to the parent (host) uid. One example is Chrome.
1075 *
1076 * Logged from:
1077 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1078 */
1079message IsolatedUidChanged {
1080 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1081 optional int32 parent_uid = 1;
1082
1083 optional int32 isolated_uid = 2;
1084
1085 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1086 // be removed before if it's used for another parent uid.
1087 optional int32 is_create = 3;
1088}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001089
Chenjie Yu05013b32017-11-21 10:21:41 -08001090/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001091 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001092 * Pulls the time the cpu spend on the frequency index. Frequency index
1093 * starts from highest to lowest. The value should be monotonically
1094 * increasing since boot. However, if there is a cpu
1095 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001096 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001097message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001098 optional uint32 cluster = 1;
1099 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001100 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001101}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001102
Chenjie Yu05013b32017-11-21 10:21:41 -08001103/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001104 * Pulls Cpu Time Per Uid.
1105 * Note that isolated process uid time should be attributed to host uids.
1106 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001107message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001108 optional uint64 uid = 1;
1109 optional uint64 user_time_ms = 2;
1110 optional uint64 sys_time_ms = 3;
1111}
1112
1113/**
1114 * Pulls Cpu Time Per Uid per frequency.
1115 * Note that isolated process uid time should be attributed to host uids.
1116 * For each uid, we order the time by descending frequencies.
1117 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001118message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001119 optional uint64 uid = 1;
1120 optional uint64 freq_idx = 2;
1121 optional uint64 time_ms = 3;
1122}
Hugo Benichi884970e2017-11-14 22:42:46 +09001123
1124/*
1125 * Logs the reception of an incoming network packet causing the main system to wake up for
1126 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1127 * and processed by WakeupController.cpp.
1128 */
1129message PacketWakeupOccurred {
1130 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1131 // delivered nowhere.
1132 optional int32 uid = 1;
1133 // The interface name on which the packet was received.
1134 optional string iface = 2;
1135 // The ethertype value of the packet.
1136 optional int32 ethertype = 3;
1137 // String representation of the destination MAC address of the packet.
1138 optional string destination_hardware_address = 4;
1139 // String representation of the source address of the packet if this was an IP packet.
1140 optional string source_ip = 5;
1141 // String representation of the destination address of the packet if this was an IP packet.
1142 optional string destination_ip = 6;
1143 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1144 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1145 // families.
1146 optional int32 ip_next_header = 7;
1147 // The source port if this was a TCP or UDP packet.
1148 optional int32 source_port = 8;
1149 // The destination port if this was a TCP or UDP packet.
1150 optional int32 destination_port = 9;
1151}
Chenjie Yu05013b32017-11-21 10:21:41 -08001152
1153/**
1154 * Pulls Wifi Controller Activity Energy Info
1155 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001156message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001157 // timestamp(wall clock) of record creation
1158 optional uint64 timestamp_ms = 1;
1159 // stack reported state
1160 // TODO: replace this with proto enum
1161 optional int32 stack_state = 2;
1162 // tx time in ms
1163 optional uint64 controller_tx_time_ms = 3;
1164 // rx time in ms
1165 optional uint64 controller_rx_time_ms = 4;
1166 // idle time in ms
1167 optional uint64 controller_idle_time_ms = 5;
1168 // product of current(mA), voltage(V) and time(ms)
1169 optional uint64 controller_energy_used = 6;
1170}
1171
1172/**
1173 * Pulls Modem Activity Energy Info
1174 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001175message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001176 // timestamp(wall clock) of record creation
1177 optional uint64 timestamp_ms = 1;
1178 // sleep time in ms.
1179 optional uint64 sleep_time_ms = 2;
1180 // idle time in ms
1181 optional uint64 controller_idle_time_ms = 3;
1182 /**
1183 * Tx power index
1184 * index 0 = tx_power < 0dBm
1185 * index 1 = 0dBm < tx_power < 5dBm
1186 * index 2 = 5dBm < tx_power < 15dBm
1187 * index 3 = 15dBm < tx_power < 20dBm
1188 * index 4 = tx_power > 20dBm
1189 */
1190 // tx time in ms at power level 0
1191 optional uint64 controller_tx_time_pl0_ms = 4;
1192 // tx time in ms at power level 1
1193 optional uint64 controller_tx_time_pl1_ms = 5;
1194 // tx time in ms at power level 2
1195 optional uint64 controller_tx_time_pl2_ms = 6;
1196 // tx time in ms at power level 3
1197 optional uint64 controller_tx_time_pl3_ms = 7;
1198 // tx time in ms at power level 4
1199 optional uint64 controller_tx_time_pl4_ms = 8;
1200 // rx time in ms at power level 5
1201 optional uint64 controller_rx_time_ms = 9;
1202 // product of current(mA), voltage(V) and time(ms)
1203 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001204}