From 62a622b22717b454d3de26bb3311536a27492b6e Mon Sep 17 00:00:00 2001 From: Angus Kong Date: Fri, 30 Aug 2013 15:10:38 -0700 Subject: Skip bitmaps with 0 dimension. bug:10514553 Change-Id: I0d26a324ede55b281e60cedc174869f5b863ca31 --- src/com/android/camera/data/LocalMediaData.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/camera/data/LocalMediaData.java b/src/com/android/camera/data/LocalMediaData.java index fef141f55..53c153c0c 100644 --- a/src/com/android/camera/data/LocalMediaData.java +++ b/src/com/android/camera/data/LocalMediaData.java @@ -344,22 +344,28 @@ public abstract class LocalMediaData implements LocalData { int width = c.getInt(COL_WIDTH); int height = c.getInt(COL_HEIGHT); if (width <= 0 || height <= 0) { - Log.w(TAG, "Warning! zero dimension for " + Log.w(TAG, "Zero dimension in ContentResolver for " + path + ":" + width + "x" + height); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; BitmapFactory.decodeFile(path, opts); - if (opts.outWidth != -1 && opts.outHeight != -1) { + if (opts.outWidth > 0 && opts.outHeight > 0) { width = opts.outWidth; height = opts.outHeight; } else { - Log.w(TAG, "Warning! dimension decode failed for " + path); + Log.w(TAG, "Dimension decode failed for " + path); Bitmap b = BitmapFactory.decodeFile(path); if (b == null) { + Log.w(TAG, "PhotoData skipeped." + + " Decoding " + path + "failed."); return null; } width = b.getWidth(); height = b.getHeight(); + if (width == 0 || height == 0) { + Log.w(TAG, "PhotoData skipped. Bitmap size 0 for " + path); + return null; + } } } if (orientation == 90 || orientation == 270) { -- cgit v1.2.3