@@ -2597,6 +2597,15 @@ public void enter() {
25972597 public boolean processMessage (Message message ) {
25982598 if (DBG ) log (getName () + message .toString () + "\n " );
25992599 switch (message .what ) {
2600+ case WifiMonitor .SUPPLICANT_STATE_CHANGE_EVENT :
2601+ StateChangeResult stateChangeResult = (StateChangeResult ) message .obj ;
2602+ SupplicantState state = stateChangeResult .state ;
2603+ // A WEXT bug means that we can be back to driver started state
2604+ // unexpectedly
2605+ if (SupplicantState .isDriverActive (state )) {
2606+ transitionTo (mDriverStartedState );
2607+ }
2608+ break ;
26002609 case CMD_START_DRIVER :
26012610 mWakeLock .acquire ();
26022611 WifiNative .startDriverCommand ();
@@ -2667,8 +2676,18 @@ public boolean processMessage(Message message) {
26672676 sendErrorBroadcast (WifiManager .WPS_OVERLAP_ERROR );
26682677 break ;
26692678 case WifiMonitor .SUPPLICANT_STATE_CHANGE_EVENT :
2670- handleSupplicantStateChange (message );
2671- break ;
2679+ SupplicantState state = handleSupplicantStateChange (message );
2680+ // Due to a WEXT bug, during the time of driver start/stop
2681+ // we can go into a driver stopped state in an unexpected way.
2682+ // The sequence eventually puts interface
2683+ // up and we should be back to a connected state
2684+ if (!SupplicantState .isDriverActive (state )) {
2685+ if (mNetworkInfo .getState () != NetworkInfo .State .DISCONNECTED ) {
2686+ handleNetworkDisconnect ();
2687+ }
2688+ transitionTo (mDriverStoppedState );
2689+ }
2690+ break ;
26722691 /* Do a redundant disconnect without transition */
26732692 case CMD_DISCONNECT :
26742693 WifiNative .disconnectCommand ();
0 commit comments