Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location EXIF data is set to 0 after scaling image in SmallImage form on Androids 11+ #6009

Closed
WKobus opened this issue Mar 12, 2024 · 13 comments

Comments

@WKobus
Copy link

WKobus commented Mar 12, 2024

ODK Collect version

the store version 2023.1.2, the master version

Android version

11, 14

Device used

Samsung Galaxy M12, Pixel 7A

Problem description

After scaling image in SmallImage form, location EXIF data is set to 0.

Issue does not occurs on Android 10

Steps to reproduce the problem

  1. Open SmallImage form
    SmallImage.xlsx.txt
  2. Press Choose image button
  3. Using bottom sheet upload attached image - originalsize.jpg
  4. Send form
  5. Go to central and download image
  6. Open https://jimpl.com/ site
  7. Upload image

Expected behavior

Location EXIF data should remain same as on original image, before scaling.

Other information

Issue does not occurs on 2023.3.1 release

Upload this image for step 3.
originalsize

@seadowg seadowg added this to the v2024.2 milestone Mar 26, 2024
@grzesiek2010 grzesiek2010 self-assigned this Apr 15, 2024
@grzesiek2010
Copy link
Member

I've tried to reproduce the issue on two devices but to no avail. @WKobus could you try again? @dbemke please try as well.
@WKobus what do you mean the location is set to 0? latitude and longitude are both 0?

@WKobus
Copy link
Author

WKobus commented Apr 24, 2024

I've tried to reproduce the issue on two devices but to no avail. @WKobus could you try again? @dbemke please try as well.

@grzesiek2010 I'm able to reproduce this issue using same reproduction steps as in issue, both on store version 2024.1.3 and master version ac5d061, I'm using Samsung Galaxy M12 with Android 11.

@WKobus what do you mean the location is set to 0? latitude and longitude are both 0?

Yes, both latitude and longitude are set to 0.

@WKobus
Copy link
Author

WKobus commented Jun 6, 2024

@grzesiek2010 It turns out, that location EXIF data is getting set 0 only when uploading photo from bottom sheet that pops after pressing Choose Image button, I've updated steps to reproduce in this issue to reflect this change.

@grzesiek2010
Copy link
Member

So maybe it's an Android bug? What if you do the same without any compression (no max-pixels set on a form level or in settings)? Is the location preserved then?

@WKobus
Copy link
Author

WKobus commented Jun 6, 2024

I've did same steps in regular image form and in this case almost same thing happens, EXIF location data is unknown instead of being set to 0

@grzesiek2010
Copy link
Member

grzesiek2010 commented Jun 6, 2024

Ok so it looks like Android did this on purpose, let me explain...
In Android 13 they introduced the new photo picker. It is backported to all Android 11 & 12 devices, excluding Android Go and non-GMS devices. That means even if we do not use it deliberately it's used automatically whenever an intent with Intent.ACTION_GET_CONTENT is called (see more: https://medium.com/androiddevelopers/permissionless-is-the-future-of-storage-on-android-3fbceeb3d70a
This new picker removes sensitive data from photos like the GPS location.
There is already an issue reported where developers complain about the new changes https://issuetracker.google.com/issues/243294058
We could replace Intent.ACTION_GET_CONTENT with Intent.ACTION_OPEN_DOCUMENT to trigger choosing an image for now and it would behave like the old picker (although it's not the same so it might not support all the sources like Google Photos etc.)
We can also just wait to see if Google changes anything.

@seadowg @lognaturel any thoughts?

@seadowg
Copy link
Member

seadowg commented Jun 7, 2024

@grzesiek2010 @WKobus so it's got nothing to do with scaling?

This is an interesting one, on one hand it feels like we shouldn't try and get around the default behaviour here as it's actually a very nice piece of privacy preservation. On the other, it does feel like our users might have specific cases where they need that info. I'd be very surprised if Google added location EXIF back in given that it looks like they're intentionally removing it currently.

@grzesiek2010 it sounds to me like Intent.ACTION_OPEN_DOCUMENT is a good option as it preserves the behaviour of older Android as much as possible (which I don't think would have made grabbing images from cloud sources possible anyway). Do we need any extra permissions to use that?

@grzesiek2010
Copy link
Member

grzesiek2010 commented Jun 7, 2024

so it's got nothing to do with scaling?

Yes the location data is being removed on file picking.

Do we need any extra permissions to use that?

No, the Arbitrary File Question has been using it for a long time. However, I'm not sure if we should do something like that kind of against Google's policy. Additionally, if they introduced the new file picker for Intent.ACTION_GET_CONTENT, they might soon do the same for Intent.ACTION_OPEN_DOCUMENT.

Perhaps simply announcing and documenting this behavior would suffice. We can recommend using the file question type for attaching photos if users want to retain the location data.
@lognaturel what do you think?

@lognaturel
Copy link
Member

lognaturel commented Jun 7, 2024

Sounds good to me to document the behavior for now and keep an eye on this. The issue you linked to @grzesiek2010 has been reopened so I have a little bit of hope that an improvement will be made. I agree with @seadowg that it's good for the default behavior to be privacy-preserving but apps should be able to explicitly ask users to grant them the permissions to access EXIF data (https://developer.android.com/training/data-storage/shared/media#media-location-permission)

@seadowg
Copy link
Member

seadowg commented Jun 10, 2024

@grzesiek2010 let's pull this out of the current release and discuss when we plan for the next one.

@seadowg seadowg modified the milestones: v2024.2, v2024.3 Jun 10, 2024
@grzesiek2010 grzesiek2010 self-assigned this Aug 5, 2024
@grzesiek2010 grzesiek2010 removed their assignment Aug 28, 2024
@grzesiek2010
Copy link
Member

@seadowg is there anything we want to do or just wait for a fix for https://issuetracker.google.com/issues/243294058

@seadowg
Copy link
Member

seadowg commented Aug 28, 2024

@grzesiek2010 as @lognaturel suggests, I think we should keep an eye on the issue and document this. Can you add an issue to docs and then close this?

@grzesiek2010
Copy link
Member

Ok I've added and issue to docs getodk/docs#1851 so let's close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: done
Development

No branches or pull requests

4 participants