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

Commit cca308e3 authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

Fix network reload when config is restored

With scan mode opted in, supplicant connection is not shut
down even when wifi is turned off. This is a problem since
networks need to be reloaded when wifi is turned off and turned on
and this currently happens only on a supplicant connection.

Fix to handle this for scan mode state.

Bug: 8714796
Change-Id: I7d66c39fb51018fb52e783341222cea993993893
parent 89a60814
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ class WifiConfigStore {
     * Fetch the list of configured networks
     * and enable all stored networks in supplicant.
     */
    void initialize() {
    void loadAndEnableAllNetworks() {
        if (DBG) log("Loading config and enabling all networks");
        loadConfiguredNetworks();
        enableAllNetworks();
+7 −2
Original line number Diff line number Diff line
@@ -1111,6 +1111,7 @@ public class WifiStateMachine extends StateMachine {
        pw.println("mUserWantsSuspendOpt " + mUserWantsSuspendOpt);
        pw.println("mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled);
        pw.println("Supplicant status " + mWifiNative.status());
        pw.println("mEnableBackgroundScan " + mEnableBackgroundScan);
        pw.println();
        mWifiConfigStore.dump(fd, pw, args);
    }
@@ -2121,7 +2122,7 @@ public class WifiStateMachine extends StateMachine {
                    mLastSignalLevel = -1;

                    mWifiInfo.setMacAddress(mWifiNative.getMacAddress());
                    mWifiConfigStore.initialize();
                    mWifiConfigStore.loadAndEnableAllNetworks();
                    initializeWpsDetails();

                    sendSupplicantConnectionChangedBroadcast(true);
@@ -2657,9 +2658,13 @@ public class WifiStateMachine extends StateMachine {
        public void exit() {
            if (mLastOperationMode == SCAN_ONLY_WITH_WIFI_OFF_MODE) {
                setWifiState(WIFI_STATE_ENABLED);
                // Load and re-enable networks when going back to enabled state
                // This is essential for networks to show up after restore
                mWifiConfigStore.loadAndEnableAllNetworks();
                mWifiP2pChannel.sendMessage(CMD_ENABLE_P2P);
            }
            } else {
                mWifiConfigStore.enableAllNetworks();
            }
            mWifiNative.reconnect();
        }
        @Override