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

Commit 4f4f5166 authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

Fetch WifiManager instance at the time of use

Bug: 5340393
Change-Id: Idb0a6dbe969bc3c7955134df43b86f28208c73c3
parent ca7086f5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -681,10 +681,15 @@ public class SettingsBackupAgent extends BackupAgentHelper {
    }

    private int enableWifi(boolean enable) {
        if (mWfm == null) {
            mWfm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
        }
        if (mWfm != null) {
            int state = mWfm.getWifiState();
            mWfm.setWifiEnabled(enable);
            return state;
        } else {
            Log.e(TAG, "Failed to fetch WifiManager instance");
        }
        return WifiManager.WIFI_STATE_UNKNOWN;
    }