From 2d57d860c2ddf792f4afd6101c19a6d0cf01547c Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Thu, 20 Oct 2011 14:38:54 -0700 Subject: [PATCH] Fix handling in DisconnectingState Now that we also handle supplicant state change to identify that a network is disconnected (in case CTRL-EVENT-DISCONNECTED goes missing), it is dangerous to defer all supplicant state change messages while in DisconnectingState. It may happen that the CTRL-EVENT-DISCONNECTED goes missing while in DisconnectingState resulting in a supplicant state change of 0 (disconnect) getting deferred. Eventually after a connection completes, the supplicant state change events get handled and the state machine goes into DisconnectedState. Fix by having state machine switch out of DisconnectingState once we do not immediately see a CTRL-EVENT-DISCONNECTED state. Bug: 5490789 Change-Id: Ia2263795e53c51da0a2bfeefecfeb6256d6c5267 --- wifi/java/android/net/wifi/WifiStateMachine.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index b76f8b9ee3416..e981da722ecaf 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -3043,9 +3043,14 @@ public class WifiStateMachine extends StateMachine { deferMessage(message); } break; - /* Handle in DisconnectedState */ case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: + /* If we get a SUPPLICANT_STATE_CHANGE_EVENT before NETWORK_DISCONNECTION_EVENT + * we have missed the network disconnection, transition to mDisconnectedState + * and handle the rest of the events there + */ deferMessage(message); + handleNetworkDisconnect(); + transitionTo(mDisconnectedState); break; default: return NOT_HANDLED;