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

Commit 0fe3f7cb authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

DO NOT MERGE Avoid wifi disable in a UNKNOWN state

Multiple broadcast receiver unregister calls cause exception.

Bug: 2361335
parent bb79e5fd
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -329,6 +329,17 @@ public class WifiService extends IWifiManager.Stub {
            return false;
            return false;
        }
        }


        /**
         * Multiple calls to unregisterReceiver() cause exception and a system crash.
         * This can happen if a supplicant is lost (or firmware crash occurs) and user indicates
         * disable wifi at the same time.
         * Avoid doing a disable when the current Wifi state is UNKNOWN
         * TODO: Handle driver load fail and supplicant lost as seperate states
         */
        if (mWifiState == WIFI_STATE_UNKNOWN && !enable) {
            return false;
        }

        setWifiEnabledState(enable ? WIFI_STATE_ENABLING : WIFI_STATE_DISABLING, uid);
        setWifiEnabledState(enable ? WIFI_STATE_ENABLING : WIFI_STATE_DISABLING, uid);


        if (enable) {
        if (enable) {