diff options
author | Likai Ding <likaid@codeaurora.org> | 2014-09-29 11:32:02 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-11-11 07:18:20 -0800 |
commit | 291c0f59bd170836c502a8c5c8d0aaf2b2dd2f82 (patch) | |
tree | 6d532843046f0d99330d33fb748b3e072e2e7bea /src/com/android/camera/exif/ExifInterface.java | |
parent | 52f4cda298a5d53395fc46959c88f94b2d3fe921 (diff) | |
download | android_packages_apps_Snap-291c0f59bd170836c502a8c5c8d0aaf2b2dd2f82.tar.gz android_packages_apps_Snap-291c0f59bd170836c502a8c5c8d0aaf2b2dd2f82.tar.bz2 android_packages_apps_Snap-291c0f59bd170836c502a8c5c8d0aaf2b2dd2f82.zip |
Camera2: correct image size recorded in media provider db
Photos taken in camcorder can't be previewed on PC via MTP mode. The
root cause is that, the actual image file size does not always match
the _size column in media provider database. During the saving process,
EXIF data are rewritten, but the size sent to media provider is not
updated accordingly.
Record bytes written in ExifOutputStream and OrderedDataOutputStream so
that after rewritting, the correct image size could be sent to media
provider.
Change-Id: I74d91e86d712c121eb50daecaf879ab4f5be97fc
CRs-Fixed: 711522
Diffstat (limited to 'src/com/android/camera/exif/ExifInterface.java')
-rw-r--r-- | src/com/android/camera/exif/ExifInterface.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/camera/exif/ExifInterface.java b/src/com/android/camera/exif/ExifInterface.java index 340f19e1c..f353f3586 100644 --- a/src/com/android/camera/exif/ExifInterface.java +++ b/src/com/android/camera/exif/ExifInterface.java @@ -850,14 +850,14 @@ public class ExifInterface { * @throws FileNotFoundException * @throws IOException */ - public void writeExif(byte[] jpeg, String exifOutFileName) throws FileNotFoundException, + public int writeExif(byte[] jpeg, String exifOutFileName) throws FileNotFoundException, IOException { if (jpeg == null || exifOutFileName == null) { throw new IllegalArgumentException(NULL_ARGUMENT_STRING); } - OutputStream s = null; + ExifOutputStream s = null; try { - s = getExifWriterStream(exifOutFileName); + s = (ExifOutputStream) getExifWriterStream(exifOutFileName); s.write(jpeg, 0, jpeg.length); s.flush(); } catch (IOException e) { @@ -865,6 +865,7 @@ public class ExifInterface { throw e; } s.close(); + return s.size(); } /** |