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 | |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 24 | import "frameworks/base/core/proto/android/app/activitymanager.proto"; |
| 25 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 26 | /** |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 27 | * The master atom class. This message defines all of the available |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 28 | * 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 Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 35 | * This Atom class is not actually built into the Android system. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 36 | * Instead, statsd on Android constructs these messages synthetically, |
| 37 | * in the format defined here and in stats_log.proto. |
| 38 | */ |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 39 | message Atom { |
| 40 | // Pushed atoms start at 2. |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 41 | oneof pushed { |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 42 | // 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; |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 51 | WakelockStateChanged wakelock_state_changed = 10; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 52 | 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; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 59 | 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; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 66 | 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; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 73 | 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 Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 77 | SettingChanged setting_changed = 41; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 78 | ActivityForegroundStateChanged activity_foreground_state_changed = 42; |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 79 | IsolatedUidChanged isolated_uid_changed = 43; |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 80 | PacketWakeupOccurred packet_wakeup_occurred = 44; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 81 | DropboxErrorChanged dropbox_error_changed = 45; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 82 | AnomalyDetected anomaly_detected = 46; |
| 83 | AppHook app_hook = 47; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 84 | // 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] | 85 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 86 | |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 87 | // Pulled events will start at field 10000. |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 88 | oneof pulled { |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 89 | WifiBytesTransfer wifi_bytes_transfer = 10000; |
| 90 | WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001; |
| 91 | MobileBytesTransfer mobile_bytes_transfer = 10002; |
| 92 | MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003; |
| 93 | KernelWakelock kernel_wakelock = 10004; |
| 94 | PlatformSleepState platform_sleep_state = 10005; |
| 95 | SleepStateVoter sleep_state_voter = 10006; |
| 96 | SubsystemSleepState subsystem_sleep_state = 10007; |
| 97 | CpuTimePerFreq cpu_time_per_freq = 10008; |
| 98 | CpuTimePerUid cpu_time_per_uid = 10009; |
| 99 | CpuTimePerUidFreq cpu_time_per_uid_freq = 10010; |
| 100 | WifiActivityEnergyInfo wifi_activity_energy_info = 10011; |
| 101 | ModemActivityInfo modem_activity_info = 10012; |
| 102 | AttributionChainDummyAtom attribution_chain_dummy_atom = 100000; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 103 | } |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 104 | } |
| 105 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 106 | /** |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 107 | * This proto represents a node of an attribution chain. |
| 108 | * Note: All attribution chains are represented as a repeated field of type |
| 109 | * AttributionNode. It is understood that in such arrays, the order is that |
| 110 | * of calls, that is [A, B, C] if A calls B that calls C. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 111 | */ |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 112 | message AttributionNode { |
| 113 | // The uid for a given element in the attribution chain. |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 114 | optional int32 uid = 1; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 115 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 116 | // The (optional) string tag for an element in the attribution chain. If the |
| 117 | // element has no tag, it is encoded as an empty string. |
| 118 | optional string tag = 2; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 119 | } |
| 120 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 121 | /* |
| 122 | * ***************************************************************************** |
yro | de4ca10 | 2017-11-15 22:57:24 -0800 | [diff] [blame] | 123 | * 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] | 124 | * |
| 125 | * RULES: |
| 126 | * - The field ids for each atom must start at 1, and count upwards by 1. |
| 127 | * Skipping field ids is not allowed. |
| 128 | * - These form an API, so renaming, renumbering or removing fields is |
| 129 | * not allowed between android releases. (This is not currently enforced, |
| 130 | * but there will be a tool to enforce this restriction). |
| 131 | * - The types must be built-in protocol buffer types, namely, no sub-messages |
| 132 | * are allowed (yet). The bytes type is also not allowed. |
| 133 | * - The CamelCase name of the message type should match the |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 134 | * underscore_separated name as defined in Atom. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 135 | * - If an atom represents work that can be attributed to an app, there can |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 136 | * be exactly one AttributionChain field. It must be field number 1. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 137 | * - A field that is a uid should be a string field, tagged with the [xxx] |
| 138 | * annotation. The generated code on android will be represented by UIDs, |
| 139 | * and those UIDs will be translated in xxx to those strings. |
| 140 | * |
| 141 | * CONVENTIONS: |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 142 | * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 143 | * - If there is a UID, it goes first. Think in an object-oriented fashion. |
| 144 | * ***************************************************************************** |
| 145 | */ |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 146 | |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 147 | message AttributionChainDummyAtom { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 148 | repeated AttributionNode attribution_node = 1; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 149 | optional int32 value = 2; |
| 150 | } |
| 151 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 152 | /** |
| 153 | * Logs when the screen state changes. |
| 154 | * |
| 155 | * Logged from: |
| 156 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 157 | */ |
| 158 | message ScreenStateChanged { |
| 159 | // TODO: Use the real screen state. |
| 160 | enum State { |
| 161 | STATE_UNKNOWN = 0; |
| 162 | STATE_OFF = 1; |
| 163 | STATE_ON = 2; |
| 164 | STATE_DOZE = 3; |
| 165 | STATE_DOZE_SUSPEND = 4; |
| 166 | STATE_VR = 5; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 167 | STATE_ON_SUSPEND = 6; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 168 | } |
| 169 | // New screen state. |
| 170 | optional State display_state = 1; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 171 | } |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 172 | |
| 173 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 174 | * 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] | 175 | * |
| 176 | * Logged from: |
| 177 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 178 | */ |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 179 | message UidProcessStateChanged { |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 180 | optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation |
| 181 | |
| 182 | // The state. |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 183 | // TODO: Use the real (mapped) process states. |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 184 | optional android.app.ProcessState state = 2; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 188 | * Logs that a process started, finished, crashed, or ANRed. |
| 189 | * |
| 190 | * Logged from: |
| 191 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 192 | */ |
| 193 | message ProcessLifeCycleStateChanged { |
| 194 | // TODO: Use the real (mapped) process states. |
| 195 | optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation |
| 196 | |
| 197 | // TODO: What is this? |
| 198 | optional string name = 2; |
| 199 | |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 200 | // What lifecycle state the process changed to. |
| 201 | // This enum is specific to atoms.proto. |
| 202 | enum Event { |
| 203 | PROCESS_FINISHED = 0; |
| 204 | PROCESS_STARTED = 1; |
| 205 | PROCESS_CRASHED = 2; |
| 206 | PROCESS_ANRED = 3; |
| 207 | } |
| 208 | optional Event event = 3; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 209 | } |
| 210 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 211 | /** |
| 212 | * Logs when the ble scan state changes. |
| 213 | * |
| 214 | * Logged from: |
| 215 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 216 | */ |
| 217 | message BleScanStateChanged { |
| 218 | // TODO: Add attribution instead of uid. |
| 219 | optional int32 uid = 1; |
| 220 | |
| 221 | enum State { |
| 222 | OFF = 0; |
| 223 | ON = 1; |
| 224 | } |
| 225 | optional State state = 2; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Logs when an unoptimized ble scan state changes. |
| 230 | * |
| 231 | * Logged from: |
| 232 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 233 | */ |
| 234 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 235 | message BleUnoptimizedScanStateChanged { |
| 236 | // TODO: Add attribution instead of uid. |
| 237 | optional int32 uid = 1; |
| 238 | |
| 239 | enum State { |
| 240 | OFF = 0; |
| 241 | ON = 1; |
| 242 | } |
| 243 | optional State state = 2; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Logs reporting of a ble scan finding results. |
| 248 | * |
| 249 | * Logged from: |
| 250 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 251 | */ |
| 252 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 253 | message BleScanResultReceived { |
| 254 | // TODO: Add attribution instead of uid. |
| 255 | optional int32 uid = 1; |
| 256 | |
| 257 | // Number of ble scan results returned. |
| 258 | optional int32 num_of_results = 2; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Logs when a sensor state changes. |
| 263 | * |
| 264 | * Logged from: |
| 265 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 266 | */ |
| 267 | message SensorStateChanged { |
| 268 | // TODO: Add attribution instead of uid. |
| 269 | optional int32 uid = 1; |
| 270 | |
| 271 | // TODO: Is there a way to get the actual name of the sensor? |
| 272 | // The id (int) of the sensor. |
| 273 | optional int32 sensor_id = 2; |
| 274 | |
| 275 | enum State { |
| 276 | OFF = 0; |
| 277 | ON = 1; |
| 278 | } |
| 279 | optional State state = 3; |
| 280 | } |
| 281 | |
| 282 | |
| 283 | /** |
| 284 | * Logs when GPS state changes. |
| 285 | * |
| 286 | * Logged from: |
| 287 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 288 | */ |
| 289 | message GpsScanStateChanged { |
| 290 | // TODO: Add attribution instead of uid. |
| 291 | optional int32 uid = 1; |
| 292 | |
| 293 | enum State { |
| 294 | OFF = 0; |
| 295 | ON = 1; |
| 296 | } |
| 297 | optional State state = 2; |
| 298 | } |
| 299 | |
| 300 | |
| 301 | /** |
| 302 | * Logs when a sync manager sync state changes. |
| 303 | * |
| 304 | * Logged from: |
| 305 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 306 | */ |
| 307 | message SyncStateChanged { |
| 308 | // TODO: Add attribution instead of uid. |
| 309 | optional int32 uid = 1; |
| 310 | |
| 311 | // Name of the sync (as named in the app) |
| 312 | optional string name = 2; |
| 313 | |
| 314 | enum State { |
| 315 | OFF = 0; |
| 316 | ON = 1; |
| 317 | } |
| 318 | optional State state = 3; |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * Logs when a job scheduler job state changes. |
| 323 | * |
| 324 | * Logged from: |
| 325 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 326 | */ |
| 327 | message ScheduledJobStateChanged { |
| 328 | // TODO: Add attribution instead of uid. |
| 329 | optional int32 uid = 1; |
| 330 | |
| 331 | // Name of the job (as named in the app) |
| 332 | optional string name = 2; |
| 333 | |
| 334 | enum State { |
| 335 | OFF = 0; |
| 336 | ON = 1; |
| 337 | } |
| 338 | optional State state = 3; |
| 339 | |
| 340 | // TODO: Consider adding the stopReason (int) |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * Logs when the audio state changes. |
| 345 | * |
| 346 | * Logged from: |
| 347 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 348 | */ |
| 349 | message AudioStateChanged { |
| 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 video codec state changes. |
| 362 | * |
| 363 | * Logged from: |
| 364 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 365 | */ |
| 366 | message MediaCodecActivityChanged { |
| 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 flashlight state changes. |
| 379 | * |
| 380 | * Logged from: |
| 381 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 382 | */ |
| 383 | message FlashlightStateChanged { |
| 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 when the camera state changes. |
| 396 | * |
| 397 | * Logged from: |
| 398 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 399 | */ |
| 400 | message CameraStateChanged { |
| 401 | // TODO: Add attribution instead of uid. |
| 402 | optional int32 uid = 1; |
| 403 | |
| 404 | enum State { |
| 405 | OFF = 0; |
| 406 | ON = 1; |
| 407 | } |
| 408 | optional State state = 2; |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * 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] | 413 | * |
| 414 | * Logged from: |
| 415 | * TODO |
| 416 | */ |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 417 | message WakelockStateChanged { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 418 | repeated AttributionNode attribution_node = 1; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 419 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 420 | // Type of wakelock. |
| 421 | enum Type { |
| 422 | PARTIAL = 0; |
| 423 | FULL = 1; |
| 424 | WINDOW = 2; |
| 425 | } |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 426 | optional Type type = 2; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 427 | |
| 428 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 429 | optional string tag = 3; |
| 430 | |
| 431 | enum State { |
Yangster-mac | cfdf3a4 | 2017-12-06 13:42:38 -0800 | [diff] [blame] | 432 | RELEASE = 0; |
| 433 | ACQUIRE = 1; |
| 434 | CHANGE_RELEASE = 2; |
| 435 | CHANGE_ACQUIRE = 3; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 436 | } |
| 437 | optional State state = 4; |
| 438 | } |
| 439 | |
| 440 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 441 | * Logs when a partial wakelock is considered 'long' (over 1 min). |
| 442 | * |
| 443 | * Logged from: |
| 444 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 445 | */ |
| 446 | message LongPartialWakelockStateChanged { |
| 447 | // TODO: Add attribution instead of uid? |
| 448 | optional int32 uid = 1; |
| 449 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 450 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 451 | optional string tag = 2; |
| 452 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 453 | // TODO: I have no idea what this is. |
| 454 | optional string history_tag = 3; |
| 455 | |
| 456 | enum State { |
| 457 | OFF = 0; |
| 458 | ON = 1; |
| 459 | } |
| 460 | optional State state = 4; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 461 | } |
| 462 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 463 | /** |
| 464 | * Logs Battery Saver state change. |
| 465 | * |
| 466 | * Logged from: |
| 467 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 468 | */ |
| 469 | message BatterySaverModeStateChanged { |
| 470 | enum State { |
| 471 | OFF = 0; |
| 472 | ON = 1; |
| 473 | } |
| 474 | optional State state = 1; |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * Logs Doze mode state change. |
| 479 | * |
| 480 | * Logged from: |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 481 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 482 | */ |
| 483 | message DeviceIdleModeStateChanged { |
| 484 | // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_. |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 485 | enum State { |
| 486 | DEVICE_IDLE_MODE_OFF = 0; |
| 487 | DEVICE_IDLE_MODE_LIGHT = 1; |
| 488 | DEVICE_IDLE_MODE_DEEP = 2; |
| 489 | } |
| 490 | optional State state = 1; |
| 491 | } |
| 492 | |
| 493 | |
| 494 | /** |
| 495 | * Logs state change of Doze mode including maintenance windows. |
| 496 | * |
| 497 | * Logged from: |
| 498 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 499 | */ |
| 500 | message DeviceIdlingModeStateChanged { |
| 501 | // TODO: Use the enum matching BatteryStats.DEVICE_IDLE_MODE_. |
| 502 | enum State { |
| 503 | DEVICE_IDLE_MODE_OFF = 0; |
| 504 | DEVICE_IDLE_MODE_LIGHT = 1; |
| 505 | DEVICE_IDLE_MODE_DEEP = 2; |
| 506 | } |
| 507 | optional State state = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Logs screen brightness level. |
| 512 | * |
| 513 | * Logged from: |
| 514 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 515 | */ |
| 516 | message ScreenBrightnessChanged { |
| 517 | // Screen brightness level. Should be in [-1, 255] according to PowerManager.java. |
| 518 | optional int32 level = 1; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | /** |
| 522 | * Logs battery level (percent full, from 0 to 100). |
| 523 | * |
| 524 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 525 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 526 | */ |
| 527 | message BatteryLevelChanged { |
| 528 | // Battery level. Should be in [0, 100]. |
| 529 | optional int32 battery_level = 1; |
| 530 | } |
| 531 | |
| 532 | /** |
| 533 | * Logs change in charging status of the device. |
| 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 ChargingStateChanged { |
| 539 | // TODO: Link directly to BatteryManager.java's constants (via a proto). |
| 540 | enum State { |
| 541 | BATTERY_STATUS_UNKNOWN = 1; |
| 542 | BATTERY_STATUS_CHARGING = 2; |
| 543 | BATTERY_STATUS_DISCHARGING = 3; |
| 544 | BATTERY_STATUS_NOT_CHARGING = 4; |
| 545 | BATTERY_STATUS_FULL = 5; |
| 546 | } |
| 547 | optional State charging_state = 1; |
| 548 | } |
| 549 | |
| 550 | /** |
| 551 | * Logs whether the device is plugged in, and what power source it is using. |
| 552 | * |
| 553 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 554 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 555 | */ |
| 556 | message PluggedStateChanged { |
| 557 | // TODO: Link directly to BatteryManager.java's constants (via a proto). |
| 558 | enum State { |
| 559 | // Note that NONE is not in BatteryManager.java's constants. |
| 560 | BATTERY_PLUGGED_NONE = 0; |
| 561 | // Power source is an AC charger. |
| 562 | BATTERY_PLUGGED_AC = 1; |
| 563 | // Power source is a USB port. |
| 564 | BATTERY_PLUGGED_USB = 2; |
| 565 | // Power source is wireless. |
| 566 | BATTERY_PLUGGED_WIRELESS = 4; |
| 567 | } |
| 568 | optional State plugged_state = 1; |
| 569 | } |
| 570 | |
| 571 | /** |
| 572 | * Logs the temperature of the device, in tenths of a degree Celsius. |
| 573 | * |
| 574 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 575 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 576 | */ |
| 577 | message DeviceTemperatureReported { |
| 578 | // Temperature in tenths of a degree C. |
| 579 | optional int32 temperature = 1; |
| 580 | } |
| 581 | |
| 582 | // TODO: Define this more precisely. |
| 583 | // TODO: Log the ON state somewhere. It isn't currently logged anywhere. |
| 584 | /** |
| 585 | * Logs when the device turns off or on. |
| 586 | * |
| 587 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 588 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 589 | */ |
| 590 | message DeviceOnStatusChanged { |
| 591 | enum State { |
| 592 | OFF = 0; |
| 593 | ON = 1; |
| 594 | } |
| 595 | optional State state = 1; |
| 596 | } |
| 597 | |
| 598 | /** |
| 599 | * Logs when an app's wakeup alarm fires. |
| 600 | * |
| 601 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 602 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 603 | */ |
| 604 | message WakeupAlarmOccurred { |
| 605 | // TODO: Add attribution instead of uid? |
| 606 | optional int32 uid = 1; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 607 | |
| 608 | // Name of the wakeup alarm. |
| 609 | optional string tag = 2; |
| 610 | } |
| 611 | |
| 612 | /** |
| 613 | * Logs when an an app causes the mobile radio to change state. |
| 614 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio. |
| 615 | * |
| 616 | * Logged from: |
| 617 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 618 | */ |
| 619 | message MobileRadioPowerStateChanged { |
| 620 | // TODO: Add attribution instead of uid? |
| 621 | optional int32 uid = 1; |
| 622 | |
| 623 | // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states. |
| 624 | enum PowerState { |
| 625 | DC_POWER_STATE_LOW = 1; |
| 626 | DC_POWER_STATE_MEDIUM = 2; |
| 627 | DC_POWER_STATE_HIGH = 3; |
| 628 | } |
| 629 | optional PowerState power_state = 2; |
| 630 | } |
| 631 | |
| 632 | /** |
| 633 | * Logs when an an app causes the wifi radio to change state. |
| 634 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio. |
| 635 | * |
| 636 | * Logged from: |
| 637 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 638 | */ |
| 639 | message WifiRadioPowerStateChanged { |
| 640 | // TODO: Add attribution instead of uid? |
| 641 | optional int32 uid = 1; |
| 642 | |
| 643 | // TODO: Reference telephony/java/android/telephony/DataConnectionRealTimeInfo.java states. |
| 644 | enum PowerState { |
| 645 | DC_POWER_STATE_LOW = 1; |
| 646 | DC_POWER_STATE_MEDIUM = 2; |
| 647 | DC_POWER_STATE_HIGH = 3; |
| 648 | } |
| 649 | optional PowerState power_state = 2; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | /** |
| 653 | * Logs kernel wakeup reasons and aborts. |
| 654 | * |
| 655 | * Logged from: |
| 656 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 657 | */ |
| 658 | message KernelWakeupReported { |
| 659 | // Name of the kernel wakeup reason (or abort). |
| 660 | optional string wakeup_reason_name = 1; |
| 661 | |
| 662 | // Duration (in microseconds) for the wake-up interrupt to be serviced. |
| 663 | optional int64 duration_usec = 2; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | /** |
| 667 | * Logs wifi locks held by an app. |
| 668 | * |
| 669 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 670 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 671 | */ |
| 672 | message WifiLockStateChanged { |
| 673 | // TODO: Add attribution instead of uid. |
| 674 | optional int32 uid = 1; |
| 675 | |
| 676 | enum State { |
| 677 | OFF = 0; |
| 678 | ON = 1; |
| 679 | } |
| 680 | optional State state = 2; |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * Logs wifi signal strength changes. |
| 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 WifiSignalStrengthChanged { |
| 690 | // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states. |
| 691 | enum SignalStrength { |
| 692 | SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; |
| 693 | SIGNAL_STRENGTH_POOR = 1; |
| 694 | SIGNAL_STRENGTH_MODERATE = 2; |
| 695 | SIGNAL_STRENGTH_GOOD = 3; |
| 696 | SIGNAL_STRENGTH_GREAT = 4; |
| 697 | } |
| 698 | optional SignalStrength signal_strength = 1; |
| 699 | } |
| 700 | |
| 701 | /** |
| 702 | * Logs wifi scans performed by an app. |
| 703 | * |
| 704 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 705 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 706 | */ |
| 707 | message WifiScanStateChanged { |
| 708 | // TODO: Add attribution instead of uid. |
| 709 | optional int32 uid = 1; |
| 710 | |
| 711 | enum State { |
| 712 | OFF = 0; |
| 713 | ON = 1; |
| 714 | } |
| 715 | optional State state = 2; |
| 716 | } |
| 717 | |
| 718 | /** |
| 719 | * Logs phone signal strength changes. |
| 720 | * |
| 721 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 722 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 723 | */ |
| 724 | message PhoneSignalStrengthChanged { |
| 725 | // TODO: Reference the actual telephony/java/android/telephony/SignalStrength.java states. |
| 726 | enum SignalStrength { |
| 727 | SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; |
| 728 | SIGNAL_STRENGTH_POOR = 1; |
| 729 | SIGNAL_STRENGTH_MODERATE = 2; |
| 730 | SIGNAL_STRENGTH_GOOD = 3; |
| 731 | SIGNAL_STRENGTH_GREAT = 4; |
| 732 | } |
| 733 | optional SignalStrength signal_strength = 1; |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 734 | } |
| 735 | |
| 736 | /** |
| 737 | * Logs that a setting was updated. |
| 738 | * Logged from: |
| 739 | * frameworks/base/core/java/android/provider/Settings.java |
| 740 | * The tag and is_default allow resetting of settings to default values based on the specified |
| 741 | * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details. |
| 742 | */ |
| 743 | message SettingChanged { |
| 744 | // The name of the setting. |
| 745 | optional string setting = 1; |
| 746 | |
| 747 | // The change being imposed on this setting. May represent a number, eg "3". |
| 748 | optional string value = 2; |
| 749 | |
| 750 | // The new value of this setting. For most settings, this is same as value. For some settings, |
| 751 | // value is +X or -X where X represents an element in a set. For example, if the previous value |
| 752 | // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C. |
| 753 | // The +/- feature is currently only used for location_providers_allowed. |
| 754 | optional string new_value = 3; |
| 755 | |
| 756 | // The previous value of this setting. |
| 757 | optional string prev_value = 4; |
| 758 | |
| 759 | // The tag used with the is_default for resetting sets of settings. This is generally null. |
| 760 | optional string tag = 5; |
| 761 | |
| 762 | // 1 indicates that this setting with tag should be resettable. |
| 763 | optional int32 is_default = 6; |
| 764 | |
| 765 | // The user ID associated. Defined in android/os/UserHandle.java |
| 766 | optional int32 user = 7; |
| 767 | } |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 768 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 769 | /** |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 770 | * Logs activity going to foreground or background |
| 771 | * |
| 772 | * Logged from: |
| 773 | * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java |
| 774 | */ |
| 775 | message ActivityForegroundStateChanged { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 776 | optional int32 uid = 1; |
| 777 | optional string pkg_name = 2; |
| 778 | optional string class_name = 3; |
| 779 | |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 780 | enum Activity { |
| 781 | MOVE_TO_BACKGROUND = 0; |
| 782 | MOVE_TO_FOREGROUND = 1; |
| 783 | } |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 784 | optional Activity activity = 4; |
| 785 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 786 | |
| 787 | /** |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 788 | * Logs when an error is written to dropbox. |
| 789 | * Logged from: |
| 790 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
| 791 | */ |
| 792 | message DropboxErrorChanged { |
| 793 | // The uid if available. -1 means not available. |
| 794 | optional int32 uid = 1; |
| 795 | |
| 796 | // Tag used when recording this error to dropbox. Contains data_ or system_ prefix. |
| 797 | optional string tag = 2; |
| 798 | |
| 799 | // The name of the process. |
| 800 | optional string process_name = 3; |
| 801 | |
| 802 | // The pid if available. -1 means not available. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 803 | optional sint32 pid = 4; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 804 | |
| 805 | // 1 indicates is instant app. -1 indicates Not applicable. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 806 | optional sint32 is_instant_app = 5; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 807 | |
| 808 | // The activity name if available. |
| 809 | optional string activity_name = 6; |
| 810 | |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 811 | // The package name if available. |
| 812 | optional string package_name = 7; |
| 813 | |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 814 | // 1 indicates in foreground. -1 indicates not available. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 815 | optional sint32 is_foreground = 8; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 816 | } |
| 817 | |
David Chen | 0a368b2 | 2017-12-06 16:28:16 -0800 | [diff] [blame] | 818 | /* |
| 819 | * Allows other apps to push events into statsd. |
| 820 | * Logged from: |
| 821 | * frameworks/base/core/java/android/util/StatsLog.java |
| 822 | */ |
| 823 | message AppHook { |
| 824 | // The uid of the application that sent this custom atom. |
| 825 | optional int32 uid = 1; |
| 826 | |
| 827 | // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16). |
| 828 | optional int32 label = 2; |
| 829 | |
| 830 | // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom |
| 831 | // predicates for the metrics). |
| 832 | enum State { |
| 833 | UNKNOWN = 0; |
| 834 | UNSPECIFIED = 1; // For events that are known to not represent START/STOP. |
| 835 | STOP = 2; |
| 836 | START = 3; |
| 837 | } |
| 838 | optional State state = 3; |
| 839 | } |
| 840 | |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 841 | /** |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 842 | * Logs when statsd detects an anomaly. |
| 843 | * |
| 844 | * Logged from: |
| 845 | * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp |
| 846 | */ |
| 847 | message AnomalyDetected { |
| 848 | // Uid that owns the config whose anomaly detection alert fired. |
| 849 | optional int32 config_uid = 1; |
| 850 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame] | 851 | // Id of the config whose anomaly detection alert fired. |
| 852 | optional int64 config_id = 2; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 853 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame] | 854 | // Id of the alert (i.e. name of the anomaly that was detected). |
| 855 | optional int64 alert_id = 3; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | /** |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 859 | * Pulls bytes transferred via wifi (Sum of foreground and background usage). |
| 860 | * |
| 861 | * Pulled from: |
| 862 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 863 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 864 | message WifiBytesTransfer { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 865 | optional int32 uid = 1; |
| 866 | |
| 867 | optional int64 rx_bytes = 2; |
| 868 | |
| 869 | optional int64 rx_packets = 3; |
| 870 | |
| 871 | optional int64 tx_bytes = 4; |
| 872 | |
| 873 | optional int64 tx_packets = 5; |
| 874 | } |
| 875 | |
| 876 | /** |
| 877 | * Pulls bytes transferred via wifi (separated by foreground and background usage). |
| 878 | * |
| 879 | * Pulled from: |
| 880 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 881 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 882 | message WifiBytesTransferByFgBg { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 883 | optional int32 uid = 1; |
| 884 | |
| 885 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 886 | optional int32 is_foreground = 2; |
| 887 | |
| 888 | optional int64 rx_bytes = 3; |
| 889 | |
| 890 | optional int64 rx_packets = 4; |
| 891 | |
| 892 | optional int64 tx_bytes = 5; |
| 893 | |
| 894 | optional int64 tx_packets = 6; |
| 895 | } |
| 896 | |
| 897 | /** |
| 898 | * Pulls bytes transferred via mobile networks (Sum of foreground and background usage). |
| 899 | * |
| 900 | * Pulled from: |
| 901 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 902 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 903 | message MobileBytesTransfer { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 904 | optional int32 uid = 1; |
| 905 | |
| 906 | optional int64 rx_bytes = 2; |
| 907 | |
| 908 | optional int64 rx_packets = 3; |
| 909 | |
| 910 | optional int64 tx_bytes = 4; |
| 911 | |
| 912 | optional int64 tx_packets = 5; |
| 913 | } |
| 914 | |
| 915 | /** |
| 916 | * Pulls bytes transferred via mobile networks (separated by foreground and background usage). |
| 917 | * |
| 918 | * Pulled from: |
| 919 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 920 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 921 | message MobileBytesTransferByFgBg { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 922 | optional int32 uid = 1; |
| 923 | |
| 924 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 925 | optional int32 is_foreground = 2; |
| 926 | |
| 927 | optional int64 rx_bytes = 3; |
| 928 | |
| 929 | optional int64 rx_packets = 4; |
| 930 | |
| 931 | optional int64 tx_bytes = 5; |
| 932 | |
| 933 | optional int64 tx_packets = 6; |
| 934 | } |
| 935 | |
| 936 | /** |
| 937 | * Pulls the kernel wakelock durations. This atom is adapted from |
| 938 | * android/internal/os/KernelWakelockStats.java |
| 939 | * |
| 940 | * Pulled from: |
| 941 | * StatsCompanionService using KernelWakelockReader. |
| 942 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 943 | message KernelWakelock { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 944 | optional string name = 1; |
| 945 | |
| 946 | optional int32 count = 2; |
| 947 | |
| 948 | optional int32 version = 3; |
| 949 | |
| 950 | optional int64 time = 4; |
| 951 | } |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 952 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 953 | /** |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 954 | * Pulls PowerStatePlatformSleepState. |
| 955 | * |
| 956 | * Definition here: |
| 957 | * hardware/interfaces/power/1.0/types.hal |
| 958 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 959 | message PlatformSleepState { |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 960 | optional string name = 1; |
| 961 | optional uint64 residency_in_msec_since_boot = 2; |
| 962 | optional uint64 total_transitions = 3; |
| 963 | optional bool supported_only_in_suspend = 4; |
| 964 | } |
| 965 | |
| 966 | /** |
| 967 | * Pulls PowerStateVoter. |
| 968 | * |
| 969 | * Definition here: |
| 970 | * hardware/interfaces/power/1.0/types.hal |
| 971 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 972 | message SleepStateVoter { |
| 973 | optional string platform_sleep_state_name = 1; |
| 974 | optional string voter_name = 2; |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 975 | optional uint64 total_time_in_msec_voted_for_since_boot = 3; |
| 976 | optional uint64 total_number_of_times_voted_since_boot = 4; |
| 977 | } |
| 978 | |
| 979 | /** |
| 980 | * Pulls PowerStateSubsystemSleepState. |
| 981 | * |
| 982 | * Definition here: |
| 983 | * hardware/interfaces/power/1.1/types.hal |
| 984 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 985 | message SubsystemSleepState { |
| 986 | optional string subsystem_name = 1; |
| 987 | optional string subsystem_sleep_state_name = 2; |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 988 | optional uint64 residency_in_msec_since_boot = 3; |
| 989 | optional uint64 total_transitions = 4; |
| 990 | optional uint64 last_entry_timestamp_ms = 5; |
| 991 | optional bool supported_only_in_suspend = 6; |
| 992 | } |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 993 | |
| 994 | /** |
| 995 | * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky |
| 996 | * behavior in its own uid. However, the metrics of these isolated uid's almost always should be |
| 997 | * attributed back to the parent (host) uid. One example is Chrome. |
| 998 | * |
| 999 | * Logged from: |
| 1000 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 1001 | */ |
| 1002 | message IsolatedUidChanged { |
| 1003 | // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid. |
| 1004 | optional int32 parent_uid = 1; |
| 1005 | |
| 1006 | optional int32 isolated_uid = 2; |
| 1007 | |
| 1008 | // 1 denotes we're creating an isolated uid and 0 denotes removal. We expect an isolated uid to |
| 1009 | // be removed before if it's used for another parent uid. |
| 1010 | optional int32 is_create = 3; |
| 1011 | } |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1012 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1013 | /** |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1014 | * Pulls Cpu time per frequency. |
| 1015 | * Note: this should be pulled for gauge metric only, without condition. |
| 1016 | * The puller keeps internal state of last values. It should not be pulled by |
| 1017 | * different metrics. |
| 1018 | * The pulled data is delta of cpu time from last pull, calculated as |
| 1019 | * following: |
| 1020 | * if current time is larger than last value, take delta between the two. |
| 1021 | * if current time is smaller than last value, there must be a cpu |
| 1022 | * hotplug event, and the current time is taken as delta. |
| 1023 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1024 | message CpuTimePerFreq { |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1025 | optional uint32 cluster = 1; |
| 1026 | optional uint32 freq_index = 2; |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1027 | optional uint64 time_ms = 3; |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1028 | } |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1029 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1030 | /** |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1031 | * Pulls Cpu Time Per Uid. |
| 1032 | * Note that isolated process uid time should be attributed to host uids. |
| 1033 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1034 | message CpuTimePerUid { |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1035 | optional uint64 uid = 1; |
| 1036 | optional uint64 user_time_ms = 2; |
| 1037 | optional uint64 sys_time_ms = 3; |
| 1038 | } |
| 1039 | |
| 1040 | /** |
| 1041 | * Pulls Cpu Time Per Uid per frequency. |
| 1042 | * Note that isolated process uid time should be attributed to host uids. |
| 1043 | * For each uid, we order the time by descending frequencies. |
| 1044 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1045 | message CpuTimePerUidFreq { |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1046 | optional uint64 uid = 1; |
| 1047 | optional uint64 freq_idx = 2; |
| 1048 | optional uint64 time_ms = 3; |
| 1049 | } |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 1050 | |
| 1051 | /* |
| 1052 | * Logs the reception of an incoming network packet causing the main system to wake up for |
| 1053 | * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd |
| 1054 | * and processed by WakeupController.cpp. |
| 1055 | */ |
| 1056 | message PacketWakeupOccurred { |
| 1057 | // The uid owning the socket into which the packet was delivered, or -1 if the packet was |
| 1058 | // delivered nowhere. |
| 1059 | optional int32 uid = 1; |
| 1060 | // The interface name on which the packet was received. |
| 1061 | optional string iface = 2; |
| 1062 | // The ethertype value of the packet. |
| 1063 | optional int32 ethertype = 3; |
| 1064 | // String representation of the destination MAC address of the packet. |
| 1065 | optional string destination_hardware_address = 4; |
| 1066 | // String representation of the source address of the packet if this was an IP packet. |
| 1067 | optional string source_ip = 5; |
| 1068 | // String representation of the destination address of the packet if this was an IP packet. |
| 1069 | optional string destination_ip = 6; |
| 1070 | // The value of the protocol field if this was an IPv4 packet or the value of the Next Header |
| 1071 | // field if this was an IPv6 packet. The range of possible values is the same for both IP |
| 1072 | // families. |
| 1073 | optional int32 ip_next_header = 7; |
| 1074 | // The source port if this was a TCP or UDP packet. |
| 1075 | optional int32 source_port = 8; |
| 1076 | // The destination port if this was a TCP or UDP packet. |
| 1077 | optional int32 destination_port = 9; |
| 1078 | } |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1079 | |
| 1080 | /** |
| 1081 | * Pulls Wifi Controller Activity Energy Info |
| 1082 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1083 | message WifiActivityEnergyInfo { |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1084 | // timestamp(wall clock) of record creation |
| 1085 | optional uint64 timestamp_ms = 1; |
| 1086 | // stack reported state |
| 1087 | // TODO: replace this with proto enum |
| 1088 | optional int32 stack_state = 2; |
| 1089 | // tx time in ms |
| 1090 | optional uint64 controller_tx_time_ms = 3; |
| 1091 | // rx time in ms |
| 1092 | optional uint64 controller_rx_time_ms = 4; |
| 1093 | // idle time in ms |
| 1094 | optional uint64 controller_idle_time_ms = 5; |
| 1095 | // product of current(mA), voltage(V) and time(ms) |
| 1096 | optional uint64 controller_energy_used = 6; |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * Pulls Modem Activity Energy Info |
| 1101 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1102 | message ModemActivityInfo { |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1103 | // timestamp(wall clock) of record creation |
| 1104 | optional uint64 timestamp_ms = 1; |
| 1105 | // sleep time in ms. |
| 1106 | optional uint64 sleep_time_ms = 2; |
| 1107 | // idle time in ms |
| 1108 | optional uint64 controller_idle_time_ms = 3; |
| 1109 | /** |
| 1110 | * Tx power index |
| 1111 | * index 0 = tx_power < 0dBm |
| 1112 | * index 1 = 0dBm < tx_power < 5dBm |
| 1113 | * index 2 = 5dBm < tx_power < 15dBm |
| 1114 | * index 3 = 15dBm < tx_power < 20dBm |
| 1115 | * index 4 = tx_power > 20dBm |
| 1116 | */ |
| 1117 | // tx time in ms at power level 0 |
| 1118 | optional uint64 controller_tx_time_pl0_ms = 4; |
| 1119 | // tx time in ms at power level 1 |
| 1120 | optional uint64 controller_tx_time_pl1_ms = 5; |
| 1121 | // tx time in ms at power level 2 |
| 1122 | optional uint64 controller_tx_time_pl2_ms = 6; |
| 1123 | // tx time in ms at power level 3 |
| 1124 | optional uint64 controller_tx_time_pl3_ms = 7; |
| 1125 | // tx time in ms at power level 4 |
| 1126 | optional uint64 controller_tx_time_pl4_ms = 8; |
| 1127 | // rx time in ms at power level 5 |
| 1128 | optional uint64 controller_rx_time_ms = 9; |
| 1129 | // product of current(mA), voltage(V) and time(ms) |
| 1130 | optional uint64 energy_used = 10; |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 1131 | } |