summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2013-08-30 23:26:15 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-30 23:26:15 (GMT)
commit8d2c6b830131a3d2e6ec7f2f8158b37506403dbd (patch)
tree9a037accb568b750d0ce3ef2835a1400bd73645e
parent5f6b50deaf46fb546ebf6d0d6244ebf7fb79c7ca (diff)
parent62a622b22717b454d3de26bb3311536a27492b6e (diff)
downloadandroid_packages_apps_Snap-8d2c6b830131a3d2e6ec7f2f8158b37506403dbd.zip
android_packages_apps_Snap-8d2c6b830131a3d2e6ec7f2f8158b37506403dbd.tar.gz
android_packages_apps_Snap-8d2c6b830131a3d2e6ec7f2f8158b37506403dbd.tar.bz2
Merge "Skip bitmaps with 0 dimension." into gb-ub-photos-carlsbad
-rw-r--r--src/com/android/camera/data/LocalMediaData.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/camera/data/LocalMediaData.java b/src/com/android/camera/data/LocalMediaData.java
index fef141f..53c153c 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) {