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

Commit c1976a34 authored by Hu Wang's avatar Hu Wang Committed by Steve Kondik
Browse files

Wifi: fix auto connect policy for forgetNetwork

Use shouldAutoConnect() to judge if Wi-Fi networks have to get
enabled.
Thus, after forget network, if shouldAutoConnect() is false,
do not enable other saved networks to prevent auto connect.

Change-Id: I05b00bba54876f2d0d928e0faa9476b8d51b84b4
CRs-Fixed: 684684
parent 1bcdd618
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -403,6 +403,10 @@ class WifiConfigStore {
    boolean forgetNetwork(int netId) {
        if (VDBG) localLog("forgetNetwork", netId);
        if (mWifiNative.removeNetwork(netId)) {
            if (mContext.getResources().getBoolean(R.bool.wifi_autocon)
                && !shouldAutoConnect()) {
                // do not enable networks to avoid auto connect
            } else {
                for(WifiConfiguration config : mConfiguredNetworks.values()) {
                    if(config != null && config.status == Status.DISABLED) {
                        if(mWifiNative.enableNetwork(config.networkId, false)) {
@@ -412,6 +416,7 @@ class WifiConfigStore {
                        }
                    }
                }
            }
            mWifiNative.saveConfig();
            removeConfigAndSendBroadcastIfNeeded(netId);
            return true;