diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-11-21 19:48:49 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-11-21 19:55:17 +0100 |
commit | 49cea4f6f4d1f35a6afb51c5a4bb76a50cef3495 (patch) | |
tree | aef0b12a8c69ccdc38aa37ec9a03e0efe59cb783 | |
parent | f99bc5ede6876f2be3071205950e4251995ac3d9 (diff) |
FileProvider: attempt to work with sd cards
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 1 | ||||
-rw-r--r-- | src/main/res/xml/file_paths.xml | 3 |
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/" /> |