From a2a1078576187f1192e339c927478205a8bc937f Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Mon, 17 Oct 2011 13:29:52 -0700 Subject: Disconnect without CTRL-EVENT-DISCONNECTED Handle a supplicant state change indicating disconnection even if we have missed the CTRL-EVENT-DISCONNECTED notice Bug: 5437924 Change-Id: I28e314f47f17359926c091b2015cd1fb7422fb22 --- wifi/java/android/net/wifi/WifiStateMachine.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 55e9587..b76f8b9 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -2698,6 +2698,19 @@ public class WifiStateMachine extends StateMachine { handleNetworkDisconnect(); } transitionTo(mDriverStoppedState); + break; + } + + // Supplicant can fail to report a NETWORK_DISCONNECTION_EVENT + // when authentication times out after a successful connection, + // we can figure this from the supplicant state. If supplicant + // state is DISCONNECTED, but the mNetworkInfo says we are not + // disconnected, we need to handle a disconnection + if (state == SupplicantState.DISCONNECTED && + mNetworkInfo.getState() != NetworkInfo.State.DISCONNECTED) { + if (DBG) log("Missed CTRL-EVENT-DISCONNECTED, disconnect"); + handleNetworkDisconnect(); + transitionTo(mDisconnectedState); } break; /* Do a redundant disconnect without transition */ -- cgit v1.1