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:
drabux 2017-10-06 01:49:19 +02:00
parent 77ee4558e7
commit ba689273a6
1 changed files with 1 additions and 1 deletions

View File

@ -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) {