Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4564cbce authored by Hyundo Moon's avatar Hyundo Moon
Browse files

ExifInterface: Correct thumbnail compression info

Exifinterface sets the thumbnail's compression information as JPEG
whenever the image has no compression tag in it. As a result, even
an image with no thumbnail can have the thumbnail compression info.
This CL fixes the problem.

Test: Run CTS test on angler
Change-Id: I4b06956b1bac672e1bf235df6f458b31e8ee82bb
parent d5386fd4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1938,6 +1938,9 @@ public class ExifInterface {
     * not exist or thumbnail image is uncompressed.
     */
    public boolean isThumbnailCompressed() {
        if (!mHasThumbnail) {
            return false;
        }
        if (mThumbnailCompression == DATA_JPEG || mThumbnailCompression == DATA_JPEG_COMPRESSED) {
            return true;
        }
@@ -2974,7 +2977,6 @@ public class ExifInterface {
            }
        } else {
            // Thumbnail data may not contain Compression tag value
            mThumbnailCompression = DATA_JPEG;
            handleThumbnailFromJfif(in, thumbnailData);
        }
    }
@@ -3009,6 +3011,8 @@ public class ExifInterface {
                mHasThumbnail = true;
                mThumbnailOffset = thumbnailOffset;
                mThumbnailLength = thumbnailLength;
                mThumbnailCompression = DATA_JPEG;

                if (mFilename == null && mAssetInputStream == null
                        && mSeekableFileDescriptor == null) {
                    // Save the thumbnail in memory if the input doesn't support reading again.