diff options
-rw-r--r-- | src/com/android/settings/wifi/WifiSettings.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index fefbdfc..ff4f390 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -59,6 +59,7 @@ import android.widget.Toast; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; /** * This currently provides three types of UI. @@ -95,6 +96,8 @@ public class WifiSettings extends SettingsPreferenceFragment private DetailedState mLastState; private WifiInfo mLastInfo; + private AtomicBoolean mConnected = new AtomicBoolean(false); + private int mKeyStoreNetworkId = INVALID_NETWORK_ID; private WifiDialog mDialog; @@ -423,11 +426,20 @@ public class WifiSettings extends SettingsPreferenceFragment WifiManager.SUPPLICANT_CONFIG_CHANGED_ACTION.equals(action)) { updateAccessPoints(); } else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) { - updateConnectionState(WifiInfo.getDetailedStateOf((SupplicantState) - intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE))); + //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. + if (!mConnected.get()) { + updateConnectionState(WifiInfo.getDetailedStateOf((SupplicantState) + intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE))); + } } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( WifiManager.EXTRA_NETWORK_INFO); + mConnected.set(info.isConnected()); changeNextButtonState(info.isConnected()); updateConnectionState(info.getDetailedState()); } else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) { |