Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | syntax = "proto2"; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 18 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 19 | // TODO: Not the right package and class name |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 20 | package android.os.statsd; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 21 | option java_package = "com.android.os"; |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 22 | option java_outer_classname = "AtomsProto"; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 23 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 24 | /** |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 25 | * The master atom class. This message defines all of the available |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 26 | * raw stats log events from the Android system, also known as "atoms." |
| 27 | * |
| 28 | * This field contains a single oneof with all of the available messages. |
| 29 | * The stats-log-api-gen tool runs as part of the Android build and |
| 30 | * generates the android.util.StatsLog class, which contains the constants |
| 31 | * and methods that Android uses to log. |
| 32 | * |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 33 | * This Atom class is not actually built into the Android system. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 34 | * Instead, statsd on Android constructs these messages synthetically, |
| 35 | * in the format defined here and in stats_log.proto. |
| 36 | */ |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 37 | message Atom { |
| 38 | // Pushed atoms start at 2. |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 39 | oneof pushed { |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 40 | // For StatsLog reasons, 1 is illegal and will not work. Must start at 2. |
| 41 | BleScanStateChanged ble_scan_state_changed = 2; |
| 42 | BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3; |
| 43 | BleScanResultReceived ble_scan_result_received = 4; |
| 44 | SensorStateChanged sensor_state_changed = 5; |
| 45 | GpsScanStateChanged gps_scan_state_changed = 6; // TODO: untested |
| 46 | SyncStateChanged sync_state_changed = 7; |
| 47 | ScheduledJobStateChanged scheduled_job_state_changed = 8; |
| 48 | ScreenBrightnessChanged screen_brightness_changed = 9; |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 49 | WakelockStateChanged wakelock_state_changed = 10; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 50 | LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11; |
| 51 | MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12; |
| 52 | WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13; |
| 53 | // TODO: 14-19 are blank, but need not be |
| 54 | BatterySaverModeStateChanged battery_saver_mode_state_changed = 20; |
| 55 | DeviceIdleModeStateChanged device_idle_mode_state_changed = 21; |
| 56 | DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 57 | AudioStateChanged audio_state_changed = 23; |
| 58 | MediaCodecActivityChanged media_codec_activity_changed = 24; |
| 59 | CameraStateChanged camera_state_changed = 25; |
| 60 | FlashlightStateChanged flashlight_state_changed = 26; |
| 61 | UidProcessStateChanged uid_process_state_changed = 27; |
| 62 | ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28; |
| 63 | ScreenStateChanged screen_state_changed = 29; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 64 | BatteryLevelChanged battery_level_changed = 30; |
| 65 | ChargingStateChanged charging_state_changed = 31; |
| 66 | PluggedStateChanged plugged_state_changed = 32; |
| 67 | DeviceTemperatureReported device_temperature_reported = 33; |
| 68 | DeviceOnStatusChanged device_on_status_changed = 34; |
| 69 | WakeupAlarmOccurred wakeup_alarm_occurred = 35; |
| 70 | KernelWakeupReported kernel_wakeup_reported = 36; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 71 | WifiLockStateChanged wifi_lock_state_changed = 37; |
| 72 | WifiSignalStrengthChanged wifi_signal_strength_changed = 38; |
| 73 | WifiScanStateChanged wifi_scan_state_changed = 39; |
| 74 | PhoneSignalStrengthChanged phone_signal_strength_changed = 40; |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 75 | SettingChanged setting_changed = 41; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 76 | ActivityForegroundStateChanged activity_foreground_state_changed = 42; |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 77 | IsolatedUidChanged isolated_uid_changed = 43; |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 78 | PacketWakeupOccurred packet_wakeup_occurred = 44; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 79 | DropboxErrorChanged dropbox_error_changed = 45; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 80 | // TODO: Reorder the numbering so that the most frequent occur events occur in the first 15. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 81 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 82 | |
| 83 | // Pulled events will start at field 1000. |
| 84 | oneof pulled { |
| 85 | WifiBytesTransferred wifi_bytes_transferred = 1000; |
| 86 | WifiBytesTransferredByFgBg wifi_bytes_transferred_by_fg_bg = 1001; |
| 87 | MobileBytesTransferred mobile_bytes_transferred = 1002; |
| 88 | MobileBytesTransferredByFgBg mobile_bytes_transferred_by_fg_bg = 1003; |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 89 | KernelWakelockPulled kernel_wakelock_pulled = 1004; |
| 90 | PowerStatePlatformSleepStatePulled power_state_platform_sleep_state_pulled = 1005; |
| 91 | PowerStateVoterPulled power_state_voter_pulled = 1006; |
| 92 | PowerStateSubsystemSleepStatePulled power_state_subsystem_sleep_state_pulled = 1007; |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 93 | CpuTimePerFreqPulled cpu_time_per_freq_pulled = 1008; |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 94 | CpuTimePerUidPulled cpu_time_per_uid_pulled = 1009; |
| 95 | CpuTimePerUidFreqPulled cpu_time_per_uid_freq_pulled = 1010; |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 96 | WifiActivityEnergyInfoPulled wifi_activity_energy_info_pulled = 1011; |
| 97 | ModemActivityInfoPulled modem_activity_info_pulled = 1012; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 98 | } |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 101 | /** |
| 102 | * A WorkSource represents the chained attribution of applications that |
| 103 | * resulted in a particular bit of work being done. |
| 104 | */ |
| 105 | message WorkSource { |
| 106 | // TODO |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 109 | /* |
| 110 | * ***************************************************************************** |
yro | de4ca10 | 2017-11-15 22:57:24 -0800 | [diff] [blame] | 111 | * Below are all of the individual atoms that are logged by Android via statsd. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 112 | * |
| 113 | * RULES: |
| 114 | * - The field ids for each atom must start at 1, and count upwards by 1. |
| 115 | * Skipping field ids is not allowed. |
| 116 | * - These form an API, so renaming, renumbering or removing fields is |
| 117 | * not allowed between android releases. (This is not currently enforced, |
| 118 | * but there will be a tool to enforce this restriction). |
| 119 | * - The types must be built-in protocol buffer types, namely, no sub-messages |
| 120 | * are allowed (yet). The bytes type is also not allowed. |
| 121 | * - The CamelCase name of the message type should match the |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 122 | * underscore_separated name as defined in Atom. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 123 | * - If an atom represents work that can be attributed to an app, there can |
| 124 | * be exactly one WorkSource field. It must be field number 1. |
| 125 | * - A field that is a uid should be a string field, tagged with the [xxx] |
| 126 | * annotation. The generated code on android will be represented by UIDs, |
| 127 | * and those UIDs will be translated in xxx to those strings. |
| 128 | * |
| 129 | * CONVENTIONS: |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 130 | * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 131 | * - If there is a UID, it goes first. Think in an object-oriented fashion. |
| 132 | * ***************************************************************************** |
| 133 | */ |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 134 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 135 | /** |
| 136 | * Logs when the screen state changes. |
| 137 | * |
| 138 | * Logged from: |
| 139 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 140 | */ |
| 141 | message ScreenStateChanged { |
| 142 | // TODO: Use the real screen state. |
| 143 | enum State { |
| 144 | STATE_UNKNOWN = 0; |
| 145 | STATE_OFF = 1; |
| 146 | STATE_ON = 2; |
| 147 | STATE_DOZE = 3; |
| 148 | STATE_DOZE_SUSPEND = 4; |
| 149 | STATE_VR = 5; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 150 | STATE_ON_SUSPEND = 6; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 151 | } |
| 152 | // New screen state. |
| 153 | optional State display_state = 1; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 154 | } |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 155 | |
| 156 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 157 | * Logs that the state of a process state, as per the activity manager, has changed. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 158 | * |
| 159 | * Logged from: |
| 160 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 161 | */ |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 162 | message UidProcessStateChanged { |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 163 | optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation |
| 164 | |
| 165 | // The state. |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 166 | // TODO: Use the real (mapped) process states. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 167 | optional int32 state = 2; |
| 168 | } |
| 169 | |
| 170 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 171 | * Logs that a process started, finished, crashed, or ANRed. |
| 172 | * |
| 173 | * Logged from: |
| 174 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 175 | */ |
| 176 | message ProcessLifeCycleStateChanged { |
| 177 | // TODO: Use the real (mapped) process states. |
| 178 | optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation |
| 179 | |
| 180 | // TODO: What is this? |
| 181 | optional string name = 2; |
| 182 | |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 183 | // What lifecycle state the process changed to. |
| 184 | // This enum is specific to atoms.proto. |
| 185 | enum Event { |
| 186 | PROCESS_FINISHED = 0; |
| 187 | PROCESS_STARTED = 1; |
| 188 | PROCESS_CRASHED = 2; |
| 189 | PROCESS_ANRED = 3; |
| 190 | } |
| 191 | optional Event event = 3; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 192 | } |
| 193 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 194 | /** |
| 195 | * Logs when the ble scan state changes. |
| 196 | * |
| 197 | * Logged from: |
| 198 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 199 | */ |
| 200 | message BleScanStateChanged { |
| 201 | // TODO: Add attribution instead of uid. |
| 202 | optional int32 uid = 1; |
| 203 | |
| 204 | enum State { |
| 205 | OFF = 0; |
| 206 | ON = 1; |
| 207 | } |
| 208 | optional State state = 2; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Logs when an unoptimized ble scan state changes. |
| 213 | * |
| 214 | * Logged from: |
| 215 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 216 | */ |
| 217 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 218 | message BleUnoptimizedScanStateChanged { |
| 219 | // TODO: Add attribution instead of uid. |
| 220 | optional int32 uid = 1; |
| 221 | |
| 222 | enum State { |
| 223 | OFF = 0; |
| 224 | ON = 1; |
| 225 | } |
| 226 | optional State state = 2; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Logs reporting of a ble scan finding results. |
| 231 | * |
| 232 | * Logged from: |
| 233 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 234 | */ |
| 235 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 236 | message BleScanResultReceived { |
| 237 | // TODO: Add attribution instead of uid. |
| 238 | optional int32 uid = 1; |
| 239 | |
| 240 | // Number of ble scan results returned. |
| 241 | optional int32 num_of_results = 2; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Logs when a sensor state changes. |
| 246 | * |
| 247 | * Logged from: |
| 248 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 249 | */ |
| 250 | message SensorStateChanged { |
| 251 | // TODO: Add attribution instead of uid. |
| 252 | optional int32 uid = 1; |
| 253 | |
| 254 | // TODO: Is there a way to get the actual name of the sensor? |
| 255 | // The id (int) of the sensor. |
| 256 | optional int32 sensor_id = 2; |
| 257 | |
| 258 | enum State { |
| 259 | OFF = 0; |
| 260 | ON = 1; |
| 261 | } |
| 262 | optional State state = 3; |
| 263 | } |
| 264 | |
| 265 | |
| 266 | /** |
| 267 | * Logs when GPS state changes. |
| 268 | * |
| 269 | * Logged from: |
| 270 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 271 | */ |
| 272 | message GpsScanStateChanged { |
| 273 | // TODO: Add attribution instead of uid. |
| 274 | optional int32 uid = 1; |
| 275 | |
| 276 | enum State { |
| 277 | OFF = 0; |
| 278 | ON = 1; |
| 279 | } |
| 280 | optional State state = 2; |
| 281 | } |
| 282 | |
| 283 | |
| 284 | /** |
| 285 | * Logs when a sync manager sync state changes. |
| 286 | * |
| 287 | * Logged from: |
| 288 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 289 | */ |
| 290 | message SyncStateChanged { |
| 291 | // TODO: Add attribution instead of uid. |
| 292 | optional int32 uid = 1; |
| 293 | |
| 294 | // Name of the sync (as named in the app) |
| 295 | optional string name = 2; |
| 296 | |
| 297 | enum State { |
| 298 | OFF = 0; |
| 299 | ON = 1; |
| 300 | } |
| 301 | optional State state = 3; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Logs when a job scheduler job state changes. |
| 306 | * |
| 307 | * Logged from: |
| 308 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 309 | */ |
| 310 | message ScheduledJobStateChanged { |
| 311 | // TODO: Add attribution instead of uid. |
| 312 | optional int32 uid = 1; |
| 313 | |
| 314 | // Name of the job (as named in the app) |
| 315 | optional string name = 2; |
| 316 | |
| 317 | enum State { |
| 318 | OFF = 0; |
| 319 | ON = 1; |
| 320 | } |
| 321 | optional State state = 3; |
| 322 | |
| 323 | // TODO: Consider adding the stopReason (int) |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Logs when the audio state changes. |
| 328 | * |
| 329 | * Logged from: |
| 330 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 331 | */ |
| 332 | message AudioStateChanged { |
| 333 | // TODO: Add attribution instead of uid. |
| 334 | optional int32 uid = 1; |
| 335 | |
| 336 | enum State { |
| 337 | OFF = 0; |
| 338 | ON = 1; |
| 339 | } |
| 340 | optional State state = 2; |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * Logs when the video codec state changes. |
| 345 | * |
| 346 | * Logged from: |
| 347 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 348 | */ |
| 349 | message MediaCodecActivityChanged { |
| 350 | // TODO: Add attribution instead of uid. |
| 351 | optional int32 uid = 1; |
| 352 | |
| 353 | enum State { |
| 354 | OFF = 0; |
| 355 | ON = 1; |
| 356 | } |
| 357 | optional State state = 2; |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Logs when the flashlight state changes. |
| 362 | * |
| 363 | * Logged from: |
| 364 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 365 | */ |
| 366 | message FlashlightStateChanged { |
| 367 | // TODO: Add attribution instead of uid. |
| 368 | optional int32 uid = 1; |
| 369 | |
| 370 | enum State { |
| 371 | OFF = 0; |
| 372 | ON = 1; |
| 373 | } |
| 374 | optional State state = 2; |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Logs when the camera state changes. |
| 379 | * |
| 380 | * Logged from: |
| 381 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 382 | */ |
| 383 | message CameraStateChanged { |
| 384 | // TODO: Add attribution instead of uid. |
| 385 | optional int32 uid = 1; |
| 386 | |
| 387 | enum State { |
| 388 | OFF = 0; |
| 389 | ON = 1; |
| 390 | } |
| 391 | optional State state = 2; |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Logs that the state of a wakelock (per app and per wakelock name) has changed. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 396 | * |
| 397 | * Logged from: |
| 398 | * TODO |
| 399 | */ |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 400 | message WakelockStateChanged { |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 401 | // TODO: Add attribution instead of uid. |
| 402 | optional int32 uid = 1; |
| 403 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 404 | // Type of wakelock. |
| 405 | enum Type { |
| 406 | PARTIAL = 0; |
| 407 | FULL = 1; |
| 408 | WINDOW = 2; |
| 409 | } |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 410 | optional Type type = 2; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 411 | |
| 412 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 413 | optional string tag = 3; |
| 414 | |
| 415 | enum State { |
| 416 | OFF = 0; |
| 417 | ON = 1; |
| 418 | } |
| 419 | optional State state = 4; |
| 420 | } |
| 421 | |
| 422 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 423 | * Logs when a partial wakelock is considered 'long' (over 1 min). |
| 424 | * |
| 425 | * Logged from: |
| 426 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 427 | */ |
| 428 | message LongPartialWakelockStateChanged { |
| 429 | // TODO: Add attribution instead of uid? |
| 430 | optional int32 uid = 1; |
| 431 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 432 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 433 | optional string tag = 2; |
| 434 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 435 | // TODO: I have no idea what this is. |
| 436 | optional string history_tag = 3; |
| 437 | |
| 438 | enum State { |
| 439 | OFF = 0; |
| 440 | ON = 1; |
| 441 | } |
| 442 | optional State state = 4; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 443 | } |
| 444 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 445 | /** |
| 446 | * Logs Battery Saver state change. |
| 447 | * |
| 448 | * Logged from: |
| 449 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 450 | */ |
| 451 | message BatterySaverModeStateChanged { |
| 452 | enum State { |
| 453 | OFF = 0; |
| 454 | ON = 1; |
| 455 | } |
| 456 | optional State state = 1; |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Logs Doze mode state change. |
| 461 | * |
| 462 | * Logged from: |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 463 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 464 | */ |
| 465 | message DeviceIdleModeStateChanged { |
| 466 | // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_. |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 467 | enum State { |
| 468 | DEVICE_IDLE_MODE_OFF = 0; |
| 469 | DEVICE_IDLE_MODE_LIGHT = 1; |
| 470 | DEVICE_IDLE_MODE_DEEP = 2; |
| 471 | } |
| 472 | optional State state = 1; |
| 473 | } |
| 474 | |
| 475 | |
| 476 | /** |
| 477 | * Logs state change of Doze mode including maintenance windows. |
| 478 | * |
| 479 | * Logged from: |
| 480 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 481 | */ |
| 482 | message DeviceIdlingModeStateChanged { |
| 483 | // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_. |
| 484 | enum State { |
| 485 | DEVICE_IDLE_MODE_OFF = 0; |
| 486 | DEVICE_IDLE_MODE_LIGHT = 1; |
| 487 | DEVICE_IDLE_MODE_DEEP = 2; |
| 488 | } |
| 489 | optional State state = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Logs screen brightness level. |
| 494 | * |
| 495 | * Logged from: |
| 496 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 497 | */ |
| 498 | message ScreenBrightnessChanged { |
| 499 | // Screen brightness level. Should be in [-1, 255] according to PowerManager.java. |
| 500 | optional int32 level = 1; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | /** |
| 504 | * Logs battery level (percent full, from 0 to 100). |
| 505 | * |
| 506 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 507 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 508 | */ |
| 509 | message BatteryLevelChanged { |
| 510 | // Battery level. Should be in [0, 100]. |
| 511 | optional int32 battery_level = 1; |
| 512 | } |
| 513 | |
| 514 | /** |
| 515 | * Logs change in charging status of the device. |
| 516 | * |
| 517 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 518 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 519 | */ |
| 520 | message ChargingStateChanged { |
| 521 | // TODO: Link directly to BatteryManager.java's constants (via a proto). |
| 522 | enum State { |
| 523 | BATTERY_STATUS_UNKNOWN = 1; |
| 524 | BATTERY_STATUS_CHARGING = 2; |
| 525 | BATTERY_STATUS_DISCHARGING = 3; |
| 526 | BATTERY_STATUS_NOT_CHARGING = 4; |
| 527 | BATTERY_STATUS_FULL = 5; |
| 528 | } |
| 529 | optional State charging_state = 1; |
| 530 | } |
| 531 | |
| 532 | /** |
| 533 | * Logs whether the device is plugged in, and what power source it is using. |
| 534 | * |
| 535 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 536 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 537 | */ |
| 538 | message PluggedStateChanged { |
| 539 | // TODO: Link directly to BatteryManager.java's constants (via a proto). |
| 540 | enum State { |
| 541 | // Note that NONE is not in BatteryManager.java's constants. |
| 542 | BATTERY_PLUGGED_NONE = 0; |
| 543 | // Power source is an AC charger. |
| 544 | BATTERY_PLUGGED_AC = 1; |
| 545 | // Power source is a USB port. |
| 546 | BATTERY_PLUGGED_USB = 2; |
| 547 | // Power source is wireless. |
| 548 | BATTERY_PLUGGED_WIRELESS = 4; |
| 549 | } |
| 550 | optional State plugged_state = 1; |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * Logs the temperature of the device, in tenths of a degree Celsius. |
| 555 | * |
| 556 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 557 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 558 | */ |
| 559 | message DeviceTemperatureReported { |
| 560 | // Temperature in tenths of a degree C. |
| 561 | optional int32 temperature = 1; |
| 562 | } |
| 563 | |
| 564 | // TODO: Define this more precisely. |
| 565 | // TODO: Log the ON state somewhere. It isn't currently logged anywhere. |
| 566 | /** |
| 567 | * Logs when the device turns off or on. |
| 568 | * |
| 569 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 570 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 571 | */ |
| 572 | message DeviceOnStatusChanged { |
| 573 | enum State { |
| 574 | OFF = 0; |
| 575 | ON = 1; |
| 576 | } |
| 577 | optional State state = 1; |
| 578 | } |
| 579 | |
| 580 | /** |
| 581 | * Logs when an app's wakeup alarm fires. |
| 582 | * |
| 583 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 584 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 585 | */ |
| 586 | message WakeupAlarmOccurred { |
| 587 | // TODO: Add attribution instead of uid? |
| 588 | optional int32 uid = 1; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame^] | 589 | |
| 590 | // Name of the wakeup alarm. |
| 591 | optional string tag = 2; |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * Logs when an an app causes the mobile radio to change state. |
| 596 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio. |
| 597 | * |
| 598 | * Logged from: |
| 599 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 600 | */ |
| 601 | message MobileRadioPowerStateChanged { |
| 602 | // TODO: Add attribution instead of uid? |
| 603 | optional int32 uid = 1; |
| 604 | |
| 605 | // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states. |
| 606 | enum PowerState { |
| 607 | DC_POWER_STATE_LOW = 1; |
| 608 | DC_POWER_STATE_MEDIUM = 2; |
| 609 | DC_POWER_STATE_HIGH = 3; |
| 610 | } |
| 611 | optional PowerState power_state = 2; |
| 612 | } |
| 613 | |
| 614 | /** |
| 615 | * Logs when an an app causes the wifi radio to change state. |
| 616 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio. |
| 617 | * |
| 618 | * Logged from: |
| 619 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 620 | */ |
| 621 | message WifiRadioPowerStateChanged { |
| 622 | // TODO: Add attribution instead of uid? |
| 623 | optional int32 uid = 1; |
| 624 | |
| 625 | // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states. |
| 626 | enum PowerState { |
| 627 | DC_POWER_STATE_LOW = 1; |
| 628 | DC_POWER_STATE_MEDIUM = 2; |
| 629 | DC_POWER_STATE_HIGH = 3; |
| 630 | } |
| 631 | optional PowerState power_state = 2; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | /** |
| 635 | * Logs kernel wakeup reasons and aborts. |
| 636 | * |
| 637 | * Logged from: |
| 638 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 639 | */ |
| 640 | message KernelWakeupReported { |
| 641 | // Name of the kernel wakeup reason (or abort). |
| 642 | optional string wakeup_reason_name = 1; |
| 643 | |
| 644 | // Duration (in microseconds) for the wake-up interrupt to be serviced. |
| 645 | optional int64 duration_usec = 2; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | /** |
| 649 | * Logs wifi locks held by an app. |
| 650 | * |
| 651 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 652 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 653 | */ |
| 654 | message WifiLockStateChanged { |
| 655 | // TODO: Add attribution instead of uid. |
| 656 | optional int32 uid = 1; |
| 657 | |
| 658 | enum State { |
| 659 | OFF = 0; |
| 660 | ON = 1; |
| 661 | } |
| 662 | optional State state = 2; |
| 663 | } |
| 664 | |
| 665 | /** |
| 666 | * Logs wifi signal strength changes. |
| 667 | * |
| 668 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 669 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 670 | */ |
| 671 | message WifiSignalStrengthChanged { |
| 672 | // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states. |
| 673 | enum SignalStrength { |
| 674 | SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; |
| 675 | SIGNAL_STRENGTH_POOR = 1; |
| 676 | SIGNAL_STRENGTH_MODERATE = 2; |
| 677 | SIGNAL_STRENGTH_GOOD = 3; |
| 678 | SIGNAL_STRENGTH_GREAT = 4; |
| 679 | } |
| 680 | optional SignalStrength signal_strength = 1; |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * Logs wifi scans performed by an app. |
| 685 | * |
| 686 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 687 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 688 | */ |
| 689 | message WifiScanStateChanged { |
| 690 | // TODO: Add attribution instead of uid. |
| 691 | optional int32 uid = 1; |
| 692 | |
| 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 Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 704 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 705 | */ |
| 706 | message 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 Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 716 | } |
| 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 | */ |
| 725 | message 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 Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 750 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 751 | /** |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 752 | * Logs activity going to foreground or background |
| 753 | * |
| 754 | * Logged from: |
| 755 | * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java |
| 756 | */ |
| 757 | message ActivityForegroundStateChanged { |
| 758 | enum Activity { |
| 759 | MOVE_TO_BACKGROUND = 0; |
| 760 | MOVE_TO_FOREGROUND = 1; |
| 761 | } |
| 762 | optional int32 uid = 1; |
| 763 | optional string pkg_name = 2; |
| 764 | optional string class_name = 3; |
| 765 | optional Activity activity = 4; |
| 766 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 767 | |
| 768 | /** |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 769 | * Logs when an error is written to dropbox. |
| 770 | * Logged from: |
| 771 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
| 772 | */ |
| 773 | message DropboxErrorChanged { |
| 774 | // The uid if available. -1 means not available. |
| 775 | optional int32 uid = 1; |
| 776 | |
| 777 | // Tag used when recording this error to dropbox. Contains data_ or system_ prefix. |
| 778 | optional string tag = 2; |
| 779 | |
| 780 | // The name of the process. |
| 781 | optional string process_name = 3; |
| 782 | |
| 783 | // The pid if available. -1 means not available. |
| 784 | optional int32 pid = 4; |
| 785 | |
| 786 | // 1 indicates is instant app. -1 indicates Not applicable. |
| 787 | optional int32 is_instant_app = 5; |
| 788 | |
| 789 | // The activity name if available. |
| 790 | optional string activity_name = 6; |
| 791 | |
| 792 | // 1 indicates in foreground. -1 indicates not available. |
| 793 | optional int32 is_foreground = 7; |
| 794 | } |
| 795 | |
| 796 | /** |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 797 | * Pulls bytes transferred via wifi (Sum of foreground and background usage). |
| 798 | * |
| 799 | * Pulled from: |
| 800 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 801 | */ |
| 802 | message WifiBytesTransferred { |
| 803 | optional int32 uid = 1; |
| 804 | |
| 805 | optional int64 rx_bytes = 2; |
| 806 | |
| 807 | optional int64 rx_packets = 3; |
| 808 | |
| 809 | optional int64 tx_bytes = 4; |
| 810 | |
| 811 | optional int64 tx_packets = 5; |
| 812 | } |
| 813 | |
| 814 | /** |
| 815 | * Pulls bytes transferred via wifi (separated by foreground and background usage). |
| 816 | * |
| 817 | * Pulled from: |
| 818 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 819 | */ |
| 820 | message WifiBytesTransferredByFgBg { |
| 821 | optional int32 uid = 1; |
| 822 | |
| 823 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 824 | optional int32 is_foreground = 2; |
| 825 | |
| 826 | optional int64 rx_bytes = 3; |
| 827 | |
| 828 | optional int64 rx_packets = 4; |
| 829 | |
| 830 | optional int64 tx_bytes = 5; |
| 831 | |
| 832 | optional int64 tx_packets = 6; |
| 833 | } |
| 834 | |
| 835 | /** |
| 836 | * Pulls bytes transferred via mobile networks (Sum of foreground and background usage). |
| 837 | * |
| 838 | * Pulled from: |
| 839 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 840 | */ |
| 841 | message MobileBytesTransferred { |
| 842 | optional int32 uid = 1; |
| 843 | |
| 844 | optional int64 rx_bytes = 2; |
| 845 | |
| 846 | optional int64 rx_packets = 3; |
| 847 | |
| 848 | optional int64 tx_bytes = 4; |
| 849 | |
| 850 | optional int64 tx_packets = 5; |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * Pulls bytes transferred via mobile networks (separated by foreground and background usage). |
| 855 | * |
| 856 | * Pulled from: |
| 857 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 858 | */ |
| 859 | message MobileBytesTransferredByFgBg { |
| 860 | optional int32 uid = 1; |
| 861 | |
| 862 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 863 | optional int32 is_foreground = 2; |
| 864 | |
| 865 | optional int64 rx_bytes = 3; |
| 866 | |
| 867 | optional int64 rx_packets = 4; |
| 868 | |
| 869 | optional int64 tx_bytes = 5; |
| 870 | |
| 871 | optional int64 tx_packets = 6; |
| 872 | } |
| 873 | |
| 874 | /** |
| 875 | * Pulls the kernel wakelock durations. This atom is adapted from |
| 876 | * android/internal/os/KernelWakelockStats.java |
| 877 | * |
| 878 | * Pulled from: |
| 879 | * StatsCompanionService using KernelWakelockReader. |
| 880 | */ |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 881 | message KernelWakelockPulled { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 882 | optional string name = 1; |
| 883 | |
| 884 | optional int32 count = 2; |
| 885 | |
| 886 | optional int32 version = 3; |
| 887 | |
| 888 | optional int64 time = 4; |
| 889 | } |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 890 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 891 | /** |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 892 | * Pulls PowerStatePlatformSleepState. |
| 893 | * |
| 894 | * Definition here: |
| 895 | * hardware/interfaces/power/1.0/types.hal |
| 896 | */ |
| 897 | message PowerStatePlatformSleepStatePulled { |
| 898 | optional string name = 1; |
| 899 | optional uint64 residency_in_msec_since_boot = 2; |
| 900 | optional uint64 total_transitions = 3; |
| 901 | optional bool supported_only_in_suspend = 4; |
| 902 | } |
| 903 | |
| 904 | /** |
| 905 | * Pulls PowerStateVoter. |
| 906 | * |
| 907 | * Definition here: |
| 908 | * hardware/interfaces/power/1.0/types.hal |
| 909 | */ |
| 910 | message PowerStateVoterPulled { |
| 911 | optional string power_state_platform_sleep_state_name = 1; |
| 912 | optional string power_state_voter_name = 2; |
| 913 | optional uint64 total_time_in_msec_voted_for_since_boot = 3; |
| 914 | optional uint64 total_number_of_times_voted_since_boot = 4; |
| 915 | } |
| 916 | |
| 917 | /** |
| 918 | * Pulls PowerStateSubsystemSleepState. |
| 919 | * |
| 920 | * Definition here: |
| 921 | * hardware/interfaces/power/1.1/types.hal |
| 922 | */ |
| 923 | message PowerStateSubsystemSleepStatePulled { |
| 924 | optional string power_state_subsystem_name = 1; |
| 925 | optional string power_state_subsystem_sleep_state_name = 2; |
| 926 | optional uint64 residency_in_msec_since_boot = 3; |
| 927 | optional uint64 total_transitions = 4; |
| 928 | optional uint64 last_entry_timestamp_ms = 5; |
| 929 | optional bool supported_only_in_suspend = 6; |
| 930 | } |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 931 | |
| 932 | /** |
| 933 | * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky |
| 934 | * behavior in its own uid. However, the metrics of these isolated uid's almost always should be |
| 935 | * attributed back to the parent (host) uid. One example is Chrome. |
| 936 | * |
| 937 | * Logged from: |
| 938 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 939 | */ |
| 940 | message IsolatedUidChanged { |
| 941 | // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid. |
| 942 | optional int32 parent_uid = 1; |
| 943 | |
| 944 | optional int32 isolated_uid = 2; |
| 945 | |
| 946 | // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to |
| 947 | // be removed before if it's used for another parent uid. |
| 948 | optional int32 is_create = 3; |
| 949 | } |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 950 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 951 | /** |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 952 | * Pulls Cpu time per frequency. |
| 953 | * Note: this should be pulled for gauge metric only, without condition. |
| 954 | * The puller keeps internal state of last values. It should not be pulled by |
| 955 | * different metrics. |
| 956 | * The pulled data is delta of cpu time from last pull, calculated as |
| 957 | * following: |
| 958 | * if current time is larger than last value, take delta between the two. |
| 959 | * if current time is smaller than last value, there must be a cpu |
| 960 | * hotplug event, and the current time is taken as delta. |
| 961 | */ |
| 962 | message CpuTimePerFreqPulled { |
| 963 | optional uint32 cluster = 1; |
| 964 | optional uint32 freq_index = 2; |
| 965 | optional uint64 time = 3; |
| 966 | } |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 967 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 968 | /** |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 969 | * Pulls Cpu Time Per Uid. |
| 970 | * Note that isolated process uid time should be attributed to host uids. |
| 971 | */ |
| 972 | message CpuTimePerUidPulled { |
| 973 | optional uint64 uid = 1; |
| 974 | optional uint64 user_time_ms = 2; |
| 975 | optional uint64 sys_time_ms = 3; |
| 976 | } |
| 977 | |
| 978 | /** |
| 979 | * Pulls Cpu Time Per Uid per frequency. |
| 980 | * Note that isolated process uid time should be attributed to host uids. |
| 981 | * For each uid, we order the time by descending frequencies. |
| 982 | */ |
| 983 | message CpuTimePerUidFreqPulled { |
| 984 | optional uint64 uid = 1; |
| 985 | optional uint64 freq_idx = 2; |
| 986 | optional uint64 time_ms = 3; |
| 987 | } |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 988 | |
| 989 | /* |
| 990 | * Logs the reception of an incoming network packet causing the main system to wake up for |
| 991 | * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd |
| 992 | * and processed by WakeupController.cpp. |
| 993 | */ |
| 994 | message PacketWakeupOccurred { |
| 995 | // The uid owning the socket into which the packet was delivered, or -1 if the packet was |
| 996 | // delivered nowhere. |
| 997 | optional int32 uid = 1; |
| 998 | // The interface name on which the packet was received. |
| 999 | optional string iface = 2; |
| 1000 | // The ethertype value of the packet. |
| 1001 | optional int32 ethertype = 3; |
| 1002 | // String representation of the destination MAC address of the packet. |
| 1003 | optional string destination_hardware_address = 4; |
| 1004 | // String representation of the source address of the packet if this was an IP packet. |
| 1005 | optional string source_ip = 5; |
| 1006 | // String representation of the destination address of the packet if this was an IP packet. |
| 1007 | optional string destination_ip = 6; |
| 1008 | // The value of the protocol field if this was an IPv4 packet or the value of the Next Header |
| 1009 | // field if this was an IPv6 packet. The range of possible values is the same for both IP |
| 1010 | // families. |
| 1011 | optional int32 ip_next_header = 7; |
| 1012 | // The source port if this was a TCP or UDP packet. |
| 1013 | optional int32 source_port = 8; |
| 1014 | // The destination port if this was a TCP or UDP packet. |
| 1015 | optional int32 destination_port = 9; |
| 1016 | } |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1017 | |
| 1018 | /** |
| 1019 | * Pulls Wifi Controller Activity Energy Info |
| 1020 | */ |
| 1021 | message WifiActivityEnergyInfoPulled { |
| 1022 | // timestamp(wall clock) of record creation |
| 1023 | optional uint64 timestamp_ms = 1; |
| 1024 | // stack reported state |
| 1025 | // TODO: replace this with proto enum |
| 1026 | optional int32 stack_state = 2; |
| 1027 | // tx time in ms |
| 1028 | optional uint64 controller_tx_time_ms = 3; |
| 1029 | // rx time in ms |
| 1030 | optional uint64 controller_rx_time_ms = 4; |
| 1031 | // idle time in ms |
| 1032 | optional uint64 controller_idle_time_ms = 5; |
| 1033 | // product of current(mA), voltage(V) and time(ms) |
| 1034 | optional uint64 controller_energy_used = 6; |
| 1035 | } |
| 1036 | |
| 1037 | /** |
| 1038 | * Pulls Modem Activity Energy Info |
| 1039 | */ |
| 1040 | message ModemActivityInfoPulled { |
| 1041 | // timestamp(wall clock) of record creation |
| 1042 | optional uint64 timestamp_ms = 1; |
| 1043 | // sleep time in ms. |
| 1044 | optional uint64 sleep_time_ms = 2; |
| 1045 | // idle time in ms |
| 1046 | optional uint64 controller_idle_time_ms = 3; |
| 1047 | /** |
| 1048 | * Tx power index |
| 1049 | * index 0 = tx_power < 0dBm |
| 1050 | * index 1 = 0dBm < tx_power < 5dBm |
| 1051 | * index 2 = 5dBm < tx_power < 15dBm |
| 1052 | * index 3 = 15dBm < tx_power < 20dBm |
| 1053 | * index 4 = tx_power > 20dBm |
| 1054 | */ |
| 1055 | // tx time in ms at power level 0 |
| 1056 | optional uint64 controller_tx_time_pl0_ms = 4; |
| 1057 | // tx time in ms at power level 1 |
| 1058 | optional uint64 controller_tx_time_pl1_ms = 5; |
| 1059 | // tx time in ms at power level 2 |
| 1060 | optional uint64 controller_tx_time_pl2_ms = 6; |
| 1061 | // tx time in ms at power level 3 |
| 1062 | optional uint64 controller_tx_time_pl3_ms = 7; |
| 1063 | // tx time in ms at power level 4 |
| 1064 | optional uint64 controller_tx_time_pl4_ms = 8; |
| 1065 | // rx time in ms at power level 5 |
| 1066 | optional uint64 controller_rx_time_ms = 9; |
| 1067 | // product of current(mA), voltage(V) and time(ms) |
| 1068 | optional uint64 energy_used = 10; |
| 1069 | } |