blob: fe3ca21eca9a8a9b181f8bfaa7d1075ed6ca1e6f [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 {
325 OFF = 0;
326 ON = 1;
327 }
328 optional State state = 3;
329
330 // TODO: Consider adding the stopReason (int)
331}
332
333/**
334 * Logs when the audio state changes.
335 *
336 * Logged from:
337 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
338 */
339message AudioStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800340 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700341
342 enum State {
343 OFF = 0;
344 ON = 1;
345 }
346 optional State state = 2;
347}
348
349/**
350 * Logs when the video codec state changes.
351 *
352 * Logged from:
353 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
354 */
355message MediaCodecActivityChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800356 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700357
358 enum State {
359 OFF = 0;
360 ON = 1;
361 }
362 optional State state = 2;
363}
364
365/**
366 * Logs when the flashlight state changes.
367 *
368 * Logged from:
369 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
370 */
371message FlashlightStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800372 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700373
374 enum State {
375 OFF = 0;
376 ON = 1;
377 }
378 optional State state = 2;
379}
380
381/**
382 * Logs when the camera state changes.
383 *
384 * Logged from:
385 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
386 */
387message CameraStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800388 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700389
390 enum State {
391 OFF = 0;
392 ON = 1;
393 }
394 optional State state = 2;
395}
396
397/**
398 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000399 *
400 * Logged from:
401 * TODO
402 */
Bookatzd6746242017-10-24 18:39:35 -0700403message WakelockStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800404 repeated AttributionNode attribution_node = 1;
Yao Chend54f9dd2017-10-17 17:37:48 +0000405
Bookatzc1a050a2017-10-10 15:49:28 -0700406 // Type of wakelock.
407 enum Type {
408 PARTIAL = 0;
409 FULL = 1;
410 WINDOW = 2;
411 }
Stefan Lafonae2df012017-11-14 09:17:21 -0800412 optional Type type = 2;
Bookatzc1a050a2017-10-10 15:49:28 -0700413
414 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
415 optional string tag = 3;
416
417 enum State {
Yangster-maccfdf3a42017-12-06 13:42:38 -0800418 RELEASE = 0;
419 ACQUIRE = 1;
420 CHANGE_RELEASE = 2;
421 CHANGE_ACQUIRE = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700422 }
423 optional State state = 4;
424}
425
426/**
Bookatzc1a050a2017-10-10 15:49:28 -0700427 * Logs when a partial wakelock is considered 'long' (over 1 min).
428 *
429 * Logged from:
430 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
431 */
432message LongPartialWakelockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800433 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700434
Yao Chend54f9dd2017-10-17 17:37:48 +0000435 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
436 optional string tag = 2;
437
Bookatzc1a050a2017-10-10 15:49:28 -0700438 // TODO: I have no idea what this is.
439 optional string history_tag = 3;
440
441 enum State {
442 OFF = 0;
443 ON = 1;
444 }
445 optional State state = 4;
Yao Chend54f9dd2017-10-17 17:37:48 +0000446}
447
Bookatzc1a050a2017-10-10 15:49:28 -0700448/**
449 * Logs Battery Saver state change.
450 *
451 * Logged from:
452 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
453 */
454message BatterySaverModeStateChanged {
455 enum State {
456 OFF = 0;
457 ON = 1;
458 }
459 optional State state = 1;
460}
461
462/**
463 * Logs Doze mode state change.
464 *
465 * Logged from:
Bookatzddccf0a2017-11-28 16:48:14 -0800466 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatzc1a050a2017-10-10 15:49:28 -0700467 */
468message DeviceIdleModeStateChanged {
469 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
Bookatzddccf0a2017-11-28 16:48:14 -0800470 enum State {
471 DEVICE_IDLE_MODE_OFF = 0;
472 DEVICE_IDLE_MODE_LIGHT = 1;
473 DEVICE_IDLE_MODE_DEEP = 2;
474 }
475 optional State state = 1;
476}
477
478
479/**
480 * Logs state change of Doze mode including maintenance windows.
481 *
482 * Logged from:
483 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
484 */
485message DeviceIdlingModeStateChanged {
486 // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_.
487 enum State {
488 DEVICE_IDLE_MODE_OFF = 0;
489 DEVICE_IDLE_MODE_LIGHT = 1;
490 DEVICE_IDLE_MODE_DEEP = 2;
491 }
492 optional State state = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700493}
494
495/**
496 * Logs screen brightness level.
497 *
498 * Logged from:
499 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
500 */
501message ScreenBrightnessChanged {
502 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
503 optional int32 level = 1;
Bookatz8c6571b2017-10-24 15:04:41 -0700504}
505
506/**
507 * Logs battery level (percent full, from 0 to 100).
508 *
509 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700510 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700511 */
512message BatteryLevelChanged {
513 // Battery level. Should be in [0, 100].
514 optional int32 battery_level = 1;
515}
516
517/**
518 * Logs change in charging status of the device.
519 *
520 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700521 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700522 */
523message ChargingStateChanged {
524 // TODO: Link directly to BatteryManager.java's constants (via a proto).
525 enum State {
526 BATTERY_STATUS_UNKNOWN = 1;
527 BATTERY_STATUS_CHARGING = 2;
528 BATTERY_STATUS_DISCHARGING = 3;
529 BATTERY_STATUS_NOT_CHARGING = 4;
530 BATTERY_STATUS_FULL = 5;
531 }
532 optional State charging_state = 1;
533}
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 {
542 // TODO: Link directly to BatteryManager.java's constants (via a proto).
543 enum State {
544 // Note that NONE is not in BatteryManager.java's constants.
545 BATTERY_PLUGGED_NONE = 0;
546 // Power source is an AC charger.
547 BATTERY_PLUGGED_AC = 1;
548 // Power source is a USB port.
549 BATTERY_PLUGGED_USB = 2;
550 // Power source is wireless.
551 BATTERY_PLUGGED_WIRELESS = 4;
552 }
553 optional State plugged_state = 1;
554}
555
556/**
557 * Logs the temperature of the device, in tenths of a degree Celsius.
558 *
559 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700560 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatz8c6571b2017-10-24 15:04:41 -0700561 */
562message DeviceTemperatureReported {
563 // Temperature in tenths of a degree C.
564 optional int32 temperature = 1;
565}
566
567// TODO: Define this more precisely.
568// TODO: Log the ON state somewhere. It isn't currently logged anywhere.
569/**
570 * Logs when the device turns off or on.
571 *
572 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700573 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700574 */
575message DeviceOnStatusChanged {
576 enum State {
577 OFF = 0;
578 ON = 1;
579 }
580 optional State state = 1;
581}
582
583/**
584 * Logs when an app's wakeup alarm fires.
585 *
586 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700587 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Bookatz8c6571b2017-10-24 15:04:41 -0700588 */
589message WakeupAlarmOccurred {
Yangster-macafad8c62018-01-05 22:30:49 -0800590 repeated AttributionNode attribution_node = 1;
Bookatzddccf0a2017-11-28 16:48:14 -0800591
592 // Name of the wakeup alarm.
593 optional string tag = 2;
594}
595
596/**
597 * Logs when an an app causes the mobile radio to change state.
598 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
599 *
600 * Logged from:
601 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
602 */
603message MobileRadioPowerStateChanged {
604 // TODO: Add attribution instead of uid?
605 optional int32 uid = 1;
606
607 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
608 enum PowerState {
609 DC_POWER_STATE_LOW = 1;
610 DC_POWER_STATE_MEDIUM = 2;
611 DC_POWER_STATE_HIGH = 3;
612 }
613 optional PowerState power_state = 2;
614}
615
616/**
617 * Logs when an an app causes the wifi radio to change state.
618 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
619 *
620 * Logged from:
621 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
622 */
623message WifiRadioPowerStateChanged {
624 // TODO: Add attribution instead of uid?
625 optional int32 uid = 1;
626
627 // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states.
628 enum PowerState {
629 DC_POWER_STATE_LOW = 1;
630 DC_POWER_STATE_MEDIUM = 2;
631 DC_POWER_STATE_HIGH = 3;
632 }
633 optional PowerState power_state = 2;
Bookatz8c6571b2017-10-24 15:04:41 -0700634}
635
636/**
637 * Logs kernel wakeup reasons and aborts.
638 *
639 * Logged from:
640 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
641 */
642message KernelWakeupReported {
643 // Name of the kernel wakeup reason (or abort).
644 optional string wakeup_reason_name = 1;
645
646 // Duration (in microseconds) for the wake-up interrupt to be serviced.
647 optional int64 duration_usec = 2;
Bookatze5885242017-10-24 20:10:31 -0700648}
649
650/**
651 * Logs wifi locks held by an app.
652 *
653 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700654 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700655 */
656message WifiLockStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800657 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700658
659 enum State {
660 OFF = 0;
661 ON = 1;
662 }
663 optional State state = 2;
664}
665
666/**
667 * Logs wifi signal strength changes.
668 *
669 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700670 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700671 */
672message WifiSignalStrengthChanged {
673 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
674 enum SignalStrength {
675 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
676 SIGNAL_STRENGTH_POOR = 1;
677 SIGNAL_STRENGTH_MODERATE = 2;
678 SIGNAL_STRENGTH_GOOD = 3;
679 SIGNAL_STRENGTH_GREAT = 4;
680 }
681 optional SignalStrength signal_strength = 1;
682}
683
684/**
685 * Logs wifi scans performed by an app.
686 *
687 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700688 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700689 */
690message WifiScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800691 repeated AttributionNode attribution_node = 1;
Bookatze5885242017-10-24 20:10:31 -0700692
693 enum State {
694 OFF = 0;
695 ON = 1;
696 }
697 optional State state = 2;
698}
699
700/**
701 * Logs phone signal strength changes.
702 *
703 * Logged from:
David Chenc28b2bb2017-10-24 12:52:52 -0700704 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Bookatze5885242017-10-24 20:10:31 -0700705 */
706message PhoneSignalStrengthChanged {
707 // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states.
708 enum SignalStrength {
709 SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
710 SIGNAL_STRENGTH_POOR = 1;
711 SIGNAL_STRENGTH_MODERATE = 2;
712 SIGNAL_STRENGTH_GOOD = 3;
713 SIGNAL_STRENGTH_GREAT = 4;
714 }
715 optional SignalStrength signal_strength = 1;
David Chenc28b2bb2017-10-24 12:52:52 -0700716}
717
718/**
719 * Logs that a setting was updated.
720 * Logged from:
721 * frameworks/base/core/java/android/provider/Settings.java
722 * The tag and is_default allow resetting of settings to default values based on the specified
723 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
724 */
725message SettingChanged {
726 // The name of the setting.
727 optional string setting = 1;
728
729 // The change being imposed on this setting. May represent a number, eg "3".
730 optional string value = 2;
731
732 // The new value of this setting. For most settings, this is same as value. For some settings,
733 // value is +X or -X where X represents an element in a set. For example, if the previous value
734 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
735 // The +/- feature is currently only used for location_providers_allowed.
736 optional string new_value = 3;
737
738 // The previous value of this setting.
739 optional string prev_value = 4;
740
741 // The tag used with the is_default for resetting sets of settings. This is generally null.
742 optional string tag = 5;
743
744 // 1 indicates that this setting with tag should be resettable.
745 optional int32 is_default = 6;
746
747 // The user ID associated. Defined in android/os/UserHandle.java
748 optional int32 user = 7;
749}
Chenjie Yub3dda412017-10-24 13:41:59 -0700750
Chenjie Yu05013b32017-11-21 10:21:41 -0800751/**
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700752 * Logs activity going to foreground or background
753 *
754 * Logged from:
755 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
756 */
757message ActivityForegroundStateChanged {
Yangster-mac20877162017-12-22 17:19:39 -0800758 optional int32 uid = 1;
759 optional string pkg_name = 2;
760 optional string class_name = 3;
761
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700762 enum Activity {
763 MOVE_TO_BACKGROUND = 0;
764 MOVE_TO_FOREGROUND = 1;
765 }
Chenjie Yu3d4f6042017-10-27 15:39:34 -0700766 optional Activity activity = 4;
767}
David Chenc8a43242017-10-17 16:23:28 -0700768
769/**
David Chen9e3808c2017-11-20 17:25:34 -0800770 * Logs when an error is written to dropbox.
771 * Logged from:
772 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
773 */
774message DropboxErrorChanged {
775 // The uid if available. -1 means not available.
776 optional int32 uid = 1;
777
778 // Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
779 optional string tag = 2;
780
781 // The name of the process.
782 optional string process_name = 3;
783
784 // The pid if available. -1 means not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800785 optional sint32 pid = 4;
David Chen9e3808c2017-11-20 17:25:34 -0800786
787 // 1 indicates is instant app. -1 indicates Not applicable.
David Chen6e3e6cb2018-01-03 16:14:06 -0800788 optional sint32 is_instant_app = 5;
David Chen9e3808c2017-11-20 17:25:34 -0800789
790 // The activity name if available.
791 optional string activity_name = 6;
792
David Chen6e3e6cb2018-01-03 16:14:06 -0800793 // The package name if available.
794 optional string package_name = 7;
795
David Chen9e3808c2017-11-20 17:25:34 -0800796 // 1 indicates in foreground. -1 indicates not available.
David Chen6e3e6cb2018-01-03 16:14:06 -0800797 optional sint32 is_foreground = 8;
David Chen9e3808c2017-11-20 17:25:34 -0800798}
799
David Chen0a368b22017-12-06 16:28:16 -0800800/*
801 * Allows other apps to push events into statsd.
802 * Logged from:
803 * frameworks/base/core/java/android/util/StatsLog.java
804 */
805message AppHook {
806 // The uid of the application that sent this custom atom.
807 optional int32 uid = 1;
808
809 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
810 optional int32 label = 2;
811
812 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
813 // predicates for the metrics).
814 enum State {
815 UNKNOWN = 0;
816 UNSPECIFIED = 1; // For events that are known to not represent START/STOP.
817 STOP = 2;
818 START = 3;
819 }
820 optional State state = 3;
821}
822
David Chen9e3808c2017-11-20 17:25:34 -0800823/**
Bookatz8fcd09a2017-12-18 13:01:10 -0800824 * Logs when statsd detects an anomaly.
825 *
826 * Logged from:
827 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
828 */
829message AnomalyDetected {
830 // Uid that owns the config whose anomaly detection alert fired.
831 optional int32 config_uid = 1;
832
Yangster-mac94e197c2018-01-02 16:03:03 -0800833 // Id of the config whose anomaly detection alert fired.
834 optional int64 config_id = 2;
Bookatz8fcd09a2017-12-18 13:01:10 -0800835
Yangster-mac94e197c2018-01-02 16:03:03 -0800836 // Id of the alert (i.e. name of the anomaly that was detected).
837 optional int64 alert_id = 3;
Bookatz8fcd09a2017-12-18 13:01:10 -0800838}
839
Olivier Gaillardaed7f122017-12-12 14:26:22 +0000840message AppStartChanged {
841 // The uid if available. -1 means not available.
842 optional int32 uid = 1;
843
844 // The app package name.
845 optional string pkg_name = 2;
846
847 enum TransitionType {
848 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
849 WARM = 1;
850 HOT = 2;
851 COLD = 3;
852 }
853 // The transition type.
854 optional TransitionType type = 3;
855
856 // The activity name.
857 optional string activity_name = 4;
858
859 // The name of the calling app. Empty if not set.
860 optional string calling_pkg_name = 5;
861
862 // Whether the app is an instant app.
863 optional bool is_instant_app = 6;
864
865 // Device uptime when activity started.
866 optional int64 activity_start_msec = 7;
867
868 // TODO: Update android/app/ActivityManagerInternal.java constants to depend on our proto enum.
869 enum TransitionReason {
870 APP_START_TRANSITION_REASON_UNKNOWN = 0;
871 SPLASH_SCREEN = 1;
872 WINDOWS_DRAWN = 2;
873 TIMEOUT = 3;
874 SNAPSHOT = 4;
875 }
876 optional TransitionReason reason = 8;
877
878 optional int32 transition_delay_msec = 9;
879 // -1 if not set.
880 optional int32 starting_window_delay_msec = 10;
881 // -1 if not set.
882 optional int32 bind_application_delay_msec = 11;
883 optional int32 windows_drawn_delay_msec = 12;
884
885 // Empty if not set.
886 optional string launch_token = 13;
887
888}
889
890message AppStartCancelChanged {
891 // The uid if available. -1 means not available.
892 optional int32 uid = 1;
893
894 // The app package name.
895 optional string pkg_name = 2;
896
897 enum TransitionType {
898 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
899 WARM = 1;
900 HOT = 2;
901 COLD = 3;
902 }
903 // The transition type.
904 optional TransitionType type = 3;
905
906 // The activity name.
907 optional string activity_name = 4;
908}
909
910message AppStartFullyDrawnChanged {
911 // The uid if available. -1 means not available.
912 optional int32 uid = 1;
913
914 // The app package name.
915 optional string pkg_name = 2;
916
917 enum TransitionType {
918 APP_START_TRANSITION_TYPE_UNKNOWN = 0;
919 WITH_BUNDLE = 1;
920 WITHOUT_BUNDLE = 2;
921 }
922 // The transition type.
923 optional TransitionType type = 3;
924
925 // The activity name.
926 optional string activity_name = 4;
927
928 optional bool transition_process_running = 5;
929
930 // App startup time (until call to Activity#reportFullyDrawn()).
931 optional int64 app_startup_time_ms = 6;
932}
933
Bookatz8fcd09a2017-12-18 13:01:10 -0800934/**
David Chenc8a43242017-10-17 16:23:28 -0700935 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
936 *
937 * Pulled from:
938 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
939 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800940message WifiBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700941 optional int32 uid = 1;
942
943 optional int64 rx_bytes = 2;
944
945 optional int64 rx_packets = 3;
946
947 optional int64 tx_bytes = 4;
948
949 optional int64 tx_packets = 5;
950}
951
952/**
953 * Pulls bytes transferred via wifi (separated by foreground and background usage).
954 *
955 * Pulled from:
956 * StatsCompanionService (using BatteryStats to get which interfaces are wifi)
957 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800958message WifiBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700959 optional int32 uid = 1;
960
961 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
962 optional int32 is_foreground = 2;
963
964 optional int64 rx_bytes = 3;
965
966 optional int64 rx_packets = 4;
967
968 optional int64 tx_bytes = 5;
969
970 optional int64 tx_packets = 6;
971}
972
973/**
974 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
975 *
976 * Pulled from:
977 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
978 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800979message MobileBytesTransfer {
David Chenc8a43242017-10-17 16:23:28 -0700980 optional int32 uid = 1;
981
982 optional int64 rx_bytes = 2;
983
984 optional int64 rx_packets = 3;
985
986 optional int64 tx_bytes = 4;
987
988 optional int64 tx_packets = 5;
989}
990
991/**
992 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
993 *
994 * Pulled from:
995 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
996 */
Chenjie Yu31d14d72017-12-12 17:54:33 -0800997message MobileBytesTransferByFgBg {
David Chenc8a43242017-10-17 16:23:28 -0700998 optional int32 uid = 1;
999
1000 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
1001 optional int32 is_foreground = 2;
1002
1003 optional int64 rx_bytes = 3;
1004
1005 optional int64 rx_packets = 4;
1006
1007 optional int64 tx_bytes = 5;
1008
1009 optional int64 tx_packets = 6;
1010}
1011
1012/**
1013 * Pulls the kernel wakelock durations. This atom is adapted from
1014 * android/internal/os/KernelWakelockStats.java
1015 *
1016 * Pulled from:
1017 * StatsCompanionService using KernelWakelockReader.
1018 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001019message KernelWakelock {
David Chenc8a43242017-10-17 16:23:28 -07001020 optional string name = 1;
1021
1022 optional int32 count = 2;
1023
1024 optional int32 version = 3;
1025
1026 optional int64 time = 4;
1027}
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001028
Chenjie Yu05013b32017-11-21 10:21:41 -08001029/**
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001030 * Pulls PowerStatePlatformSleepState.
1031 *
1032 * Definition here:
1033 * hardware/interfaces/power/1.0/types.hal
1034 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001035message PlatformSleepState {
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001036 optional string name = 1;
1037 optional uint64 residency_in_msec_since_boot = 2;
1038 optional uint64 total_transitions = 3;
1039 optional bool supported_only_in_suspend = 4;
1040}
1041
1042/**
1043 * Pulls PowerStateVoter.
1044 *
1045 * Definition here:
1046 * hardware/interfaces/power/1.0/types.hal
1047 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001048message SleepStateVoter {
1049 optional string platform_sleep_state_name = 1;
1050 optional string voter_name = 2;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001051 optional uint64 total_time_in_msec_voted_for_since_boot = 3;
1052 optional uint64 total_number_of_times_voted_since_boot = 4;
1053}
1054
1055/**
1056 * Pulls PowerStateSubsystemSleepState.
1057 *
1058 * Definition here:
1059 * hardware/interfaces/power/1.1/types.hal
1060 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001061message SubsystemSleepState {
1062 optional string subsystem_name = 1;
1063 optional string subsystem_sleep_state_name = 2;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001064 optional uint64 residency_in_msec_since_boot = 3;
1065 optional uint64 total_transitions = 4;
1066 optional uint64 last_entry_timestamp_ms = 5;
1067 optional bool supported_only_in_suspend = 6;
1068}
David Chen21582962017-11-01 17:32:46 -07001069
1070/**
1071 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1072 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1073 * attributed back to the parent (host) uid. One example is Chrome.
1074 *
1075 * Logged from:
1076 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1077 */
1078message IsolatedUidChanged {
1079 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1080 optional int32 parent_uid = 1;
1081
1082 optional int32 isolated_uid = 2;
1083
1084 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1085 // be removed before if it's used for another parent uid.
1086 optional int32 is_create = 3;
1087}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001088
Chenjie Yu05013b32017-11-21 10:21:41 -08001089/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001090 * Pulls Cpu time per frequency.
1091 * Note: this should be pulled for gauge metric only, without condition.
1092 * The puller keeps internal state of last values. It should not be pulled by
1093 * different metrics.
1094 * The pulled data is delta of cpu time from last pull, calculated as
1095 * following:
1096 * if current time is larger than last value, take delta between the two.
1097 * if current time is smaller than last value, there must be a cpu
1098 * hotplug event, and the current time is taken as delta.
1099 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001100message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001101 optional uint32 cluster = 1;
1102 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001103 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001104}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001105
Chenjie Yu05013b32017-11-21 10:21:41 -08001106/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001107 * Pulls Cpu Time Per Uid.
1108 * Note that isolated process uid time should be attributed to host uids.
1109 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001110message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001111 optional uint64 uid = 1;
1112 optional uint64 user_time_ms = 2;
1113 optional uint64 sys_time_ms = 3;
1114}
1115
1116/**
1117 * Pulls Cpu Time Per Uid per frequency.
1118 * Note that isolated process uid time should be attributed to host uids.
1119 * For each uid, we order the time by descending frequencies.
1120 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001121message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001122 optional uint64 uid = 1;
1123 optional uint64 freq_idx = 2;
1124 optional uint64 time_ms = 3;
1125}
Hugo Benichi884970e2017-11-14 22:42:46 +09001126
1127/*
1128 * Logs the reception of an incoming network packet causing the main system to wake up for
1129 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1130 * and processed by WakeupController.cpp.
1131 */
1132message PacketWakeupOccurred {
1133 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1134 // delivered nowhere.
1135 optional int32 uid = 1;
1136 // The interface name on which the packet was received.
1137 optional string iface = 2;
1138 // The ethertype value of the packet.
1139 optional int32 ethertype = 3;
1140 // String representation of the destination MAC address of the packet.
1141 optional string destination_hardware_address = 4;
1142 // String representation of the source address of the packet if this was an IP packet.
1143 optional string source_ip = 5;
1144 // String representation of the destination address of the packet if this was an IP packet.
1145 optional string destination_ip = 6;
1146 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1147 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1148 // families.
1149 optional int32 ip_next_header = 7;
1150 // The source port if this was a TCP or UDP packet.
1151 optional int32 source_port = 8;
1152 // The destination port if this was a TCP or UDP packet.
1153 optional int32 destination_port = 9;
1154}
Chenjie Yu05013b32017-11-21 10:21:41 -08001155
1156/**
1157 * Pulls Wifi Controller Activity Energy Info
1158 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001159message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001160 // timestamp(wall clock) of record creation
1161 optional uint64 timestamp_ms = 1;
1162 // stack reported state
1163 // TODO: replace this with proto enum
1164 optional int32 stack_state = 2;
1165 // tx time in ms
1166 optional uint64 controller_tx_time_ms = 3;
1167 // rx time in ms
1168 optional uint64 controller_rx_time_ms = 4;
1169 // idle time in ms
1170 optional uint64 controller_idle_time_ms = 5;
1171 // product of current(mA), voltage(V) and time(ms)
1172 optional uint64 controller_energy_used = 6;
1173}
1174
1175/**
1176 * Pulls Modem Activity Energy Info
1177 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001178message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001179 // timestamp(wall clock) of record creation
1180 optional uint64 timestamp_ms = 1;
1181 // sleep time in ms.
1182 optional uint64 sleep_time_ms = 2;
1183 // idle time in ms
1184 optional uint64 controller_idle_time_ms = 3;
1185 /**
1186 * Tx power index
1187 * index 0 = tx_power < 0dBm
1188 * index 1 = 0dBm < tx_power < 5dBm
1189 * index 2 = 5dBm < tx_power < 15dBm
1190 * index 3 = 15dBm < tx_power < 20dBm
1191 * index 4 = tx_power > 20dBm
1192 */
1193 // tx time in ms at power level 0
1194 optional uint64 controller_tx_time_pl0_ms = 4;
1195 // tx time in ms at power level 1
1196 optional uint64 controller_tx_time_pl1_ms = 5;
1197 // tx time in ms at power level 2
1198 optional uint64 controller_tx_time_pl2_ms = 6;
1199 // tx time in ms at power level 3
1200 optional uint64 controller_tx_time_pl3_ms = 7;
1201 // tx time in ms at power level 4
1202 optional uint64 controller_tx_time_pl4_ms = 8;
1203 // rx time in ms at power level 5
1204 optional uint64 controller_rx_time_ms = 9;
1205 // product of current(mA), voltage(V) and time(ms)
1206 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001207}