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

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

DO NOT MERGE Avoid nullifying dhcp target

A race condition causes an NPE on mDhcpTarget. The safest change is
to avoid nullifying it. A dummy call to remove messages
on a handler whose looper is quit should do no harm.

Bug: 3191203
Change-Id: I7613a5add873ce9512e9719cb2dc8da61255370e
parent 3591bebd
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -933,10 +933,8 @@ public class WifiStateTracker extends NetworkStateTracker {
                    resetConnections(true);
                }
                // When supplicant dies, kill the DHCP thread
                if (mDhcpTarget != null) {
                mDhcpTarget.getLooper().quit();
                    mDhcpTarget = null;
                }

                mContext.removeStickyBroadcast(new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION));
                if (ActivityManagerNative.isSystemReady()) {
                    intent = new Intent(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
@@ -1407,10 +1405,9 @@ public class WifiStateTracker extends NetworkStateTracker {
        NetworkUtils.resetConnections(mInterfaceName);

        // Stop DHCP
        if (mDhcpTarget != null) {
        mDhcpTarget.setCancelCallback(true);
        mDhcpTarget.removeMessages(EVENT_DHCP_START);
        }

        if (!NetworkUtils.stopDhcp(mInterfaceName)) {
            Log.e(TAG, "Could not stop DHCP");
        }