diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2012-10-01 15:08:23 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2012-10-01 15:12:37 -0700 |
commit | aede0abc1e73eb6128b87e0cccb04ca0fcfb6bdc (patch) | |
tree | d780cff44551d6744211ad192c76d596af177809 /src/com/android/gallery3d/filtershow | |
parent | fa434b0ece14ed98eb0e25d3a13374720d641709 (diff) | |
download | android_packages_apps_Snap-aede0abc1e73eb6128b87e0cccb04ca0fcfb6bdc.tar.gz android_packages_apps_Snap-aede0abc1e73eb6128b87e0cccb04ca0fcfb6bdc.tar.bz2 android_packages_apps_Snap-aede0abc1e73eb6128b87e0cccb04ca0fcfb6bdc.zip |
Fix for exceptions when image has no orientation data.
Bug: 7219163
When image has no orientation data, getOrientation now
catches the SQLiteException.
Change-Id: I6783f05bae67532c1b186fc07ca96b9361440984
Diffstat (limited to 'src/com/android/gallery3d/filtershow')
-rw-r--r-- | src/com/android/gallery3d/filtershow/cache/ImageLoader.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java index 19a841a4b..2c8fff9a2 100644 --- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java +++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Vector; +import com.android.gallery3d.common.Utils; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.HistoryAdapter; import com.android.gallery3d.filtershow.imageshow.ImageShow; @@ -17,6 +18,7 @@ import com.android.gallery3d.R; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; +import android.database.sqlite.SQLiteException; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; @@ -58,11 +60,17 @@ public class ImageLoader { } private int getOrientation(Uri uri) { - Cursor cursor = mContext.getContentResolver().query(uri, - new String[] { - MediaStore.Images.ImageColumns.ORIENTATION - }, - null, null, null); + Cursor cursor = null; + try { + cursor = mContext.getContentResolver().query(uri, + new String[] { + MediaStore.Images.ImageColumns.ORIENTATION + }, + null, null, null); + } catch (SQLiteException e){ + Utils.closeSilently(cursor); + return ExifInterface.ORIENTATION_UNDEFINED; + } if (cursor.getCount() != 1) { return -1; |