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

Commit d2c444a1 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 54db4b9a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4425,9 +4425,10 @@ public class ImageSaver extends Thread {
            // Normally if geotagging is enabled, location should have already been added via the Camera API.
            // But we need this when using camera extensions (since Camera API doesn't support location for camera extensions).
            // And 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
            // Similarly Fairphone 5 always has longitude stored as 0.0.
            // fine to ignore request.remove_device_exif, as this is a separate user option
            if( !exif.hasAttribute(ExifInterface.TAG_GPS_LATITUDE) || !exif.hasAttribute(ExifInterface.TAG_GPS_LONGITUDE) ) {
            if( !exif.hasAttribute(ExifInterface.TAG_GPS_LATITUDE) || !exif.hasAttribute(ExifInterface.TAG_GPS_LONGITUDE)  || exif.getLatLong()[1] == 0.0d ) {
                if( MyDebug.LOG )
                    Log.d(TAG, "force location as not present in exif");
                force_location = true;