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 17 syntax = "proto2"; 18 19 package clearcut.connectivity; 20 21 option java_package = "com.android.server.wifi"; 22 option java_outer_classname = "WifiMetricsProto"; 23 24 // The information about the Wifi events. 25 message WifiLog { 26 27 // Session information that gets logged for every Wifi connection. 28 repeated ConnectionEvent connection_event = 1; 29 30 // Number of saved networks in the user profile. 31 optional int32 num_saved_networks = 2; 32 33 // Number of open networks in the saved networks. 34 optional int32 num_open_networks = 3; 35 36 // Number of personal networks. 37 optional int32 num_personal_networks = 4; 38 39 // Number of enterprise networks. 40 optional int32 num_enterprise_networks = 5; 41 42 // Does the user have location setting enabled. 43 optional bool is_location_enabled = 6; 44 45 // Does the user have scanning enabled. 46 optional bool is_scanning_always_enabled = 7; 47 48 // Number of times user toggled wifi using the settings menu. 49 optional int32 num_wifi_toggled_via_settings = 8; 50 51 // Number of times user toggled wifi using the airplane menu. 52 optional int32 num_wifi_toggled_via_airplane = 9; 53 54 // Number of networks added by the user. 55 optional int32 num_networks_added_by_user = 10; 56 57 // Number of networks added by applications. 58 optional int32 num_networks_added_by_apps = 11; 59 60 // Number scans that returned empty results. 61 optional int32 num_empty_scan_results = 12; 62 63 // Number scans that returned at least one result. 64 optional int32 num_non_empty_scan_results = 13; 65 66 // Number of scans that were one time. 67 optional int32 num_oneshot_scans = 14; 68 69 // Number of repeated background scans that were scheduled to the chip. 70 optional int32 num_background_scans = 15; 71 72 // Error codes that a scan can result in. 73 enum ScanReturnCode { 74 75 // Return Code is unknown. 76 SCAN_UNKNOWN = 0; 77 78 // Scan was successful. 79 SCAN_SUCCESS = 1; 80 81 // Scan was successfully started, but was interrupted. 82 SCAN_FAILURE_INTERRUPTED = 2; 83 84 // Scan failed to start because of invalid configuration 85 // (bad channel, etc). 86 SCAN_FAILURE_INVALID_CONFIGURATION = 3; 87 88 // Could not start a scan because wifi is disabled. 89 FAILURE_WIFI_DISABLED = 4; 90 91 } 92 93 // Mapping of error codes to the number of times that scans resulted 94 // in that error. 95 repeated ScanReturnEntry scan_return_entries = 16; 96 97 message ScanReturnEntry { 98 99 // Return code of the scan. 100 optional ScanReturnCode scan_return_code = 1; 101 102 // Number of entries that were found in the scan. 103 optional int32 scan_results_count = 2; 104 } 105 106 // State of the Wifi. 107 enum WifiState { 108 109 // State is unknown. 110 WIFI_UNKNOWN = 0; 111 112 // Wifi is disabled. 113 WIFI_DISABLED = 1; 114 115 // Wifi is enabled. 116 WIFI_DISCONNECTED = 2; 117 118 // Wifi is enabled and associated with an AP. 119 WIFI_ASSOCIATED = 3; 120 } 121 122 // Mapping of system state to the number of times that scans were requested in 123 // that state 124 repeated WifiSystemStateEntry wifi_system_state_entries = 17; 125 126 message WifiSystemStateEntry { 127 128 // Current WiFi state. 129 optional WifiState wifi_state = 1; 130 131 // Count of scans in state. 132 optional int32 wifi_state_count = 2; 133 134 // Is screen on. 135 optional bool is_screen_on = 3; 136 } 137 138 // Mapping of Error/Success codes to the number of background scans that resulted in it 139 repeated ScanReturnEntry background_scan_return_entries = 18; 140 141 // Mapping of system state to the number of times that Background scans were requested in that 142 // state 143 repeated WifiSystemStateEntry background_scan_request_state = 19; 144 145 // Total number of times the Watchdog of Last Resort triggered, resetting the wifi stack 146 optional int32 num_last_resort_watchdog_triggers = 20; 147 148 // Total number of networks over bad association threshold when watchdog triggered 149 optional int32 num_last_resort_watchdog_bad_association_networks_total = 21; 150 151 // Total number of networks over bad authentication threshold when watchdog triggered 152 optional int32 num_last_resort_watchdog_bad_authentication_networks_total = 22; 153 154 // Total number of networks over bad dhcp threshold when watchdog triggered 155 optional int32 num_last_resort_watchdog_bad_dhcp_networks_total = 23; 156 157 // Total number of networks over bad other threshold when watchdog triggered 158 optional int32 num_last_resort_watchdog_bad_other_networks_total = 24; 159 160 // Total count of networks seen when watchdog triggered 161 optional int32 num_last_resort_watchdog_available_networks_total = 25; 162 163 // Total count of triggers with atleast one bad association network 164 optional int32 num_last_resort_watchdog_triggers_with_bad_association = 26; 165 166 // Total count of triggers with atleast one bad authentication network 167 optional int32 num_last_resort_watchdog_triggers_with_bad_authentication = 27; 168 169 // Total count of triggers with atleast one bad dhcp network 170 optional int32 num_last_resort_watchdog_triggers_with_bad_dhcp = 28; 171 172 // Total count of triggers with atleast one bad other network 173 optional int32 num_last_resort_watchdog_triggers_with_bad_other = 29; 174 175 // Count of times connectivity watchdog confirmed pno is working 176 optional int32 num_connectivity_watchdog_pno_good = 30; 177 178 // Count of times connectivity watchdog found pno not working 179 optional int32 num_connectivity_watchdog_pno_bad = 31; 180 181 // Count of times connectivity watchdog confirmed background scan is working 182 optional int32 num_connectivity_watchdog_background_good = 32; 183 184 // Count of times connectivity watchdog found background scan not working 185 optional int32 num_connectivity_watchdog_background_bad = 33; 186 187 // The time duration represented by this wifi log, from start to end of capture 188 optional int32 record_duration_sec = 34; 189 190 // Counts the occurrences of each individual RSSI poll level 191 repeated RssiPollCount rssi_poll_rssi_count = 35; 192 193 // Total number of times WiFi connected immediately after a Last Resort Watchdog trigger, 194 // without new networks becoming available. 195 optional int32 num_last_resort_watchdog_successes = 36; 196 197 // Total number of saved hidden networks 198 optional int32 num_hidden_networks = 37; 199 200 // Total number of saved passpoint / hotspot 2.0 networks 201 optional int32 num_passpoint_networks = 38; 202 203 // Total number of scan results 204 optional int32 num_total_scan_results = 39; 205 206 // Total number of scan results for open networks 207 optional int32 num_open_network_scan_results = 40; 208 209 // Total number of scan results for personal networks 210 optional int32 num_personal_network_scan_results = 41; 211 212 // Total number of scan results for enterprise networks 213 optional int32 num_enterprise_network_scan_results = 42; 214 215 // Total number of scan results for hidden networks 216 optional int32 num_hidden_network_scan_results = 43; 217 218 // Total number of scan results for hotspot 2.0 r1 networks 219 optional int32 num_hotspot2_r1_network_scan_results = 44; 220 221 // Total number of scan results for hotspot 2.0 r2 networks 222 optional int32 num_hotspot2_r2_network_scan_results = 45; 223 224 // Total number of scans handled by framework (oneshot or otherwise) 225 optional int32 num_scans = 46; 226 227 // Counts the occurrences of each alert reason. 228 repeated AlertReasonCount alert_reason_count = 47; 229 230 // Counts the occurrences of each Wifi score 231 repeated WifiScoreCount wifi_score_count = 48; 232 233 // Histogram of Soft AP Durations 234 repeated SoftApDurationBucket soft_ap_duration = 49; 235 236 // Histogram of Soft AP ReturnCode 237 repeated SoftApReturnCodeCount soft_ap_return_code = 50; 238 239 // Histogram of the delta between scan result RSSI and RSSI polls 240 repeated RssiPollCount rssi_poll_delta_count = 51; 241 242 // List of events 243 repeated StaEvent sta_event_list = 52; 244 245 // Total number of times WiFi HAL crashed. 246 optional int32 num_hal_crashes = 53; 247 248 // Total number of times WiFicond crashed. 249 optional int32 num_wificond_crashes = 54; 250 251 // Indicates the number of times an error was encountered in 252 // Wifi HAL when wifi was turned on. 253 optional int32 num_wifi_on_failure_due_to_hal = 55; 254 255 // Indicates the number of times an error was encountered in 256 // Wificond when wifi was turned on. 257 optional int32 num_wifi_on_failure_due_to_wificond = 56; 258 } 259 260 // Information that gets logged for every WiFi connection. 261 message RouterFingerPrint { 262 263 enum RoamType { 264 265 // Type is unknown. 266 ROAM_TYPE_UNKNOWN = 0; 267 268 // No roaming - usually happens on a single band (2.4 GHz) router. 269 ROAM_TYPE_NONE = 1; 270 271 // Enterprise router. 272 ROAM_TYPE_ENTERPRISE = 2; 273 274 // DBDC => Dual Band Dual Concurrent essentially a router that 275 // supports both 2.4 GHz and 5 GHz bands. 276 ROAM_TYPE_DBDC = 3; 277 } 278 279 enum Auth { 280 281 // Auth is unknown. 282 AUTH_UNKNOWN = 0; 283 284 // No authentication. 285 AUTH_OPEN = 1; 286 287 // If the router uses a personal authentication. 288 AUTH_PERSONAL = 2; 289 290 // If the router is setup for enterprise authentication. 291 AUTH_ENTERPRISE = 3; 292 } 293 294 enum RouterTechnology { 295 296 // Router is unknown. 297 ROUTER_TECH_UNKNOWN = 0; 298 299 // Router Channel A. 300 ROUTER_TECH_A = 1; 301 302 // Router Channel B. 303 ROUTER_TECH_B = 2; 304 305 // Router Channel G. 306 ROUTER_TECH_G = 3; 307 308 // Router Channel N. 309 ROUTER_TECH_N = 4; 310 311 // Router Channel AC. 312 ROUTER_TECH_AC = 5; 313 314 // When the channel is not one of the above. 315 ROUTER_TECH_OTHER = 6; 316 } 317 318 optional RoamType roam_type = 1; 319 320 // Channel on which the connection takes place. 321 optional int32 channel_info = 2; 322 323 // DTIM setting of the router. 324 optional int32 dtim = 3; 325 326 // Authentication scheme of the router. 327 optional Auth authentication = 4; 328 329 // If the router is hidden. 330 optional bool hidden = 5; 331 332 // Channel information. 333 optional RouterTechnology router_technology = 6; 334 335 // whether ipv6 is supported. 336 optional bool supports_ipv6 = 7; 337 338 // If the router is a passpoint / hotspot 2.0 network 339 optional bool passpoint = 8; 340 } 341 342 message ConnectionEvent { 343 344 // Roam Type. 345 enum RoamType { 346 347 // Type is unknown. 348 ROAM_UNKNOWN = 0; 349 350 // No roaming. 351 ROAM_NONE = 1; 352 353 // DBDC roaming. 354 ROAM_DBDC = 2; 355 356 // Enterprise roaming. 357 ROAM_ENTERPRISE = 3; 358 359 // User selected roaming. 360 ROAM_USER_SELECTED = 4; 361 362 // Unrelated. 363 ROAM_UNRELATED = 5; 364 } 365 366 // Connectivity Level Failure. 367 enum ConnectivityLevelFailure { 368 369 // Failure is unknown. 370 HLF_UNKNOWN = 0; 371 372 // No failure. 373 HLF_NONE = 1; 374 375 // DHCP failure. 376 HLF_DHCP = 2; 377 378 // No internet connection. 379 HLF_NO_INTERNET = 3; 380 381 // No internet connection. 382 HLF_UNWANTED = 4; 383 } 384 385 // Start time of the connection. 386 optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP]; 387 388 // Duration to connect. 389 optional int32 duration_taken_to_connect_millis = 2; 390 391 // Router information. 392 optional RouterFingerPrint router_fingerprint = 3; 393 394 // RSSI at the start of the connection. 395 optional int32 signal_strength = 4; 396 397 // Roam Type. 398 optional RoamType roam_type = 5; 399 400 // Result of the connection. 401 optional int32 connection_result = 6; 402 403 // Reasons for level 2 failure (needs to be coordinated with wpa-supplicant). 404 optional int32 level_2_failure_code = 7; 405 406 // Failures that happen at the connectivity layer. 407 optional ConnectivityLevelFailure connectivity_level_failure_code = 8; 408 409 // Has bug report been taken. 410 optional bool automatic_bug_report_taken = 9; 411 } 412 413 // Number of occurrences of a specific RSSI poll rssi value 414 message RssiPollCount { 415 // RSSI 416 optional int32 rssi = 1; 417 418 // Number of RSSI polls with 'rssi' 419 optional int32 count = 2; 420 } 421 422 // Number of occurrences of a specific alert reason value 423 message AlertReasonCount { 424 // Alert reason 425 optional int32 reason = 1; 426 427 // Number of alerts with |reason|. 428 optional int32 count = 2; 429 } 430 431 // Counts the number of instances of a specific Wifi Score calculated by WifiScoreReport 432 message WifiScoreCount { 433 // Wifi Score 434 optional int32 score = 1; 435 436 // Number of Wifi score reports with this score 437 optional int32 count = 2; 438 } 439 440 // Number of occurrences of Soft AP session durations 441 message SoftApDurationBucket { 442 // Bucket covers duration : [duration_sec, duration_sec + bucket_size_sec) 443 // The (inclusive) lower bound of Soft AP session duration represented by this bucket 444 optional int32 duration_sec = 1; 445 446 // The size of this bucket 447 optional int32 bucket_size_sec = 2; 448 449 // Number of soft AP session durations that fit into this bucket 450 optional int32 count = 3; 451 } 452 453 // Number of occurrences of a soft AP session return code 454 message SoftApReturnCodeCount { 455 456 enum SoftApStartResult { 457 458 // SoftApManager return code unknown 459 SOFT_AP_RETURN_CODE_UNKNOWN = 0; 460 461 // SoftAp started successfully 462 SOFT_AP_STARTED_SUCCESSFULLY = 1; 463 464 // Catch all for failures with no specific failure reason 465 SOFT_AP_FAILED_GENERAL_ERROR = 2; 466 467 // SoftAp failed to start due to NO_CHANNEL error 468 SOFT_AP_FAILED_NO_CHANNEL = 3; 469 } 470 471 // Historical, no longer used for writing as of 01/2017. 472 optional int32 return_code = 1 [deprecated = true]; 473 474 // Occurrences of this soft AP return code 475 optional int32 count = 2; 476 477 // Result of attempt to start SoftAp 478 optional SoftApStartResult start_result = 3; 479 } 480 481 message StaEvent { 482 message ConfigInfo { 483 // The set of key management protocols supported by this configuration. 484 optional uint32 allowed_key_management = 1 [default = 0]; 485 486 // The set of security protocols supported by this configuration. 487 optional uint32 allowed_protocols = 2 [default = 0]; 488 489 // The set of authentication protocols supported by this configuration. 490 optional uint32 allowed_auth_algorithms = 3 [default = 0]; 491 492 // The set of pairwise ciphers for WPA supported by this configuration. 493 optional uint32 allowed_pairwise_ciphers = 4 [default = 0]; 494 495 // The set of group ciphers supported by this configuration. 496 optional uint32 allowed_group_ciphers = 5; 497 498 // Is this a 'hidden network' 499 optional bool hidden_ssid = 6; 500 501 // Is this a Hotspot 2.0 / passpoint network 502 optional bool is_passpoint = 7; 503 504 // Is this an 'ephemeral' network (Not in saved network list, recommended externally) 505 optional bool is_ephemeral = 8; 506 507 // Has a successful connection ever been established using this WifiConfiguration 508 optional bool has_ever_connected = 9; 509 510 // RSSI of the scan result candidate associated with this WifiConfiguration 511 optional int32 scan_rssi = 10 [default = -127]; 512 513 // Frequency of the scan result candidate associated with this WifiConfiguration 514 optional int32 scan_freq = 11 [default = -1]; 515 } 516 517 enum EventType { 518 // Default/Invalid event 519 TYPE_UNKNOWN = 0; 520 521 // Supplicant Association Rejection event. Code contains the 802.11 522 TYPE_ASSOCIATION_REJECTION_EVENT = 1; 523 524 // Supplicant L2 event, 525 TYPE_AUTHENTICATION_FAILURE_EVENT = 2; 526 527 // Supplicant L2 event 528 TYPE_NETWORK_CONNECTION_EVENT = 3; 529 530 // Supplicant L2 event 531 TYPE_NETWORK_DISCONNECTION_EVENT = 4; 532 533 // Supplicant L2 event 534 TYPE_SUPPLICANT_STATE_CHANGE_EVENT = 5; 535 536 // Supplicant L2 event 537 TYPE_CMD_ASSOCIATED_BSSID = 6; 538 539 // IP Manager successfully completed IP Provisioning 540 TYPE_CMD_IP_CONFIGURATION_SUCCESSFUL = 7; 541 542 // IP Manager failed to complete IP Provisioning 543 TYPE_CMD_IP_CONFIGURATION_LOST = 8; 544 545 // IP Manager lost reachability to network neighbors 546 TYPE_CMD_IP_REACHABILITY_LOST = 9; 547 548 // Indicator that Supplicant is targeting a BSSID for roam/connection 549 TYPE_CMD_TARGET_BSSID = 10; 550 551 // Wifi framework is initiating a connection attempt 552 TYPE_CMD_START_CONNECT = 11; 553 554 // Wifi framework is initiating a roaming connection attempt 555 TYPE_CMD_START_ROAM = 12; 556 557 // SystemAPI connect() command, Settings App 558 TYPE_CONNECT_NETWORK = 13; 559 560 // Network Agent has validated the internet connection (Captive Portal Check success, or user 561 // validation) 562 TYPE_NETWORK_AGENT_VALID_NETWORK = 14; 563 564 // Framework initiated disconnect. Sometimes generated to give an extra reason for a disconnect 565 // Should typically be followed by a NETWORK_DISCONNECTION_EVENT with a local_gen = true 566 TYPE_FRAMEWORK_DISCONNECT = 15; 567 } 568 569 enum FrameworkDisconnectReason { 570 // default/none/unknown value 571 DISCONNECT_UNKNOWN = 0; 572 573 // API DISCONNECT 574 DISCONNECT_API = 1; 575 576 // Some framework internal reason (generic) 577 DISCONNECT_GENERIC = 2; 578 579 // Network Agent network validation failed, user signaled network unwanted 580 DISCONNECT_UNWANTED = 3; 581 582 // Roaming timed out 583 DISCONNECT_ROAM_WATCHDOG_TIMER = 4; 584 585 // P2P service requested wifi disconnect 586 DISCONNECT_P2P_DISCONNECT_WIFI_REQUEST = 5; 587 588 // SIM was removed while using a SIM config 589 DISCONNECT_RESET_SIM_NETWORKS = 6; 590 } 591 592 // Authentication Failure reasons as reported through the API. 593 enum AuthFailureReason { 594 // Unknown default 595 AUTH_FAILURE_UNKNOWN = 0; 596 597 // The reason code if there is no error during authentication. It could also imply that there no 598 // authentication in progress, 599 AUTH_FAILURE_NONE = 1; 600 601 // The reason code if there was a timeout authenticating. 602 AUTH_FAILURE_TIMEOUT = 2; 603 604 // The reason code if there was a wrong password while authenticating. 605 AUTH_FAILURE_WRONG_PSWD = 3; 606 607 // The reason code if there was EAP failure while authenticating. 608 AUTH_FAILURE_EAP_FAILURE = 4; 609 } 610 611 // What event was this 612 optional EventType type = 1; 613 614 // 80211 death reason code, relevant to NETWORK_DISCONNECTION_EVENTs 615 optional int32 reason = 2 [default = -1]; 616 617 // 80211 Association Status code, relevant to ASSOCIATION_REJECTION_EVENTs 618 optional int32 status = 3 [default = -1]; 619 620 // Designates whether a NETWORK_DISCONNECT_EVENT was by the STA or AP 621 optional bool local_gen = 4 [default = false]; 622 623 // Network information from the WifiConfiguration of a framework initiated connection attempt 624 optional ConfigInfo config_info = 5; 625 626 // RSSI from the last rssi poll (Only valid for active connections) 627 optional int32 last_rssi = 6 [default = -127]; 628 629 // Link speed from the last rssi poll (Only valid for active connections) 630 optional int32 last_link_speed = 7 [default = -1]; 631 632 // Frequency from the last rssi poll (Only valid for active connections) 633 optional int32 last_freq = 8 [default = -1]; 634 635 // Enum used to define bit positions in the supplicant_state_change_bitmask 636 // See {@code frameworks/base/wifi/java/android/net/wifi/SupplicantState.java} for documentation 637 enum SupplicantState { 638 STATE_DISCONNECTED = 0; 639 640 STATE_INTERFACE_DISABLED = 1; 641 642 STATE_INACTIVE = 2; 643 644 STATE_SCANNING = 3; 645 646 STATE_AUTHENTICATING = 4; 647 648 STATE_ASSOCIATING = 5; 649 650 STATE_ASSOCIATED = 6; 651 652 STATE_FOUR_WAY_HANDSHAKE = 7; 653 654 STATE_GROUP_HANDSHAKE = 8; 655 656 STATE_COMPLETED = 9; 657 658 STATE_DORMANT = 10; 659 660 STATE_UNINITIALIZED = 11; 661 662 STATE_INVALID = 12; 663 } 664 665 // Bit mask of all supplicant state changes that occured since the last event 666 optional uint32 supplicant_state_changes_bitmask = 9 [default = 0]; 667 668 // The number of milliseconds that have elapsed since the device booted 669 optional int64 start_time_millis = 10 [default = 0]; 670 671 optional FrameworkDisconnectReason framework_disconnect_reason = 11 [default = DISCONNECT_UNKNOWN]; 672 673 // Flag which indicates if an association rejection event occured due to a timeout 674 optional bool association_timed_out = 12 [default = false]; 675 676 // Authentication failure reason, as reported by WifiManager (calculated from state & deauth code) 677 optional AuthFailureReason auth_failure_reason = 13 [default = AUTH_FAILURE_UNKNOWN]; 678 } 679