[Scummvm-git-logs] scummvm master -> a405524123145ca7d02b83e68b69fa5fb4e76944
antoniou79
a.antoniou79 at gmail.com
Sun May 24 17:30:33 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a405524123 ANDROID: Use ApplicationContext for WIFI service look up
Commit: a405524123145ca7d02b83e68b69fa5fb4e76944
https://github.com/scummvm/scummvm/commit/a405524123145ca7d02b83e68b69fa5fb4e76944
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-05-24T20:30:21+03:00
Commit Message:
ANDROID: Use ApplicationContext for WIFI service look up
Android Studio warns for memory leaks otherwise on devices < Android N
Changed paths:
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index d434ed878b..0ef1d0b5b1 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -140,7 +140,8 @@ public class ScummVMActivity extends Activity {
@Override
protected boolean isConnectionLimited() {
- WifiManager wifiMgr = (WifiManager)getSystemService(Context.WIFI_SERVICE);
+ // The WIFI Service must be looked up on the Application Context or memory will leak on devices < Android N (According to Android Studio warning)
+ WifiManager wifiMgr = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiMgr != null && wifiMgr.isWifiEnabled()) {
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
return (wifiInfo == null || wifiInfo.getNetworkId() == -1); //WiFi is on, but it's not connected to any network
@@ -223,7 +224,7 @@ public class ScummVMActivity extends Activity {
// REMOVED: Since getFilesDir() is guaranteed to exist, getFilesDir().mkdirs() might be related to crashes in Android version 9+ (Pie or above, API 28+)!
- // REMOVED: Setting savePath to Environment.getExternalStorageDirectory() + "/ScummVM/Saves/"
+ // REMOVED: Setting savePath to Environment.getExternalStorageDirectory() + "/ScummVM/Saves/"
// so that it will be in persistent external storage and not deleted on uninstall
// This has the issue for external storage being unavailable on some devices
// Is this persistence really important considering that Android does not really support it anymore
More information about the Scummvm-git-logs
mailing list