From 9faf17d68749ce1688e49e068bd6f50ed36135ae Mon Sep 17 00:00:00 2001 From: Rohit Sekhar Date: Fri, 19 Apr 2024 00:10:25 +0530 Subject: [PATCH] ImageSaver: Update GPS EXIF data if longitude is not set or zero - Except in dark conditions (cover the camera with hands), FP5 stores the longitude in exif metadata as zero, leading to incorrect GPS location. - This is despite, passing the proper location via https://gitlab.e.foundation/e/os/camera/-/blob/5992f11fa7029d9d15349a762f21206531384fe4/app/src/main/java/net/sourceforge/opencamera/cameracontroller/CameraController2.java#L479 - Since the bug happens in deeper proprietary layer, extend the existing mechanism used for devices with cameraextensions, to update the exif data when longitude is zero. --- app/src/main/java/net/sourceforge/opencamera/ImageSaver.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/sourceforge/opencamera/ImageSaver.java b/app/src/main/java/net/sourceforge/opencamera/ImageSaver.java index af7d78f0d..c20ebc757 100644 --- a/app/src/main/java/net/sourceforge/opencamera/ImageSaver.java +++ b/app/src/main/java/net/sourceforge/opencamera/ImageSaver.java @@ -3950,9 +3950,10 @@ public class ImageSaver extends Thread { } setCustomExif(exif, custom_tag_artist, custom_tag_copyright); - if( store_location && ( !exif.hasAttribute(ExifInterface.TAG_GPS_LATITUDE) || !exif.hasAttribute(ExifInterface.TAG_GPS_LATITUDE) ) ) { + if( store_location && ( !exif.hasAttribute(ExifInterface.TAG_GPS_LATITUDE) || !exif.hasAttribute(ExifInterface.TAG_GPS_LONGITUDE) || exif.getLatLong()[1] == 0.0d) ) { // We need this when using camera extensions (since Camera API doesn't support location for camera extensions). // But some devices (e.g., Pixel 6 Pro with Camera2 API) seem to not store location data, so we always check if we need to add it. + // Also for FP5, wherein longitude randomly is 0.0d, even when properly passed via JPEG_GPS_LOCATION // fine to ignore request.remove_device_exif, as this is a separate user option if( MyDebug.LOG ) Log.d(TAG, "store location"); // don't log location for privacy reasons! -- GitLab