Strip GPS/EXIF metadata when sharing photos (opt-in setting)#1048
Open
dsremo wants to merge 1 commit into
Open
Strip GPS/EXIF metadata when sharing photos (opt-in setting)#1048dsremo wants to merge 1 commit into
dsremo wants to merge 1 commit into
Conversation
Photos taken on modern devices embed location, timestamp, camera serial, and software signature in EXIF. When users share a photo from Gallery through any share-sheet target (messaging app, email, web upload), all of that metadata travels with the file unless they explicitly strip it first - which most users don't, because the toolchain is fiddly and nobody knows it's there. This adds an opt-in toggle 'Strip GPS/EXIF metadata when sharing photos' under Settings. When enabled, shareMediumPath() and shareMediaPaths() copy the file to the app cache directory, blank out a comprehensive list of sensitive EXIF tags (47 tags covering all GPS sub-fields, all timestamp variants, camera Make/Model/Software/Serial, Artist, Copyright, UserComment, Subject*Location, BodySerialNumber, LensSerialNumber, CameraOwnerName), and pass the stripped copy to the share intent. The original file on disk is untouched. Tags preserved: orientation, image dimensions, color space, ICC profile, focal length, aperture, ISO, exposure - the things that affect rendering but don't identify the user, device, or location. Supported formats: JPEG, HEIC/HEIF, WebP, TIFF, PNG, DNG. Other formats (video, RAW) pass through unchanged. Default: off (no behaviour change for existing users).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Photos taken on modern devices embed location, timestamp, camera make/model/serial, and software signature in their EXIF block. When a user shares a photo from Fossify Gallery — through a messaging app, email, or any share-sheet target — all of that metadata travels with the file unless they explicitly strip it first. Most users don't, because the tooling is fiddly and they don't know the data is there.
Fix
Adds an opt-in toggle under Settings: "Strip GPS/EXIF metadata when sharing photos".
When enabled,
shareMediumPath()andshareMediaPaths()route throughMetadataStripper.stripToCacheCopy(), which:cacheDir/metadata-stripped/<timestamp>-<original>so the on-disk original is untouched.androidx.exifinterface.media.ExifInterfaceand blanks out the sensitive tag set.Tags stripped (47 total)
DATETIME,DATETIME_ORIGINAL,DATETIME_DIGITIZED,OFFSET_TIME,OFFSET_TIME_ORIGINAL,OFFSET_TIME_DIGITIZED.MAKE,MODEL,SOFTWARE,BODY_SERIAL_NUMBER,LENS_SERIAL_NUMBER,CAMERA_OWNER_NAME.ARTIST,COPYRIGHT,USER_COMMENT,IMAGE_DESCRIPTION,SUBJECT_LOCATION,SUBJECT_AREA.Tags preserved
ORIENTATION, image width/height, color space, ICC profile, focal length, aperture, ISO, exposure, white balance — the things that affect how the image renders but don't identify the user, device, or location.Supported file formats
JPEG, HEIC/HEIF, WebP, TIFF, PNG, DNG. Other formats (video, RAW) pass through unchanged.
Files touched
app/src/main/kotlin/org/fossify/gallery/helpers/MetadataStripper.kt(new, 78 lines)app/src/main/kotlin/org/fossify/gallery/helpers/Config.kt(+5)app/src/main/kotlin/org/fossify/gallery/helpers/Constants.kt(+1)app/src/main/kotlin/org/fossify/gallery/activities/SettingsActivity.kt(+9)app/src/main/kotlin/org/fossify/gallery/extensions/Activity.kt(+18 / −2)app/src/main/res/layout/activity_settings.xml(+15)app/src/main/res/values/strings.xml(+1)Default behavior
Off. Existing users see no change unless they enable the toggle.
Tested
Built and installed on Android 16. Toggled on → shared a photo with GPS metadata to a file-manager → verified received file has no GPS tags via
exiftool. Toggled off → original metadata preserved as before.