[Scummvm-git-logs] scummvm master -> bd969478f8f90f845e05d9f0089c3a9ec50165d1
antoniou79
antoniou at cti.gr
Mon Oct 7 23:05:09 CEST 2019
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:
bd969478f8 ANDROID: Ask for external storage access onCreate()
Commit: bd969478f8f90f845e05d9f0089c3a9ec50165d1
https://github.com/scummvm/scummvm/commit/bd969478f8f90f845e05d9f0089c3a9ec50165d1
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-10-08T00:02:12+03:00
Commit Message:
ANDROID: Ask for external storage access onCreate()
This is a quick fix, it needs to be improved upon
With this fix on devices with API >= Marshmallow (6.0.1) the ScummVM app will ask for the permission during runtime onCreate(),
and not only when trying to browse the list of folders and files.
However, it is only a quick fix, because the original behavior will still kick in and the prompt to Quit because no SD Card was detected will be displayed anyway.
So even if the user grants access during runtime, they will still be forced to exit the app and will have to relaunch.
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 2d48dfa..abced48 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -193,6 +193,12 @@ public class ScummVMActivity extends Activity {
setContentView(R.layout.main);
takeKeyEvents(true);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
+ && checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
+ ) {
+ requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_EXT_STORAGE);
+ }
+
// This is a common enough error that we should warn about it
// explicitly.
if (!Environment.getExternalStorageDirectory().canRead()) {
@@ -333,7 +339,7 @@ public class ScummVMActivity extends Activity {
Log.i(ScummVM.LOG_TAG, "Read External Storage permission was granted at Runtime");
} else {
// permission denied! We won't be able to make use of functionality depending on this permission.
- Toast.makeText(this, "Until permission is granted, some folders might not be listed!", Toast.LENGTH_SHORT)
+ Toast.makeText(this, "Until permission is granted, some storage locations may be inaccessible!", Toast.LENGTH_SHORT)
.show();
}
break;
More information about the Scummvm-git-logs
mailing list