fix wifi service mem leak
The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing activity to activity.getApplicationContext() [WifiManagerLeak]
This commit is contained in:
parent
77ee4558e7
commit
ba689273a6
|
@ -759,7 +759,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
||||||
clearAutodownloadSelectedNetworsPreference();
|
clearAutodownloadSelectedNetworsPreference();
|
||||||
}
|
}
|
||||||
// get configured networks
|
// get configured networks
|
||||||
WifiManager wifiservice = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE);
|
WifiManager wifiservice = (WifiManager) activity.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||||
List<WifiConfiguration> networks = wifiservice.getConfiguredNetworks();
|
List<WifiConfiguration> networks = wifiservice.getConfiguredNetworks();
|
||||||
|
|
||||||
if (networks != null) {
|
if (networks != null) {
|
||||||
|
|
Loading…
Reference in New Issue