summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorKeith Mok <kmok@cyngn.com>2016-06-17 08:51:56 -0700
committerSteve Kondik <steve@cyngn.com>2016-11-20 02:09:17 -0800
commit60d4b8189f6beead65ffd4974e444062664919d5 (patch)
treecf58046c93ae8d4afb252c6516917e50bd00c3fa /src/com
parent00e8c21eda3c2d84f040e513675a1400094536e9 (diff)
downloadandroid_packages_apps_Snap-60d4b8189f6beead65ffd4974e444062664919d5.tar.gz
android_packages_apps_Snap-60d4b8189f6beead65ffd4974e444062664919d5.tar.bz2
android_packages_apps_Snap-60d4b8189f6beead65ffd4974e444062664919d5.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
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/exif/ExifInterface.java11
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 3049d2680..beacbc00d 100644
--- a/src/com/android/camera/exif/ExifInterface.java
+++ b/src/com/android/camera/exif/ExifInterface.java
@@ -1098,7 +1098,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);