diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-12-07 00:33:50 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-12-07 13:24:41 +0100 |
commit | 739648e909446c83fe1474636b8465a7ef91cce2 (patch) | |
tree | d108cf0be0843761868295d3ab7ea54a87ee49d9 /src/main/java/eu/siacs/conversations/persistance | |
parent | c3e8fb3446237dee34bf49436076a10d07e2efdf (diff) |
ask for contact permissions when first opening StartConversationActivity
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance')
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index febb09705..02b14c7df 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -410,6 +410,8 @@ public class FileBackend { } return cropCenterSquare(input, size); } + } catch (SecurityException e) { + return null; // happens for example on Android 6.0 if contacts permissions get revoked } catch (FileNotFoundException e) { return null; } finally { @@ -424,7 +426,7 @@ public class FileBackend { InputStream is = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); - options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth)); + options.inSampleSize = calcSampleSize(image, Math.max(newHeight, newWidth)); is = mXmppConnectionService.getContentResolver().openInputStream(image); if (is == null) { return null; @@ -451,6 +453,8 @@ public class FileBackend { source.recycle(); } return dest; + } catch (SecurityException e) { + return null; //android 6.0 with revoked permissions for example } catch (FileNotFoundException e) { return null; } finally { @@ -479,7 +483,7 @@ public class FileBackend { return output; } - private int calcSampleSize(Uri image, int size) throws FileNotFoundException { + private int calcSampleSize(Uri image, int size) throws FileNotFoundException, SecurityException { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(mXmppConnectionService.getContentResolver().openInputStream(image), null, options); |