1/* 2 * Copyright (C) 2016 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 17syntax = "proto2"; 18option java_multiple_files = true; 19 20package android.os; 21 22import "frameworks/base/core/proto/android/os/powermanager.proto"; 23import "frameworks/base/core/proto/android/privacy.proto"; 24import "frameworks/proto_logging/stats/enums/app/job/job_enums.proto"; 25import "frameworks/proto_logging/stats/enums/telephony/enums.proto"; 26 27message BatteryStatsProto { 28 option (android.msg_privacy).dest = DEST_AUTOMATIC; 29 30 optional int32 report_version = 1; 31 optional int64 parcel_version = 2; 32 optional string start_platform_version = 3; 33 optional string end_platform_version = 4; 34 repeated UidProto uids = 5; 35 optional SystemProto system = 6; 36} 37 38message ControllerActivityProto { 39 option (android.msg_privacy).dest = DEST_AUTOMATIC; 40 41 // Time (milliseconds) spent in the idle state. 42 optional int64 idle_duration_ms = 1; 43 // Time (milliseconds) spent in the receive state. 44 optional int64 rx_duration_ms = 2; 45 // Total power (mAh) consumed by the controller in all states. The value may 46 // always be 0 if the device doesn't support power calculations. 47 optional int64 power_mah = 3; 48 49 // Represents a transmit level, where each level may draw a different amount 50 // of power. The levels themselves are controller-specific (and may possibly 51 // be device specific...yet to be confirmed). 52 message TxLevel { 53 option (android.msg_privacy).dest = DEST_AUTOMATIC; 54 55 // Transmit level. Higher levels draw more power. 56 optional int32 level = 1; 57 // Time spent in this specific transmit level state. 58 optional int64 duration_ms = 2; 59 } 60 repeated TxLevel tx = 4; 61 62 // Total rail charge consumed by the monitored rails by the controller. The value may 63 // always be 0 if the device doesn't support monitored rail calculations. 64 optional double monitored_rail_charge_mah = 5; 65} 66 67message SystemProto { 68 option (android.msg_privacy).dest = DEST_AUTOMATIC; 69 70 message Battery { 71 option (android.msg_privacy).dest = DEST_AUTOMATIC; 72 73 // Wall clock time when the data collection started. 74 // In case of device time manually reset by users: 75 // start_clock_time_ms keeps the same value in the current collection 76 // period and changes for later collection periods. 77 optional int64 start_clock_time_ms = 1; 78 // #times the device has been started since start_clock_time_millis. 79 optional int64 start_count = 2; 80 // Total realtime duration (= SINCE_UNPLUGGED battery_realtime_millis.) 81 optional int64 total_realtime_ms = 3; 82 optional int64 total_uptime_ms = 4; 83 // Realtime duration on battery. 84 optional int64 battery_realtime_ms = 5; 85 // Uptime duration (i.e., not suspend). 86 // Uptime is anytime the CPUs were on. The radio and Wifi chip 87 // can be running while the CPUs are off. 88 optional int64 battery_uptime_ms = 6; 89 // Total realtime duration measured with screen off or dozing. 90 optional int64 screen_off_realtime_ms = 7; 91 // Total uptime duration measured with screen off or dozing. 92 optional int64 screen_off_uptime_ms = 8; 93 // Total time the screen was dozing while the device was running on battery. 94 // For historical reasons, screen_doze_duration_msec is a subset of 95 // screen_off_realtime_msec. 96 optional int64 screen_doze_duration_ms = 9; 97 // The estimated real battery capacity, which may be less than the declared 98 // battery capacity (for example, because of battery aging). This field is 99 // less reliable than min(max)_learned_battery_capacity_uah, use those two 100 // fields whenever possible. 101 optional int64 estimated_battery_capacity_mah = 10; 102 // The minimum learned battery capacity in uAh. 103 optional int64 min_learned_battery_capacity_uah = 11; 104 // The maximum learned battery capacity in uAh. 105 optional int64 max_learned_battery_capacity_uah = 12; 106 }; 107 optional Battery battery = 1; 108 109 message BatteryDischarge { 110 option (android.msg_privacy).dest = DEST_AUTOMATIC; 111 112 // Discharged battery percentage points since the stats were last reset 113 // after charging (lower bound approximation). 114 optional int32 lower_bound_since_charge = 1; 115 // Upper bound approximation. 116 optional int32 upper_bound_since_charge = 2; 117 // Discharged points while screen is on. 118 optional int32 screen_on_since_charge = 3; 119 // Discharged points while screen is off. 120 optional int32 screen_off_since_charge = 4; 121 // Discharged points while screen was dozing. For historical reasons, 122 // screen_doze_since_charge is a subset of screen_off_since_charge. 123 optional int32 screen_doze_since_charge = 5; 124 // Total amount of battery discharged in mAh. This will only be non-zero for 125 // devices that report battery discharge via a coulomb counter. 126 optional int64 total_mah = 6; 127 // Total amount of battery discharged while the screen was off in mAh. 128 // This will only be non-zero for devices that report battery discharge 129 // via a coulomb counter. 130 optional int64 total_mah_screen_off = 7; 131 // Total amount of battery discharged while the screen was dozing in mAh. 132 // This will only be non-zero for devices that report battery discharge 133 // via a coulomb counter. For historical reasons, total_mah_screen_doze is 134 // a subset of total_mah_screen_off. 135 optional int64 total_mah_screen_doze = 8; 136 // Total amount of battery discharged in mAh while the device was in light doze mode. 137 // This will only be non-zero for devices that report battery discharge 138 // via a coulomb counter. 139 optional int64 total_mah_light_doze = 9; 140 // Total amount of battery discharged in mAh while the device was in deep doze mode. 141 // This will only be non-zero for devices that report battery discharge 142 // via a coulomb counter. 143 optional int64 total_mah_deep_doze = 10; 144 }; 145 optional BatteryDischarge battery_discharge = 2; 146 147 oneof time_remaining { 148 // Approximation for how much time remains until the battery is fully 149 // charged. The device will print -1 if there wasn't enough data to 150 // calculate an estimate, or if the battery is currently discharging. 151 int64 charge_time_remaining_ms = 3; 152 // Approximation for how much time remains until the battery is fully 153 // discharged. The device will print -1 if there wasn't enough data to 154 // calculate an estimate, or if the battery is currently charging. 155 int64 discharge_time_remaining_ms = 4; 156 } 157 158 // BatteryLevelStep tracks data for which conditions were continuously held for 159 // the entire duration. Field for which the conditions were not consistent 160 // for the entire duration should be marked MIXED. 161 message BatteryLevelStep { 162 option (android.msg_privacy).dest = DEST_AUTOMATIC; 163 164 // How long the battery was at the current level. 165 optional int64 duration_ms = 1; 166 // Battery level 167 optional int32 level = 2; 168 169 // State of the display. A special enum is used rather than 170 // DisplayProto.State because a MIXED value needs to be in the enum, and 171 // batterystats doesn't care about all of the different display states. 172 enum DisplayState { 173 DS_MIXED = 0; 174 DS_ON = 1; 175 DS_OFF = 2; 176 DS_DOZE = 3; 177 DS_DOZE_SUSPEND = 4; 178 // Any display state error that comes through should be sent to hackbod@. 179 DS_ERROR = 5; 180 } 181 // The state of the display for the entire battery level step. MIXED is used 182 // if there were multiple states for this step. 183 optional DisplayState display_state = 3; 184 185 // Indicates status in power save mode. 186 enum PowerSaveMode { 187 PSM_MIXED = 0; 188 PSM_ON = 1; 189 PSM_OFF = 2; 190 } 191 // Battery Saver mode for the entire battery level step. MIXED is used 192 // if there were multiple states for this step. 193 optional PowerSaveMode power_save_mode = 4; 194 195 // Indicates status in idle mode. 196 enum IdleMode { 197 IM_MIXED = 0; 198 IM_ON = 2; 199 IM_OFF = 3; 200 } 201 // Doze mode for the entire battery level step. MIXED is used if there were 202 // multiple states for this step. 203 optional IdleMode idle_mode = 5; 204 }; 205 // Battery level steps when the device was charging. 206 repeated BatteryLevelStep charge_step = 5; 207 // Battery level steps when the device was discharging. 208 repeated BatteryLevelStep discharge_step = 6; 209 210 // All CPU frequencies of the device. 211 repeated int64 cpu_frequency = 7; 212 213 message DataConnection { 214 option (android.msg_privacy).dest = DEST_AUTOMATIC; 215 oneof type { 216 android.telephony.NetworkTypeEnum name = 1; 217 // If is_none is not set, then the name is a valid network type. 218 bool is_none = 2; 219 } 220 optional TimerProto total = 3; 221 }; 222 repeated DataConnection data_connection = 8; 223 224 optional ControllerActivityProto global_bluetooth_controller = 9; 225 optional ControllerActivityProto global_modem_controller = 10; 226 optional ControllerActivityProto global_wifi_controller = 11; 227 228 message GlobalNetwork { 229 option (android.msg_privacy).dest = DEST_AUTOMATIC; 230 231 // Total Bytes received on mobile connections. 232 optional int64 mobile_bytes_rx = 1; 233 // Total Bytes transmitted on mobile connections. 234 optional int64 mobile_bytes_tx = 2; 235 // Total Bytes received on wifi connections. 236 optional int64 wifi_bytes_rx = 3; 237 // Total Bytes transmitted on wifi connections. 238 optional int64 wifi_bytes_tx = 4; 239 // Total Packets received on mobile connections. 240 optional int64 mobile_packets_rx = 5; 241 // Total Packets transmitted on mobile connections. 242 optional int64 mobile_packets_tx = 6; 243 // Total Packets received on wifi connections. 244 optional int64 wifi_packets_rx = 7; 245 // Total Packets transmitted on wifi connections. 246 optional int64 wifi_packets_tx = 8; 247 // Total Bytes received on bluetooth connections. 248 optional int64 bt_bytes_rx = 9; 249 // Total Bytes transmitted on bluetooth connections. 250 optional int64 bt_bytes_tx = 10; 251 }; 252 optional GlobalNetwork global_network = 12; 253 254 message GlobalWifi { 255 option (android.msg_privacy).dest = DEST_AUTOMATIC; 256 257 // The amount of time that wifi has been on while the device was running on 258 // battery. 259 optional int64 on_duration_ms = 1; 260 // The amount of time that wifi has been on and the driver has been in the 261 // running state while the device was running on battery. 262 optional int64 running_duration_ms = 2; 263 } 264 optional GlobalWifi global_wifi = 13; 265 266 // Kernel wakelock metrics are only recorded when the device is unplugged 267 // *and* the screen is off. 268 message KernelWakelock { 269 option (android.msg_privacy).dest = DEST_AUTOMATIC; 270 271 optional string name = 1; 272 // Kernel wakelock stats aren't apportioned across all kernel wakelocks (as 273 // app wakelocks stats are). 274 optional TimerProto total = 2; 275 // The kernel doesn't have the data to enable printing out current and max 276 // durations. 277 }; 278 repeated KernelWakelock kernel_wakelock = 14; 279 280 message Misc { 281 option (android.msg_privacy).dest = DEST_AUTOMATIC; 282 283 optional int64 screen_on_duration_ms = 1; 284 optional int64 phone_on_duration_ms = 2; 285 optional int64 full_wakelock_total_duration_ms = 3; 286 // The total elapsed time that a partial wakelock was held. This duration 287 // does not double count wakelocks held at the same time. 288 optional int64 partial_wakelock_total_duration_ms = 4; 289 optional int64 mobile_radio_active_duration_ms = 5; 290 // The time that is the difference between the mobile radio time we saw 291 // based on the elapsed timestamp when going down vs. the given time stamp 292 // from the radio. 293 optional int64 mobile_radio_active_adjusted_time_ms = 6; 294 optional int32 mobile_radio_active_count = 7; 295 // The amount of time that the mobile network has been active (in a high 296 // power state) but not being able to blame on an app. 297 optional int32 mobile_radio_active_unknown_duration_ms = 8; 298 // Total amount of time the device was in the interactive state. 299 optional int64 interactive_duration_ms = 9; 300 optional int64 battery_saver_mode_enabled_duration_ms = 10; 301 optional int32 num_connectivity_changes = 11; 302 // Amount of time the device was in deep Doze. 303 optional int64 deep_doze_enabled_duration_ms = 12; 304 // How many times the device went into deep Doze mode. 305 optional int32 deep_doze_count = 13; 306 // Amount of time the device was idling in deep Doze. Idling time 307 // encompasses "doze" time and the maintenance windows that allow apps to 308 // operate. 309 optional int64 deep_doze_idling_duration_ms = 14; 310 // How many times the device idling for deep Doze mode. 311 optional int32 deep_doze_idling_count = 15; 312 optional int64 longest_deep_doze_duration_ms = 16; 313 // Amount of time the device was in Doze Light. 314 optional int64 light_doze_enabled_duration_ms = 17; 315 // How many times the device went into Doze Light mode. 316 optional int32 light_doze_count = 18; 317 // Amount of time the device was idling in Doze Light. Idling time 318 // encompasses "doze" time and the maintenance windows that allow apps to 319 // operate. 320 optional int64 light_doze_idling_duration_ms = 19; 321 // How many times the device idling for Doze Light mode. 322 optional int32 light_doze_idling_count = 20; 323 optional int64 longest_light_doze_duration_ms = 21; 324 } 325 optional Misc misc = 15; 326 327 message PhoneSignalStrength { 328 option (android.msg_privacy).dest = DEST_AUTOMATIC; 329 330 optional android.telephony.SignalStrengthEnum name = 1; 331 optional TimerProto total = 2; 332 }; 333 repeated PhoneSignalStrength phone_signal_strength = 16; 334 335 message PowerUseItem { 336 option (android.msg_privacy).dest = DEST_AUTOMATIC; 337 338 enum Sipper { 339 UNKNOWN_SIPPER = 0; 340 IDLE = 1; 341 CELL = 2; 342 PHONE = 3; 343 WIFI = 4; 344 BLUETOOTH = 5; 345 FLASHLIGHT = 6; 346 SCREEN = 7; 347 USER = 8; 348 UNACCOUNTED = 9; 349 OVERCOUNTED = 10; 350 CAMERA = 11; 351 MEMORY = 12; 352 AMBIENT_DISPLAY = 13; 353 }; 354 optional Sipper name = 1; 355 // UID, only valid for the USER sipper. 356 optional int32 uid = 2; 357 // Estimated power use in mAh. 358 optional double computed_power_mah = 3; 359 // Starting in Oreo, Battery Settings has two modes to display the battery 360 // info. The first is "app usage list". In this mode, items with should_hide 361 // enabled are hidden. 362 optional bool should_hide = 4; 363 // Smeared power from screen usage. Screen usage power is split and smeared 364 // among apps, based on activity time. 365 optional double screen_power_mah = 5; 366 // Smeared power using proportional method. Power usage from hidden sippers 367 // is smeared to all apps proportionally (except for screen usage). 368 optional double proportional_smear_mah = 6; 369 }; 370 repeated PowerUseItem power_use_item = 17; 371 372 message PowerUseSummary { 373 option (android.msg_privacy).dest = DEST_AUTOMATIC; 374 375 optional double battery_capacity_mah = 1; 376 optional double computed_power_mah = 2; 377 // Lower bound of actual power drained. 378 optional double min_drained_power_mah = 3; 379 // Upper bound of actual power drained. 380 optional double max_drained_power_mah = 4; 381 }; 382 optional PowerUseSummary power_use_summary = 18; 383 384 message ResourcePowerManager { 385 option (android.msg_privacy).dest = DEST_AUTOMATIC; 386 387 // Either StateName or StateName.VoterName. 388 optional string name = 1; 389 optional TimerProto total = 2; 390 optional TimerProto screen_off = 3; 391 } 392 repeated ResourcePowerManager resource_power_manager = 19; 393 394 message ScreenBrightness { 395 option (android.msg_privacy).dest = DEST_AUTOMATIC; 396 397 enum Name { 398 DARK = 0; // Not screen-off. 399 DIM = 1; 400 MEDIUM = 2; 401 LIGHT = 3; 402 BRIGHT = 4; 403 }; 404 optional Name name = 1; 405 optional TimerProto total = 2; 406 }; 407 repeated ScreenBrightness screen_brightness = 20; 408 409 // Duration and number of times trying to acquire a signal 410 optional TimerProto signal_scanning = 21; 411 412 message WakeupReason { 413 option (android.msg_privacy).dest = DEST_AUTOMATIC; 414 415 optional string name = 1; 416 optional TimerProto total = 2; 417 }; 418 repeated WakeupReason wakeup_reason = 22; 419 420 message WifiMulticastWakelockTotal { 421 option (android.msg_privacy).dest = DEST_AUTOMATIC; 422 423 optional int64 duration_ms = 1; 424 optional int32 count = 2; 425 } 426 optional WifiMulticastWakelockTotal wifi_multicast_wakelock_total = 23; 427 428 message WifiSignalStrength { 429 option (android.msg_privacy).dest = DEST_AUTOMATIC; 430 431 enum Name { 432 NONE = 0; 433 POOR = 1; 434 MODERATE = 2; 435 GOOD = 3; 436 GREAT = 4; 437 }; 438 optional Name name = 1; 439 optional TimerProto total = 2; 440 }; 441 repeated WifiSignalStrength wifi_signal_strength = 24; 442 443 message WifiState { 444 option (android.msg_privacy).dest = DEST_AUTOMATIC; 445 446 enum Name { 447 OFF = 0; 448 OFF_SCANNING = 1; 449 ON_NO_NETWORKS = 2; 450 ON_DISCONNECTED = 3; 451 ON_CONNECTED_STA = 4; 452 ON_CONNECTED_P2P = 5; 453 ON_CONNECTED_STA_P2P = 6; 454 SOFT_AP = 7; 455 }; 456 optional Name name = 1; 457 optional TimerProto total = 2; 458 }; 459 repeated WifiState wifi_state = 25; 460 461 message WifiSupplicantState { 462 option (android.msg_privacy).dest = DEST_AUTOMATIC; 463 464 enum Name { 465 INVALID = 0; 466 DISCONNECTED = 1; 467 INTERFACE_DISABLED = 2; 468 INACTIVE = 3; 469 SCANNING = 4; 470 AUTHENTICATING = 5; 471 ASSOCIATING = 6; 472 ASSOCIATED = 7; 473 FOUR_WAY_HANDSHAKE = 8; 474 GROUP_HANDSHAKE = 9; 475 COMPLETED = 10; 476 DORMANT = 11; 477 UNINITIALIZED = 12; 478 }; 479 optional Name name = 1; 480 optional TimerProto total = 2; 481 }; 482 repeated WifiSupplicantState wifi_supplicant_state = 26; 483} 484 485message TimerProto { 486 option (android.msg_privacy).dest = DEST_AUTOMATIC; 487 488 // This may be an apportioned time. 489 optional int64 duration_ms = 1; 490 optional int64 count = 2; 491 // The max duration if it is being tracked. Not all Timer subclasses 492 // track the max duration. 493 optional int64 max_duration_ms = 3; 494 // The current time the timer has been active, if it is being tracked. 495 // Not all Timer subclasses track the current duration. 496 optional int64 current_duration_ms = 4; 497 // The total cumulative duration (i.e. sum of past durations) that this timer 498 // has been on since reset. This may differ from duration_ms since, depending 499 // on the Timer, getTotalTimeLocked may represent the total 'blamed' or 500 // 'pooled' time, rather than the actual time. By contrast, total_duration_ms 501 // always gives the actual total time. Not all Timer subclasses track the 502 // total duration. 503 optional int64 total_duration_ms = 5; 504} 505 506message UidProto { 507 option (android.msg_privacy).dest = DEST_AUTOMATIC; 508 509 // Combination of app ID and user ID. 510 optional int32 uid = 1; 511 512 // The statistics associated with a particular package. 513 message Package { 514 option (android.msg_privacy).dest = DEST_AUTOMATIC; 515 516 optional string name = 1; 517 518 message Service { 519 option (android.msg_privacy).dest = DEST_AUTOMATIC; 520 521 optional string name = 1; 522 // Time spent started. 523 optional int64 start_duration_ms = 2; 524 optional int32 start_count = 3; 525 optional int32 launch_count = 4; 526 } 527 repeated Service services = 2; 528 } 529 repeated Package packages = 2; 530 531 optional ControllerActivityProto bluetooth_controller = 3; 532 optional ControllerActivityProto modem_controller = 4; 533 optional ControllerActivityProto wifi_controller = 5; 534 535 // Bluetooth misc data. 536 message BluetoothMisc { 537 option (android.msg_privacy).dest = DEST_AUTOMATIC; 538 539 // Duration spent BLE scanning blamed on this App (i.e. apportioned to this 540 // app amongst all apps doing BLE scanning; see explanation of 'apportioned' 541 // in App's comment). 542 optional TimerProto apportioned_ble_scan = 1; 543 // Background times aren't apportioned. 544 optional TimerProto background_ble_scan = 2; 545 // Running unoptimized BLE scanning, as defined by Bluetooth's 546 // AppScanStats.recordScanStart. As of May 2017, these are unfiltered, 547 // non-opportunistic, non-first-match scans. Durations are not 548 // pooled/apportioned. 549 optional TimerProto unoptimized_ble_scan = 3; 550 // Running unoptimized BLE scanning when app is in background. Durations are 551 // not pooled/apportioned. 552 optional TimerProto background_unoptimized_ble_scan = 4; 553 // Count of results returned by BLE scanning. 554 optional int32 ble_scan_result_count = 5; 555 // Count of results returned by BLE scans when app is in background. 556 // (Included in ble_scan_result_count.) 557 optional int32 background_ble_scan_result_count = 6; 558 } 559 optional BluetoothMisc bluetooth_misc = 6; 560 561 message Cpu { 562 option (android.msg_privacy).dest = DEST_AUTOMATIC; 563 564 // Total CPU time with processes executing in userspace. Summed up across 565 // multiple cores. 566 optional int64 user_duration_ms = 1; 567 // Total CPU time with processes executing kernel syscalls. Summed up across 568 // multiple cores. 569 optional int64 system_duration_ms = 2; 570 571 // CPU time broken down by CPU frequency (go/cpu-battery-metrics). 572 // 573 // These are real CPU time measurement from the kernel, so their sum can 574 // be different from the sum of user_duration_millis and 575 // system_duration_millis, which are just approximations. Data is not 576 // tracked when device is charging. 577 message ByFrequency { 578 option (android.msg_privacy).dest = DEST_AUTOMATIC; 579 580 // Index of the frequency in system.cpu_frequency. It starts from 1, to 581 // make it easier to analyze. 582 optional int32 frequency_index = 1; 583 // CPU time in milliseconds. 584 optional int64 total_duration_ms = 2; 585 // Screen-off CPU time in milliseconds. 586 optional int64 screen_off_duration_ms = 3; 587 } 588 // CPU times accumulated across all process states. 589 repeated ByFrequency by_frequency = 3; 590 591 enum ProcessState { 592 TOP = 0; 593 FOREGROUND_SERVICE = 1; 594 FOREGROUND = 2; 595 BACKGROUND = 3; 596 TOP_SLEEPING = 4; 597 HEAVY_WEIGHT = 5; 598 CACHED = 6; 599 } 600 // CPU times at different process states. 601 message ByProcessState { 602 option (android.msg_privacy).dest = DEST_AUTOMATIC; 603 604 optional ProcessState process_state = 1; 605 repeated ByFrequency by_frequency = 2; 606 } 607 repeated ByProcessState by_process_state = 4; 608 } 609 optional Cpu cpu = 7; 610 611 // Duration is pooled/apportioned. 612 optional TimerProto audio = 8; 613 // Duration is pooled/apportioned. 614 optional TimerProto camera = 9; 615 // Duration is pooled/apportioned. 616 optional TimerProto flashlight = 10; 617 // Duration is not pooled/apportioned. 618 optional TimerProto foreground_activity = 11; 619 // Duration is not pooled/apportioned. 620 optional TimerProto foreground_service = 12; 621 // Duration is not pooled/apportioned. 622 optional TimerProto vibrator = 13; 623 // Duration is pooled/apportioned. 624 optional TimerProto video = 14; 625 626 message Job { 627 option (android.msg_privacy).dest = DEST_AUTOMATIC; 628 629 optional string name = 1; 630 // Job times aren't apportioned. 631 optional TimerProto total = 2; 632 optional TimerProto background = 3; 633 } 634 repeated Job jobs = 15; 635 636 message JobCompletion { 637 option (android.msg_privacy).dest = DEST_AUTOMATIC; 638 639 // Job name. 640 optional string name = 1; 641 642 message ReasonCount { 643 option (android.msg_privacy).dest = DEST_AUTOMATIC; 644 645 optional android.app.job.InternalStopReasonEnum name = 1; 646 optional int32 count = 2; 647 } 648 repeated ReasonCount reason_count = 2; 649 }; 650 repeated JobCompletion job_completion = 16; 651 652 message Network { 653 option (android.msg_privacy).dest = DEST_AUTOMATIC; 654 655 // Mobile data traffic (total, background + foreground). 656 optional int64 mobile_bytes_rx = 1; 657 optional int64 mobile_bytes_tx = 2; 658 // Wifi data traffic (total, background + foreground). 659 optional int64 wifi_bytes_rx = 3; 660 optional int64 wifi_bytes_tx = 4; 661 // Bluetooth data traffic (total, background + foreground). 662 optional int64 bt_bytes_rx = 5; 663 optional int64 bt_bytes_tx = 6; 664 // In packets (total, background + foreground). 665 optional int64 mobile_packets_rx = 7; 666 optional int64 mobile_packets_tx = 8; 667 optional int64 wifi_packets_rx = 9; 668 optional int64 wifi_packets_tx = 10; 669 // Radio active duration. 670 optional int64 mobile_active_duration_ms = 11; 671 optional int32 mobile_active_count = 12; 672 // Number of times the app woke up the mobile radio. 673 optional int32 mobile_wakeup_count = 13; 674 // Number of times the app woke up the wifi radio. 675 optional int32 wifi_wakeup_count = 14; 676 // Mobile data traffic in the background only, included in total above. 677 optional int64 mobile_bytes_bg_rx = 15; 678 optional int64 mobile_bytes_bg_tx = 16; 679 // Wifi data traffic in the background only, included in total above. 680 optional int64 wifi_bytes_bg_rx = 17; 681 optional int64 wifi_bytes_bg_tx = 18; 682 // In packets (background only, included in total packets above). 683 optional int64 mobile_packets_bg_rx = 19; 684 optional int64 mobile_packets_bg_tx = 20; 685 optional int64 wifi_packets_bg_rx = 21; 686 optional int64 wifi_packets_bg_tx = 22; 687 }; 688 optional Network network = 17; 689 690 // TODO: combine System and App messages? 691 message PowerUseItem { 692 option (android.msg_privacy).dest = DEST_AUTOMATIC; 693 694 // Estimated power use in mAh. 695 optional double computed_power_mah = 1; 696 // Starting in Oreo, Battery Settings has two modes to display the battery 697 // info. The first is "app usage list". In this mode, items with should_hide 698 // enabled are hidden. 699 optional bool should_hide = 2; 700 // Smeared power from screen usage. Screen usage power is split and smeared 701 // among apps, based on activity time. 702 optional double screen_power_mah = 3; 703 // Smeared power using proportional method. Power usage from hidden sippers 704 // is smeared to all apps proportionally (except for screen usage). 705 optional double proportional_smear_mah = 4; 706 }; 707 optional PowerUseItem power_use_item = 18; 708 709 // Durations are not pooled/apportioned. 710 message Process { 711 option (android.msg_privacy).dest = DEST_AUTOMATIC; 712 713 optional string name = 1; 714 // Time spent executing in user code. 715 optional int64 user_duration_ms = 2; 716 // Time spent executing in kernel code. 717 optional int64 system_duration_ms = 3; 718 // Time the process was running in the foreground. 719 optional int64 foreground_duration_ms = 4; 720 // Number of times the process has been started. 721 optional int32 start_count = 5; 722 // Number of times the process has had an ANR. 723 optional int32 anr_count = 6; 724 // Number of times the process has crashed. 725 optional int32 crash_count = 7; 726 }; 727 repeated Process process = 19; 728 729 message StateTime { 730 option (android.msg_privacy).dest = DEST_AUTOMATIC; 731 732 // All of these (non-deprecated) states are mutually exclusive and can be 733 // added together to find the total time a uid has had any processes running 734 // at all. 735 736 // In approximate order or priority (top being what the framework considers 737 // most important and is thus least likely to kill when resources are 738 // needed: 739 // top > foreground service > foreground > background > top sleeping > heavy weight > cache 740 enum State { 741 // Time this uid has any processes in the top state. 742 PROCESS_STATE_TOP = 0; 743 // Time this uid has any process with a started foreground service, but 744 // none in the "top" state. 745 PROCESS_STATE_FOREGROUND_SERVICE = 1; 746 // Time this uid has any process in an active foreground state, but none in the 747 // "foreground service" or better state. Persistent and other foreground states go here. 748 PROCESS_STATE_FOREGROUND = 2; 749 // Time this uid has any process in an active background state, but none 750 // in the "foreground" or better state. 751 PROCESS_STATE_BACKGROUND = 3; 752 // Time this uid has any process that is top while the device is sleeping, 753 // but not active for any other reason. We consider is a kind of cached 754 // process for execution restrictions. Sleeping is mostly screen off, but 755 // also includes the time when the screen is on but the device has not yet 756 // been unlocked. 757 PROCESS_STATE_TOP_SLEEPING = 4; 758 // Time this uid has any process that is in the background but it has an 759 // activity marked as "can't save state". This is essentially a cached 760 // process, though the system will try much harder than normal to avoid 761 // killing it. 762 PROCESS_STATE_HEAVY_WEIGHT = 5; 763 // Time this uid has any processes that are sitting around cached, not in 764 // one of the other active states. 765 PROCESS_STATE_CACHED = 6; 766 } 767 optional State state = 1; 768 optional int64 duration_ms = 2; 769 } 770 repeated StateTime states = 20; 771 772 message Sensor { 773 option (android.msg_privacy).dest = DEST_AUTOMATIC; 774 775 optional int32 id = 1; 776 optional TimerProto apportioned = 2; 777 // Background times aren't apportioned. 778 optional TimerProto background = 3; 779 } 780 repeated Sensor sensors = 21; 781 782 message Sync { 783 option (android.msg_privacy).dest = DEST_AUTOMATIC; 784 785 optional string name = 1; 786 // Sync times aren't apportioned. 787 optional TimerProto total = 2; 788 optional TimerProto background = 3; 789 } 790 repeated Sync syncs = 22; 791 792 message UserActivity { 793 option (android.msg_privacy).dest = DEST_AUTOMATIC; 794 795 optional PowerManagerProto.UserActivityEvent name = 1; 796 optional int32 count = 2; 797 }; 798 repeated UserActivity user_activity = 23; 799 800 // Aggregated wakelock data for an app overall, across all of its wakelocks. 801 // The Wakelock message holds data about each *individual* wakelock, but it 802 // cannot be used to ascertain the aggregated time the app spent holding 803 // wakelocks, since merely summing Wakelock data will either underestimate (in 804 // the case of wakelock.partial.duration_ms) or overestimate (in the case of 805 // wakelock.partial.total_duration_ms) the total time, due to overlapping 806 // wakelocks. AggregatedWakelock, on the other hand, holds overall per-app 807 // wakelock data. 808 message AggregatedWakelock { 809 option (android.msg_privacy).dest = DEST_AUTOMATIC; 810 811 // The total duration that the app spent holding partial wakelocks. 812 // It includes both foreground + background use. 813 optional int64 partial_duration_ms = 1; 814 // The total duration that the app spent holding partial wakelocks while the 815 // app was in the background. Subtracting from partial_duration_ms will 816 // yield foreground usage. 817 optional int64 background_partial_duration_ms = 2; 818 }; 819 optional AggregatedWakelock aggregated_wakelock = 24; 820 821 message Wakelock { 822 option (android.msg_privacy).dest = DEST_AUTOMATIC; 823 824 optional string name = 1; 825 826 // Full wakelocks keep the screen on. Based on 827 // PowerManager.SCREEN_BRIGHT_WAKE_LOCK (deprecated in API 13) and 828 // PowerManager.SCREEN_DIM_WAKE_LOCK (deprecated in API 17). Current, max, 829 // and total durations are not tracked for full wakelocks. 830 optional TimerProto full = 2; 831 832 // Partial wakelocks ensure the CPU is running while allowing the screen 833 // to turn off. Based on PowerManager.PARTIAL_WAKE_LOCK. 834 // Partial wakelock metrics are only recorded when the device is unplugged 835 // *and* the screen is off. Current, max, and total durations are tracked 836 // for partial wakelocks. 837 optional TimerProto partial = 3; 838 839 // These fields are for tracking partial wakelocks (see above), but only 840 // the time the wakelock was held while the app was in a background state. 841 // Since all background tracking is 'actual', not 'apportioned', 842 // background_partial.duration_ms is identical to 843 // background_partial.total_duration_ms. 844 optional TimerProto background_partial = 4; 845 846 // Window wakelocks keep the screen on. Current, max, and total durations 847 // are not tracked for window wakelocks. 848 optional TimerProto window = 5; 849 }; 850 repeated Wakelock wakelocks = 25; 851 852 message WakeupAlarm { 853 option (android.msg_privacy).dest = DEST_AUTOMATIC; 854 855 // Wakeup alarm name. 856 optional string name = 1; 857 // Only includes counts when screen-off (& on battery). 858 optional int32 count = 2; 859 } 860 repeated WakeupAlarm wakeup_alarm = 26; 861 862 message Wifi { 863 option (android.msg_privacy).dest = DEST_AUTOMATIC; 864 865 // Duration holding Wifi-lock. This time is apportioned. 866 optional int64 full_wifi_lock_duration_ms = 1; 867 // Duration running Wifi. This time is apportioned. 868 optional int64 running_duration_ms = 2; 869 // Duration performing Wifi-scan blamed on this App (i.e. apportioned to 870 // this app amongst all apps doing Wifi-scanning; see explanation of 871 // 'apportioned' in App's comment). 872 optional TimerProto apportioned_scan = 3; 873 // Scans performed when app is in background. (Included in 874 // apportioned_scan). This value is not apportioned. Subtracting 875 // background_scan.total_duration_ms from apportioned_scan.total_duration_ms 876 // will yield foreground usage. 877 optional TimerProto background_scan = 4; 878 }; 879 optional Wifi wifi = 27; 880 881 // WiFi Multicast Wakelock 882 // This timer tracks the duration and count for the app to request the 883 // wakelock for wifi multicast traffic. 884 // This wakelock disables the filtering of multicast packets to reach the host 885 // processor, and results in a power penalty. 886 // It is useful to monitor the applications resulting in that 887 optional TimerProto wifi_multicast_wakelock = 28; 888} 889