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

Commit e468a67d authored by Jaesung Chung's avatar Jaesung Chung Committed by Android (Google) Code Review
Browse files

Merge "ExifInterface: fix creating pointer tags which indicate 0 offset" into nyc-dev

parents 98551e43 616a42f9
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -1888,6 +1888,19 @@ public class ExifInterface {
        for (ExifTag tag : IFD_POINTER_TAGS) {
            setAttribute(tag.name, null);
        }
        // Remove old thumbnail data
        setAttribute(JPEG_INTERCHANGE_FORMAT_TAG.name, null);
        setAttribute(JPEG_INTERCHANGE_FORMAT_LENGTH_TAG.name, null);

        // Remove null value tags.
        for (int hint = 0; hint < EXIF_TAGS.length; ++hint) {
            for (Object obj : mAttributes[hint].entrySet().toArray()) {
                Map.Entry entry = (Map.Entry) obj;
                if (entry.getValue() == null) {
                    mAttributes[hint].remove(entry.getKey());
                }
            }
        }

        // Add IFD pointer tags. The next offset of primary image TIFF IFD will have thumbnail IFD
        // offset when there is one or more tags in the thumbnail IFD.
@@ -1900,25 +1913,12 @@ public class ExifInterface {
        if (!mAttributes[IFD_GPS_HINT].isEmpty()) {
            mAttributes[IFD_TIFF_HINT].put(IFD_POINTER_TAGS[1].name, "0");
        }
        // Remove old thumbnail data
        setAttribute(JPEG_INTERCHANGE_FORMAT_TAG.name, null);
        setAttribute(JPEG_INTERCHANGE_FORMAT_LENGTH_TAG.name, null);
        if (mHasThumbnail) {
            mAttributes[IFD_TIFF_HINT].put(JPEG_INTERCHANGE_FORMAT_TAG.name, "0");
            mAttributes[IFD_TIFF_HINT].put(JPEG_INTERCHANGE_FORMAT_LENGTH_TAG.name,
                    String.valueOf(mThumbnailLength));
        }

        // Remove null value tags.
        for (int hint = 0; hint < EXIF_TAGS.length; ++hint) {
            for (Object obj : mAttributes[hint].entrySet().toArray()) {
                Map.Entry entry = (Map.Entry) obj;
                if (entry.getValue() == null) {
                    mAttributes[hint].remove(entry.getKey());
                }
            }
        }

        // Calculate IFD group data area sizes. IFD group data area is assigned to save the entry
        // value which has a bigger size than 4 bytes.
        for (int i = 0; i < 5; ++i) {