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 | |
Bookatz | db026a2 | 2018-01-10 19:01:56 -0800 | [diff] [blame] | 24 | import "frameworks/base/core/proto/android/app/enums.proto"; |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 25 | import "frameworks/base/core/proto/android/os/enums.proto"; |
Bookatz | 8bdae8d | 2018-01-16 11:24:30 -0800 | [diff] [blame] | 26 | import "frameworks/base/core/proto/android/server/enums.proto"; |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 27 | import "frameworks/base/core/proto/android/telephony/enums.proto"; |
| 28 | import "frameworks/base/core/proto/android/view/enums.proto"; |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 29 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 30 | /** |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 31 | * The master atom class. This message defines all of the available |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 32 | * raw stats log events from the Android system, also known as "atoms." |
| 33 | * |
| 34 | * This field contains a single oneof with all of the available messages. |
| 35 | * The stats-log-api-gen tool runs as part of the Android build and |
| 36 | * generates the android.util.StatsLog class, which contains the constants |
| 37 | * and methods that Android uses to log. |
| 38 | * |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 39 | * This Atom class is not actually built into the Android system. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 40 | * Instead, statsd on Android constructs these messages synthetically, |
| 41 | * in the format defined here and in stats_log.proto. |
| 42 | */ |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 43 | message Atom { |
| 44 | // Pushed atoms start at 2. |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 45 | oneof pushed { |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 46 | // For StatsLog reasons, 1 is illegal and will not work. Must start at 2. |
| 47 | BleScanStateChanged ble_scan_state_changed = 2; |
| 48 | BleUnoptimizedScanStateChanged ble_unoptimized_scan_state_changed = 3; |
| 49 | BleScanResultReceived ble_scan_result_received = 4; |
| 50 | SensorStateChanged sensor_state_changed = 5; |
Bookatz | db026a2 | 2018-01-10 19:01:56 -0800 | [diff] [blame] | 51 | GpsScanStateChanged gps_scan_state_changed = 6; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 52 | SyncStateChanged sync_state_changed = 7; |
| 53 | ScheduledJobStateChanged scheduled_job_state_changed = 8; |
| 54 | ScreenBrightnessChanged screen_brightness_changed = 9; |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 55 | WakelockStateChanged wakelock_state_changed = 10; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 56 | LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11; |
| 57 | MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12; |
| 58 | WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13; |
| 59 | // TODO: 14-19 are blank, but need not be |
| 60 | BatterySaverModeStateChanged battery_saver_mode_state_changed = 20; |
| 61 | DeviceIdleModeStateChanged device_idle_mode_state_changed = 21; |
| 62 | DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 63 | AudioStateChanged audio_state_changed = 23; |
| 64 | MediaCodecActivityChanged media_codec_activity_changed = 24; |
| 65 | CameraStateChanged camera_state_changed = 25; |
| 66 | FlashlightStateChanged flashlight_state_changed = 26; |
| 67 | UidProcessStateChanged uid_process_state_changed = 27; |
| 68 | ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28; |
| 69 | ScreenStateChanged screen_state_changed = 29; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 70 | BatteryLevelChanged battery_level_changed = 30; |
| 71 | ChargingStateChanged charging_state_changed = 31; |
| 72 | PluggedStateChanged plugged_state_changed = 32; |
| 73 | DeviceTemperatureReported device_temperature_reported = 33; |
| 74 | DeviceOnStatusChanged device_on_status_changed = 34; |
| 75 | WakeupAlarmOccurred wakeup_alarm_occurred = 35; |
| 76 | KernelWakeupReported kernel_wakeup_reported = 36; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 77 | WifiLockStateChanged wifi_lock_state_changed = 37; |
| 78 | WifiSignalStrengthChanged wifi_signal_strength_changed = 38; |
| 79 | WifiScanStateChanged wifi_scan_state_changed = 39; |
| 80 | PhoneSignalStrengthChanged phone_signal_strength_changed = 40; |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 81 | SettingChanged setting_changed = 41; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 82 | ActivityForegroundStateChanged activity_foreground_state_changed = 42; |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 83 | IsolatedUidChanged isolated_uid_changed = 43; |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 84 | PacketWakeupOccurred packet_wakeup_occurred = 44; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 85 | DropboxErrorChanged dropbox_error_changed = 45; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 86 | AnomalyDetected anomaly_detected = 46; |
| 87 | AppHook app_hook = 47; |
Olivier Gaillard | aed7f12 | 2017-12-12 14:26:22 +0000 | [diff] [blame] | 88 | AppStartChanged app_start_changed = 48; |
| 89 | AppStartCancelChanged app_start_cancel_changed = 49; |
| 90 | AppStartFullyDrawnChanged app_start_fully_drawn_changed = 50; |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 91 | LmkKillOccurred lmk_kill_occurred = 51; |
Chenjie Yu | 52cacc6 | 2017-12-08 18:11:45 -0800 | [diff] [blame] | 92 | PictureInPictureStateChanged picture_in_picture_state_changed = 52; |
Tej Singh | 4503e10 | 2018-01-04 14:35:01 -0800 | [diff] [blame] | 93 | WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53; |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 94 | LmkStateChanged lmk_state_changed = 54; |
| 95 | AppStartMemoryStateCaptured app_start_memory_state_captured = 55; |
Tej Singh | 1ea4289 | 2018-01-19 09:27:00 -0800 | [diff] [blame] | 96 | ShutdownSequenceReported shutdown_sequence_reported = 56; |
Tej Singh | 6483ea4 | 2018-01-25 17:45:49 -0800 | [diff] [blame] | 97 | BootSequenceReported boot_sequence_reported = 57; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 98 | // 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] | 99 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 100 | |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 101 | // Pulled events will start at field 10000. |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 102 | // Next: 10019 |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 103 | oneof pulled { |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 104 | WifiBytesTransfer wifi_bytes_transfer = 10000; |
| 105 | WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001; |
| 106 | MobileBytesTransfer mobile_bytes_transfer = 10002; |
| 107 | MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003; |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 108 | BluetoothBytesTransfer bluetooth_bytes_transfer = 10006; |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 109 | KernelWakelock kernel_wakelock = 10004; |
Chenjie Yu | c8b7f22 | 2018-01-11 23:25:57 -0800 | [diff] [blame] | 110 | SubsystemSleepState subsystem_sleep_state = 10005; |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 111 | CpuTimePerFreq cpu_time_per_freq = 10008; |
| 112 | CpuTimePerUid cpu_time_per_uid = 10009; |
| 113 | CpuTimePerUidFreq cpu_time_per_uid_freq = 10010; |
| 114 | WifiActivityEnergyInfo wifi_activity_energy_info = 10011; |
| 115 | ModemActivityInfo modem_activity_info = 10012; |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 116 | BluetoothActivityInfo bluetooth_activity_info = 10007; |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 117 | ProcessMemoryState process_memory_state = 10013; |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 118 | SystemElapsedRealtime system_elapsed_realtime = 10014; |
| 119 | SystemUptime system_uptime = 10015; |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 120 | CpuActiveTime cpu_active_time = 10016; |
| 121 | CpuClusterTime cpu_cluster_time = 10017; |
Chenjie Yu | 937d742 | 2018-01-10 16:37:53 -0800 | [diff] [blame] | 122 | DiskSpace disk_space = 10018; |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 123 | } |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 124 | } |
| 125 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 126 | /** |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 127 | * This proto represents a node of an attribution chain. |
| 128 | * Note: All attribution chains are represented as a repeated field of type |
| 129 | * AttributionNode. It is understood that in such arrays, the order is that |
| 130 | * 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] | 131 | */ |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 132 | message AttributionNode { |
| 133 | // The uid for a given element in the attribution chain. |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 134 | optional int32 uid = 1; |
Yangster-mac | 7604aea | 2017-12-11 22:55:49 -0800 | [diff] [blame] | 135 | |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 136 | // The (optional) string tag for an element in the attribution chain. If the |
| 137 | // element has no tag, it is encoded as an empty string. |
| 138 | optional string tag = 2; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 139 | } |
| 140 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 141 | /* |
| 142 | * ***************************************************************************** |
yro | de4ca10 | 2017-11-15 22:57:24 -0800 | [diff] [blame] | 143 | * 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] | 144 | * |
| 145 | * RULES: |
| 146 | * - The field ids for each atom must start at 1, and count upwards by 1. |
| 147 | * Skipping field ids is not allowed. |
| 148 | * - These form an API, so renaming, renumbering or removing fields is |
| 149 | * not allowed between android releases. (This is not currently enforced, |
| 150 | * but there will be a tool to enforce this restriction). |
| 151 | * - The types must be built-in protocol buffer types, namely, no sub-messages |
| 152 | * are allowed (yet). The bytes type is also not allowed. |
| 153 | * - The CamelCase name of the message type should match the |
Stefan Lafon | ae2df01 | 2017-11-14 09:17:21 -0800 | [diff] [blame] | 154 | * underscore_separated name as defined in Atom. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 155 | * - 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] | 156 | * be exactly one AttributionChain field. It must be field number 1. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 157 | * - A field that is a uid should be a string field, tagged with the [xxx] |
| 158 | * annotation. The generated code on android will be represented by UIDs, |
| 159 | * and those UIDs will be translated in xxx to those strings. |
| 160 | * |
| 161 | * CONVENTIONS: |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 162 | * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange. |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 163 | * - If there is a UID, it goes first. Think in an object-oriented fashion. |
| 164 | * ***************************************************************************** |
| 165 | */ |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 166 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 167 | /** |
| 168 | * Logs when the screen state changes. |
| 169 | * |
| 170 | * Logged from: |
| 171 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 172 | */ |
| 173 | message ScreenStateChanged { |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 174 | // New screen state, from frameworks/base/core/proto/android/view/enums.proto. |
| 175 | optional android.view.DisplayStateEnum state = 1; |
Stefan Lafon | cdb1a0e | 2017-09-27 20:24:15 -0700 | [diff] [blame] | 176 | } |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 177 | |
| 178 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 179 | * 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] | 180 | * |
| 181 | * Logged from: |
| 182 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 183 | */ |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 184 | message UidProcessStateChanged { |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 185 | optional int32 uid = 1; // TODO: should be a string tagged w/ uid annotation |
| 186 | |
Bookatz | db026a2 | 2018-01-10 19:01:56 -0800 | [diff] [blame] | 187 | // The state, from frameworks/base/core/proto/android/app/enums.proto. |
| 188 | optional android.app.ProcessStateEnum state = 2; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 192 | * Logs that a process started, finished, crashed, or ANRed. |
| 193 | * |
| 194 | * Logged from: |
| 195 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 196 | */ |
| 197 | message ProcessLifeCycleStateChanged { |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 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 { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 221 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 222 | |
| 223 | enum State { |
| 224 | OFF = 0; |
| 225 | ON = 1; |
| 226 | } |
| 227 | optional State state = 2; |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Logs when an unoptimized ble scan state changes. |
| 232 | * |
| 233 | * Logged from: |
| 234 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 235 | */ |
| 236 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 237 | message BleUnoptimizedScanStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 238 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 239 | |
| 240 | enum State { |
| 241 | OFF = 0; |
| 242 | ON = 1; |
| 243 | } |
| 244 | optional State state = 2; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Logs reporting of a ble scan finding results. |
| 249 | * |
| 250 | * Logged from: |
| 251 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 252 | */ |
| 253 | // TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). |
| 254 | message BleScanResultReceived { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 255 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 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 { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 268 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 269 | |
| 270 | // TODO: Is there a way to get the actual name of the sensor? |
| 271 | // The id (int) of the sensor. |
| 272 | optional int32 sensor_id = 2; |
| 273 | |
| 274 | enum State { |
| 275 | OFF = 0; |
| 276 | ON = 1; |
| 277 | } |
| 278 | optional State state = 3; |
| 279 | } |
| 280 | |
| 281 | |
| 282 | /** |
| 283 | * Logs when GPS state changes. |
| 284 | * |
| 285 | * Logged from: |
| 286 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 287 | */ |
| 288 | message GpsScanStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 289 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 290 | |
| 291 | enum State { |
| 292 | OFF = 0; |
| 293 | ON = 1; |
| 294 | } |
| 295 | optional State state = 2; |
| 296 | } |
| 297 | |
| 298 | |
| 299 | /** |
| 300 | * Logs when a sync manager sync state changes. |
| 301 | * |
| 302 | * Logged from: |
| 303 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 304 | */ |
| 305 | message SyncStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 306 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 307 | |
| 308 | // Name of the sync (as named in the app) |
| 309 | optional string name = 2; |
| 310 | |
| 311 | enum State { |
| 312 | OFF = 0; |
| 313 | ON = 1; |
| 314 | } |
| 315 | optional State state = 3; |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Logs when a job scheduler job state changes. |
| 320 | * |
| 321 | * Logged from: |
| 322 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 323 | */ |
| 324 | message ScheduledJobStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 325 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 326 | |
| 327 | // Name of the job (as named in the app) |
| 328 | optional string name = 2; |
| 329 | |
| 330 | enum State { |
Tej Singh | d5747a6 | 2018-01-08 20:57:35 -0800 | [diff] [blame] | 331 | FINISHED = 0; |
| 332 | STARTED = 1; |
| 333 | SCHEDULED = 2; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 334 | } |
| 335 | optional State state = 3; |
| 336 | |
| 337 | // TODO: Consider adding the stopReason (int) |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Logs when the audio state changes. |
| 342 | * |
| 343 | * Logged from: |
| 344 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 345 | */ |
| 346 | message AudioStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 347 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 348 | |
| 349 | enum State { |
| 350 | OFF = 0; |
| 351 | ON = 1; |
| 352 | } |
| 353 | optional State state = 2; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Logs when the video codec state changes. |
| 358 | * |
| 359 | * Logged from: |
| 360 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 361 | */ |
| 362 | message MediaCodecActivityChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 363 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 364 | |
| 365 | enum State { |
| 366 | OFF = 0; |
| 367 | ON = 1; |
| 368 | } |
| 369 | optional State state = 2; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Logs when the flashlight state changes. |
| 374 | * |
| 375 | * Logged from: |
| 376 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 377 | */ |
| 378 | message FlashlightStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 379 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 380 | |
| 381 | enum State { |
| 382 | OFF = 0; |
| 383 | ON = 1; |
| 384 | } |
| 385 | optional State state = 2; |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * Logs when the camera state changes. |
| 390 | * |
| 391 | * Logged from: |
| 392 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 393 | */ |
| 394 | message CameraStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 395 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 396 | |
| 397 | enum State { |
| 398 | OFF = 0; |
| 399 | ON = 1; |
| 400 | } |
| 401 | optional State state = 2; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * 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] | 406 | * |
| 407 | * Logged from: |
| 408 | * TODO |
| 409 | */ |
Bookatz | d674624 | 2017-10-24 18:39:35 -0700 | [diff] [blame] | 410 | message WakelockStateChanged { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 411 | repeated AttributionNode attribution_node = 1; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 412 | |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 413 | // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock. |
| 414 | // From frameworks/base/core/proto/android/os/enums.proto. |
| 415 | optional android.os.WakeLockLevelEnum level = 2; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 416 | |
| 417 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 418 | optional string tag = 3; |
| 419 | |
| 420 | enum State { |
Yangster-mac | cfdf3a4 | 2017-12-06 13:42:38 -0800 | [diff] [blame] | 421 | RELEASE = 0; |
| 422 | ACQUIRE = 1; |
| 423 | CHANGE_RELEASE = 2; |
| 424 | CHANGE_ACQUIRE = 3; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 425 | } |
| 426 | optional State state = 4; |
| 427 | } |
| 428 | |
| 429 | /** |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 430 | * Logs when a partial wakelock is considered 'long' (over 1 min). |
| 431 | * |
| 432 | * Logged from: |
| 433 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 434 | */ |
| 435 | message LongPartialWakelockStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 436 | repeated AttributionNode attribution_node = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 437 | |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 438 | // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). |
| 439 | optional string tag = 2; |
| 440 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 441 | // TODO: I have no idea what this is. |
| 442 | optional string history_tag = 3; |
| 443 | |
| 444 | enum State { |
| 445 | OFF = 0; |
| 446 | ON = 1; |
| 447 | } |
| 448 | optional State state = 4; |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 449 | } |
| 450 | |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 451 | /** |
| 452 | * Logs Battery Saver state change. |
| 453 | * |
| 454 | * Logged from: |
| 455 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 456 | */ |
| 457 | message BatterySaverModeStateChanged { |
| 458 | enum State { |
| 459 | OFF = 0; |
| 460 | ON = 1; |
| 461 | } |
| 462 | optional State state = 1; |
| 463 | } |
| 464 | |
| 465 | /** |
| 466 | * Logs Doze mode state change. |
| 467 | * |
| 468 | * Logged from: |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 469 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 470 | */ |
| 471 | message DeviceIdleModeStateChanged { |
Bookatz | 8bdae8d | 2018-01-16 11:24:30 -0800 | [diff] [blame] | 472 | optional android.server.DeviceIdleModeEnum state = 1; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | |
| 476 | /** |
| 477 | * Logs state change of Doze mode including maintenance windows. |
| 478 | * |
| 479 | * Logged from: |
| 480 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 481 | */ |
| 482 | message DeviceIdlingModeStateChanged { |
Bookatz | 8bdae8d | 2018-01-16 11:24:30 -0800 | [diff] [blame] | 483 | optional android.server.DeviceIdleModeEnum state = 1; |
Bookatz | c1a050a | 2017-10-10 15:49:28 -0700 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | /** |
| 487 | * Logs screen brightness level. |
| 488 | * |
| 489 | * Logged from: |
| 490 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 491 | */ |
| 492 | message ScreenBrightnessChanged { |
| 493 | // Screen brightness level. Should be in [-1, 255] according to PowerManager.java. |
| 494 | optional int32 level = 1; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | /** |
| 498 | * Logs battery level (percent full, from 0 to 100). |
| 499 | * |
| 500 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 501 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 502 | */ |
| 503 | message BatteryLevelChanged { |
| 504 | // Battery level. Should be in [0, 100]. |
| 505 | optional int32 battery_level = 1; |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * Logs change in charging status of the device. |
| 510 | * |
| 511 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 512 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 513 | */ |
| 514 | message ChargingStateChanged { |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 515 | // State of the battery, from frameworks/base/core/proto/android/os/enums.proto. |
| 516 | optional android.os.BatteryStatusEnum state = 1; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | /** |
| 520 | * Logs whether the device is plugged in, and what power source it is using. |
| 521 | * |
| 522 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 523 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 524 | */ |
| 525 | message PluggedStateChanged { |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 526 | // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto. |
| 527 | optional android.os.BatteryPluggedStateEnum state = 1; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | /** |
| 531 | * Logs the temperature of the device, in tenths of a degree Celsius. |
| 532 | * |
| 533 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 534 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 535 | */ |
| 536 | message DeviceTemperatureReported { |
| 537 | // Temperature in tenths of a degree C. |
| 538 | optional int32 temperature = 1; |
| 539 | } |
| 540 | |
| 541 | // TODO: Define this more precisely. |
| 542 | // TODO: Log the ON state somewhere. It isn't currently logged anywhere. |
| 543 | /** |
| 544 | * Logs when the device turns off or on. |
| 545 | * |
| 546 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 547 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 548 | */ |
| 549 | message DeviceOnStatusChanged { |
| 550 | enum State { |
| 551 | OFF = 0; |
| 552 | ON = 1; |
| 553 | } |
| 554 | optional State state = 1; |
| 555 | } |
| 556 | |
| 557 | /** |
| 558 | * Logs when an app's wakeup alarm fires. |
| 559 | * |
| 560 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 561 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 562 | */ |
| 563 | message WakeupAlarmOccurred { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 564 | repeated AttributionNode attribution_node = 1; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 565 | |
| 566 | // Name of the wakeup alarm. |
| 567 | optional string tag = 2; |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * Logs when an an app causes the mobile radio to change state. |
| 572 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio. |
| 573 | * |
| 574 | * Logged from: |
| 575 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 576 | */ |
| 577 | message MobileRadioPowerStateChanged { |
| 578 | // TODO: Add attribution instead of uid? |
| 579 | optional int32 uid = 1; |
| 580 | |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 581 | // Power state, from frameworks/base/core/proto/android/telephony/enums.proto. |
| 582 | optional android.telephony.DataConnectionPowerStateEnum state = 2; |
Bookatz | ddccf0a | 2017-11-28 16:48:14 -0800 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | /** |
| 586 | * Logs when an an app causes the wifi radio to change state. |
| 587 | * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio. |
| 588 | * |
| 589 | * Logged from: |
| 590 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 591 | */ |
| 592 | message WifiRadioPowerStateChanged { |
| 593 | // TODO: Add attribution instead of uid? |
| 594 | optional int32 uid = 1; |
| 595 | |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 596 | // Power state, from frameworks/base/core/proto/android/telephony/enums.proto. |
| 597 | optional android.telephony.DataConnectionPowerStateEnum state = 2; |
Bookatz | 8c6571b | 2017-10-24 15:04:41 -0700 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | /** |
| 601 | * Logs kernel wakeup reasons and aborts. |
| 602 | * |
| 603 | * Logged from: |
| 604 | * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java |
| 605 | */ |
| 606 | message KernelWakeupReported { |
| 607 | // Name of the kernel wakeup reason (or abort). |
| 608 | optional string wakeup_reason_name = 1; |
| 609 | |
| 610 | // Duration (in microseconds) for the wake-up interrupt to be serviced. |
| 611 | optional int64 duration_usec = 2; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | /** |
| 615 | * Logs wifi locks held by an app. |
| 616 | * |
| 617 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 618 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 619 | */ |
| 620 | message WifiLockStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 621 | repeated AttributionNode attribution_node = 1; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 622 | |
| 623 | enum State { |
| 624 | OFF = 0; |
| 625 | ON = 1; |
| 626 | } |
| 627 | optional State state = 2; |
| 628 | } |
| 629 | |
| 630 | /** |
| 631 | * Logs wifi signal strength changes. |
| 632 | * |
| 633 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 634 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 635 | */ |
| 636 | message WifiSignalStrengthChanged { |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 637 | // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto. |
| 638 | optional android.telephony.SignalStrengthEnum signal_strength = 1; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | /** |
| 642 | * Logs wifi scans performed by an app. |
| 643 | * |
| 644 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 645 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 646 | */ |
| 647 | message WifiScanStateChanged { |
Yangster-mac | afad8c6 | 2018-01-05 22:30:49 -0800 | [diff] [blame] | 648 | repeated AttributionNode attribution_node = 1; |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 649 | |
| 650 | enum State { |
| 651 | OFF = 0; |
| 652 | ON = 1; |
| 653 | } |
| 654 | optional State state = 2; |
| 655 | } |
| 656 | |
| 657 | /** |
Tej Singh | 4503e10 | 2018-01-04 14:35:01 -0800 | [diff] [blame] | 658 | * Logs wifi multicast locks held by an app |
| 659 | * |
| 660 | * Logged from: |
| 661 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 662 | */ |
| 663 | message WifiMulticastLockStateChanged { |
| 664 | repeated AttributionNode attribution_node = 1; |
| 665 | |
| 666 | enum State { |
| 667 | OFF = 0; |
| 668 | ON = 1; |
| 669 | } |
| 670 | optional State state = 2; |
| 671 | } |
| 672 | |
| 673 | /** |
Tej Singh | 1ea4289 | 2018-01-19 09:27:00 -0800 | [diff] [blame] | 674 | * Logs shutdown reason and duration on next boot. |
| 675 | * |
| 676 | * Logged from: |
| 677 | * frameworks/base/core/java/com/android/server/BootReceiver.java |
| 678 | */ |
| 679 | message ShutdownSequenceReported { |
| 680 | // True if shutdown is for a reboot. Default: false if we do not know. |
| 681 | optional bool reboot = 1; |
| 682 | |
| 683 | // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>". |
| 684 | optional string reason = 2; |
| 685 | |
| 686 | // Beginning of shutdown time in ms using wall clock time since unix epoch. |
| 687 | // Default: 0 if no start time received. |
| 688 | optional int64 start_time_ms = 3; |
| 689 | |
| 690 | // Duration of shutdown in ms. Default: 0 if no duration received. |
| 691 | optional int64 duration_ms = 4; |
| 692 | } |
| 693 | |
Tej Singh | 6483ea4 | 2018-01-25 17:45:49 -0800 | [diff] [blame] | 694 | |
| 695 | /** |
| 696 | * Logs boot reason and duration. |
| 697 | * |
| 698 | * Logged from: |
| 699 | * system/core/bootstat/bootstat.cpp |
| 700 | */ |
| 701 | message BootSequenceReported { |
| 702 | // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list |
| 703 | // Default: "<EMPTY>" if not available. |
| 704 | optional string bootloader_reason = 1; |
| 705 | |
| 706 | // Reason for system boot. Eg. bootloader, reboot,userrequested |
| 707 | // Default: "<EMPTY>" if not available. |
| 708 | optional string system_reason = 2; |
| 709 | |
| 710 | // End of boot time in ms from unix epoch using system wall clock. |
| 711 | optional int64 end_time_ms = 3; |
| 712 | |
| 713 | // Total boot duration in ms. |
| 714 | optional int64 total_duration_ms = 4; |
| 715 | |
| 716 | // Bootloader duration in ms. |
| 717 | optional int64 bootloader_duration_ms = 5; |
| 718 | |
| 719 | // Time since last boot in ms. Default: 0 if not available. |
| 720 | optional int64 time_since_last_boot = 6; |
| 721 | } |
| 722 | |
Tej Singh | 1ea4289 | 2018-01-19 09:27:00 -0800 | [diff] [blame] | 723 | /** |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 724 | * Logs phone signal strength changes. |
| 725 | * |
| 726 | * Logged from: |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 727 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
Bookatz | e588524 | 2017-10-24 20:10:31 -0700 | [diff] [blame] | 728 | */ |
| 729 | message PhoneSignalStrengthChanged { |
Bookatz | 1a1b046 | 2018-01-12 11:47:03 -0800 | [diff] [blame] | 730 | // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto. |
| 731 | optional android.telephony.SignalStrengthEnum signal_strength = 1; |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | /** |
| 735 | * Logs that a setting was updated. |
| 736 | * Logged from: |
| 737 | * frameworks/base/core/java/android/provider/Settings.java |
| 738 | * The tag and is_default allow resetting of settings to default values based on the specified |
| 739 | * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details. |
| 740 | */ |
| 741 | message SettingChanged { |
| 742 | // The name of the setting. |
| 743 | optional string setting = 1; |
| 744 | |
| 745 | // The change being imposed on this setting. May represent a number, eg "3". |
| 746 | optional string value = 2; |
| 747 | |
| 748 | // The new value of this setting. For most settings, this is same as value. For some settings, |
| 749 | // value is +X or -X where X represents an element in a set. For example, if the previous value |
| 750 | // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C. |
| 751 | // The +/- feature is currently only used for location_providers_allowed. |
| 752 | optional string new_value = 3; |
| 753 | |
| 754 | // The previous value of this setting. |
| 755 | optional string prev_value = 4; |
| 756 | |
| 757 | // The tag used with the is_default for resetting sets of settings. This is generally null. |
| 758 | optional string tag = 5; |
| 759 | |
Bookatz | 9086762 | 2018-01-31 15:05:57 -0800 | [diff] [blame^] | 760 | // True if this setting with tag should be resettable. |
| 761 | optional bool is_default = 6; |
David Chen | c28b2bb | 2017-10-24 12:52:52 -0700 | [diff] [blame] | 762 | |
| 763 | // The user ID associated. Defined in android/os/UserHandle.java |
| 764 | optional int32 user = 7; |
| 765 | } |
Chenjie Yu | b3dda41 | 2017-10-24 13:41:59 -0700 | [diff] [blame] | 766 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 767 | /** |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 768 | * Logs activity going to foreground or background |
| 769 | * |
| 770 | * Logged from: |
| 771 | * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java |
| 772 | */ |
| 773 | message ActivityForegroundStateChanged { |
Yangster-mac | 2087716 | 2017-12-22 17:19:39 -0800 | [diff] [blame] | 774 | optional int32 uid = 1; |
| 775 | optional string pkg_name = 2; |
| 776 | optional string class_name = 3; |
| 777 | |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 778 | enum Activity { |
| 779 | MOVE_TO_BACKGROUND = 0; |
| 780 | MOVE_TO_FOREGROUND = 1; |
| 781 | } |
Chenjie Yu | 3d4f604 | 2017-10-27 15:39:34 -0700 | [diff] [blame] | 782 | optional Activity activity = 4; |
| 783 | } |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 784 | |
| 785 | /** |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 786 | * Logs when an error is written to dropbox. |
| 787 | * Logged from: |
| 788 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
| 789 | */ |
| 790 | message DropboxErrorChanged { |
| 791 | // The uid if available. -1 means not available. |
| 792 | optional int32 uid = 1; |
| 793 | |
| 794 | // Tag used when recording this error to dropbox. Contains data_ or system_ prefix. |
| 795 | optional string tag = 2; |
| 796 | |
| 797 | // The name of the process. |
| 798 | optional string process_name = 3; |
| 799 | |
| 800 | // The pid if available. -1 means not available. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 801 | optional sint32 pid = 4; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 802 | |
| 803 | // 1 indicates is instant app. -1 indicates Not applicable. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 804 | optional sint32 is_instant_app = 5; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 805 | |
| 806 | // The activity name if available. |
| 807 | optional string activity_name = 6; |
| 808 | |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 809 | // The package name if available. |
| 810 | optional string package_name = 7; |
| 811 | |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 812 | // 1 indicates in foreground. -1 indicates not available. |
David Chen | 6e3e6cb | 2018-01-03 16:14:06 -0800 | [diff] [blame] | 813 | optional sint32 is_foreground = 8; |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 814 | } |
| 815 | |
David Chen | 0a368b2 | 2017-12-06 16:28:16 -0800 | [diff] [blame] | 816 | /* |
| 817 | * Allows other apps to push events into statsd. |
| 818 | * Logged from: |
| 819 | * frameworks/base/core/java/android/util/StatsLog.java |
| 820 | */ |
| 821 | message AppHook { |
| 822 | // The uid of the application that sent this custom atom. |
| 823 | optional int32 uid = 1; |
| 824 | |
| 825 | // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16). |
| 826 | optional int32 label = 2; |
| 827 | |
| 828 | // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom |
| 829 | // predicates for the metrics). |
| 830 | enum State { |
| 831 | UNKNOWN = 0; |
| 832 | UNSPECIFIED = 1; // For events that are known to not represent START/STOP. |
| 833 | STOP = 2; |
| 834 | START = 3; |
| 835 | } |
| 836 | optional State state = 3; |
| 837 | } |
| 838 | |
David Chen | 9e3808c | 2017-11-20 17:25:34 -0800 | [diff] [blame] | 839 | /** |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 840 | * Logs when statsd detects an anomaly. |
| 841 | * |
| 842 | * Logged from: |
| 843 | * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp |
| 844 | */ |
| 845 | message AnomalyDetected { |
| 846 | // Uid that owns the config whose anomaly detection alert fired. |
| 847 | optional int32 config_uid = 1; |
| 848 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame] | 849 | // Id of the config whose anomaly detection alert fired. |
| 850 | optional int64 config_id = 2; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 851 | |
Yangster-mac | 94e197c | 2018-01-02 16:03:03 -0800 | [diff] [blame] | 852 | // Id of the alert (i.e. name of the anomaly that was detected). |
| 853 | optional int64 alert_id = 3; |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 854 | } |
| 855 | |
Olivier Gaillard | aed7f12 | 2017-12-12 14:26:22 +0000 | [diff] [blame] | 856 | message AppStartChanged { |
| 857 | // The uid if available. -1 means not available. |
| 858 | optional int32 uid = 1; |
| 859 | |
| 860 | // The app package name. |
| 861 | optional string pkg_name = 2; |
| 862 | |
| 863 | enum TransitionType { |
| 864 | APP_START_TRANSITION_TYPE_UNKNOWN = 0; |
| 865 | WARM = 1; |
| 866 | HOT = 2; |
| 867 | COLD = 3; |
| 868 | } |
| 869 | // The transition type. |
| 870 | optional TransitionType type = 3; |
| 871 | |
| 872 | // The activity name. |
| 873 | optional string activity_name = 4; |
| 874 | |
| 875 | // The name of the calling app. Empty if not set. |
| 876 | optional string calling_pkg_name = 5; |
| 877 | |
| 878 | // Whether the app is an instant app. |
| 879 | optional bool is_instant_app = 6; |
| 880 | |
| 881 | // Device uptime when activity started. |
| 882 | optional int64 activity_start_msec = 7; |
| 883 | |
Bookatz | 80d11a0 | 2018-01-16 10:46:35 -0800 | [diff] [blame] | 884 | optional android.app.AppTransitionReasonEnum reason = 8; |
Olivier Gaillard | aed7f12 | 2017-12-12 14:26:22 +0000 | [diff] [blame] | 885 | |
| 886 | optional int32 transition_delay_msec = 9; |
| 887 | // -1 if not set. |
| 888 | optional int32 starting_window_delay_msec = 10; |
| 889 | // -1 if not set. |
| 890 | optional int32 bind_application_delay_msec = 11; |
| 891 | optional int32 windows_drawn_delay_msec = 12; |
| 892 | |
| 893 | // Empty if not set. |
| 894 | optional string launch_token = 13; |
| 895 | |
| 896 | } |
| 897 | |
| 898 | message AppStartCancelChanged { |
| 899 | // The uid if available. -1 means not available. |
| 900 | optional int32 uid = 1; |
| 901 | |
| 902 | // The app package name. |
| 903 | optional string pkg_name = 2; |
| 904 | |
| 905 | enum TransitionType { |
| 906 | APP_START_TRANSITION_TYPE_UNKNOWN = 0; |
| 907 | WARM = 1; |
| 908 | HOT = 2; |
| 909 | COLD = 3; |
| 910 | } |
| 911 | // The transition type. |
| 912 | optional TransitionType type = 3; |
| 913 | |
| 914 | // The activity name. |
| 915 | optional string activity_name = 4; |
| 916 | } |
| 917 | |
| 918 | message AppStartFullyDrawnChanged { |
| 919 | // The uid if available. -1 means not available. |
| 920 | optional int32 uid = 1; |
| 921 | |
| 922 | // The app package name. |
| 923 | optional string pkg_name = 2; |
| 924 | |
| 925 | enum TransitionType { |
| 926 | APP_START_TRANSITION_TYPE_UNKNOWN = 0; |
| 927 | WITH_BUNDLE = 1; |
| 928 | WITHOUT_BUNDLE = 2; |
| 929 | } |
| 930 | // The transition type. |
| 931 | optional TransitionType type = 3; |
| 932 | |
| 933 | // The activity name. |
| 934 | optional string activity_name = 4; |
| 935 | |
| 936 | optional bool transition_process_running = 5; |
| 937 | |
| 938 | // App startup time (until call to Activity#reportFullyDrawn()). |
| 939 | optional int64 app_startup_time_ms = 6; |
| 940 | } |
| 941 | |
Bookatz | 8fcd09a | 2017-12-18 13:01:10 -0800 | [diff] [blame] | 942 | /** |
Chenjie Yu | 52cacc6 | 2017-12-08 18:11:45 -0800 | [diff] [blame] | 943 | * Logs a picture-in-picture action |
| 944 | * Logged from: |
| 945 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
| 946 | * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java |
| 947 | * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java |
| 948 | */ |
| 949 | message PictureInPictureStateChanged { |
| 950 | optional int32 uid = 1; |
| 951 | |
| 952 | optional string package_name = 2; |
| 953 | |
| 954 | optional string class_name = 3; |
| 955 | |
| 956 | // Picture-in-Picture action occurred, similar to |
| 957 | // frameworks/base/proto/src/metrics_constants.proto |
| 958 | enum State { |
| 959 | ENTERED = 1; |
| 960 | EXPANDED_TO_FULL_SCREEN = 2; |
| 961 | MINIMIZED = 3; |
| 962 | DISMISSED = 4; |
| 963 | } |
| 964 | optional State state = 4; |
| 965 | } |
| 966 | |
| 967 | /** |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 968 | * Pulls bytes transferred via wifi (Sum of foreground and background usage). |
| 969 | * |
| 970 | * Pulled from: |
| 971 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 972 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 973 | message WifiBytesTransfer { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 974 | optional int32 uid = 1; |
| 975 | |
| 976 | optional int64 rx_bytes = 2; |
| 977 | |
| 978 | optional int64 rx_packets = 3; |
| 979 | |
| 980 | optional int64 tx_bytes = 4; |
| 981 | |
| 982 | optional int64 tx_packets = 5; |
| 983 | } |
| 984 | |
| 985 | /** |
| 986 | * Pulls bytes transferred via wifi (separated by foreground and background usage). |
| 987 | * |
| 988 | * Pulled from: |
| 989 | * StatsCompanionService (using BatteryStats to get which interfaces are wifi) |
| 990 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 991 | message WifiBytesTransferByFgBg { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 992 | optional int32 uid = 1; |
| 993 | |
| 994 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 995 | optional int32 is_foreground = 2; |
| 996 | |
| 997 | optional int64 rx_bytes = 3; |
| 998 | |
| 999 | optional int64 rx_packets = 4; |
| 1000 | |
| 1001 | optional int64 tx_bytes = 5; |
| 1002 | |
| 1003 | optional int64 tx_packets = 6; |
| 1004 | } |
| 1005 | |
| 1006 | /** |
| 1007 | * Pulls bytes transferred via mobile networks (Sum of foreground and background usage). |
| 1008 | * |
| 1009 | * Pulled from: |
| 1010 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 1011 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1012 | message MobileBytesTransfer { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 1013 | optional int32 uid = 1; |
| 1014 | |
| 1015 | optional int64 rx_bytes = 2; |
| 1016 | |
| 1017 | optional int64 rx_packets = 3; |
| 1018 | |
| 1019 | optional int64 tx_bytes = 4; |
| 1020 | |
| 1021 | optional int64 tx_packets = 5; |
| 1022 | } |
| 1023 | |
| 1024 | /** |
| 1025 | * Pulls bytes transferred via mobile networks (separated by foreground and background usage). |
| 1026 | * |
| 1027 | * Pulled from: |
| 1028 | * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) |
| 1029 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1030 | message MobileBytesTransferByFgBg { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 1031 | optional int32 uid = 1; |
| 1032 | |
| 1033 | // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. |
| 1034 | optional int32 is_foreground = 2; |
| 1035 | |
| 1036 | optional int64 rx_bytes = 3; |
| 1037 | |
| 1038 | optional int64 rx_packets = 4; |
| 1039 | |
| 1040 | optional int64 tx_bytes = 5; |
| 1041 | |
| 1042 | optional int64 tx_packets = 6; |
| 1043 | } |
| 1044 | |
| 1045 | /** |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1046 | * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller. |
| 1047 | * |
| 1048 | * Pulled from: |
| 1049 | * StatsCompanionService |
| 1050 | */ |
| 1051 | message BluetoothBytesTransfer { |
| 1052 | optional int32 uid = 1; |
| 1053 | |
| 1054 | optional int64 rx_bytes = 2; |
| 1055 | |
| 1056 | optional int64 tx_bytes = 3; |
| 1057 | } |
| 1058 | |
| 1059 | /** |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 1060 | * Pulls the kernel wakelock durations. This atom is adapted from |
| 1061 | * android/internal/os/KernelWakelockStats.java |
| 1062 | * |
| 1063 | * Pulled from: |
| 1064 | * StatsCompanionService using KernelWakelockReader. |
| 1065 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1066 | message KernelWakelock { |
David Chen | c8a4324 | 2017-10-17 16:23:28 -0700 | [diff] [blame] | 1067 | optional string name = 1; |
| 1068 | |
| 1069 | optional int32 count = 2; |
| 1070 | |
| 1071 | optional int32 version = 3; |
| 1072 | |
| 1073 | optional int64 time = 4; |
| 1074 | } |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 1075 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1076 | /** |
Chenjie Yu | c8b7f22 | 2018-01-11 23:25:57 -0800 | [diff] [blame] | 1077 | * Pulls low power state information. This includes platform and subsystem sleep state information, |
| 1078 | * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 1079 | * hardware/interfaces/power/1.0/types.hal |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 1080 | * hardware/interfaces/power/1.1/types.hal |
| 1081 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1082 | message SubsystemSleepState { |
Chenjie Yu | c8b7f22 | 2018-01-11 23:25:57 -0800 | [diff] [blame] | 1083 | // Name should be in the format of XXX.YYY where XXX is subsystem name, |
| 1084 | // YYY is corresponding voter name. |
| 1085 | // If there are no voters, the format should just be XXX (with no dot). |
| 1086 | // XXX and YYY should not contain a "." in it. |
| 1087 | optional string name = 1; |
| 1088 | // The number of times it entered, or voted for entering the sleep state |
| 1089 | optional uint64 count = 2; |
| 1090 | // The length of time spent in, or spent voting for, the sleep state |
| 1091 | optional uint64 timeMs = 3; |
Chenjie Yu | 5305e1d | 2017-10-31 13:49:36 -0700 | [diff] [blame] | 1092 | } |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 1093 | |
| 1094 | /** |
| 1095 | * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky |
| 1096 | * behavior in its own uid. However, the metrics of these isolated uid's almost always should be |
| 1097 | * attributed back to the parent (host) uid. One example is Chrome. |
| 1098 | * |
| 1099 | * Logged from: |
| 1100 | * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java |
| 1101 | */ |
| 1102 | message IsolatedUidChanged { |
| 1103 | // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid. |
| 1104 | optional int32 parent_uid = 1; |
| 1105 | |
| 1106 | optional int32 isolated_uid = 2; |
| 1107 | |
Bookatz | 9086762 | 2018-01-31 15:05:57 -0800 | [diff] [blame^] | 1108 | // We expect an isolated uid to be removed before if it's used for another parent uid. |
| 1109 | enum Event { |
| 1110 | REMOVED = 0; |
| 1111 | CREATED = 1; |
| 1112 | } |
| 1113 | optional Event event = 3; |
David Chen | 2158296 | 2017-11-01 17:32:46 -0700 | [diff] [blame] | 1114 | } |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1115 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1116 | /** |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1117 | * Pulls Cpu time per frequency. |
Chenjie Yu | 1ee9b74 | 2018-01-10 16:02:57 -0800 | [diff] [blame] | 1118 | * Pulls the time the cpu spend on the frequency index. Frequency index |
| 1119 | * starts from highest to lowest. The value should be monotonically |
| 1120 | * increasing since boot. However, if there is a cpu |
| 1121 | * hotplug event, the value would be reset as well. |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1122 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1123 | message CpuTimePerFreq { |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1124 | optional uint32 cluster = 1; |
| 1125 | optional uint32 freq_index = 2; |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1126 | optional uint64 time_ms = 3; |
Chenjie Yu | 7f8def9 | 2017-11-03 09:33:15 -0700 | [diff] [blame] | 1127 | } |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1128 | |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1129 | /** |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1130 | * Pulls Cpu Time Per Uid. |
| 1131 | * Note that isolated process uid time should be attributed to host uids. |
| 1132 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1133 | message CpuTimePerUid { |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1134 | optional uint64 uid = 1; |
| 1135 | optional uint64 user_time_ms = 2; |
| 1136 | optional uint64 sys_time_ms = 3; |
| 1137 | } |
| 1138 | |
| 1139 | /** |
| 1140 | * Pulls Cpu Time Per Uid per frequency. |
| 1141 | * Note that isolated process uid time should be attributed to host uids. |
| 1142 | * For each uid, we order the time by descending frequencies. |
| 1143 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1144 | message CpuTimePerUidFreq { |
Chenjie Yu | e33bc3b | 2017-11-06 17:56:44 -0800 | [diff] [blame] | 1145 | optional uint64 uid = 1; |
| 1146 | optional uint64 freq_idx = 2; |
| 1147 | optional uint64 time_ms = 3; |
| 1148 | } |
Hugo Benichi | 884970e | 2017-11-14 22:42:46 +0900 | [diff] [blame] | 1149 | |
| 1150 | /* |
| 1151 | * Logs the reception of an incoming network packet causing the main system to wake up for |
| 1152 | * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd |
| 1153 | * and processed by WakeupController.cpp. |
| 1154 | */ |
| 1155 | message PacketWakeupOccurred { |
| 1156 | // The uid owning the socket into which the packet was delivered, or -1 if the packet was |
| 1157 | // delivered nowhere. |
| 1158 | optional int32 uid = 1; |
| 1159 | // The interface name on which the packet was received. |
| 1160 | optional string iface = 2; |
| 1161 | // The ethertype value of the packet. |
| 1162 | optional int32 ethertype = 3; |
| 1163 | // String representation of the destination MAC address of the packet. |
| 1164 | optional string destination_hardware_address = 4; |
| 1165 | // String representation of the source address of the packet if this was an IP packet. |
| 1166 | optional string source_ip = 5; |
| 1167 | // String representation of the destination address of the packet if this was an IP packet. |
| 1168 | optional string destination_ip = 6; |
| 1169 | // The value of the protocol field if this was an IPv4 packet or the value of the Next Header |
| 1170 | // field if this was an IPv6 packet. The range of possible values is the same for both IP |
| 1171 | // families. |
| 1172 | optional int32 ip_next_header = 7; |
| 1173 | // The source port if this was a TCP or UDP packet. |
| 1174 | optional int32 source_port = 8; |
| 1175 | // The destination port if this was a TCP or UDP packet. |
| 1176 | optional int32 destination_port = 9; |
| 1177 | } |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1178 | |
| 1179 | /** |
| 1180 | * Pulls Wifi Controller Activity Energy Info |
| 1181 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1182 | message WifiActivityEnergyInfo { |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1183 | // timestamp(wall clock) of record creation |
| 1184 | optional uint64 timestamp_ms = 1; |
| 1185 | // stack reported state |
| 1186 | // TODO: replace this with proto enum |
| 1187 | optional int32 stack_state = 2; |
| 1188 | // tx time in ms |
| 1189 | optional uint64 controller_tx_time_ms = 3; |
| 1190 | // rx time in ms |
| 1191 | optional uint64 controller_rx_time_ms = 4; |
| 1192 | // idle time in ms |
| 1193 | optional uint64 controller_idle_time_ms = 5; |
| 1194 | // product of current(mA), voltage(V) and time(ms) |
| 1195 | optional uint64 controller_energy_used = 6; |
| 1196 | } |
| 1197 | |
| 1198 | /** |
| 1199 | * Pulls Modem Activity Energy Info |
| 1200 | */ |
Chenjie Yu | 31d14d7 | 2017-12-12 17:54:33 -0800 | [diff] [blame] | 1201 | message ModemActivityInfo { |
Chenjie Yu | 05013b3 | 2017-11-21 10:21:41 -0800 | [diff] [blame] | 1202 | // timestamp(wall clock) of record creation |
| 1203 | optional uint64 timestamp_ms = 1; |
| 1204 | // sleep time in ms. |
| 1205 | optional uint64 sleep_time_ms = 2; |
| 1206 | // idle time in ms |
| 1207 | optional uint64 controller_idle_time_ms = 3; |
| 1208 | /** |
| 1209 | * Tx power index |
| 1210 | * index 0 = tx_power < 0dBm |
| 1211 | * index 1 = 0dBm < tx_power < 5dBm |
| 1212 | * index 2 = 5dBm < tx_power < 15dBm |
| 1213 | * index 3 = 15dBm < tx_power < 20dBm |
| 1214 | * index 4 = tx_power > 20dBm |
| 1215 | */ |
| 1216 | // tx time in ms at power level 0 |
| 1217 | optional uint64 controller_tx_time_pl0_ms = 4; |
| 1218 | // tx time in ms at power level 1 |
| 1219 | optional uint64 controller_tx_time_pl1_ms = 5; |
| 1220 | // tx time in ms at power level 2 |
| 1221 | optional uint64 controller_tx_time_pl2_ms = 6; |
| 1222 | // tx time in ms at power level 3 |
| 1223 | optional uint64 controller_tx_time_pl3_ms = 7; |
| 1224 | // tx time in ms at power level 4 |
| 1225 | optional uint64 controller_tx_time_pl4_ms = 8; |
| 1226 | // rx time in ms at power level 5 |
| 1227 | optional uint64 controller_rx_time_ms = 9; |
| 1228 | // product of current(mA), voltage(V) and time(ms) |
| 1229 | optional uint64 energy_used = 10; |
Joe Onorato | 62c220b | 2017-11-18 20:32:56 -0800 | [diff] [blame] | 1230 | } |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1231 | |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1232 | /** |
| 1233 | * Pulls Bluetooth Activity Energy Info |
| 1234 | * Note: BluetoothBytesTransfer is pulled at the same time from the controller. |
| 1235 | */ |
| 1236 | message BluetoothActivityInfo { |
| 1237 | // timestamp(wall clock) of record creation |
| 1238 | optional uint64 timestamp_ms = 1; |
| 1239 | // bluetooth stack state |
| 1240 | optional int32 bluetooth_stack_state = 2; |
| 1241 | // tx time in ms |
| 1242 | optional uint64 controller_tx_time_ms = 3; |
| 1243 | // rx time in ms |
| 1244 | optional uint64 controller_rx_time_ms = 4; |
| 1245 | // idle time in ms |
| 1246 | optional uint64 controller_idle_time_ms = 5; |
| 1247 | // product of current(mA), voltage(V) and time(ms) |
| 1248 | optional uint64 energy_used = 6; |
| 1249 | } |
| 1250 | |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1251 | /* |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1252 | * Logs the memory stats for an app on startup. |
| 1253 | * Logged from: |
| 1254 | * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1255 | */ |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1256 | message AppStartMemoryStateCaptured { |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1257 | // The uid if available. -1 means not available. |
| 1258 | optional int32 uid = 1; |
| 1259 | |
Rajeev Kumar | 27572b9 | 2018-01-23 16:12:51 -0800 | [diff] [blame] | 1260 | // The process name. |
| 1261 | optional string process_name = 2; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1262 | |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1263 | // The activity name. |
| 1264 | optional string activity_name = 3; |
| 1265 | |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1266 | // # of page-faults |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1267 | optional int64 pgfault = 4; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1268 | |
| 1269 | // # of major page-faults |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1270 | optional int64 pgmajfault = 5; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1271 | |
Rajeev Kumar | 9023599 | 2018-01-29 11:06:48 -0800 | [diff] [blame] | 1272 | // RSS |
| 1273 | optional int64 rss_in_bytes = 6; |
| 1274 | |
| 1275 | // CACHE |
| 1276 | optional int64 cache_in_bytes = 7; |
| 1277 | |
| 1278 | // SWAP |
| 1279 | optional int64 swap_in_bytes = 8; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1280 | } |
| 1281 | |
| 1282 | /* |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1283 | * Logs the memory stats for a process. |
| 1284 | */ |
| 1285 | message ProcessMemoryState { |
| 1286 | // The uid if available. -1 means not available. |
| 1287 | optional int32 uid = 1; |
| 1288 | |
| 1289 | // The process name. |
| 1290 | optional string process_name = 2; |
| 1291 | |
| 1292 | // oom adj score. |
| 1293 | optional int32 oom_score = 3; |
| 1294 | |
| 1295 | // # of page-faults |
| 1296 | optional int64 pgfault = 4; |
| 1297 | |
| 1298 | // # of major page-faults |
| 1299 | optional int64 pgmajfault = 5; |
| 1300 | |
Rajeev Kumar | 9023599 | 2018-01-29 11:06:48 -0800 | [diff] [blame] | 1301 | // RSS |
| 1302 | optional int64 rss_in_bytes = 6; |
| 1303 | |
| 1304 | // CACHE |
| 1305 | optional int64 cache_in_bytes = 7; |
| 1306 | |
| 1307 | // SWAP |
| 1308 | optional int64 swap_in_bytes = 8; |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1309 | } |
| 1310 | |
| 1311 | /* |
| 1312 | * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries |
| 1313 | * for LMK event. |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1314 | * Logged from: |
| 1315 | * system/core/lmkd/lmkd.c |
| 1316 | */ |
Rajeev Kumar | 8a9fa05 | 2018-01-25 19:03:09 -0800 | [diff] [blame] | 1317 | message LmkStateChanged { |
| 1318 | enum State { |
| 1319 | UNKNOWN = 0; |
| 1320 | START = 1; |
| 1321 | STOP = 2; |
| 1322 | } |
| 1323 | optional State state = 1; |
| 1324 | } |
| 1325 | |
| 1326 | /* |
| 1327 | * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure. |
| 1328 | * Logged from: |
| 1329 | * system/core/lmkd/lmkd.c |
| 1330 | */ |
| 1331 | message LmkKillOccurred { |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1332 | // The uid if available. -1 means not available. |
| 1333 | optional int32 uid = 1; |
| 1334 | |
Rajeev Kumar | 27572b9 | 2018-01-23 16:12:51 -0800 | [diff] [blame] | 1335 | // The process name. |
| 1336 | optional string process_name = 2; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1337 | |
| 1338 | // oom adj score. |
| 1339 | optional int32 oom_score = 3; |
| 1340 | |
Rajeev Kumar | 27572b9 | 2018-01-23 16:12:51 -0800 | [diff] [blame] | 1341 | // # of page-faults |
| 1342 | optional int64 pgfault = 4; |
| 1343 | |
| 1344 | // # of major page-faults |
| 1345 | optional int64 pgmajfault = 5; |
| 1346 | |
Rajeev Kumar | 9023599 | 2018-01-29 11:06:48 -0800 | [diff] [blame] | 1347 | // RSS |
| 1348 | optional int64 rss_in_bytes = 6; |
| 1349 | |
| 1350 | // CACHE |
| 1351 | optional int64 cache_in_bytes = 7; |
| 1352 | |
| 1353 | // SWAP |
| 1354 | optional int64 swap_in_bytes = 8; |
Rajeev Kumar | 508a9bf | 2018-01-18 15:49:11 -0800 | [diff] [blame] | 1355 | } |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 1356 | |
| 1357 | /* |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1358 | * Elapsed real time from SystemClock. |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 1359 | */ |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1360 | message SystemElapsedRealtime { |
| 1361 | optional uint64 time_ms = 1; |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 1362 | } |
| 1363 | |
| 1364 | /* |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1365 | * Up time from SystemClock. |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 1366 | */ |
Chenjie Yu | 9d7720b | 2018-01-24 10:34:48 -0800 | [diff] [blame] | 1367 | message SystemUptime { |
| 1368 | // Milliseconds since the system was booted. |
| 1369 | // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting |
| 1370 | // for external input). |
| 1371 | // It is not affected by clock scaling, idle, or other power saving mechanisms. |
| 1372 | optional uint64 uptime_ms = 1; |
Chenjie Yu | 9da105b | 2018-01-13 12:41:08 -0800 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | /* |
| 1376 | * Reads from /proc/uid_concurrent_active_time which has the format: |
| 1377 | * active: X (X is # cores) |
| 1378 | * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores) |
| 1379 | * [uid1]: [time-0] [time-1] [time-2] ... ... |
| 1380 | * ... |
| 1381 | * Time-N means the CPU time a UID spent running concurrently with N other processes. |
| 1382 | * The file contains a monotonically increasing count of time for a single boot. |
| 1383 | */ |
| 1384 | message CpuActiveTime { |
| 1385 | optional uint64 uid = 1; |
| 1386 | optional uint64 idx = 2; |
| 1387 | optional uint64 time_ms = 3; |
| 1388 | } |
| 1389 | |
| 1390 | /** |
| 1391 | * Reads from /proc/uid_concurrent_policy_time which has the format: |
| 1392 | * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4) |
| 1393 | * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ... |
| 1394 | * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ... |
| 1395 | * ... |
| 1396 | * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes. |
| 1397 | * The file contains a monotonically increasing count of time for a single boot. |
| 1398 | */ |
| 1399 | message CpuClusterTime { |
| 1400 | optional uint64 uid = 1; |
| 1401 | optional uint64 idx = 2; |
| 1402 | optional uint64 time_ms = 3; |
Chenjie Yu | 937d742 | 2018-01-10 16:37:53 -0800 | [diff] [blame] | 1403 | } |
| 1404 | |
| 1405 | /* |
| 1406 | * Pulls free disk space, for data, system partition and temporary directory. |
| 1407 | */ |
| 1408 | message DiskSpace { |
| 1409 | // available bytes in data partition |
| 1410 | optional uint64 data_available_bytes = 1; |
| 1411 | // available bytes in system partition |
| 1412 | optional uint64 system_available_bytes = 2; |
| 1413 | // available bytes in download cache or temp directories |
| 1414 | optional uint64 temp_available_bytes = 3; |
| 1415 | } |