Loading src/com/android/gallery3d/filtershow/cache/ImageLoader.java +42 −26 Original line number Diff line number Diff line Loading @@ -129,17 +129,37 @@ public final class ImageLoader { } finally { Utils.closeSilently(cursor); } // Fall back to checking EXIF tags in file. ExifInterface exif = new ExifInterface(); InputStream is = null; // Fall back to checking EXIF tags in file or input stream. try { if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { String mimeType = getMimeType(uri); if (!JPEG_MIME_TYPE.equals(mimeType)) { return ORI_NORMAL; } String path = uri.getPath(); ExifInterface exif = new ExifInterface(); try { exif.readExif(path); } else { is = context.getContentResolver().openInputStream(uri); exif.readExif(is); } return parseExif(exif); } catch (IOException e) { Log.w(LOGTAG, "Failed to read EXIF orientation", e); } finally { try { if (is != null) { is.close(); } } catch (IOException e) { Log.w(LOGTAG, "Failed to close InputStream", e); } } return ORI_NORMAL; } private static int parseExif(ExifInterface exif){ Integer tagval = exif.getTagIntValue(ExifInterface.TAG_ORIENTATION); if (tagval != null) { int orientation = tagval; Loading @@ -157,10 +177,6 @@ public final class ImageLoader { return ORI_NORMAL; } } } catch (IOException e) { Log.w(LOGTAG, "Failed to read EXIF orientation", e); } } return ORI_NORMAL; } Loading Loading
src/com/android/gallery3d/filtershow/cache/ImageLoader.java +42 −26 Original line number Diff line number Diff line Loading @@ -129,17 +129,37 @@ public final class ImageLoader { } finally { Utils.closeSilently(cursor); } // Fall back to checking EXIF tags in file. ExifInterface exif = new ExifInterface(); InputStream is = null; // Fall back to checking EXIF tags in file or input stream. try { if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { String mimeType = getMimeType(uri); if (!JPEG_MIME_TYPE.equals(mimeType)) { return ORI_NORMAL; } String path = uri.getPath(); ExifInterface exif = new ExifInterface(); try { exif.readExif(path); } else { is = context.getContentResolver().openInputStream(uri); exif.readExif(is); } return parseExif(exif); } catch (IOException e) { Log.w(LOGTAG, "Failed to read EXIF orientation", e); } finally { try { if (is != null) { is.close(); } } catch (IOException e) { Log.w(LOGTAG, "Failed to close InputStream", e); } } return ORI_NORMAL; } private static int parseExif(ExifInterface exif){ Integer tagval = exif.getTagIntValue(ExifInterface.TAG_ORIENTATION); if (tagval != null) { int orientation = tagval; Loading @@ -157,10 +177,6 @@ public final class ImageLoader { return ORI_NORMAL; } } } catch (IOException e) { Log.w(LOGTAG, "Failed to read EXIF orientation", e); } } return ORI_NORMAL; } Loading