Explicitly request write URI permissions

pull/208/head
M66B 3 years ago
parent 40bb26dfe6
commit e2beac7154

@ -375,6 +375,7 @@ public class ActivityEML extends ActivityBase {
Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT);
create.addCategory(Intent.CATEGORY_OPENABLE); create.addCategory(Intent.CATEGORY_OPENABLE);
create.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
create.setType(apart.attachment.getMimeType()); create.setType(apart.attachment.getMimeType());
if (!TextUtils.isEmpty(apart.attachment.name)) if (!TextUtils.isEmpty(apart.attachment.name))
create.putExtra(Intent.EXTRA_TITLE, apart.attachment.name); create.putExtra(Intent.EXTRA_TITLE, apart.attachment.name);

@ -1767,6 +1767,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
private static Intent getIntentExport() { private static Intent getIntentExport() {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.setType("*/*"); intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, "fairemail_" + intent.putExtra(Intent.EXTRA_TITLE, "fairemail_" +
new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".backup"); new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".backup");

@ -1102,6 +1102,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.setType("*/*"); intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, filename); intent.putExtra(Intent.EXTRA_TITLE, filename);
Helper.openAdvanced(intent); Helper.openAdvanced(intent);

@ -479,6 +479,7 @@ public class FragmentBase extends Fragment {
Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT);
create.addCategory(Intent.CATEGORY_OPENABLE); create.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
create.setType(intent.getStringExtra("type")); create.setType(intent.getStringExtra("type"));
create.putExtra(Intent.EXTRA_TITLE, intent.getStringExtra("name")); create.putExtra(Intent.EXTRA_TITLE, intent.getStringExtra("name"));
Helper.openAdvanced(create); Helper.openAdvanced(create);

@ -389,6 +389,7 @@ public class FragmentContacts extends FragmentBase {
if (export) { if (export) {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.setType("*/*"); intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, "fairemail.vcf"); intent.putExtra(Intent.EXTRA_TITLE, "fairemail.vcf");
Helper.openAdvanced(intent); Helper.openAdvanced(intent);

@ -7527,6 +7527,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT);
create.addCategory(Intent.CATEGORY_OPENABLE); create.addCategory(Intent.CATEGORY_OPENABLE);
create.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
create.setType("*/*"); create.setType("*/*");
create.putExtra(Intent.EXTRA_TITLE, name); create.putExtra(Intent.EXTRA_TITLE, name);
Helper.openAdvanced(create); Helper.openAdvanced(create);

@ -297,6 +297,7 @@ public class FragmentRules extends FragmentBase {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.setType("*/*"); intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, "fairemail_" + intent.putExtra(Intent.EXTRA_TITLE, "fairemail_" +
new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".rules"); new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".rules");

Loading…
Cancel
Save