diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-11-23 07:43:19 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-11-24 09:13:14 -0800 |
commit | 582ab4d414c21f71cf1e4df658b304d1a409c155 (patch) | |
tree | d20438c7e6aedc027e9e95e24bbff5b7b790296e | |
parent | f48945a7aeaaea3a570f9429a32111e19541b3b1 (diff) | |
download | packages_apps_settings-582ab4d414c21f71cf1e4df658b304d1a409c155.zip packages_apps_settings-582ab4d414c21f71cf1e4df658b304d1a409c155.tar.gz packages_apps_settings-582ab4d414c21f71cf1e4df658b304d1a409c155.tar.bz2 |
Act on supplicant changes only when disconnected
When wifi network state is disconnected, supplicant
state changes provide more fine grained information to display.
When network is connected, the UI should ignore supplicant
state changes.
Change-Id: I46aa8c2ba80303aae5c74415825102a13cc41380
-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)) { |