blob: f840894db416ae3c8263ef4a968a6e83d4d22136 [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;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -080087 LmkEventOccurred lmk_event_occurred = 51;
Bookatzc1a050a2017-10-10 15:49:28 -070088 // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
Yao Chend54f9dd2017-10-17 17:37:48 +000089 }
David Chenc8a43242017-10-17 16:23:28 -070090
David Chen6e3e6cb2018-01-03 16:14:06 -080091 // Pulled events will start at field 10000.
David Chenc8a43242017-10-17 16:23:28 -070092 oneof pulled {
David Chen6e3e6cb2018-01-03 16:14:06 -080093 WifiBytesTransfer wifi_bytes_transfer = 10000;
94 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
95 MobileBytesTransfer mobile_bytes_transfer = 10002;
96 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003;
97 KernelWakelock kernel_wakelock = 10004;
Chenjie Yuc8b7f222018-01-11 23:25:57 -080098 SubsystemSleepState subsystem_sleep_state = 10005;
99 // 10006 and 10007 are free to use.
David Chen6e3e6cb2018-01-03 16:14:06 -0800100 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;
Rajeev Kumar508a9bf2018-01-18 15:49:11 -0800105 MemoryStat memory_stat = 10013;
David Chenc8a43242017-10-17 16:23:28 -0700106 }
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700107}
108
Yao Chend54f9dd2017-10-17 17:37:48 +0000109/**
Yangster-mac20877162017-12-22 17:19:39 -0800110 * This proto represents a node of an attribution chain.
111 * Note: All attribution chains are represented as a repeated field of type
112 * AttributionNode. It is understood that in such arrays, the order is that
113 * of calls, that is [A, B, C] if A calls B that calls C.
Yao Chend54f9dd2017-10-17 17:37:48 +0000114 */
Yangster-mac20877162017-12-22 17:19:39 -0800115message AttributionNode {
116 // The uid for a given element in the attribution chain.
Yangster-mac7604aea2017-12-11 22:55:49 -0800117 optional int32 uid = 1;
Yangster-mac7604aea2017-12-11 22:55:49 -0800118
Yangster-mac20877162017-12-22 17:19:39 -0800119 // The (optional) string tag for an element in the attribution chain. If the
120 // element has no tag, it is encoded as an empty string.
121 optional string tag = 2;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700122}
123
Yao Chend54f9dd2017-10-17 17:37:48 +0000124/*
125 * *****************************************************************************
yrode4ca102017-11-15 22:57:24 -0800126 * Below are all of the individual atoms that are logged by Android via statsd.
Yao Chend54f9dd2017-10-17 17:37:48 +0000127 *
128 * RULES:
129 * - The field ids for each atom must start at 1, and count upwards by 1.
130 * Skipping field ids is not allowed.
131 * - These form an API, so renaming, renumbering or removing fields is
132 * not allowed between android releases. (This is not currently enforced,
133 * but there will be a tool to enforce this restriction).
134 * - The types must be built-in protocol buffer types, namely, no sub-messages
135 * are allowed (yet). The bytes type is also not allowed.
136 * - The CamelCase name of the message type should match the
Stefan Lafonae2df012017-11-14 09:17:21 -0800137 * underscore_separated name as defined in Atom.
Yao Chend54f9dd2017-10-17 17:37:48 +0000138 * - If an atom represents work that can be attributed to an app, there can
Yangster-mac7604aea2017-12-11 22:55:49 -0800139 * be exactly one AttributionChain field. It must be field number 1.
Yao Chend54f9dd2017-10-17 17:37:48 +0000140 * - A field that is a uid should be a string field, tagged with the [xxx]
141 * annotation. The generated code on android will be represented by UIDs,
142 * and those UIDs will be translated in xxx to those strings.
143 *
144 * CONVENTIONS:
Bookatzc1a050a2017-10-10 15:49:28 -0700145 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
Yao Chend54f9dd2017-10-17 17:37:48 +0000146 * - If there is a UID, it goes first. Think in an object-oriented fashion.
147 * *****************************************************************************
148 */
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700149
Yao Chend54f9dd2017-10-17 17:37:48 +0000150/**
151 * Logs when the screen state changes.
152 *
153 * Logged from:
154 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
155 */
156message ScreenStateChanged {
157 // TODO: Use the real screen state.
158 enum State {
159 STATE_UNKNOWN = 0;
160 STATE_OFF = 1;
161 STATE_ON = 2;
162 STATE_DOZE = 3;
163 STATE_DOZE_SUSPEND = 4;
164 STATE_VR = 5;
Bookatzddccf0a2017-11-28 16:48:14 -0800165 STATE_ON_SUSPEND = 6;
Yao Chend54f9dd2017-10-17 17:37:48 +0000166 }
167 // New screen state.
168 optional State display_state = 1;
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -0700169}
Yao Chend54f9dd2017-10-17 17:37:48 +0000170
171/**
Bookatzc1a050a2017-10-10 15:49:28 -0700172 * Logs that the state of a process state, as per the activity manager, has changed.
Yao Chend54f9dd2017-10-17 17:37:48 +0000173 *
174 * Logged from:
175 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
176 */
Bookatzc1a050a2017-10-10 15:49:28 -0700177message UidProcessStateChanged {
Yao Chend54f9dd2017-10-17 17:37:48 +0000178 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
179
180 // The state.
Bookatzc1a050a2017-10-10 15:49:28 -0700181 // TODO: Use the real (mapped) process states.
Joe Onorato62c220b2017-11-18 20:32:56 -0800182 optional android.app.ProcessState state = 2;
Yao Chend54f9dd2017-10-17 17:37:48 +0000183}
184
185/**
Bookatzc1a050a2017-10-10 15:49:28 -0700186 * Logs that a process started, finished, crashed, or ANRed.
187 *
188 * Logged from:
189 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
190 */
191message ProcessLifeCycleStateChanged {
192 // TODO: Use the real (mapped) process states.
193 optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation
194
195 // TODO: What is this?
196 optional string name = 2;
197
Bookatzddccf0a2017-11-28 16:48:14 -0800198 // What lifecycle state the process changed to.
199 // This enum is specific to atoms.proto.
200 enum Event {
201 PROCESS_FINISHED = 0;
202 PROCESS_STARTED = 1;
203 PROCESS_CRASHED = 2;
204 PROCESS_ANRED = 3;
205 }
206 optional Event event = 3;
Bookatzc1a050a2017-10-10 15:49:28 -0700207}
208
Bookatzc1a050a2017-10-10 15:49:28 -0700209/**
210 * Logs when the ble scan state changes.
211 *
212 * Logged from:
213 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
214 */
215message BleScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800216 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700217
218 enum State {
219 OFF = 0;
220 ON = 1;
221 }
222 optional State state = 2;
223}
224
225/**
226 * Logs when an unoptimized ble scan state changes.
227 *
228 * Logged from:
229 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
230 */
231// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
232message BleUnoptimizedScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800233 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700234
235 enum State {
236 OFF = 0;
237 ON = 1;
238 }
239 optional State state = 2;
240}
241
242/**
243 * Logs reporting of a ble scan finding results.
244 *
245 * Logged from:
246 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
247 */
248// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats).
249message BleScanResultReceived {
Yangster-macafad8c62018-01-05 22:30:49 -0800250 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700251
252 // Number of ble scan results returned.
253 optional int32 num_of_results = 2;
254}
255
256/**
257 * Logs when a sensor state changes.
258 *
259 * Logged from:
260 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
261 */
262message SensorStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800263 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700264
265 // TODO: Is there a way to get the actual name of the sensor?
266 // The id (int) of the sensor.
267 optional int32 sensor_id = 2;
268
269 enum State {
270 OFF = 0;
271 ON = 1;
272 }
273 optional State state = 3;
274}
275
276
277/**
278 * Logs when GPS state changes.
279 *
280 * Logged from:
281 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
282 */
283message GpsScanStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800284 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700285
286 enum State {
287 OFF = 0;
288 ON = 1;
289 }
290 optional State state = 2;
291}
292
293
294/**
295 * Logs when a sync manager sync state changes.
296 *
297 * Logged from:
298 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
299 */
300message SyncStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800301 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700302
303 // Name of the sync (as named in the app)
304 optional string name = 2;
305
306 enum State {
307 OFF = 0;
308 ON = 1;
309 }
310 optional State state = 3;
311}
312
313/**
314 * Logs when a job scheduler job state changes.
315 *
316 * Logged from:
317 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
318 */
319message ScheduledJobStateChanged {
Yangster-macafad8c62018-01-05 22:30:49 -0800320 repeated AttributionNode attribution_node = 1;
Bookatzc1a050a2017-10-10 15:49:28 -0700321
322 // Name of the job (as named in the app)
323 optional string name = 2;
324
325 enum State {
326 OFF = 0;
327 ON = 1;
328 }
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 Yuc8b7f222018-01-11 23:25:57 -08001031 * Pulls low power state information. This includes platform and subsystem sleep state information,
1032 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001033 * hardware/interfaces/power/1.0/types.hal
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001034 * hardware/interfaces/power/1.1/types.hal
1035 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001036message SubsystemSleepState {
Chenjie Yuc8b7f222018-01-11 23:25:57 -08001037 // Name should be in the format of XXX.YYY where XXX is subsystem name,
1038 // YYY is corresponding voter name.
1039 // If there are no voters, the format should just be XXX (with no dot).
1040 // XXX and YYY should not contain a "." in it.
1041 optional string name = 1;
1042 // The number of times it entered, or voted for entering the sleep state
1043 optional uint64 count = 2;
1044 // The length of time spent in, or spent voting for, the sleep state
1045 optional uint64 timeMs = 3;
Chenjie Yu5305e1d2017-10-31 13:49:36 -07001046}
David Chen21582962017-11-01 17:32:46 -07001047
1048/**
1049 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
1050 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
1051 * attributed back to the parent (host) uid. One example is Chrome.
1052 *
1053 * Logged from:
1054 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1055 */
1056message IsolatedUidChanged {
1057 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
1058 optional int32 parent_uid = 1;
1059
1060 optional int32 isolated_uid = 2;
1061
1062 // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to
1063 // be removed before if it's used for another parent uid.
1064 optional int32 is_create = 3;
1065}
Chenjie Yu7f8def92017-11-03 09:33:15 -07001066
Chenjie Yu05013b32017-11-21 10:21:41 -08001067/**
Chenjie Yu7f8def92017-11-03 09:33:15 -07001068 * Pulls Cpu time per frequency.
Chenjie Yu1ee9b742018-01-10 16:02:57 -08001069 * Pulls the time the cpu spend on the frequency index. Frequency index
1070 * starts from highest to lowest. The value should be monotonically
1071 * increasing since boot. However, if there is a cpu
1072 * hotplug event, the value would be reset as well.
Chenjie Yu7f8def92017-11-03 09:33:15 -07001073 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001074message CpuTimePerFreq {
Chenjie Yu7f8def92017-11-03 09:33:15 -07001075 optional uint32 cluster = 1;
1076 optional uint32 freq_index = 2;
Chenjie Yu31d14d72017-12-12 17:54:33 -08001077 optional uint64 time_ms = 3;
Chenjie Yu7f8def92017-11-03 09:33:15 -07001078}
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001079
Chenjie Yu05013b32017-11-21 10:21:41 -08001080/**
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001081 * Pulls Cpu Time Per Uid.
1082 * Note that isolated process uid time should be attributed to host uids.
1083 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001084message CpuTimePerUid {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001085 optional uint64 uid = 1;
1086 optional uint64 user_time_ms = 2;
1087 optional uint64 sys_time_ms = 3;
1088}
1089
1090/**
1091 * Pulls Cpu Time Per Uid per frequency.
1092 * Note that isolated process uid time should be attributed to host uids.
1093 * For each uid, we order the time by descending frequencies.
1094 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001095message CpuTimePerUidFreq {
Chenjie Yue33bc3b2017-11-06 17:56:44 -08001096 optional uint64 uid = 1;
1097 optional uint64 freq_idx = 2;
1098 optional uint64 time_ms = 3;
1099}
Hugo Benichi884970e2017-11-14 22:42:46 +09001100
1101/*
1102 * Logs the reception of an incoming network packet causing the main system to wake up for
1103 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
1104 * and processed by WakeupController.cpp.
1105 */
1106message PacketWakeupOccurred {
1107 // The uid owning the socket into which the packet was delivered, or -1 if the packet was
1108 // delivered nowhere.
1109 optional int32 uid = 1;
1110 // The interface name on which the packet was received.
1111 optional string iface = 2;
1112 // The ethertype value of the packet.
1113 optional int32 ethertype = 3;
1114 // String representation of the destination MAC address of the packet.
1115 optional string destination_hardware_address = 4;
1116 // String representation of the source address of the packet if this was an IP packet.
1117 optional string source_ip = 5;
1118 // String representation of the destination address of the packet if this was an IP packet.
1119 optional string destination_ip = 6;
1120 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
1121 // field if this was an IPv6 packet. The range of possible values is the same for both IP
1122 // families.
1123 optional int32 ip_next_header = 7;
1124 // The source port if this was a TCP or UDP packet.
1125 optional int32 source_port = 8;
1126 // The destination port if this was a TCP or UDP packet.
1127 optional int32 destination_port = 9;
1128}
Chenjie Yu05013b32017-11-21 10:21:41 -08001129
1130/**
1131 * Pulls Wifi Controller Activity Energy Info
1132 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001133message WifiActivityEnergyInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001134 // timestamp(wall clock) of record creation
1135 optional uint64 timestamp_ms = 1;
1136 // stack reported state
1137 // TODO: replace this with proto enum
1138 optional int32 stack_state = 2;
1139 // tx time in ms
1140 optional uint64 controller_tx_time_ms = 3;
1141 // rx time in ms
1142 optional uint64 controller_rx_time_ms = 4;
1143 // idle time in ms
1144 optional uint64 controller_idle_time_ms = 5;
1145 // product of current(mA), voltage(V) and time(ms)
1146 optional uint64 controller_energy_used = 6;
1147}
1148
1149/**
1150 * Pulls Modem Activity Energy Info
1151 */
Chenjie Yu31d14d72017-12-12 17:54:33 -08001152message ModemActivityInfo {
Chenjie Yu05013b32017-11-21 10:21:41 -08001153 // timestamp(wall clock) of record creation
1154 optional uint64 timestamp_ms = 1;
1155 // sleep time in ms.
1156 optional uint64 sleep_time_ms = 2;
1157 // idle time in ms
1158 optional uint64 controller_idle_time_ms = 3;
1159 /**
1160 * Tx power index
1161 * index 0 = tx_power < 0dBm
1162 * index 1 = 0dBm < tx_power < 5dBm
1163 * index 2 = 5dBm < tx_power < 15dBm
1164 * index 3 = 15dBm < tx_power < 20dBm
1165 * index 4 = tx_power > 20dBm
1166 */
1167 // tx time in ms at power level 0
1168 optional uint64 controller_tx_time_pl0_ms = 4;
1169 // tx time in ms at power level 1
1170 optional uint64 controller_tx_time_pl1_ms = 5;
1171 // tx time in ms at power level 2
1172 optional uint64 controller_tx_time_pl2_ms = 6;
1173 // tx time in ms at power level 3
1174 optional uint64 controller_tx_time_pl3_ms = 7;
1175 // tx time in ms at power level 4
1176 optional uint64 controller_tx_time_pl4_ms = 8;
1177 // rx time in ms at power level 5
1178 optional uint64 controller_rx_time_ms = 9;
1179 // product of current(mA), voltage(V) and time(ms)
1180 optional uint64 energy_used = 10;
Joe Onorato62c220b2017-11-18 20:32:56 -08001181}
Rajeev Kumar508a9bf2018-01-18 15:49:11 -08001182
1183/*
1184 * Logs the memory stats for a process
1185 */
1186message MemoryStat {
1187 // The uid if available. -1 means not available.
1188 optional int32 uid = 1;
1189
1190 // The app package name.
1191 optional string pkg_name = 2;
1192
1193 // # of page-faults
1194 optional int64 pgfault = 3;
1195
1196 // # of major page-faults
1197 optional int64 pgmajfault = 4;
1198
1199 // RSS+CACHE(+SWAP)
1200 optional int64 usage_in_bytes = 5;
1201}
1202
1203/*
1204 * Logs the event when LMKD kills a process to reduce memory pressure
1205 * Logged from:
1206 * system/core/lmkd/lmkd.c
1207 */
1208message LmkEventOccurred {
1209 // The uid if available. -1 means not available.
1210 optional int32 uid = 1;
1211
1212 // The app package name.
1213 optional string pkg_name = 2;
1214
1215 // oom adj score.
1216 optional int32 oom_score = 3;
1217
1218 // Used as start/stop boundaries for the event
1219 enum State {
1220 UNKNOWN = 0;
1221 START = 1;
1222 END = 2;
1223 }
1224 optional State state = 4;
1225}