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