aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-11-21 19:48:49 +0100
committerChristian Schneppe <christian@pix-art.de>2017-11-21 19:55:17 +0100
commit49cea4f6f4d1f35a6afb51c5a4bb76a50cef3495 (patch)
treeaef0b12a8c69ccdc38aa37ec9a03e0efe59cb783
parentf99bc5ede6876f2be3071205950e4251995ac3d9 (diff)
FileProvider: attempt to work with sd cards
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java1
-rw-r--r--src/main/res/xml/file_paths.xml3
3 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 43f362993..17a90c84a 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -554,7 +554,7 @@ public class FileBackend {
return FileProvider.getUriForFile(context, packageId + FILE_PROVIDER, file);
} catch (IllegalArgumentException e) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- throw new SecurityException();
+ throw new SecurityException(e);
} else {
return Uri.fromFile(file);
}
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index fdb57e692..48f971ac9 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -1096,6 +1096,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
try {
uri = FileBackend.getUriForFile(activity, file);
} catch (SecurityException e) {
+ Log.d(Config.LOGTAG, "No permission to access " + file.getAbsolutePath(), e);
Toast.makeText(activity, activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show();
return;
}
diff --git a/src/main/res/xml/file_paths.xml b/src/main/res/xml/file_paths.xml
index 9390b53c3..847faf68f 100644
--- a/src/main/res/xml/file_paths.xml
+++ b/src/main/res/xml/file_paths.xml
@@ -3,6 +3,9 @@
<external-path
name="external"
path="/" />
+ <root-path
+ name="storage"
+ path="/storage/" />
<files-path
name="pictures"
path="Images/" />