diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b3e9fad931..4ce038edb0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -207,17 +207,6 @@
-
-
-
-
-
= Build.VERSION_CODES.N) {
- return GenericFileProvider.getUriForFile(context, GenericFileProvider.PROVIDER_NAME,
+ return FileProvider.getUriForFile(context, FileUtils.FILE_PROVIDER_AUTHORITY,
new File(baseFile.getPath()));
} else {
return Uri.fromFile(new File(baseFile.getPath()));
diff --git a/app/src/main/java/com/amaze/filemanager/utils/files/FileUtils.java b/app/src/main/java/com/amaze/filemanager/utils/files/FileUtils.java
index 28f50a4d55..48f06f4772 100644
--- a/app/src/main/java/com/amaze/filemanager/utils/files/FileUtils.java
+++ b/app/src/main/java/com/amaze/filemanager/utils/files/FileUtils.java
@@ -1,6 +1,7 @@
/*
- * Copyright (C) 2014 Arpit Khurana , Vishal Nehra ,
- * Marcin Zasuwa
+ * Copyright (C) 2014-2020 Arpit Khurana ,
+ * Vishal Nehra , Marcin Zasuwa ,
+ * Raymond Lai and contributors.
*
* This file is part of Amaze File Manager.
*
@@ -97,6 +98,7 @@
*/
public class FileUtils {
+ public static final String FILE_PROVIDER_AUTHORITY = "com.amaze.filemanager";
public static final String NOMEDIA_FILE = ".nomedia";
public static long folderSize(File directory, OnProgressUpdate updateState) {
@@ -357,7 +359,7 @@ public static void shareFiles(ArrayList a, Activity c,AppTheme appTheme,in
ArrayList uris = new ArrayList<>();
boolean b = true;
for (File f : a) {
- uris.add(Uri.fromFile(f));
+ uris.add(FileProvider.getUriForFile(c, FILE_PROVIDER_AUTHORITY, f));
}
String mime = MimeTypes.getMimeType(a.get(0).getPath(), a.get(0).isDirectory());
@@ -523,7 +525,7 @@ public static Uri fileToContentUri(Context context, File file, Intent chooserInt
}
chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION);
- return FileProvider.getUriForFile(context, "com.amaze.filemanager", file);
+ return FileProvider.getUriForFile(context, FILE_PROVIDER_AUTHORITY, file);
}
private static Uri fileToContentUri(Context context, String path, boolean isDirectory, String volume) {
diff --git a/app/src/main/java/com/amaze/filemanager/utils/share/ShareTask.java b/app/src/main/java/com/amaze/filemanager/utils/share/ShareTask.java
index 6b43d58c6c..6b5699ba44 100644
--- a/app/src/main/java/com/amaze/filemanager/utils/share/ShareTask.java
+++ b/app/src/main/java/com/amaze/filemanager/utils/share/ShareTask.java
@@ -1,3 +1,26 @@
+/*
+ * Copyright (C) 2015-2020 Arpit Khurana ,
+ * Vishal Nehra , RĂ©mi Piotaix ,
+ * John Carlson , Emmanuel Messulam,
+ * James Downs , Bowie Chen ,
+ * Raymond Lai and contributors.
+ *
+ * This file is part of Amaze File Manager.
+ *
+ * Amaze File Manager is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package com.amaze.filemanager.utils.share;
import android.app.Activity;
@@ -53,9 +76,9 @@ protected Void doInBackground(String... strings) {
arrayList1.add(resInfo.loadLabel(packageManager).toString());
if (packageName.contains("android.bluetooth")) bluetooth_present = true;
Intent intent = new Intent();
- System.out.println(resInfo.activityInfo.packageName + "\t" + resInfo.activityInfo.name);
intent.setComponent(new ComponentName(packageName, resInfo.activityInfo.name));
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
+ intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setType(mime);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayList);
intent.setPackage(packageName);