diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java b/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java index 21422095ee59d63c672319e942f6a2a5db5b8bf4..e74c84dffc007220acc91a428dbe9ef27a15463b 100644 --- a/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java +++ b/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java @@ -1942,12 +1942,13 @@ public class ExifInterface { Rational[] longitude = getTagRationalValues(TAG_GPS_LONGITUDE); String longitudeRef = getTagStringValue(TAG_GPS_LONGITUDE_REF); if (latitude == null || longitude == null || latitudeRef == null || longitudeRef == null - || latitude.length < 3 || longitude.length < 3) { + || latitude.length < 3 || longitude.length < 3 + || latitudeRef.length() != 2 || longitudeRef.length() != 2) { return null; } double[] latLon = new double[2]; - latLon[0] = convertLatOrLongToDouble(latitude, latitudeRef); - latLon[1] = convertLatOrLongToDouble(longitude, longitudeRef); + latLon[0] = convertLatOrLongToDouble(latitude, latitudeRef.substring(0, 1)); + latLon[1] = convertLatOrLongToDouble(longitude, longitudeRef.substring(0, 1)); return latLon; } @@ -2283,9 +2284,9 @@ public class ExifInterface { mTagInfo.put(ExifInterface.TAG_GPS_LONGITUDE_REF, gpsFlags | ExifTag.TYPE_ASCII << 16 | 2); mTagInfo.put(ExifInterface.TAG_GPS_LATITUDE, - gpsFlags | ExifTag.TYPE_RATIONAL << 16 | 3); + gpsFlags | ExifTag.TYPE_UNSIGNED_RATIONAL << 16 | 3); mTagInfo.put(ExifInterface.TAG_GPS_LONGITUDE, - gpsFlags | ExifTag.TYPE_RATIONAL << 16 | 3); + gpsFlags | ExifTag.TYPE_UNSIGNED_RATIONAL << 16 | 3); mTagInfo.put(ExifInterface.TAG_GPS_ALTITUDE_REF, gpsFlags | ExifTag.TYPE_UNSIGNED_BYTE << 16 | 1); mTagInfo.put(ExifInterface.TAG_GPS_ALTITUDE,