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
This commit is contained in:
vandwalle
2014-07-31 00:06:40 -07:00
committed by Pierre Vandwalle
parent d94e78b4b2
commit 3b5e4e2421
2 changed files with 4 additions and 27 deletions

View File

@@ -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);