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

Commit b74b58aa authored by Rohit Sekhar's avatar Rohit Sekhar Committed by Mohammed Althaf T
Browse files

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.
parent 64d907be
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3952,9 +3952,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!