Skip to content

Commit 80f84a1

Browse files
isheriffAndroid (Google) Code Review
authored andcommitted
Merge "Fetch WifiManager instance at the time of use" into jb-dev
2 parents 665a376 + 4f4f516 commit 80f84a1

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)