Home | History | Annotate | Download | only in src
      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   // Wi-Fi Aware metrics
    260   optional WifiAwareLog wifi_aware_log = 57;
    261 
    262   // Number of saved Passpoint providers in user profile.
    263   optional int32 num_passpoint_providers = 58;
    264 
    265   // Count of times Passpoint provider being installed.
    266   optional int32 num_passpoint_provider_installation = 59;
    267 
    268   // Count of times Passpoint provivider is installed successfully.
    269   optional int32 num_passpoint_provider_install_success = 60;
    270 
    271   // Count of times Passpoint provider is being uninstalled.
    272   optional int32 num_passpoint_provider_uninstallation = 61;
    273 
    274   // Count of times Passpoint provider is uninstalled successfully.
    275   optional int32 num_passpoint_provider_uninstall_success = 62;
    276 
    277   // Count of saved Passpoint providers device has ever connected to.
    278   optional int32 num_passpoint_providers_successfully_connected = 63;
    279 
    280   // Histogram counting instances of scans with N many ScanResults with unique ssids
    281   repeated NumConnectableNetworksBucket total_ssids_in_scan_histogram = 64;
    282 
    283   // Histogram counting instances of scans with N many ScanResults/bssids
    284   repeated NumConnectableNetworksBucket total_bssids_in_scan_histogram = 65;
    285 
    286   // Histogram counting instances of scans with N many unique open ssids
    287   repeated NumConnectableNetworksBucket available_open_ssids_in_scan_histogram = 66;
    288 
    289   // Histogram counting instances of scans with N many bssids for open networks
    290   repeated NumConnectableNetworksBucket available_open_bssids_in_scan_histogram = 67;
    291 
    292   // Histogram counting instances of scans with N many unique ssids for saved networks
    293   repeated NumConnectableNetworksBucket available_saved_ssids_in_scan_histogram = 68;
    294 
    295   // Histogram counting instances of scans with N many bssids for saved networks
    296   repeated NumConnectableNetworksBucket available_saved_bssids_in_scan_histogram = 69;
    297 
    298   // Histogram counting instances of scans with N many unique SSIDs for open or saved networks
    299   repeated NumConnectableNetworksBucket available_open_or_saved_ssids_in_scan_histogram = 70;
    300 
    301   // Histogram counting instances of scans with N many BSSIDs for open or saved networks
    302   repeated NumConnectableNetworksBucket available_open_or_saved_bssids_in_scan_histogram = 71;
    303 
    304   // Histogram counting instances of scans with N many ScanResults matching unique saved passpoint providers
    305   repeated NumConnectableNetworksBucket available_saved_passpoint_provider_profiles_in_scan_histogram = 72;
    306 
    307   // Histogram counting instances of scans with N many ScanResults BSSIDs matching a saved passpoint provider
    308   repeated NumConnectableNetworksBucket available_saved_passpoint_provider_bssids_in_scan_histogram = 73;
    309 
    310   // Counts the number of AllSingleScanLister.onResult calls with a full band scan result
    311   optional int32 full_band_all_single_scan_listener_results = 74;
    312 
    313   // Counts the number of AllSingleScanLister.onResult calls with a partial (channels) scan result
    314   optional int32 partial_all_single_scan_listener_results = 75;
    315 
    316   // Pno scan metrics
    317   optional PnoScanMetrics pno_scan_metrics = 76;
    318 
    319   // Histogram of "Connect to Network" notifications.
    320   // The notification Action should be unset.
    321   repeated ConnectToNetworkNotificationAndActionCount connect_to_network_notification_count = 77;
    322 
    323   // Histogram of "Connect to Network" notification user actions.
    324   repeated ConnectToNetworkNotificationAndActionCount connect_to_network_notification_action_count = 78;
    325 
    326   // The number of SSIDs blacklisted from recommendation by the open network
    327   // notification recommender
    328   optional int32 open_network_recommender_blacklist_size = 79;
    329 
    330   // Is the available network notification feature turned on
    331   optional bool is_wifi_networks_available_notification_on = 80;
    332 
    333   // Count of recommendation updates made by the open network notification
    334   // recommender
    335   optional int32 num_open_network_recommendation_updates = 81;
    336 
    337   // Count of connection attempts that were initiated unsuccessfully
    338   optional int32 num_open_network_connect_message_failed_to_send = 82;
    339 }
    340 
    341 // Information that gets logged for every WiFi connection.
    342 message RouterFingerPrint {
    343 
    344   enum RoamType {
    345 
    346     // Type is unknown.
    347     ROAM_TYPE_UNKNOWN = 0;
    348 
    349     // No roaming - usually happens on a single band (2.4 GHz) router.
    350     ROAM_TYPE_NONE = 1;
    351 
    352     // Enterprise router.
    353     ROAM_TYPE_ENTERPRISE = 2;
    354 
    355     // DBDC => Dual Band Dual Concurrent essentially a router that
    356     // supports both 2.4 GHz and 5 GHz bands.
    357     ROAM_TYPE_DBDC = 3;
    358   }
    359 
    360   enum Auth {
    361 
    362     // Auth is unknown.
    363     AUTH_UNKNOWN = 0;
    364 
    365     // No authentication.
    366     AUTH_OPEN = 1;
    367 
    368     // If the router uses a personal authentication.
    369     AUTH_PERSONAL = 2;
    370 
    371     // If the router is setup for enterprise authentication.
    372     AUTH_ENTERPRISE = 3;
    373   }
    374 
    375   enum RouterTechnology {
    376 
    377     // Router is unknown.
    378     ROUTER_TECH_UNKNOWN = 0;
    379 
    380     // Router Channel A.
    381     ROUTER_TECH_A = 1;
    382 
    383     // Router Channel B.
    384     ROUTER_TECH_B = 2;
    385 
    386     // Router Channel G.
    387     ROUTER_TECH_G = 3;
    388 
    389     // Router Channel N.
    390     ROUTER_TECH_N = 4;
    391 
    392     // Router Channel AC.
    393     ROUTER_TECH_AC = 5;
    394 
    395     // When the channel is not one of the above.
    396     ROUTER_TECH_OTHER = 6;
    397   }
    398 
    399   optional RoamType roam_type = 1;
    400 
    401   // Channel on which the connection takes place.
    402   optional int32 channel_info = 2;
    403 
    404   // DTIM setting of the router.
    405   optional int32 dtim = 3;
    406 
    407   // Authentication scheme of the router.
    408   optional Auth authentication = 4;
    409 
    410   // If the router is hidden.
    411   optional bool hidden = 5;
    412 
    413   // Channel information.
    414   optional RouterTechnology router_technology = 6;
    415 
    416   // whether ipv6 is supported.
    417   optional bool supports_ipv6 = 7;
    418 
    419   // If the router is a passpoint / hotspot 2.0 network
    420   optional bool passpoint = 8;
    421 }
    422 
    423 message ConnectionEvent {
    424 
    425   // Roam Type.
    426   enum RoamType {
    427 
    428     // Type is unknown.
    429     ROAM_UNKNOWN = 0;
    430 
    431     // No roaming.
    432     ROAM_NONE  = 1;
    433 
    434     // DBDC roaming.
    435     ROAM_DBDC = 2;
    436 
    437     // Enterprise roaming.
    438     ROAM_ENTERPRISE = 3;
    439 
    440     // User selected roaming.
    441     ROAM_USER_SELECTED = 4;
    442 
    443     // Unrelated.
    444     ROAM_UNRELATED = 5;
    445   }
    446 
    447   // Connectivity Level Failure.
    448   enum ConnectivityLevelFailure {
    449 
    450     // Failure is unknown.
    451     HLF_UNKNOWN = 0;
    452 
    453     // No failure.
    454     HLF_NONE = 1;
    455 
    456     // DHCP failure.
    457     HLF_DHCP = 2;
    458 
    459     // No internet connection.
    460     HLF_NO_INTERNET = 3;
    461 
    462     // No internet connection.
    463     HLF_UNWANTED = 4;
    464   }
    465 
    466   // Start time of the connection.
    467   optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP];
    468 
    469   // Duration to connect.
    470   optional int32 duration_taken_to_connect_millis = 2;
    471 
    472   // Router information.
    473   optional RouterFingerPrint router_fingerprint = 3;
    474 
    475   // RSSI at the start of the connection.
    476   optional int32 signal_strength = 4;
    477 
    478   // Roam Type.
    479   optional RoamType roam_type = 5;
    480 
    481   // Result of the connection.
    482   optional int32 connection_result = 6;
    483 
    484   // Reasons for level 2 failure (needs to be coordinated with wpa-supplicant).
    485   optional int32 level_2_failure_code = 7;
    486 
    487   // Failures that happen at the connectivity layer.
    488   optional ConnectivityLevelFailure connectivity_level_failure_code = 8;
    489 
    490   // Has bug report been taken.
    491   optional bool automatic_bug_report_taken = 9;
    492 }
    493 
    494 // Number of occurrences of a specific RSSI poll rssi value
    495 message RssiPollCount {
    496   // RSSI
    497   optional int32 rssi = 1;
    498 
    499   // Number of RSSI polls with 'rssi'
    500   optional int32 count = 2;
    501 }
    502 
    503 // Number of occurrences of a specific alert reason value
    504 message AlertReasonCount {
    505   // Alert reason
    506   optional int32 reason = 1;
    507 
    508   // Number of alerts with |reason|.
    509   optional int32 count = 2;
    510 }
    511 
    512 // Counts the number of instances of a specific Wifi Score calculated by WifiScoreReport
    513 message WifiScoreCount {
    514   // Wifi Score
    515   optional int32 score = 1;
    516 
    517   // Number of Wifi score reports with this score
    518   optional int32 count = 2;
    519 }
    520 
    521 // Number of occurrences of Soft AP session durations
    522 message SoftApDurationBucket {
    523   // Bucket covers duration : [duration_sec, duration_sec + bucket_size_sec)
    524   // The (inclusive) lower bound of Soft AP session duration represented by this bucket
    525   optional int32 duration_sec = 1;
    526 
    527   // The size of this bucket
    528   optional int32 bucket_size_sec = 2;
    529 
    530   // Number of soft AP session durations that fit into this bucket
    531   optional int32 count = 3;
    532 }
    533 
    534 // Number of occurrences of a soft AP session return code
    535 message SoftApReturnCodeCount {
    536 
    537   enum SoftApStartResult {
    538 
    539     // SoftApManager return code unknown
    540     SOFT_AP_RETURN_CODE_UNKNOWN = 0;
    541 
    542     // SoftAp started successfully
    543     SOFT_AP_STARTED_SUCCESSFULLY = 1;
    544 
    545     // Catch all for failures with no specific failure reason
    546     SOFT_AP_FAILED_GENERAL_ERROR = 2;
    547 
    548     // SoftAp failed to start due to NO_CHANNEL error
    549     SOFT_AP_FAILED_NO_CHANNEL = 3;
    550   }
    551 
    552   // Historical, no longer used for writing as of 01/2017.
    553   optional int32 return_code = 1 [deprecated = true];
    554 
    555   // Occurrences of this soft AP return code
    556   optional int32 count = 2;
    557 
    558   // Result of attempt to start SoftAp
    559   optional SoftApStartResult start_result = 3;
    560 }
    561 
    562 message StaEvent {
    563   message ConfigInfo {
    564     // The set of key management protocols supported by this configuration.
    565     optional uint32 allowed_key_management = 1 [default = 0];
    566 
    567     // The set of security protocols supported by this configuration.
    568     optional uint32 allowed_protocols = 2 [default = 0];
    569 
    570     // The set of authentication protocols supported by this configuration.
    571     optional uint32 allowed_auth_algorithms = 3 [default = 0];
    572 
    573     // The set of pairwise ciphers for WPA supported by this configuration.
    574     optional uint32 allowed_pairwise_ciphers = 4 [default = 0];
    575 
    576     // The set of group ciphers supported by this configuration.
    577     optional uint32 allowed_group_ciphers = 5;
    578 
    579     // Is this a 'hidden network'
    580     optional bool hidden_ssid = 6;
    581 
    582     // Is this a Hotspot 2.0 / passpoint network
    583     optional bool is_passpoint = 7;
    584 
    585     // Is this an 'ephemeral' network (Not in saved network list, recommended externally)
    586     optional bool is_ephemeral = 8;
    587 
    588     // Has a successful connection ever been established using this WifiConfiguration
    589     optional bool has_ever_connected = 9;
    590 
    591     // RSSI of the scan result candidate associated with this WifiConfiguration
    592     optional int32 scan_rssi = 10 [default = -127];
    593 
    594     // Frequency of the scan result candidate associated with this WifiConfiguration
    595     optional int32 scan_freq = 11 [default = -1];
    596   }
    597 
    598   enum EventType {
    599     // Default/Invalid event
    600     TYPE_UNKNOWN = 0;
    601 
    602     // Supplicant Association Rejection event. Code contains the 802.11
    603     TYPE_ASSOCIATION_REJECTION_EVENT = 1;
    604 
    605     // Supplicant L2 event,
    606     TYPE_AUTHENTICATION_FAILURE_EVENT = 2;
    607 
    608     // Supplicant L2 event
    609     TYPE_NETWORK_CONNECTION_EVENT = 3;
    610 
    611     // Supplicant L2 event
    612     TYPE_NETWORK_DISCONNECTION_EVENT = 4;
    613 
    614     // Supplicant L2 event
    615     TYPE_SUPPLICANT_STATE_CHANGE_EVENT = 5;
    616 
    617     // Supplicant L2 event
    618     TYPE_CMD_ASSOCIATED_BSSID = 6;
    619 
    620     // IP Manager successfully completed IP Provisioning
    621     TYPE_CMD_IP_CONFIGURATION_SUCCESSFUL = 7;
    622 
    623     // IP Manager failed to complete IP Provisioning
    624     TYPE_CMD_IP_CONFIGURATION_LOST = 8;
    625 
    626     // IP Manager lost reachability to network neighbors
    627     TYPE_CMD_IP_REACHABILITY_LOST = 9;
    628 
    629     // Indicator that Supplicant is targeting a BSSID for roam/connection
    630     TYPE_CMD_TARGET_BSSID = 10;
    631 
    632     // Wifi framework is initiating a connection attempt
    633     TYPE_CMD_START_CONNECT = 11;
    634 
    635     // Wifi framework is initiating a roaming connection attempt
    636     TYPE_CMD_START_ROAM = 12;
    637 
    638     // SystemAPI connect() command, Settings App
    639     TYPE_CONNECT_NETWORK = 13;
    640 
    641     // Network Agent has validated the internet connection (Captive Portal Check success, or user
    642     // validation)
    643     TYPE_NETWORK_AGENT_VALID_NETWORK = 14;
    644 
    645     // Framework initiated disconnect. Sometimes generated to give an extra reason for a disconnect
    646     // Should typically be followed by a NETWORK_DISCONNECTION_EVENT with a local_gen = true
    647     TYPE_FRAMEWORK_DISCONNECT = 15;
    648   }
    649 
    650   enum FrameworkDisconnectReason {
    651     // default/none/unknown value
    652     DISCONNECT_UNKNOWN = 0;
    653 
    654     // API DISCONNECT
    655     DISCONNECT_API = 1;
    656 
    657     // Some framework internal reason (generic)
    658     DISCONNECT_GENERIC = 2;
    659 
    660     // Network Agent network validation failed, user signaled network unwanted
    661     DISCONNECT_UNWANTED = 3;
    662 
    663     // Roaming timed out
    664     DISCONNECT_ROAM_WATCHDOG_TIMER = 4;
    665 
    666     // P2P service requested wifi disconnect
    667     DISCONNECT_P2P_DISCONNECT_WIFI_REQUEST = 5;
    668 
    669     // SIM was removed while using a SIM config
    670     DISCONNECT_RESET_SIM_NETWORKS = 6;
    671   }
    672 
    673   // Authentication Failure reasons as reported through the API.
    674   enum AuthFailureReason {
    675     // Unknown default
    676     AUTH_FAILURE_UNKNOWN = 0;
    677 
    678     // The reason code if there is no error during authentication. It could also imply that there no
    679     // authentication in progress,
    680     AUTH_FAILURE_NONE = 1;
    681 
    682     // The reason code if there was a timeout authenticating.
    683     AUTH_FAILURE_TIMEOUT = 2;
    684 
    685     // The reason code if there was a wrong password while authenticating.
    686     AUTH_FAILURE_WRONG_PSWD = 3;
    687 
    688     // The reason code if there was EAP failure while authenticating.
    689     AUTH_FAILURE_EAP_FAILURE = 4;
    690   }
    691 
    692   // What event was this
    693   optional EventType type = 1;
    694 
    695   // 80211 death reason code, relevant to NETWORK_DISCONNECTION_EVENTs
    696   optional int32 reason = 2 [default = -1];
    697 
    698   // 80211 Association Status code, relevant to ASSOCIATION_REJECTION_EVENTs
    699   optional int32 status = 3 [default = -1];
    700 
    701   // Designates whether a NETWORK_DISCONNECT_EVENT was by the STA or AP
    702   optional bool local_gen = 4 [default = false];
    703 
    704   // Network information from the WifiConfiguration of a framework initiated connection attempt
    705   optional ConfigInfo config_info = 5;
    706 
    707   // RSSI from the last rssi poll (Only valid for active connections)
    708   optional int32 last_rssi = 6 [default = -127];
    709 
    710   // Link speed from the last rssi poll (Only valid for active connections)
    711   optional int32 last_link_speed = 7 [default = -1];
    712 
    713   // Frequency from the last rssi poll (Only valid for active connections)
    714   optional int32 last_freq = 8 [default = -1];
    715 
    716   // Enum used to define bit positions in the supplicant_state_change_bitmask
    717   // See {@code frameworks/base/wifi/java/android/net/wifi/SupplicantState.java} for documentation
    718   enum SupplicantState {
    719     STATE_DISCONNECTED = 0;
    720 
    721     STATE_INTERFACE_DISABLED = 1;
    722 
    723     STATE_INACTIVE = 2;
    724 
    725     STATE_SCANNING = 3;
    726 
    727     STATE_AUTHENTICATING = 4;
    728 
    729     STATE_ASSOCIATING = 5;
    730 
    731     STATE_ASSOCIATED = 6;
    732 
    733     STATE_FOUR_WAY_HANDSHAKE = 7;
    734 
    735     STATE_GROUP_HANDSHAKE = 8;
    736 
    737     STATE_COMPLETED = 9;
    738 
    739     STATE_DORMANT = 10;
    740 
    741     STATE_UNINITIALIZED = 11;
    742 
    743     STATE_INVALID = 12;
    744   }
    745 
    746   // Bit mask of all supplicant state changes that occured since the last event
    747   optional uint32 supplicant_state_changes_bitmask = 9 [default = 0];
    748 
    749   // The number of milliseconds that have elapsed since the device booted
    750   optional int64 start_time_millis = 10 [default = 0];
    751 
    752   optional FrameworkDisconnectReason framework_disconnect_reason = 11 [default = DISCONNECT_UNKNOWN];
    753 
    754   // Flag which indicates if an association rejection event occured due to a timeout
    755   optional bool association_timed_out = 12 [default = false];
    756 
    757   // Authentication failure reason, as reported by WifiManager (calculated from state & deauth code)
    758   optional AuthFailureReason auth_failure_reason = 13 [default = AUTH_FAILURE_UNKNOWN];
    759 }
    760 
    761 // Wi-Fi Aware metrics
    762 message WifiAwareLog {
    763   // total number of unique apps that used Aware (measured on attach)
    764   optional int32 num_apps = 1;
    765 
    766   // total number of unique apps that used an identity callback when attaching
    767   optional int32 num_apps_using_identity_callback = 2;
    768 
    769   // maximum number of attaches for an app
    770   optional int32 max_concurrent_attach_sessions_in_app = 3;
    771 
    772   // histogram of attach request results
    773   repeated NanStatusHistogramBucket histogram_attach_session_status = 4;
    774 
    775   // maximum number of concurrent publish sessions in a single app
    776   optional int32 max_concurrent_publish_in_app = 5;
    777 
    778   // maximum number of concurrent subscribe sessions in a single app
    779   optional int32 max_concurrent_subscribe_in_app = 6;
    780 
    781   // maximum number of concurrent discovery (publish+subscribe) sessions in a single app
    782   optional int32 max_concurrent_discovery_sessions_in_app = 7;
    783 
    784   // maximum number of concurrent publish sessions in the system
    785   optional int32 max_concurrent_publish_in_system = 8;
    786 
    787   // maximum number of concurrent subscribe sessions in the system
    788   optional int32 max_concurrent_subscribe_in_system = 9;
    789 
    790   // maximum number of concurrent discovery (publish+subscribe) sessions in the system
    791   optional int32 max_concurrent_discovery_sessions_in_system = 10;
    792 
    793   // histogram of publish request results
    794   repeated NanStatusHistogramBucket histogram_publish_status = 11;
    795 
    796   // histogram of subscribe request results
    797   repeated NanStatusHistogramBucket histogram_subscribe_status = 12;
    798 
    799   // number of unique apps which experienced a discovery session creation failure due to lack of
    800   // resources
    801   optional int32 num_apps_with_discovery_session_failure_out_of_resources = 13;
    802 
    803   // histogram of create ndp request results
    804   repeated NanStatusHistogramBucket histogram_request_ndp_status = 14;
    805 
    806   // histogram of create ndp out-of-band (OOB) request results
    807   repeated NanStatusHistogramBucket histogram_request_ndp_oob_status = 15;
    808 
    809   // maximum number of concurrent active data-interfaces (NDI) in a single app
    810   optional int32 max_concurrent_ndi_in_app = 19;
    811 
    812   // maximum number of concurrent active data-interfaces (NDI) in the system
    813   optional int32 max_concurrent_ndi_in_system = 20;
    814 
    815   // maximum number of concurrent data-paths (NDP) in a single app
    816   optional int32 max_concurrent_ndp_in_app = 21;
    817 
    818   // maximum number of concurrent data-paths (NDP) in the system
    819   optional int32 max_concurrent_ndp_in_system = 22;
    820 
    821   // maximum number of concurrent secure data-paths (NDP) in a single app
    822   optional int32 max_concurrent_secure_ndp_in_app = 23;
    823 
    824   // maximum number of concurrent secure data-paths (NDP) in the system
    825   optional int32 max_concurrent_secure_ndp_in_system = 24;
    826 
    827   // maximum number of concurrent data-paths (NDP) per data-interface (NDI)
    828   optional int32 max_concurrent_ndp_per_ndi = 25;
    829 
    830   // histogram of durations of Aware being available
    831   repeated HistogramBucket histogram_aware_available_duration_ms = 26;
    832 
    833   // histogram of durations of Aware being enabled
    834   repeated HistogramBucket histogram_aware_enabled_duration_ms = 27;
    835 
    836   // histogram of duration (in ms) of attach sessions
    837   repeated HistogramBucket histogram_attach_duration_ms = 28;
    838 
    839   // histogram of duration (in ms) of publish sessions
    840   repeated HistogramBucket histogram_publish_session_duration_ms = 29;
    841 
    842   // histogram of duration (in ms) of subscribe sessions
    843   repeated HistogramBucket histogram_subscribe_session_duration_ms = 30;
    844 
    845   // histogram of duration (in ms) of data-paths (NDP)
    846   repeated HistogramBucket histogram_ndp_session_duration_ms = 31;
    847 
    848   // histogram of usage (in MB) of data-paths (NDP)
    849   repeated HistogramBucket histogram_ndp_session_data_usage_mb = 32;
    850 
    851   // histogram of usage (in MB) of data-path creation time (in ms) measured as request -> confirm
    852   repeated HistogramBucket histogram_ndp_creation_time_ms = 33;
    853 
    854   // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: minimum
    855   optional int64 ndp_creation_time_ms_min = 34;
    856 
    857   // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: maximum
    858   optional int64 ndp_creation_time_ms_max = 35;
    859 
    860   // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: sum
    861   optional int64 ndp_creation_time_ms_sum = 36;
    862 
    863   // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: sum of sq
    864   optional int64 ndp_creation_time_ms_sum_of_sq = 37;
    865 
    866   // statistics for data-path (NDP) creation time (in ms) measured as request -> confirm: number of
    867   // samples
    868   optional int64 ndp_creation_time_ms_num_samples = 38;
    869 
    870   // total time within the logging window that aware was available
    871   optional int64 available_time_ms = 39;
    872 
    873   // total time within the logging window that aware was enabled
    874   optional int64 enabled_time_ms = 40;
    875 
    876   // Histogram bucket for Wi-Fi Aware logs. Range is [start, end)
    877   message HistogramBucket {
    878     // lower range of the bucket (inclusive)
    879     optional int64 start = 1;
    880 
    881     // upper range of the bucket (exclusive)
    882     optional int64 end = 2;
    883 
    884     // number of samples in the bucket
    885     optional int32 count = 3;
    886   }
    887 
    888   // Status of various NAN operations
    889   enum NanStatusTypeEnum {
    890     // constant to be used by proto
    891     UNKNOWN = 0;
    892 
    893     // NAN operation succeeded
    894     SUCCESS = 1;
    895 
    896     // NAN Discovery Engine/Host driver failures
    897     INTERNAL_FAILURE = 2;
    898 
    899     // NAN OTA failures
    900     PROTOCOL_FAILURE = 3;
    901 
    902     // The publish/subscribe discovery session id is invalid
    903     INVALID_SESSION_ID = 4;
    904 
    905     // Out of resources to fufill request
    906     NO_RESOURCES_AVAILABLE = 5;
    907 
    908     // Invalid arguments passed
    909     INVALID_ARGS = 6;
    910 
    911     // Invalid peer id
    912     INVALID_PEER_ID = 7;
    913 
    914     // Invalid NAN data-path (ndp) id
    915     INVALID_NDP_ID = 8;
    916 
    917     // Attempting to enable NAN when not available, e.g. wifi is disabled
    918     NAN_NOT_ALLOWED = 9;
    919 
    920     // Over the air ACK not received
    921     NO_OTA_ACK = 10;
    922 
    923     // Attempting to enable NAN when already enabled
    924     ALREADY_ENABLED = 11;
    925 
    926     // Can't queue tx followup message foor transmission
    927     FOLLOWUP_TX_QUEUE_FULL = 12;
    928 
    929     // Unsupported concurrency of NAN and another feature - NAN disabled
    930     UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 13;
    931 
    932     // Unknown NanStatusType
    933     UNKNOWN_HAL_STATUS = 14;
    934   }
    935 
    936   // Histogram bucket for Wi-Fi Aware (NAN) status.
    937   message NanStatusHistogramBucket {
    938     // status type defining the bucket
    939     optional NanStatusTypeEnum nan_status_type = 1;
    940 
    941     // number of samples in the bucket
    942     optional int32 count = 2;
    943   }
    944 }
    945 
    946 // Data point used to build 'Number of Connectable Network' histograms
    947 message NumConnectableNetworksBucket {
    948   // Number of connectable networks seen in a scan result
    949   optional int32 num_connectable_networks = 1 [default = 0];
    950 
    951   // Number of scan results with num_connectable_networks
    952   optional int32 count = 2 [default = 0];
    953 }
    954 
    955 // Pno scan metrics
    956 // Here "Pno Scan" refers to the session of offloaded scans, these metrics count the result of a
    957 // single session, and not the individual scans within that session.
    958 message PnoScanMetrics {
    959   // Total number of attempts to offload pno scans
    960   optional int32 num_pno_scan_attempts = 1;
    961 
    962   // Total number of pno scans failed
    963   optional int32 num_pno_scan_failed = 2;
    964 
    965   // Number of pno scans started successfully over offload
    966   optional int32 num_pno_scan_started_over_offload = 3;
    967 
    968   // Number of pno scans failed over offload
    969   optional int32 num_pno_scan_failed_over_offload = 4;
    970 
    971   // Total number of pno scans that found any network
    972   optional int32 num_pno_found_network_events = 5;
    973 }
    974 
    975 // Number of occurrences for a particular "Connect to Network" Notification or
    976 // notification Action.
    977 message ConnectToNetworkNotificationAndActionCount {
    978 
    979   // "Connect to Network" notifications
    980   enum Notification {
    981 
    982     // Default
    983     NOTIFICATION_UNKNOWN = 0;
    984 
    985     // Initial notification with a recommended network.
    986     NOTIFICATION_RECOMMEND_NETWORK = 1;
    987 
    988     // Notification when connecting to the recommended network.
    989     NOTIFICATION_CONNECTING_TO_NETWORK = 2;
    990 
    991     // Notification when successfully connected to the network.
    992     NOTIFICATION_CONNECTED_TO_NETWORK = 3;
    993 
    994     // Notification when failed to connect to network.
    995     NOTIFICATION_FAILED_TO_CONNECT = 4;
    996   }
    997 
    998   // "Connect to Network" notification actions
    999   enum Action {
   1000 
   1001     // Default
   1002     ACTION_UNKNOWN = 0;
   1003 
   1004     // User dismissed the "Connect to Network" notification.
   1005     ACTION_USER_DISMISSED_NOTIFICATION = 1;
   1006 
   1007     // User tapped action button to connect to recommended network.
   1008     ACTION_CONNECT_TO_NETWORK = 2;
   1009 
   1010     // User tapped action button to open Wi-Fi Settings.
   1011     ACTION_PICK_WIFI_NETWORK = 3;
   1012 
   1013     // User tapped "Failed to connect" notification to open Wi-Fi Settings.
   1014     ACTION_PICK_WIFI_NETWORK_AFTER_CONNECT_FAILURE = 4;
   1015   }
   1016 
   1017   // Recommenders of the "Connect to Network" notification
   1018   enum Recommender {
   1019 
   1020     // Default.
   1021     RECOMMENDER_UNKNOWN = 0;
   1022 
   1023     // Open Network Available recommender.
   1024     RECOMMENDER_OPEN = 1;
   1025   }
   1026 
   1027   // Notification Type.
   1028   optional Notification notification = 1;
   1029 
   1030   // Action Type.
   1031   optional Action action = 2;
   1032 
   1033   // Recommender Type.
   1034   optional Recommender recommender = 3;
   1035 
   1036   // Occurrences of this action.
   1037   optional int32 count = 4;
   1038 }
   1039