Skip to content

Commit

Permalink
#22 Fix: lost permissions under android-11
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Nov 2, 2021
1 parent e14111b commit b18df08
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/de/k3b/android/toGoZip/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ private boolean openPicker(CharSequence oldFolder, int folderpickerCode, boolean
startActivityForResult(intent, folderpickerCode);
} else {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
| Intent.FLAG_GRANT_PREFIX_URI_PERMISSION);
startActivityForResult(intent, folderpickerCode);
}
return true;
Expand Down Expand Up @@ -381,8 +383,8 @@ private static void grandPermission5(Context ctx, Uri data) {
if (docPath != null) {
final ContentResolver resolver = ctx.getContentResolver();
resolver.takePersistableUriPermission(data,
Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
}
}

Expand Down

0 comments on commit b18df08

Please sign in to comment.