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