From 3b5e4e242184d8ad4adb9366e9aee24c082be7dc Mon Sep 17 00:00:00 2001 From: vandwalle Date: Thu, 31 Jul 2014 00:06:40 -0700 Subject: [PATCH] The Settings app is listening to wpa_supplicant state change so as to update the state of the AccessPoint objects and present Wifi state to the user. This is not right because wpa_supplicant states are transient (for instance when the WiFi Layer, at Layer 2, is going thru some harmless spurious disconnection cycle due to WiFi signal fluctuation). This cause the state of the WiFi Network to appear to be unstable to the user. Hence, I removed dependencies on wpa_supplicant internal state. In addition so as to improve debugging, I added the BSSID to the Wifi Verbose Logging string which is shown in wifi picker alongside the current network. This string only appear when a user goes into Developper Options and enable WiFi Verbose Logging. The below bug is an example of situation where a spurious disconnect (a coupld seconds) handled by wpa_supplicant can cause the WiFi Settings to indicate that the link is unstable. Bug:16140888 Wifi best network selection not smooth Change-Id: I0e7c6b86262b88ed993c46fcdcdbab4d9b1f5ea1 --- src/com/android/settings/wifi/AccessPoint.java | 13 ++++--------- .../android/settings/wifi/WifiSettings.java | 18 ------------------ 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java index 33c92a23fe9..b3fafa40a6c 100644 --- a/src/com/android/settings/wifi/AccessPoint.java +++ b/src/com/android/settings/wifi/AccessPoint.java @@ -427,17 +427,12 @@ class AccessPoint extends Preference { StringBuilder visibility = new StringBuilder(); long now = System.currentTimeMillis(); - long age = (now - mSeen); - if (age < VISIBILITY_MAX_AGE_IN_MILLI) { - //show age in seconds, in the form xx - visibility.append(Long.toString((age / SECOND_TO_MILLI) % SECOND_TO_MILLI)) - .append("s"); - } else { - //not seen for more than 1000 seconds - visibility.append("!"); - } if (mInfo != null) { + String bssid = mInfo.getBSSID(); + if (bssid != null) { + visibility.append(" ").append(bssid); + } visibility.append(" sc=").append(Integer.toString(mInfo.score)); visibility.append(" "); visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate)); diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 5c0a6560fa1..e83cb06765a 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -38,7 +38,6 @@ import android.net.NetworkScoreManager; import android.net.NetworkScorerAppManager; import android.net.NetworkScorerAppManager.NetworkScorerAppData; import android.net.wifi.ScanResult; -import android.net.wifi.SupplicantState; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; @@ -871,23 +870,6 @@ public class WifiSettings extends RestrictedSettingsFragment WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION.equals(action) || WifiManager.LINK_CONFIGURATION_CHANGED_ACTION.equals(action)) { updateAccessPoints(); - } else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) { - //Ignore supplicant state changes when network is connected - //TODO: we should deprecate SUPPLICANT_STATE_CHANGED_ACTION and - //introduce a broadcast that combines the supplicant and network - //network state change events so the apps dont have to worry about - //ignoring supplicant state change when network is connected - //to get more fine grained information. - SupplicantState state = (SupplicantState) intent.getParcelableExtra( - WifiManager.EXTRA_NEW_STATE); - if (!mConnected.get() && SupplicantState.isHandshakeState(state)) { - updateConnectionState(WifiInfo.getDetailedStateOf(state)); - } else { - // During a connect, we may have the supplicant - // state change affect the detailed network state. - // Make sure a lost connection is updated as well. - updateConnectionState(null); - } } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( WifiManager.EXTRA_NETWORK_INFO);