fix permissions Q needs to read our old wallet files (#744)

This commit is contained in:
m2049r 2021-04-18 16:55:14 +02:00 committed by GitHub
parent 21f44380b1
commit 99681e1bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@
package="com.m2049r.xmrwallet">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
@ -10,7 +11,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:requestLegacyExternalStorage="true"
android:preserveLegacyExternalStorage="true"
android:name=".XmrWalletApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"

View File

@ -30,7 +30,7 @@ public class LegacyStorageHelper {
static public void migrateWallets(Context context) {
try {
if (isStorageMigrated(context)) return;
if (!hasWritePermission(context)) {
if (!hasReadPermission(context)) {
// nothing to migrate, so don't try again
setStorageMigrated(context);
return;
@ -121,9 +121,9 @@ public class LegacyStorageHelper {
return dir;
}
private static boolean hasWritePermission(Context context) {
private static boolean hasReadPermission(Context context) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
return context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_DENIED;
return context.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_DENIED;
} else {
return true;
}