Skip to content

Commit 4f4f516

Browse files
committed
Fetch WifiManager instance at the time of use
Bug: 5340393 Change-Id: Idb0a6dbe969bc3c7955134df43b86f28208c73c3
1 parent ca7086f commit 4f4f516

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,15 @@ private int readInt(byte[] in, int pos) {
681681
}
682682

683683
private int enableWifi(boolean enable) {
684+
if (mWfm == null) {
685+
mWfm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
686+
}
684687
if (mWfm != null) {
685688
int state = mWfm.getWifiState();
686689
mWfm.setWifiEnabled(enable);
687690
return state;
691+
} else {
692+
Log.e(TAG, "Failed to fetch WifiManager instance");
688693
}
689694
return WifiManager.WIFI_STATE_UNKNOWN;
690695
}

0 commit comments

Comments
 (0)