diff options
author | Keith Mok <kmok@cyngn.com> | 2016-06-17 08:51:56 -0700 |
---|---|---|
committer | Chippa-a <vusal1372@gmail.com> | 2019-10-25 15:55:25 +0300 |
commit | 6bb5e3d4d533870e13884806999e36bf43f769b0 (patch) | |
tree | 3d9f4093a58bec66d74aa8e79e809aff38b85e1e | |
parent | d4d81ee0363c872ea102249c4081fa2d6525bced (diff) | |
download | android_packages_apps_Snap-6bb5e3d4d533870e13884806999e36bf43f769b0.tar.gz android_packages_apps_Snap-6bb5e3d4d533870e13884806999e36bf43f769b0.tar.bz2 android_packages_apps_Snap-6bb5e3d4d533870e13884806999e36bf43f769b0.zip |
CameraNext: Fallback to do copy exif if exif not exist
If exif in jpeg does not exist, rewriteExif will
throw IOException instead of returning false.
Let's catch it and fallback to the original logic
to do a copy instead of in-place replacement.
FEIJ-1245
Change-Id: I61b8bd9b9b7c855bff1897c036d948fcd16bb30a
-rw-r--r-- | src/com/android/camera/exif/ExifInterface.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/camera/exif/ExifInterface.java b/src/com/android/camera/exif/ExifInterface.java index 4ecdd7703..82dee3a19 100644 --- a/src/com/android/camera/exif/ExifInterface.java +++ b/src/com/android/camera/exif/ExifInterface.java @@ -1097,7 +1097,16 @@ public class ExifInterface { throws FileNotFoundException, IOException { // Attempt in-place write - if (!rewriteExif(filename, tags)) { + boolean rewriteOkay = false; + try { + rewriteOkay = rewriteExif(filename, tags); + } catch (IOException e) { + // If jpeg does not contains exif, rewriteExif + // will throw EOF IOException, let's catch + // it and fall back to do a copy instead + // of in-place replacement. + } + if (!rewriteOkay) { // Fall back to doing a copy ExifData tempData = mData; mData = new ExifData(DEFAULT_BYTE_ORDER); |