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 17syntax = "proto2"; 18 19package android.os.statsd; 20option java_package = "com.android.os"; 21option java_outer_classname = "AtomsProto"; 22 23import "frameworks/base/cmds/statsd/src/atom_field_options.proto"; 24import "frameworks/base/core/proto/android/app/enums.proto"; 25import "frameworks/base/core/proto/android/app/job/enums.proto"; 26import "frameworks/base/core/proto/android/bluetooth/enums.proto"; 27import "frameworks/base/core/proto/android/os/enums.proto"; 28import "frameworks/base/core/proto/android/server/enums.proto"; 29import "frameworks/base/core/proto/android/telecomm/enums.proto"; 30import "frameworks/base/core/proto/android/telephony/enums.proto"; 31import "frameworks/base/core/proto/android/view/enums.proto"; 32 33/** 34 * The master atom class. This message defines all of the available 35 * raw stats log events from the Android system, also known as "atoms." 36 * 37 * This field contains a single oneof with all of the available messages. 38 * The stats-log-api-gen tool runs as part of the Android build and 39 * generates the android.util.StatsLog class, which contains the constants 40 * and methods that Android uses to log. 41 * 42 * This Atom class is not actually built into the Android system. 43 * Instead, statsd on Android constructs these messages synthetically, 44 * in the format defined here and in stats_log.proto. 45 */ 46message Atom { 47 // Pushed atoms start at 2. 48 oneof pushed { 49 // For StatsLog reasons, 1 is illegal and will not work. Must start at 2. 50 BleScanStateChanged ble_scan_state_changed = 2; 51 // 3 is available for use 52 BleScanResultReceived ble_scan_result_received = 4; 53 SensorStateChanged sensor_state_changed = 5; 54 GpsScanStateChanged gps_scan_state_changed = 6; 55 SyncStateChanged sync_state_changed = 7; 56 ScheduledJobStateChanged scheduled_job_state_changed = 8; 57 ScreenBrightnessChanged screen_brightness_changed = 9; 58 WakelockStateChanged wakelock_state_changed = 10; 59 LongPartialWakelockStateChanged long_partial_wakelock_state_changed = 11; 60 MobileRadioPowerStateChanged mobile_radio_power_state_changed = 12; 61 WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13; 62 // 14 - 19 are available 63 BatterySaverModeStateChanged battery_saver_mode_state_changed = 20; 64 DeviceIdleModeStateChanged device_idle_mode_state_changed = 21; 65 DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22; 66 AudioStateChanged audio_state_changed = 23; 67 MediaCodecStateChanged media_codec_state_changed = 24; 68 CameraStateChanged camera_state_changed = 25; 69 FlashlightStateChanged flashlight_state_changed = 26; 70 UidProcessStateChanged uid_process_state_changed = 27; 71 ProcessLifeCycleStateChanged process_life_cycle_state_changed = 28; 72 ScreenStateChanged screen_state_changed = 29; 73 BatteryLevelChanged battery_level_changed = 30; 74 ChargingStateChanged charging_state_changed = 31; 75 PluggedStateChanged plugged_state_changed = 32; 76 // 33 - 34 are available 77 WakeupAlarmOccurred wakeup_alarm_occurred = 35; 78 KernelWakeupReported kernel_wakeup_reported = 36; 79 WifiLockStateChanged wifi_lock_state_changed = 37; 80 WifiSignalStrengthChanged wifi_signal_strength_changed = 38; 81 WifiScanStateChanged wifi_scan_state_changed = 39; 82 PhoneSignalStrengthChanged phone_signal_strength_changed = 40; 83 SettingChanged setting_changed = 41; 84 ActivityForegroundStateChanged activity_foreground_state_changed = 42; 85 IsolatedUidChanged isolated_uid_changed = 43; 86 PacketWakeupOccurred packet_wakeup_occurred = 44; 87 // 45 is available 88 AnomalyDetected anomaly_detected = 46; 89 AppBreadcrumbReported app_breadcrumb_reported = 47; 90 AppStartOccurred app_start_occurred = 48; 91 AppStartCanceled app_start_canceled = 49; 92 AppStartFullyDrawn app_start_fully_drawn = 50; 93 LmkKillOccurred lmk_kill_occurred = 51; 94 PictureInPictureStateChanged picture_in_picture_state_changed = 52; 95 WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53; 96 LmkStateChanged lmk_state_changed = 54; 97 AppStartMemoryStateCaptured app_start_memory_state_captured = 55; 98 ShutdownSequenceReported shutdown_sequence_reported = 56; 99 BootSequenceReported boot_sequence_reported = 57; 100 DaveyOccurred davey_occurred = 58; 101 OverlayStateChanged overlay_state_changed = 59; 102 ForegroundServiceStateChanged foreground_service_state_changed = 60; 103 CallStateChanged call_state_changed = 61; 104 KeyguardStateChanged keyguard_state_changed = 62; 105 KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63; 106 KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64; 107 AppDied app_died = 65; 108 ResourceConfigurationChanged resource_configuration_changed = 66; 109 BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67; 110 BluetoothConnectionStateChanged bluetooth_connection_state_changed = 68; 111 // 69 is blank but need not be. 112 UsbConnectorStateChanged usb_connector_state_changed = 70; 113 SpeakerImpedanceReported speaker_impedance_reported = 71; 114 HardwareFailed hardware_failed = 72; 115 PhysicalDropDetected physical_drop_detected = 73; 116 ChargeCyclesReported charge_cycles_reported = 74; 117 MobileConnectionStateChanged mobile_connection_state_changed = 75; 118 MobileRadioTechnologyChanged mobile_radio_technology_changed = 76; 119 UsbDeviceAttached usb_device_attached = 77; 120 AppCrashOccurred app_crash_occurred = 78; 121 ANROccurred anr_occurred = 79; 122 WTFOccurred wtf_occurred = 80; 123 LowMemReported low_mem_reported = 81; 124 // 86 - 165 are not available 125 BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166; 126 } 127 128 // Pulled events will start at field 10000. 129 // Next: 10022 130 oneof pulled { 131 WifiBytesTransfer wifi_bytes_transfer = 10000; 132 WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001; 133 MobileBytesTransfer mobile_bytes_transfer = 10002; 134 MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg = 10003; 135 BluetoothBytesTransfer bluetooth_bytes_transfer = 10006; 136 KernelWakelock kernel_wakelock = 10004; 137 SubsystemSleepState subsystem_sleep_state = 10005; 138 CpuTimePerFreq cpu_time_per_freq = 10008; 139 CpuTimePerUid cpu_time_per_uid = 10009; 140 CpuTimePerUidFreq cpu_time_per_uid_freq = 10010; 141 WifiActivityInfo wifi_activity_info = 10011; 142 ModemActivityInfo modem_activity_info = 10012; 143 BluetoothActivityInfo bluetooth_activity_info = 10007; 144 ProcessMemoryState process_memory_state = 10013; 145 SystemElapsedRealtime system_elapsed_realtime = 10014; 146 SystemUptime system_uptime = 10015; 147 CpuActiveTime cpu_active_time = 10016; 148 CpuClusterTime cpu_cluster_time = 10017; 149 DiskSpace disk_space = 10018; 150 RemainingBatteryCapacity remaining_battery_capacity = 10019; 151 FullBatteryCapacity full_battery_capacity = 10020; 152 Temperature temperature = 10021; 153 } 154 155 // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above 156 // 100,000 are reserved for non-AOSP (e.g. OEMs) to use. 157} 158 159/** 160 * This proto represents a node of an attribution chain. 161 * Note: All attribution chains are represented as a repeated field of type 162 * AttributionNode. It is understood that in such arrays, the order is that 163 * of calls, that is [A, B, C] if A calls B that calls C. 164 */ 165message AttributionNode { 166 // The uid for a given element in the attribution chain. 167 optional int32 uid = 1; 168 169 // The (optional) string tag for an element in the attribution chain. If the 170 // element has no tag, it is encoded as an empty string. 171 optional string tag = 2; 172} 173 174/* 175 * ***************************************************************************** 176 * Below are all of the individual atoms that are logged by Android via statsd. 177 * 178 * RULES: 179 * - The field ids for each atom must start at 1, and count upwards by 1. 180 * Skipping field ids is not allowed. 181 * - These form an API, so renaming, renumbering or removing fields is 182 * not allowed between android releases. (This is not currently enforced, 183 * but there will be a tool to enforce this restriction). 184 * - The types must be built-in protocol buffer types, namely, no sub-messages 185 * are allowed (yet). The bytes type is also not allowed. 186 * - The CamelCase name of the message type should match the 187 * underscore_separated name as defined in Atom. 188 * - If an atom represents work that can be attributed to an app, there can 189 * be exactly one AttributionChain field. It must be field number 1. 190 * - A field that is a uid should be a string field, tagged with the [xxx] 191 * annotation. The generated code on android will be represented by UIDs, 192 * and those UIDs will be translated in xxx to those strings. 193 * 194 * CONVENTIONS: 195 * - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange. 196 * - If there is a UID, it goes first. Think in an object-oriented fashion. 197 * ***************************************************************************** 198 */ 199 200/** 201 * Logs when the screen state changes. 202 * 203 * Logged from: 204 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 205 */ 206message ScreenStateChanged { 207 // New screen state, from frameworks/base/core/proto/android/view/enums.proto. 208 optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE]; 209} 210 211/** 212 * Logs that the state of a process state, as per the activity manager, has changed. 213 * 214 * Logged from: 215 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 216 */ 217message UidProcessStateChanged { 218 optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true]; 219 220 // The state, from frameworks/base/core/proto/android/app/enums.proto. 221 optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE]; 222} 223 224/** 225 * Logs that a process started, finished, crashed, or ANRed. 226 * 227 * Logged from: 228 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 229 */ 230message ProcessLifeCycleStateChanged { 231 optional int32 uid = 1 [(is_uid) = true]; 232 233 // The process name (usually same as the app name). 234 optional string process_name = 2; 235 236 // What lifecycle state the process changed to. 237 // This enum is specific to atoms.proto. 238 enum State { 239 FINISHED = 0; 240 STARTED = 1; 241 CRASHED = 2; 242 } 243 optional State state = 3; 244} 245 246/** 247 * Logs when the ble scan state changes. 248 * 249 * Logged from: 250 * packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java 251 */ 252message BleScanStateChanged { 253 repeated AttributionNode attribution_node = 1; 254 255 enum State { 256 OFF = 0; 257 ON = 1; 258 // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes). 259 RESET = 2; 260 } 261 optional State state = 2; 262 263 // Does the scan have a filter. 264 optional bool is_filtered = 3; 265 // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally. 266 optional bool is_first_match = 4; 267 // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC). 268 optional bool is_opportunistic = 5; 269} 270 271/** 272 * Logs reporting of a ble scan finding results. 273 * 274 * Logged from: 275 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 276 */ 277// TODO: Consider changing to tracking per-scanner-id (log from AppScanStats). 278message BleScanResultReceived { 279 repeated AttributionNode attribution_node = 1; 280 281 // Number of ble scan results returned. 282 optional int32 num_results = 2; 283} 284 285/** 286 * Logs when a sensor state changes. 287 * 288 * Logged from: 289 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 290 */ 291message SensorStateChanged { 292 repeated AttributionNode attribution_node = 1; 293 294 // The id (int) of the sensor. 295 optional int32 sensor_id = 2; 296 297 enum State { 298 OFF = 0; 299 ON = 1; 300 } 301 optional State state = 3; 302} 303 304 305/** 306 * Logs when GPS state changes. 307 * 308 * Logged from: 309 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 310 */ 311message GpsScanStateChanged { 312 repeated AttributionNode attribution_node = 1; 313 314 enum State { 315 OFF = 0; 316 ON = 1; 317 } 318 optional State state = 2; 319} 320 321 322/** 323 * Logs when a sync manager sync state changes. 324 * 325 * Logged from: 326 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 327 */ 328message SyncStateChanged { 329 repeated AttributionNode attribution_node = 1; 330 331 // Name of the sync (as named in the app). Can be chosen at run-time. 332 optional string sync_name = 2; 333 334 enum State { 335 OFF = 0; 336 ON = 1; 337 } 338 optional State state = 3; 339} 340 341/** 342 * Logs when a job scheduler job state changes. 343 * 344 * Logged from: 345 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 346 */ 347message ScheduledJobStateChanged { 348 repeated AttributionNode attribution_node = 1; 349 350 // Name of the job (as named in the app) 351 optional string job_name = 2; 352 353 enum State { 354 FINISHED = 0; 355 STARTED = 1; 356 SCHEDULED = 2; 357 } 358 optional State state = 3; 359 360 // The reason a job has stopped. 361 // This is only applicable when the state is FINISHED. 362 // The default value is STOP_REASON_UNKNOWN. 363 optional android.app.job.StopReasonEnum stop_reason = 4; 364} 365 366/** 367 * Logs when the audio state changes. 368 * 369 * Logged from: 370 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 371 */ 372message AudioStateChanged { 373 repeated AttributionNode attribution_node = 1; 374 375 enum State { 376 OFF = 0; 377 ON = 1; 378 // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes). 379 RESET = 2; 380 } 381 optional State state = 2; 382} 383 384/** 385 * Logs when the video codec state changes. 386 * 387 * Logged from: 388 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 389 */ 390message MediaCodecStateChanged { 391 repeated AttributionNode attribution_node = 1; 392 393 enum State { 394 OFF = 0; 395 ON = 1; 396 // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes). 397 RESET = 2; 398 } 399 optional State state = 2; 400} 401 402/** 403 * Logs when the flashlight state changes. 404 * 405 * Logged from: 406 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 407 */ 408message FlashlightStateChanged { 409 repeated AttributionNode attribution_node = 1; 410 411 enum State { 412 OFF = 0; 413 ON = 1; 414 // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes). 415 RESET = 2; 416 } 417 optional State state = 2; 418} 419 420/** 421 * Logs when the camera state changes. 422 * 423 * Logged from: 424 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 425 */ 426message CameraStateChanged { 427 repeated AttributionNode attribution_node = 1; 428 429 enum State { 430 OFF = 0; 431 ON = 1; 432 // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes). 433 RESET = 2; 434 } 435 optional State state = 2; 436} 437 438/** 439 * Logs that the state of a wakelock (per app and per wakelock name) has changed. 440 * 441 * Logged from: 442 * TODO 443 */ 444message WakelockStateChanged { 445 repeated AttributionNode attribution_node = 1; 446 447 // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock. 448 // From frameworks/base/core/proto/android/os/enums.proto. 449 optional android.os.WakeLockLevelEnum level = 2; 450 451 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). 452 optional string tag = 3; 453 454 enum State { 455 RELEASE = 0; 456 ACQUIRE = 1; 457 CHANGE_RELEASE = 2; 458 CHANGE_ACQUIRE = 3; 459 } 460 optional State state = 4; 461} 462 463/** 464 * Logs when a partial wakelock is considered 'long' (over 1 min). 465 * 466 * Logged from: 467 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 468 */ 469message LongPartialWakelockStateChanged { 470 repeated AttributionNode attribution_node = 1; 471 472 // The wakelock tag (Called tag in the Java API, sometimes name elsewhere). 473 optional string tag = 2; 474 475 // TODO: I have no idea what this is. 476 optional string history_tag = 3; 477 478 enum State { 479 OFF = 0; 480 ON = 1; 481 } 482 optional State state = 4; 483} 484 485/** 486 * Logs Battery Saver state change. 487 * 488 * Logged from: 489 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 490 */ 491message BatterySaverModeStateChanged { 492 enum State { 493 OFF = 0; 494 ON = 1; 495 } 496 optional State state = 1; 497} 498 499/** 500 * Logs Doze mode state change. 501 * 502 * Logged from: 503 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 504 */ 505message DeviceIdleModeStateChanged { 506 optional android.server.DeviceIdleModeEnum state = 1; 507} 508 509 510/** 511 * Logs state change of Doze mode including maintenance windows. 512 * 513 * Logged from: 514 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 515 */ 516message DeviceIdlingModeStateChanged { 517 optional android.server.DeviceIdleModeEnum state = 1; 518} 519 520/** 521 * Logs screen brightness level. 522 * 523 * Logged from: 524 * frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java 525 */ 526message ScreenBrightnessChanged { 527 // Screen brightness level. Should be in [-1, 255] according to PowerManager.java. 528 optional int32 level = 1; 529} 530 531/** 532 * Logs battery level (percent full, from 0 to 100). 533 * 534 * Logged from: 535 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 536 */ 537message BatteryLevelChanged { 538 // Battery level. Should be in [0, 100]. 539 optional int32 battery_level = 1; 540} 541 542/** 543 * Logs change in charging status of the device. 544 * 545 * Logged from: 546 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 547 */ 548message ChargingStateChanged { 549 // State of the battery, from frameworks/base/core/proto/android/os/enums.proto. 550 optional android.os.BatteryStatusEnum state = 1; 551} 552 553/** 554 * Logs whether the device is plugged in, and what power source it is using. 555 * 556 * Logged from: 557 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 558 */ 559message PluggedStateChanged { 560 // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto. 561 optional android.os.BatteryPluggedStateEnum state = 1; 562} 563 564/** 565 * Logs when an app's wakeup alarm fires. 566 * 567 * Logged from: 568 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 569 */ 570message WakeupAlarmOccurred { 571 repeated AttributionNode attribution_node = 1; 572 573 // Name of the wakeup alarm. 574 optional string tag = 2; 575} 576 577/** 578 * Logs when an an app causes the mobile radio to change state. 579 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio. 580 * 581 * Logged from: 582 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 583 */ 584message MobileRadioPowerStateChanged { 585 repeated AttributionNode attribution_node = 1; 586 587 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto. 588 optional android.telephony.DataConnectionPowerStateEnum state = 2; 589} 590 591/** 592 * Logs when an an app causes the wifi radio to change state. 593 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio. 594 * 595 * Logged from: 596 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 597 */ 598message WifiRadioPowerStateChanged { 599 repeated AttributionNode attribution_node = 1; 600 601 // Power state, from frameworks/base/core/proto/android/telephony/enums.proto. 602 optional android.telephony.DataConnectionPowerStateEnum state = 2; 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 */ 611message 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_micros = 2; 617} 618 619/** 620 * Logs wifi locks held by an app. 621 * 622 * Logged from: 623 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 624 */ 625message WifiLockStateChanged { 626 repeated AttributionNode attribution_node = 1; 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: 639 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 640 */ 641message WifiSignalStrengthChanged { 642 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto. 643 optional android.telephony.SignalStrengthEnum signal_strength = 1; 644} 645 646/** 647 * Logs wifi scans performed by an app. 648 * 649 * Logged from: 650 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 651 */ 652message WifiScanStateChanged { 653 repeated AttributionNode attribution_node = 1; 654 655 enum State { 656 OFF = 0; 657 ON = 1; 658 } 659 optional State state = 2; 660} 661 662/** 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 */ 668message 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/** 679 * Logs shutdown reason and duration on next boot. 680 * 681 * Logged from: 682 * frameworks/base/core/java/com/android/server/BootReceiver.java 683 */ 684message 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_millis = 3; 694 695 // Duration of shutdown in ms. Default: 0 if no duration received. 696 optional int64 duration_millis = 4; 697} 698 699 700/** 701 * Logs boot reason and duration. 702 * 703 * Logged from: 704 * system/core/bootstat/bootstat.cpp 705 */ 706message 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_millis = 3; 717 718 // Total boot duration in ms. 719 optional int64 total_duration_millis = 4; 720 721 // Bootloader duration in ms. 722 optional int64 bootloader_duration_millis = 5; 723 724 // Time since last boot in ms. Default: 0 if not available. 725 optional int64 time_since_last_boot = 6; 726} 727 728 729/** 730 * Logs call state and disconnect cause (if applicable). 731 * 732 * Logged from: 733 * packages/services/Telecomm/src/com/android/server/telecom/Call.java 734 */ 735message CallStateChanged { 736 // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED. 737 // From frameworks/base/core/proto/android/telecomm/enums.proto. 738 optional android.telecom.CallStateEnum call_state = 1; 739 740 // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY. 741 // This value is only applicable when the call_state is DISCONNECTED, and 742 // should always be UNKNOWN if the call_state is not DISCONNECTED. 743 // From frameworks/base/core/proto/android/telecomm/enums.proto. 744 optional android.telecom.DisconnectCauseEnum disconnect_cause = 2; 745 746 // True if the call is self-managed, which are apps that use the 747 // telecom infrastructure to make their own calls. 748 optional bool self_managed = 3; 749 750 // True if call is external. External calls are calls on connected Wear 751 // devices but show up in Telecom so the user can pull them onto the device. 752 optional bool external_call = 4; 753} 754 755/** 756 * Logs keyguard state. The keyguard is the lock screen. 757 * 758 * Logged from: 759 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java 760 */ 761message KeyguardStateChanged { 762 enum State { 763 UNKNOWN = 0; 764 // The keyguard is hidden when the phone is unlocked. 765 HIDDEN = 1; 766 // The keyguard is shown when the phone is locked (screen turns off). 767 SHOWN= 2; 768 // The keyguard is occluded when something is overlaying the keyguard. 769 // Eg. Opening the camera while on the lock screen. 770 OCCLUDED = 3; 771 } 772 optional State state = 1; 773} 774 775/** 776 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and 777 * prompts the user to enter a password (pattern, pin, etc). 778 * 779 * Logged from: 780 * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java 781 */ 782 783message KeyguardBouncerStateChanged { 784 enum State { 785 UNKNOWN = 0; 786 // Bouncer is hidden, either as a result of successfully entering the 787 // password, screen timing out, or user going back to lock screen. 788 HIDDEN = 1; 789 // This is when the user is being prompted to enter the password. 790 SHOWN = 2; 791 } 792 optional State state = 1; 793} 794 795/** 796 * Logs the result of entering a password into the keyguard bouncer. 797 * 798 * Logged from: 799 * frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java 800 */ 801message KeyguardBouncerPasswordEntered { 802 enum BouncerResult { 803 UNKNOWN = 0; 804 // The password entered was incorrect. 805 FAILURE = 1; 806 // The password entered was correct. 807 SUCCESS = 2; 808 } 809 optional BouncerResult result = 1; 810} 811 812/* 813 * Logs changes to the configuration of the device. The configuration is defined 814 * in frameworks/base/core/java/android/content/res/Configuration.java 815 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html 816 * Please go there to interpret the possible values each field can be. 817 * 818 * Logged from: 819 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 820 */ 821message ResourceConfigurationChanged { 822 // Bit mask of color capabilities of the screen. 823 // Contains information about the color gamut and hdr mode of the screen. 824 // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode 825 optional int32 colorMode = 1; 826 827 // The target screen density being rendered to. 828 // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi 829 optional int32 densityDpi = 2; 830 831 // Current user preference for the scaling factor for fonts, 832 // relative to the base density scaling. 833 // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale 834 optional float fontScale = 3; 835 836 // Flag indicating whether the hard keyboard is hidden. 837 // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden 838 optional int32 hardKeyboardHidden = 4; 839 840 // The type of keyboard attached to the device. 841 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard 842 optional int32 keyboard = 5; 843 844 // Flag indicating whether any keyboard is available. Takes soft keyboards into account. 845 // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden 846 optional int32 keyboardHideen = 6; 847 848 // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier. 849 // 0 if undefined. 850 // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc 851 optional int32 mcc = 7; 852 853 // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier. 854 // 0 if undefined. Note: the actual MNC may be 0, to check for this use the 855 // MNC_ZERO symbol defined in Configuration.java. 856 // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc 857 optional int32 mnc = 8; 858 859 // The kind of navigation available on the device. 860 // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation 861 optional int32 navigation = 9; 862 863 // Flag indicating whether the navigation is available. 864 // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden 865 optional int32 navigationHidden = 10; 866 867 // Overall orientation of the screen. 868 // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation 869 optional int32 orientation = 11; 870 871 // The current height of the available screen space, in dp units. 872 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp 873 optional int32 screenHeightDp = 12; 874 875 // Bit mask of overall layout of the screen. 876 // Contains information about screen size, whether the screen is wider/taller 877 // than normal, whether the screen layout is right-tl-left or left-to-right, 878 // and whether the screen has a rounded shape. 879 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout 880 optional int32 screenLayout = 13; 881 882 // Current width of the available screen space, in dp units. 883 // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp 884 optional int32 screenWidthDp = 14; 885 886 // The smallest screen size an application will see in normal operation. 887 // This is the smallest value of both screenWidthDp and screenHeightDp 888 // in portrait and landscape. 889 // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp 890 optional int32 smallestScreenWidthDp = 15; 891 892 // The type of touch screen attached to the device. 893 // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen 894 optional int32 touchscreen = 16; 895 896 // Bit mask of the ui mode. 897 // Contains information about the overall ui mode of the device. 898 // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET 899 // Also contains information about whether the device is in night mode. 900 // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode 901 optional int32 uiMode = 17; 902} 903 904 905/** 906 * Logs changes in the connection state of the mobile radio. 907 * 908 * Logged from: 909 * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java 910 */ 911message MobileConnectionStateChanged { 912 // States are from the state machine DataConnection.java. 913 enum State { 914 UNKNOWN = 0; 915 // The connection is inactive, or disconnected. 916 INACTIVE = 1; 917 // The connection is being activated, or connecting. 918 ACTIVATING = 2; 919 // The connection is active, or connected. 920 ACTIVE = 3; 921 // The connection is disconnecting. 922 DISCONNECTING = 4; 923 // The connection is disconnecting after creating a connection. 924 DISCONNECTION_ERROR_CREATING_CONNECTION = 5; 925 } 926 optional State state = 1; 927 // For multi-sim phones, this distinguishes between the sim cards. 928 optional int32 sim_slot_index = 2; 929 // Used to identify the connection. Starts at 0 and increments by 1 for 930 // every new network created. Resets whenever the device reboots. 931 optional int32 data_connection_id = 3; 932 // A bitmask for the capabilities of this connection. 933 // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS. 934 // Default value (if we have no information): 0 935 optional int64 capabilities = 4; 936 // If this connection has internet. 937 // This just checks if the DEFAULT bit of capabilities is set. 938 optional bool has_internet = 5; 939} 940 941/** 942 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA. 943 * 944 * Logged from: 945 * frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java 946 */ 947message MobileRadioTechnologyChanged { 948 optional android.telephony.NetworkTypeEnum state = 1; 949 // For multi-sim phones, this distinguishes between the sim cards. 950 optional int32 sim_slot_index = 2; 951} 952 953/** 954 * Logs the VID and PID of any connected USB devices. 955 * 956 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present. 957 * 958 * Logged by Vendor. 959 */ 960message UsbDeviceAttached { 961 optional int32 vid = 1; 962 optional int32 pid = 2; 963 optional bool has_audio = 3; 964 optional bool has_hid = 4; 965 optional bool has_storage = 5; 966} 967 968 969/** 970 * Logs when Bluetooth is enabled and disabled. 971 * 972 * Logged from: 973 * services/core/java/com/android/server/BluetoothManagerService.java 974 */ 975message BluetoothEnabledStateChanged { 976 repeated AttributionNode attribution_node = 1; 977 // Whether or not bluetooth is enabled on the device. 978 enum State { 979 UNKNOWN = 0; 980 ENABLED = 1; 981 DISABLED = 2; 982 } 983 optional State state = 2; 984 // The reason for being enabled/disabled. 985 // Eg. Airplane mode, crash, application request. 986 optional android.bluetooth.EnableDisableReasonEnum reason = 3; 987 // If the reason is an application request, this will be the package name. 988 optional string pkgName = 4; 989} 990 991/** 992 * Logs when a Bluetooth device connects and disconnects. 993 * 994 * Logged from: 995 * packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java 996 */ 997message BluetoothConnectionStateChanged { 998 // The state of the connection. 999 // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED. 1000 optional android.bluetooth.ConnectionStateEnum state = 1; 1001 // An identifier that can be used to match connect and disconnect events. 1002 // Currently is last two bytes of a hash of a device level ID and 1003 // the mac address of the bluetooth device that is connected. 1004 optional int32 obfuscated_id = 2; 1005 // The profile that is connected. Eg. GATT, A2DP, HEADSET. 1006 // From android.bluetooth.BluetoothAdapter.java 1007 optional int32 bt_profile = 3; 1008} 1009 1010/** 1011 * Logs there is an event related Bluetooth classic pairing 1012 * 1013 * Logged from: 1014 * system/bt 1015 */ 1016message BluetoothClassicPairingEventReported { 1017 // An identifier that can be used to match events for this device. 1018 // Currently, this is a salted hash of the MAC address of this Bluetooth device. 1019 // Salt: Randomly generated 256 bit value 1020 // Hash algorithm: HMAC-SHA256 1021 // Size: 32 byte 1022 // Default: null or empty if the device identifier is not known 1023 // Note: string is here for backward compatibility purpose only 1024 optional string obfuscated_id = 1; 1025 // Connection handle of this connection if available 1026 // Range: 0x0000 - 0x0EFF (12 bits) 1027 // Default: 0xFFFF if the handle is unknown 1028 optional int32 connection_handle = 2; 1029 // HCI command associated with this event 1030 // Default: CMD_UNKNOWN 1031 optional int32 hci_cmd = 3; 1032 // HCI event associated with this event 1033 // Default: EVT_UNKNOWN 1034 optional int32 hci_event = 4; 1035 // HCI command status code if this is triggered by hci_cmd 1036 // Default: STATUS_UNKNOWN 1037 optional int32 cmd_status = 5; 1038 // HCI reason code associated with this event 1039 // Default: STATUS_UNKNOWN 1040 optional int32 reason_code = 6; 1041 // A status value related to this specific event 1042 // Default: 0 1043 optional int64 event_value = 7; 1044} 1045 1046/** 1047 * Logs when something is plugged into or removed from the USB-C connector. 1048 * 1049 * Logged from: 1050 * Vendor USB HAL. 1051 */ 1052message UsbConnectorStateChanged { 1053 enum State { 1054 DISCONNECTED = 0; 1055 CONNECTED = 1; 1056 } 1057 optional State state = 1; 1058} 1059 1060/** 1061 * Logs the reported speaker impedance. 1062 * 1063 * Logged from: 1064 * Vendor audio implementation. 1065 */ 1066message SpeakerImpedanceReported { 1067 optional int32 speaker_location = 1; 1068 optional int32 impedance = 2; 1069} 1070 1071/** 1072 * Logs the report of a failed hardware. 1073 * 1074 * Logged from: 1075 * Vendor HALs. 1076 * 1077 */ 1078message HardwareFailed { 1079 enum HardwareType { 1080 HARDWARE_FAILED_UNKNOWN = 0; 1081 HARDWARE_FAILED_MICROPHONE = 1; 1082 HARDWARE_FAILED_CODEC = 2; 1083 HARDWARE_FAILED_SPEAKER = 3; 1084 HARDWARE_FAILED_FINGERPRINT = 4; 1085 } 1086 optional HardwareType hardware_type = 1; 1087 1088 /* hardware_location allows vendors to differentiate between multiple instances of 1089 * the same hardware_type. The specific locations are vendor defined integers, 1090 * referring to board-specific numbering schemes. 1091 */ 1092 optional int32 hardware_location = 2; 1093 1094 /* failure_code is specific to the HardwareType of the failed hardware. 1095 * It should use the enum values defined below. 1096 */ 1097 enum MicrophoneFailureCode { 1098 MICROPHONE_FAILURE_COMPLETE = 0; 1099 } 1100 enum CodecFailureCode { 1101 CODEC_FAILURE_COMPLETE = 0; 1102 } 1103 enum SpeakerFailureCode { 1104 SPEAKER_FAILURE_COMPLETE = 0; 1105 SPEAKER_FAILURE_HIGH_Z = 1; 1106 SPEAKER_FAILURE_SHORT = 2; 1107 } 1108 enum FingerprintFailureCode { 1109 FINGERPRINT_FAILURE_COMPLETE = 0; 1110 FINGERPRINT_SENSOR_BROKEN = 1; 1111 FINGERPRINT_TOO_MANY_DEAD_PIXELS = 2; 1112 } 1113 optional int32 failure_code = 3; 1114} 1115 1116/** 1117 * Log an event when the device has been physically dropped. 1118 * Reported from the /vendor partition. 1119 */ 1120message PhysicalDropDetected { 1121 // Confidence that the event was actually a drop, 0 -> 100 1122 optional int32 confidence_pctg = 1; 1123 // Peak acceleration of the drop, in 1/1000s of a g. 1124 optional int32 accel_peak_thousandths_g = 2; 1125 // Duration of freefall in ms 1126 optional int32 freefall_time_millis = 3; 1127} 1128 1129/** 1130 * Log bucketed battery charge cycles. 1131 * 1132 * Each bucket represents cycles of the battery past 1133 * a given charge point. For example, bucket 1 is the 1134 * lowest 1/8th of the battery, and bucket 8 is 100%. 1135 * 1136 * Logged from: 1137 * /sys/class/power_supply/bms/cycle_count, via Vendor. 1138 */ 1139message ChargeCyclesReported { 1140 optional int32 cycle_bucket_1 = 1; 1141 optional int32 cycle_bucket_2 = 2; 1142 optional int32 cycle_bucket_3 = 3; 1143 optional int32 cycle_bucket_4 = 4; 1144 optional int32 cycle_bucket_5 = 5; 1145 optional int32 cycle_bucket_6 = 6; 1146 optional int32 cycle_bucket_7 = 7; 1147 optional int32 cycle_bucket_8 = 8; 1148} 1149 1150/** 1151 * Logs the duration of a davey (jank of >=700ms) when it occurs 1152 * 1153 * Logged from: 1154 * frameworks/base/libs/hwui/JankTracker.cpp 1155 */ 1156message DaveyOccurred { 1157 // The UID that logged this atom. 1158 optional int32 uid = 1 [(is_uid) = true]; 1159 1160 // Amount of time it took to render the frame. Should be >=700ms. 1161 optional int64 jank_duration_millis = 2; 1162} 1163 1164/** 1165 * Logs phone signal strength changes. 1166 * 1167 * Logged from: 1168 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 1169 */ 1170message PhoneSignalStrengthChanged { 1171 // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto. 1172 optional android.telephony.SignalStrengthEnum signal_strength = 1; 1173} 1174 1175/** 1176 * Logs that a setting was updated. 1177 * Logged from: 1178 * frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java 1179 * The tag and is_default allow resetting of settings to default values based on the specified 1180 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details. 1181 */ 1182message SettingChanged { 1183 // The name of the setting. 1184 optional string setting = 1; 1185 1186 // The change being imposed on this setting. May represent a number, eg "3". 1187 optional string value = 2; 1188 1189 // The new value of this setting. For most settings, this is same as value. For some settings, 1190 // value is +X or -X where X represents an element in a set. For example, if the previous value 1191 // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C. 1192 // The +/- feature is currently only used for location_providers_allowed. 1193 optional string new_value = 3; 1194 1195 // The previous value of this setting. 1196 optional string prev_value = 4; 1197 1198 // The tag used with the is_default for resetting sets of settings. This is generally null. 1199 optional string tag = 5; 1200 1201 // True if this setting with tag should be resettable. 1202 optional bool is_default = 6; 1203 1204 // The associated user (for multi-user feature). Defined in android/os/UserHandle.java 1205 optional int32 user = 7; 1206 1207 enum ChangeReason { 1208 UPDATED = 1; // Updated can be an insertion or an update. 1209 DELETED = 2; 1210 } 1211 optional ChangeReason reason = 8; 1212} 1213 1214/** 1215 * Logs activity going to foreground or background 1216 * 1217 * Logged from: 1218 * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java 1219 */ 1220message ActivityForegroundStateChanged { 1221 optional int32 uid = 1 [(is_uid) = true]; 1222 optional string pkg_name = 2; 1223 optional string class_name = 3; 1224 1225 enum State { 1226 BACKGROUND = 0; 1227 FOREGROUND = 1; 1228 } 1229 optional State state = 4; 1230} 1231 1232/** 1233 * Logs when an app crashes. 1234 * Logged from: 1235 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1236 */ 1237message AppCrashOccurred { 1238 optional int32 uid = 1 [(is_uid) = true]; 1239 1240 optional string event_type = 2; 1241 1242 // The name of the process. 1243 // system_server if it is not by an app 1244 optional string process_name = 3; 1245 1246 // The pid if available. -1 means not available. 1247 optional sint32 pid = 4; 1248 1249 optional string package_name = 5; 1250 1251 enum InstantApp { 1252 UNAVAILABLE = 0; 1253 FALSE = 1; 1254 TRUE = 2; 1255 } 1256 optional InstantApp is_instant_app = 6; 1257 1258 enum ForegroundState { 1259 UNKNOWN = 0; 1260 BACKGROUND = 1; 1261 FOREGROUND = 2; 1262 } 1263 optional ForegroundState foreground_state = 7; 1264} 1265 1266/** 1267 * Logs when a WTF (What a Terrible Failure) happened. 1268 * Logged from: 1269 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1270 */ 1271message WTFOccurred { 1272 optional int32 uid = 1 [(is_uid) = true]; 1273 1274 optional string tag = 2; 1275 1276 // The name of the process. 1277 // system_server if it is not by an app 1278 optional string process_name = 3; 1279 1280 // The pid if available. -1 means not available. 1281 optional sint32 pid = 4; 1282} 1283 1284/** 1285 * Logs when system server reports low memory. 1286 * Logged from: 1287 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1288 */ 1289message LowMemReported { 1290} 1291 1292/** 1293 * Logs when an app ANR (App Not Responding) occurs. 1294 * Logged from: 1295 * frameworks/base/services/core/java/com/android/server/am/AppErrors.java 1296 */ 1297message ANROccurred { 1298 optional int32 uid = 1 [(is_uid) = true]; 1299 1300 optional string process_name = 2; 1301 1302 optional string short_component_name = 3; 1303 1304 optional string reason = 4; 1305 1306 enum InstantApp { 1307 UNAVAILABLE = 0; 1308 FALSE = 1; 1309 TRUE = 2; 1310 } 1311 optional InstantApp is_instant_app = 5; 1312 1313 enum ForegroundState { 1314 UNKNOWN = 0; 1315 BACKGROUND = 1; 1316 FOREGROUND = 2; 1317 } 1318 optional ForegroundState foreground_state = 6; 1319} 1320 1321/* 1322 * Allows other apps to push events into statsd. 1323 * Logged from: 1324 * frameworks/base/core/java/android/util/StatsLog.java 1325 */ 1326message AppBreadcrumbReported { 1327 // The uid of the application that sent this custom atom. 1328 optional int32 uid = 1 [(is_uid) = true]; 1329 1330 // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16). 1331 optional int32 label = 2; 1332 1333 // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom 1334 // predicates for the metrics). 1335 enum State { 1336 UNKNOWN = 0; 1337 UNSPECIFIED = 1; // For events that are known to not represent START/STOP. 1338 STOP = 2; 1339 START = 3; 1340 } 1341 optional State state = 3; 1342} 1343 1344/** 1345 * Logs when statsd detects an anomaly. 1346 * 1347 * Logged from: 1348 * frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp 1349 */ 1350message AnomalyDetected { 1351 // Uid that owns the config whose anomaly detection alert fired. 1352 optional int32 config_uid = 1 [(is_uid) = true]; 1353 1354 // Id of the config whose anomaly detection alert fired. 1355 optional int64 config_id = 2; 1356 1357 // Id of the alert (i.e. name of the anomaly that was detected). 1358 optional int64 alert_id = 3; 1359} 1360 1361message AppStartOccurred { 1362 // The uid if available. -1 means not available. 1363 optional int32 uid = 1 [(is_uid) = true]; 1364 1365 // The app package name. 1366 optional string pkg_name = 2; 1367 1368 enum TransitionType { 1369 UNKNOWN = 0; 1370 WARM = 1; 1371 HOT = 2; 1372 COLD = 3; 1373 } 1374 // The transition type. 1375 optional TransitionType type = 3; 1376 1377 // The activity name. 1378 optional string activity_name = 4; 1379 1380 // The name of the calling app. Empty if not set. 1381 optional string calling_pkg_name = 5; 1382 1383 // Whether the app is an instant app. 1384 optional bool is_instant_app = 6; 1385 1386 // Device uptime when activity started. 1387 optional int64 activity_start_millis = 7; 1388 1389 optional android.app.AppTransitionReasonEnum reason = 8; 1390 1391 optional int32 transition_delay_millis = 9; 1392 // -1 if not set. 1393 optional int32 starting_window_delay_millis = 10; 1394 // -1 if not set. 1395 optional int32 bind_application_delay_millis = 11; 1396 optional int32 windows_drawn_delay_millis = 12; 1397 1398 // Empty if not set. 1399 optional string launch_token = 13; 1400 1401 // The compiler filter used when when the package was optimized. 1402 optional int32 package_optimization_compilation_filter = 14; 1403 1404 // The reason why the package was optimized. 1405 optional int32 package_optimization_compilation_reason = 15; 1406} 1407 1408message AppStartCanceled { 1409 // The uid if available. -1 means not available. 1410 optional int32 uid = 1 [(is_uid) = true]; 1411 1412 // The app package name. 1413 optional string pkg_name = 2; 1414 1415 enum TransitionType { 1416 UNKNOWN = 0; 1417 WARM = 1; 1418 HOT = 2; 1419 COLD = 3; 1420 } 1421 // The transition type. 1422 optional TransitionType type = 3; 1423 1424 // The activity name. 1425 optional string activity_name = 4; 1426} 1427 1428message AppStartFullyDrawn { 1429 // The uid if available. -1 means not available. 1430 optional int32 uid = 1 [(is_uid) = true]; 1431 1432 // The app package name. 1433 optional string pkg_name = 2; 1434 1435 enum TransitionType { 1436 UNKNOWN = 0; 1437 WITH_BUNDLE = 1; 1438 WITHOUT_BUNDLE = 2; 1439 } 1440 // The transition type. 1441 optional TransitionType type = 3; 1442 1443 // The activity name. 1444 optional string activity_name = 4; 1445 1446 optional bool transition_process_running = 5; 1447 1448 // App startup time (until call to Activity#reportFullyDrawn()). 1449 optional int64 app_startup_time_millis = 6; 1450} 1451 1452/** 1453 * Logs a picture-in-picture action 1454 * Logged from: 1455 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1456 * frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java 1457 * frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java 1458 */ 1459message PictureInPictureStateChanged { 1460 // -1 if it is not available 1461 optional int32 uid = 1 [(is_uid) = true]; 1462 1463 optional string short_name = 2; 1464 1465 enum State { 1466 ENTERED = 1; 1467 EXPANDED_TO_FULL_SCREEN = 2; 1468 MINIMIZED = 3; 1469 DISMISSED = 4; 1470 } 1471 optional State state = 3; 1472} 1473 1474/** 1475 * Logs overlay action 1476 * Logged from: 1477 * services/core/java/com/android/server/wm/Session.java 1478 */ 1479message OverlayStateChanged { 1480 optional int32 uid = 1 [(is_uid) = true]; 1481 1482 optional string package_name = 2; 1483 1484 optional bool using_alert_window = 3; 1485 1486 enum State { 1487 ENTERED = 1; 1488 EXITED = 2; 1489 } 1490 optional State state = 4; 1491} 1492 1493/* 1494 * Logs foreground service starts and stops. 1495 * Note that this is not when a service starts or stops, but when it is 1496 * considered foreground. 1497 * Logged from 1498 * //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java 1499 */ 1500message ForegroundServiceStateChanged { 1501 optional int32 uid = 1 [(is_uid) = true]; 1502 // package_name + "/" + class_name 1503 optional string short_name = 2; 1504 1505 enum State { 1506 ENTER = 1; 1507 EXIT = 2; 1508 } 1509 optional State state = 3; 1510} 1511 1512/** 1513 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky 1514 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be 1515 * attributed back to the parent (host) uid. One example is Chrome. 1516 * 1517 * Logged from: 1518 * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java 1519 */ 1520message IsolatedUidChanged { 1521 // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid. 1522 // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd. 1523 optional int32 parent_uid = 1; 1524 1525 optional int32 isolated_uid = 2; 1526 1527 // We expect an isolated uid to be removed before if it's used for another parent uid. 1528 enum Event { 1529 REMOVED = 0; 1530 CREATED = 1; 1531 } 1532 optional Event event = 3; 1533} 1534 1535/* 1536 * Logs the reception of an incoming network packet causing the main system to wake up for 1537 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd 1538 * and processed by WakeupController.cpp. 1539 */ 1540message PacketWakeupOccurred { 1541 // The uid owning the socket into which the packet was delivered, or -1 if the packet was 1542 // delivered nowhere. 1543 optional int32 uid = 1 [(is_uid) = true]; 1544 // The interface name on which the packet was received. 1545 optional string iface = 2; 1546 // The ethertype value of the packet. 1547 optional int32 ethertype = 3; 1548 // String representation of the destination MAC address of the packet. 1549 optional string destination_hardware_address = 4; 1550 // String representation of the source address of the packet if this was an IP packet. 1551 optional string source_ip = 5; 1552 // String representation of the destination address of the packet if this was an IP packet. 1553 optional string destination_ip = 6; 1554 // The value of the protocol field if this was an IPv4 packet or the value of the Next Header 1555 // field if this was an IPv6 packet. The range of possible values is the same for both IP 1556 // families. 1557 optional int32 ip_next_header = 7; 1558 // The source port if this was a TCP or UDP packet. 1559 optional int32 source_port = 8; 1560 // The destination port if this was a TCP or UDP packet. 1561 optional int32 destination_port = 9; 1562} 1563 1564/* 1565 * Logs the memory stats for an app on startup. 1566 * Logged from: 1567 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1568 */ 1569message AppStartMemoryStateCaptured { 1570 // The uid if available. -1 means not available. 1571 optional int32 uid = 1 [(is_uid) = true]; 1572 1573 // The process name. 1574 optional string process_name = 2; 1575 1576 // The activity name. 1577 optional string activity_name = 3; 1578 1579 // # of page-faults 1580 optional int64 pgfault = 4; 1581 1582 // # of major page-faults 1583 optional int64 pgmajfault = 5; 1584 1585 // RSS 1586 optional int64 rss_in_bytes = 6; 1587 1588 // CACHE 1589 optional int64 cache_in_bytes = 7; 1590 1591 // SWAP 1592 optional int64 swap_in_bytes = 8; 1593} 1594 1595/* 1596 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries 1597 * for LMK event. 1598 * Logged from: 1599 * system/core/lmkd/lmkd.c 1600 */ 1601message LmkStateChanged { 1602 enum State { 1603 UNKNOWN = 0; 1604 START = 1; 1605 STOP = 2; 1606 } 1607 optional State state = 1; 1608} 1609 1610/* 1611 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure. 1612 * Logged from: 1613 * system/core/lmkd/lmkd.c 1614 */ 1615message LmkKillOccurred { 1616 // The uid if available. -1 means not available. 1617 optional int32 uid = 1 [(is_uid) = true]; 1618 1619 // The process name. 1620 optional string process_name = 2; 1621 1622 // oom adj score. 1623 optional int32 oom_score = 3; 1624 1625 // # of page-faults 1626 optional int64 pgfault = 4; 1627 1628 // # of major page-faults 1629 optional int64 pgmajfault = 5; 1630 1631 // RSS 1632 optional int64 rss_in_bytes = 6; 1633 1634 // CACHE 1635 optional int64 cache_in_bytes = 7; 1636 1637 // SWAP 1638 optional int64 swap_in_bytes = 8; 1639} 1640 1641/* 1642 * Logs when the ActivityManagerService detects that an app died. 1643 * 1644 * Logged from: 1645 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 1646 */ 1647message AppDied { 1648 // timestamp(elapsedRealtime) of record creation 1649 optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE]; 1650} 1651 1652////////////////////////////////////////////////////////////////////// 1653// Pulled atoms below this line // 1654////////////////////////////////////////////////////////////////////// 1655 1656/** 1657 * Pulls bytes transferred via wifi (Sum of foreground and background usage). 1658 * 1659 * Pulled from: 1660 * StatsCompanionService (using BatteryStats to get which interfaces are wifi) 1661 */ 1662message WifiBytesTransfer { 1663 optional int32 uid = 1 [(is_uid) = true]; 1664 1665 optional int64 rx_bytes = 2; 1666 1667 optional int64 rx_packets = 3; 1668 1669 optional int64 tx_bytes = 4; 1670 1671 optional int64 tx_packets = 5; 1672} 1673 1674/** 1675 * Pulls bytes transferred via wifi (separated by foreground and background usage). 1676 * 1677 * Pulled from: 1678 * StatsCompanionService (using BatteryStats to get which interfaces are wifi) 1679 */ 1680message WifiBytesTransferByFgBg { 1681 optional int32 uid = 1 [(is_uid) = true]; 1682 1683 // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats. 1684 optional bool is_foreground = 2; 1685 1686 optional int64 rx_bytes = 3; 1687 1688 optional int64 rx_packets = 4; 1689 1690 optional int64 tx_bytes = 5; 1691 1692 optional int64 tx_packets = 6; 1693} 1694 1695/** 1696 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage). 1697 * 1698 * Pulled from: 1699 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) 1700 */ 1701message MobileBytesTransfer { 1702 optional int32 uid = 1 [(is_uid) = true]; 1703 1704 optional int64 rx_bytes = 2; 1705 1706 optional int64 rx_packets = 3; 1707 1708 optional int64 tx_bytes = 4; 1709 1710 optional int64 tx_packets = 5; 1711} 1712 1713/** 1714 * Pulls bytes transferred via mobile networks (separated by foreground and background usage). 1715 * 1716 * Pulled from: 1717 * StatsCompanionService (using BatteryStats to get which interfaces are mobile data) 1718 */ 1719message MobileBytesTransferByFgBg { 1720 optional int32 uid = 1 [(is_uid) = true]; 1721 1722 // 1 denotes foreground and 0 denotes background. This is called Set in 1723 // NetworkStats. 1724 optional bool is_foreground = 2; 1725 1726 optional int64 rx_bytes = 3; 1727 1728 optional int64 rx_packets = 4; 1729 1730 optional int64 tx_bytes = 5; 1731 1732 optional int64 tx_packets = 6; 1733} 1734 1735/** 1736 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller. 1737 * 1738 * Pulled from: 1739 * StatsCompanionService 1740 */ 1741message BluetoothBytesTransfer { 1742 optional int32 uid = 1 [(is_uid) = true]; 1743 1744 optional int64 rx_bytes = 2; 1745 1746 optional int64 tx_bytes = 3; 1747} 1748 1749/** 1750 * Pulls the kernel wakelock durations. This atom is adapted from 1751 * android/internal/os/KernelWakelockStats.java 1752 * 1753 * Pulled from: 1754 * StatsCompanionService using KernelWakelockReader. 1755 */ 1756message KernelWakelock { 1757 optional string name = 1; 1758 1759 optional int32 count = 2; 1760 1761 optional int32 version = 3; 1762 1763 optional int64 time = 4; 1764} 1765 1766/** 1767 * Pulls low power state information. This includes platform and subsystem sleep state information, 1768 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState as defined in 1769 * hardware/interfaces/power/1.0/types.hal 1770 * hardware/interfaces/power/1.1/types.hal 1771 */ 1772message SubsystemSleepState { 1773 // Subsystem name 1774 optional string subsystem_name = 1; 1775 // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty. 1776 // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name. 1777 optional string subname = 2; 1778 // The number of times it entered, or voted for entering the sleep state 1779 optional uint64 count = 3; 1780 // The length of time spent in, or spent voting for, the sleep state 1781 optional uint64 time_millis = 4; 1782} 1783 1784/** 1785 * Pulls Cpu time per frequency. 1786 * Pulls the time the cpu spend on the frequency index. Frequency index 1787 * starts from highest to lowest. The value should be monotonically 1788 * increasing since boot. However, if there is a cpu 1789 * hotplug event, the value would be reset as well. 1790 */ 1791message CpuTimePerFreq { 1792 optional uint32 cluster = 1; 1793 optional uint32 freq_index = 2; 1794 optional uint64 time_millis = 3; 1795} 1796 1797/** 1798 * Pulls Cpu Time Per Uid. 1799 * Note that isolated process uid time should be attributed to host uids. 1800 */ 1801message CpuTimePerUid { 1802 optional int32 uid = 1 [(is_uid) = true]; 1803 optional uint64 user_time_millis = 2; 1804 optional uint64 sys_time_millis = 3; 1805} 1806 1807/** 1808 * Pulls Cpu Time Per Uid per frequency. 1809 * Note that isolated process uid time should be attributed to host uids. 1810 * For each uid, we order the time by descending frequencies. 1811 */ 1812message CpuTimePerUidFreq { 1813 optional int32 uid = 1 [(is_uid) = true]; 1814 optional uint32 freq_index = 2; 1815 optional uint64 time_millis = 3; 1816} 1817 1818/** 1819 * Pulls Wifi Controller Activity Energy Info 1820 */ 1821message WifiActivityInfo { 1822 // timestamp(wall clock) of record creation 1823 optional uint64 timestamp_millis = 1; 1824 // stack reported state 1825 // TODO: replace this with proto enum 1826 optional int32 stack_state = 2; 1827 // tx time in ms 1828 optional uint64 controller_tx_time_millis = 3; 1829 // rx time in ms 1830 optional uint64 controller_rx_time_millis = 4; 1831 // idle time in ms 1832 optional uint64 controller_idle_time_millis = 5; 1833 // product of current(mA), voltage(V) and time(ms) 1834 optional uint64 controller_energy_used = 6; 1835} 1836 1837/** 1838 * Pulls Modem Activity Energy Info 1839 */ 1840message ModemActivityInfo { 1841 // timestamp(wall clock) of record creation 1842 optional uint64 timestamp_millis = 1; 1843 // sleep time in ms. 1844 optional uint64 sleep_time_millis = 2; 1845 // idle time in ms 1846 optional uint64 controller_idle_time_millis = 3; 1847 /** 1848 * Tx power index 1849 * index 0 = tx_power < 0dBm 1850 * index 1 = 0dBm < tx_power < 5dBm 1851 * index 2 = 5dBm < tx_power < 15dBm 1852 * index 3 = 15dBm < tx_power < 20dBm 1853 * index 4 = tx_power > 20dBm 1854 */ 1855 // tx time in ms at power level 0 1856 optional uint64 controller_tx_time_pl0_millis = 4; 1857 // tx time in ms at power level 1 1858 optional uint64 controller_tx_time_pl1_millis = 5; 1859 // tx time in ms at power level 2 1860 optional uint64 controller_tx_time_pl2_millis = 6; 1861 // tx time in ms at power level 3 1862 optional uint64 controller_tx_time_pl3_millis = 7; 1863 // tx time in ms at power level 4 1864 optional uint64 controller_tx_time_pl4_millis = 8; 1865 // rx time in ms at power level 5 1866 optional uint64 controller_rx_time_millis = 9; 1867 // product of current(mA), voltage(V) and time(ms) 1868 optional uint64 energy_used = 10; 1869} 1870 1871/** 1872 * Pulls Bluetooth Activity Energy Info 1873 * Note: BluetoothBytesTransfer is pulled at the same time from the controller. 1874 */ 1875message BluetoothActivityInfo { 1876 // timestamp(wall clock) of record creation 1877 optional uint64 timestamp_millis = 1; 1878 // bluetooth stack state 1879 optional int32 bluetooth_stack_state = 2; 1880 // tx time in ms 1881 optional uint64 controller_tx_time_millis = 3; 1882 // rx time in ms 1883 optional uint64 controller_rx_time_millis = 4; 1884 // idle time in ms 1885 optional uint64 controller_idle_time_millis = 5; 1886 // product of current(mA), voltage(V) and time(ms) 1887 optional uint64 energy_used = 6; 1888} 1889 1890/* 1891 * Logs the memory stats for a process. 1892 */ 1893message ProcessMemoryState { 1894 // The uid if available. -1 means not available. 1895 optional int32 uid = 1 [(is_uid) = true]; 1896 1897 // The process name. 1898 optional string process_name = 2; 1899 1900 // oom adj score. 1901 optional int32 oom_score = 3; 1902 1903 // # of page-faults 1904 optional int64 pgfault = 4; 1905 1906 // # of major page-faults 1907 optional int64 pgmajfault = 5; 1908 1909 // RSS 1910 optional int64 rss_in_bytes = 6; 1911 1912 // CACHE 1913 optional int64 cache_in_bytes = 7; 1914 1915 // SWAP 1916 optional int64 swap_in_bytes = 8; 1917} 1918 1919/* 1920 * Elapsed real time from SystemClock. 1921 */ 1922message SystemElapsedRealtime { 1923 optional uint64 time_millis = 1; 1924} 1925 1926/* 1927 * Up time from SystemClock. 1928 */ 1929message SystemUptime { 1930 // Milliseconds since the system was booted. 1931 // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting 1932 // for external input). 1933 // It is not affected by clock scaling, idle, or other power saving mechanisms. 1934 optional uint64 uptime_millis = 1; 1935} 1936 1937/* 1938 * Reads from /proc/uid_concurrent_active_time which has the format: 1939 * active: X (X is # cores) 1940 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores) 1941 * [uid1]: [time-0] [time-1] [time-2] ... ... 1942 * ... 1943 * Time-N means the CPU time a UID spent running concurrently with N other processes. 1944 * The file contains a monotonically increasing count of time for a single boot. 1945 */ 1946message CpuActiveTime { 1947 optional int32 uid = 1 [(is_uid) = true]; 1948 optional uint64 time_millis = 2; 1949} 1950 1951/** 1952 * Reads from /proc/uid_concurrent_policy_time which has the format: 1953 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4) 1954 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ... 1955 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ... 1956 * ... 1957 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes. 1958 * The file contains a monotonically increasing count of time for a single boot. 1959 */ 1960message CpuClusterTime { 1961 optional int32 uid = 1 [(is_uid) = true]; 1962 optional int32 cluster_index = 2; 1963 optional uint64 time_millis = 3; 1964} 1965 1966/* 1967 * Pulls free disk space, for data, system partition and temporary directory. 1968 */ 1969message DiskSpace { 1970 // available bytes in data partition 1971 optional uint64 data_available_bytes = 1; 1972 // available bytes in system partition 1973 optional uint64 system_available_bytes = 2; 1974 // available bytes in download cache or temp directories 1975 optional uint64 temp_available_bytes = 3; 1976} 1977 1978/** 1979 * Pulls battery coulomb counter, which is the remaining battery charge in uAh. 1980 * Pulled from: 1981 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp 1982 */ 1983message RemainingBatteryCapacity { 1984 optional int32 charge_uAh = 1; 1985} 1986 1987/** 1988 * Pulls battery capacity, which is the battery capacity when full in uAh. 1989 * Pulled from: 1990 * frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp 1991 */ 1992message FullBatteryCapacity { 1993 optional int32 capacity_uAh = 1; 1994} 1995 1996/** 1997 * Pulls the temperature of various parts of the device. 1998 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303. 1999 * 2000 * Pulled from: 2001 * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp 2002 */ 2003message Temperature { 2004 // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY. 2005 optional android.os.TemperatureTypeEnum sensor_location = 1; 2006 2007 // The name of the temperature source. Eg. CPU0 2008 optional string sensor_name = 2; 2009 2010 // Temperature in tenths of a degree C. 2011 optional int32 temperature_dC = 3; 2012} 2013