diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-10-04 16:45:22 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-10-04 16:59:10 -0700 |
commit | 56379d23971baafa0e6987fe2b18d7a1ffea439d (patch) | |
tree | b79aab23322b3c1ef0567f7da8156627b496edae /wifi | |
parent | 53902603a47e6be0113c6e48abbbbe09b680fe13 (diff) | |
download | frameworks_base-56379d23971baafa0e6987fe2b18d7a1ffea439d.zip frameworks_base-56379d23971baafa0e6987fe2b18d7a1ffea439d.tar.gz frameworks_base-56379d23971baafa0e6987fe2b18d7a1ffea439d.tar.bz2 |
Handle unexpected interface up/down events
WEXT on crespo has an issue where the interface up/down events
can happen in an unexpected fashion.
At a driver start, we can go from interface disabled to interface enabled,
back to interface disabled and then eventually into an interface enabled state.
Earlier, we were just expecting a single interface enable event that would trigger
driver specific commands. Now, we just handle these events as individual driver
stop and driver start situations so that we do appropriate things eventually
Bug: 5239853
Change-Id: I6bd5d844edf9fadfdca4e8eb753c2ba738aa6ad5
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 5ca7aff..1e45f68 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -2597,6 +2597,15 @@ public class WifiStateMachine extends StateMachine { public boolean processMessage(Message message) { if (DBG) log(getName() + message.toString() + "\n"); switch (message.what) { + case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: + StateChangeResult stateChangeResult = (StateChangeResult) message.obj; + SupplicantState state = stateChangeResult.state; + // A WEXT bug means that we can be back to driver started state + // unexpectedly + if (SupplicantState.isDriverActive(state)) { + transitionTo(mDriverStartedState); + } + break; case CMD_START_DRIVER: mWakeLock.acquire(); WifiNative.startDriverCommand(); @@ -2667,8 +2676,18 @@ public class WifiStateMachine extends StateMachine { sendErrorBroadcast(WifiManager.WPS_OVERLAP_ERROR); break; case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: - handleSupplicantStateChange(message); - break; + SupplicantState state = handleSupplicantStateChange(message); + // Due to a WEXT bug, during the time of driver start/stop + // we can go into a driver stopped state in an unexpected way. + // The sequence eventually puts interface + // up and we should be back to a connected state + if (!SupplicantState.isDriverActive(state)) { + if (mNetworkInfo.getState() != NetworkInfo.State.DISCONNECTED) { + handleNetworkDisconnect(); + } + transitionTo(mDriverStoppedState); + } + break; /* Do a redundant disconnect without transition */ case CMD_DISCONNECT: WifiNative.disconnectCommand(); |