Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68f48867 authored by Mark Harman's avatar Mark Harman
Browse files

Catch SecurityException from Media.getBitmap().

parent f146b600
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -456,7 +456,8 @@ Fast Burst photo mode if it's available on your device (requires Camera2 API to
		this option off.</li>
		this option off.</li>
	<li><b>Selected image</b> - Select a specific image on your device to be displayed as a ghost (requires
	<li><b>Selected image</b> - Select a specific image on your device to be displayed as a ghost (requires
	Android 5). Note that for this option, the ghost image will not be displayed if Open Camera is running
	Android 5). Note that for this option, the ghost image will not be displayed if Open Camera is running
	when your device is locked.</li>
	when your device is locked. If the image doesn't show at all, it may be that Open Camera was unable to
	load the selected image.</li>
</ul>
</ul>


<p><b>More camera controls...</b> - Select to access the following controls:</p>
<p><b>More camera controls...</b> - Select to access the following controls:</p>
+5 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,11 @@
<p>&lt; <small><a href="index.html">Main Page.</a></small></p>
<p>&lt; <small><a href="index.html">Main Page.</a></small></p>


<pre>
<pre>
Version 1.44.1 (Work in progress)

FIXED   Crash in 1.44 for ghost image option if selected image could not be loaded due to
        SecurityException.

Version 1.44 (2018/09/18)
Version 1.44 (2018/09/18)


FIXED   Crash if activity is destroyed as photo is taken.
FIXED   Crash if activity is destroyed as photo is taken.
+12 −1
Original line number Original line Diff line number Diff line
@@ -506,7 +506,18 @@ public class DrawPreview {
    private Bitmap loadBitmap(Uri uri, File file) throws IOException {
    private Bitmap loadBitmap(Uri uri, File file) throws IOException {
        if( MyDebug.LOG )
        if( MyDebug.LOG )
            Log.d(TAG, "loadBitmap: " + uri);
            Log.d(TAG, "loadBitmap: " + uri);
        Bitmap bitmap = MediaStore.Images.Media.getBitmap(main_activity.getContentResolver(), uri);
        Bitmap bitmap;
        try {
			bitmap = MediaStore.Images.Media.getBitmap(main_activity.getContentResolver(), uri);
		}
		catch(Exception e) {
        	// Although Media.getBitmap() is documented as only throwing FileNotFoundException, IOException
			// (with the former being a subset of IOException anyway), I've had SecurityException from
			// Google Play - best to catch everything just in case.
            Log.e(TAG, "MediaStore.Images.Media.getBitmap exception");
        	e.printStackTrace();
            throw new IOException();
		}
        if( bitmap == null ) {
        if( bitmap == null ) {
            // just in case!
            // just in case!
            Log.e(TAG, "MediaStore.Images.Media.getBitmap returned null");
            Log.e(TAG, "MediaStore.Images.Media.getBitmap returned null");