@@ -1625,14 +1625,14 @@ private SupplicantState handleSupplicantStateChange(Message message) {
16251625 private void handleNetworkDisconnect () {
16261626 if (DBG ) log ("Stopping DHCP and clearing IP" );
16271627
1628- /* In case we were in middle of DHCP operation
1629- restore back powermode */
1630- handlePostDhcpSetup ();
1631-
16321628 /*
16331629 * stop DHCP
16341630 */
16351631 if (mDhcpStateMachine != null ) {
1632+ /* In case we were in middle of DHCP operation
1633+ restore back powermode */
1634+ handlePostDhcpSetup ();
1635+
16361636 mDhcpStateMachine .sendMessage (DhcpStateMachine .CMD_STOP_DHCP );
16371637 mDhcpStateMachine .quit ();
16381638 mDhcpStateMachine = null ;
@@ -2395,6 +2395,10 @@ class SupplicantStoppingState extends State {
23952395 public void enter () {
23962396 if (DBG ) log (getName () + "\n " );
23972397 EventLog .writeEvent (EVENTLOG_WIFI_STATE_CHANGED , getName ());
2398+
2399+ /* Send any reset commands to supplicant before shutting it down */
2400+ handleNetworkDisconnect ();
2401+
23982402 if (DBG ) log ("stopping supplicant" );
23992403 if (!mWifiNative .stopSupplicant ()) {
24002404 loge ("Failed to stop supplicant" );
@@ -2405,7 +2409,6 @@ public void enter() {
24052409 ++mSupplicantStopFailureToken , 0 ), SUPPLICANT_RESTART_INTERVAL_MSECS );
24062410
24072411 mNetworkInfo .setIsAvailable (false );
2408- handleNetworkDisconnect ();
24092412 setWifiState (WIFI_STATE_DISABLING );
24102413 sendSupplicantConnectionChangedBroadcast (false );
24112414 mSupplicantStateTracker .sendMessage (CMD_RESET_SUPPLICANT_STATE );
0 commit comments