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

Commit 7ca3862c authored by Jin Seok Park's avatar Jin Seok Park Committed by Android (Google) Code Review
Browse files

Merge "ExifInterface: Fix function for image size update"

parents 26fc6a01 e6e4e8d7
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -3240,21 +3240,28 @@ public class ExifInterface {
            }
        } else {
            // Update for JPEG image
            if (imageType == IFD_TIFF_HINT) {
            ExifAttribute newSubfileTypeAttribute =
                    (ExifAttribute) mAttributes[imageType].get(TAG_NEW_SUBFILE_TYPE);

            if (newSubfileTypeAttribute != null) {
                int newSubfileTypeValue = newSubfileTypeAttribute.getIntValue(mExifByteOrder);

                if (newSubfileTypeValue == ORIGINAL_RESOLUTION_IMAGE) {
                    // Update only for the primary image (OriginalResolutionImage)
                    ExifAttribute pixelXDimAttribute =
                            (ExifAttribute) mAttributes[IFD_EXIF_HINT].get(TAG_PIXEL_X_DIMENSION);
                    ExifAttribute pixelYDimAttribute =
                            (ExifAttribute) mAttributes[IFD_EXIF_HINT].get(TAG_PIXEL_Y_DIMENSION);

                    if (pixelXDimAttribute != null && pixelYDimAttribute != null) {
                        mAttributes[imageType].put(TAG_IMAGE_WIDTH, pixelXDimAttribute);
                        mAttributes[imageType].put(TAG_IMAGE_LENGTH, pixelYDimAttribute);
                } else {
                    retrieveJpegImageSize(in, imageType);
                        return;
                    }
            } else {
                retrieveJpegImageSize(in, imageType);
                }
            }
            retrieveJpegImageSize(in, imageType);
        }
    }

    // Gets the corresponding IFD group index of the given tag number for writing Exif Tags.