Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cd8d4de authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

handle supplicant stop after child states exit

When a user explicitly disables wifi, wait on the supplicant shut down until after
all child states have handled exit - this avoids time outs due to communicating with
supplicant after breaking the socket connection

Bug: 4052161

Change-Id: Iec5bb3e14a2df4a8a12de8bb81d9c10aeb992ad4
parent f76dc56c
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -1978,17 +1978,6 @@ public class WifiStateMachine extends StateMachine {
            boolean eventLoggingEnabled = true;
            switch(message.what) {
                case CMD_STOP_SUPPLICANT:   /* Supplicant stopped by user */
                    Log.d(TAG, "stopping supplicant");
                    if (!WifiNative.stopSupplicant()) {
                        Log.e(TAG, "Failed to stop supplicant, issue kill");
                        WifiNative.killSupplicant();
                    }
                    mNetworkInfo.setIsAvailable(false);
                    handleNetworkDisconnect();
                    setWifiState(WIFI_STATE_DISABLING);
                    sendSupplicantConnectionChangedBroadcast(false);
                    mSupplicantStateTracker.sendMessage(CMD_RESET_SUPPLICANT_STATE);
                    mWpsStateMachine.sendMessage(CMD_RESET_WPS_STATE);
                    transitionTo(mSupplicantStoppingState);
                    break;
                case SUP_DISCONNECTION_EVENT:  /* Supplicant connection lost */
@@ -2089,6 +2078,17 @@ public class WifiStateMachine extends StateMachine {
        public void enter() {
            if (DBG) Log.d(TAG, getName() + "\n");
            EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
            Log.d(TAG, "stopping supplicant");
            if (!WifiNative.stopSupplicant()) {
                Log.e(TAG, "Failed to stop supplicant, issue kill");
                WifiNative.killSupplicant();
            }
            mNetworkInfo.setIsAvailable(false);
            handleNetworkDisconnect();
            setWifiState(WIFI_STATE_DISABLING);
            sendSupplicantConnectionChangedBroadcast(false);
            mSupplicantStateTracker.sendMessage(CMD_RESET_SUPPLICANT_STATE);
            mWpsStateMachine.sendMessage(CMD_RESET_WPS_STATE);
        }
        @Override
        public boolean processMessage(Message message) {