diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-05-27 12:10:55 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-06-02 11:18:00 -0700 |
commit | 319da8c4c59be36fe2e221a0aba230ef6b77a14f (patch) | |
tree | a752f9f7b46abfeb020397523b121270a90de153 /wifi/java/android | |
parent | 6c2cb3061d031b5d8ccc095ecc038959d4489709 (diff) | |
download | frameworks_base-319da8c4c59be36fe2e221a0aba230ef6b77a14f.zip frameworks_base-319da8c4c59be36fe2e221a0aba230ef6b77a14f.tar.gz frameworks_base-319da8c4c59be36fe2e221a0aba230ef6b77a14f.tar.bz2 |
Add new states to support wpa_supplicant 0.8
Latest supplicant introduces the INTERFACE_DISABLED state. This
is entered when the interface is brought down (which is effectively
done by us and tracked already through the driver stop operation)
Also, added is a state for tracking authentication when supplicant acts as
the SME
Change-Id: I76090068d0ebba6df76f16707da559fcbd7512c5
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/SupplicantState.java | 44 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/SupplicantStateTracker.java | 22 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 2 |
3 files changed, 57 insertions, 11 deletions
diff --git a/wifi/java/android/net/wifi/SupplicantState.java b/wifi/java/android/net/wifi/SupplicantState.java index 6b79210..91e685f 100644 --- a/wifi/java/android/net/wifi/SupplicantState.java +++ b/wifi/java/android/net/wifi/SupplicantState.java @@ -39,6 +39,15 @@ public enum SupplicantState implements Parcelable { DISCONNECTED, /** + * Interface is disabled + * <p/> + * This state is entered if the network interface is disabled. + * wpa_supplicant refuses any new operations that would + * use the radio until the interface has been enabled. + */ + INTERFACE_DISABLED, + + /** * Inactive state (wpa_supplicant disabled). * <p/> * This state is entered if there are no enabled networks in the @@ -57,6 +66,15 @@ public enum SupplicantState implements Parcelable { SCANNING, /** + * Trying to authenticate with a BSS/SSID + * <p/> + * This state is entered when wpa_supplicant has found a suitable BSS + * to authenticate with and the driver is configured to try to + * authenticate with this BSS. + */ + AUTHENTICATING, + + /** * Trying to associate with a BSS/SSID. * <p/> * This state is entered when wpa_supplicant has found a suitable BSS @@ -152,8 +170,33 @@ public enum SupplicantState implements Parcelable { return state != UNINITIALIZED && state != INVALID; } + + /* Supplicant associating or authenticating is considered a handshake state */ + static boolean isHandshakeState(SupplicantState state) { + switch(state) { + case AUTHENTICATING: + case ASSOCIATING: + case ASSOCIATED: + case FOUR_WAY_HANDSHAKE: + case GROUP_HANDSHAKE: + return true; + case COMPLETED: + case DISCONNECTED: + case INTERFACE_DISABLED: + case INACTIVE: + case SCANNING: + case DORMANT: + case UNINITIALIZED: + case INVALID: + return false; + default: + throw new IllegalArgumentException("Unknown supplicant state"); + } + } + static boolean isConnecting(SupplicantState state) { switch(state) { + case AUTHENTICATING: case ASSOCIATING: case ASSOCIATED: case FOUR_WAY_HANDSHAKE: @@ -161,6 +204,7 @@ public enum SupplicantState implements Parcelable { case COMPLETED: return true; case DISCONNECTED: + case INTERFACE_DISABLED: case INACTIVE: case SCANNING: case DORMANT: diff --git a/wifi/java/android/net/wifi/SupplicantStateTracker.java b/wifi/java/android/net/wifi/SupplicantStateTracker.java index 9ae26da..0c4f9f6 100644 --- a/wifi/java/android/net/wifi/SupplicantStateTracker.java +++ b/wifi/java/android/net/wifi/SupplicantStateTracker.java @@ -98,12 +98,16 @@ class SupplicantStateTracker extends StateMachine { if (DBG) Log.d(TAG, "Supplicant state: " + supState.toString() + "\n"); switch (supState) { - case DISCONNECTED: + case DISCONNECTED: transitionTo(mDisconnectState); break; + case INTERFACE_DISABLED: + //we should have received a disconnection already, do nothing + break; case SCANNING: transitionTo(mScanState); break; + case AUTHENTICATING: case ASSOCIATING: case ASSOCIATED: case FOUR_WAY_HANDSHAKE: @@ -250,10 +254,7 @@ class SupplicantStateTracker extends StateMachine { case WifiStateMachine.SUPPLICANT_STATE_CHANGE_EVENT: StateChangeResult stateChangeResult = (StateChangeResult) message.obj; SupplicantState state = stateChangeResult.state; - if (state == SupplicantState.ASSOCIATING || - state == SupplicantState.ASSOCIATED || - state == SupplicantState.FOUR_WAY_HANDSHAKE || - state == SupplicantState.GROUP_HANDSHAKE) { + if (SupplicantState.isHandshakeState(state)) { if (mLoopDetectIndex > state.ordinal()) { mLoopDetectCount++; } @@ -296,12 +297,11 @@ class SupplicantStateTracker extends StateMachine { StateChangeResult stateChangeResult = (StateChangeResult) message.obj; SupplicantState state = stateChangeResult.state; sendSupplicantStateChangedBroadcast(state, mAuthFailureInSupplicantBroadcast); - /* Ignore a re-auth in completed state */ - if (state == SupplicantState.ASSOCIATING || - state == SupplicantState.ASSOCIATED || - state == SupplicantState.FOUR_WAY_HANDSHAKE || - state == SupplicantState.GROUP_HANDSHAKE || - state == SupplicantState.COMPLETED) { + /* Ignore any connecting state in completed state. Group re-keying + * events and other auth events that do not affect connectivity are + * ignored + */ + if (SupplicantState.isConnecting(state)) { break; } transitionOnSupplicantStateChange(stateChangeResult); diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index f60ae48..e3661bf 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -41,8 +41,10 @@ public class WifiInfo implements Parcelable { static { stateMap.put(SupplicantState.DISCONNECTED, DetailedState.DISCONNECTED); + stateMap.put(SupplicantState.INTERFACE_DISABLED, DetailedState.DISCONNECTED); stateMap.put(SupplicantState.INACTIVE, DetailedState.IDLE); stateMap.put(SupplicantState.SCANNING, DetailedState.SCANNING); + stateMap.put(SupplicantState.AUTHENTICATING, DetailedState.CONNECTING); stateMap.put(SupplicantState.ASSOCIATING, DetailedState.CONNECTING); stateMap.put(SupplicantState.ASSOCIATED, DetailedState.CONNECTING); stateMap.put(SupplicantState.FOUR_WAY_HANDSHAKE, DetailedState.AUTHENTICATING); |