-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Description
Guidelines
- I have searched searched open and closed issues for duplicates
- I am submitting a bug report for existing functionality that does not work as intended
- This isn't a feature request or a discussion topic
Bug description
When manually saving images from a Signal conversation to the device gallery, the saved images appear with the download/save date instead of the original sent/received date. This causes photos to be incorrectly sorted in the gallery app, making it difficult to find older photos in their proper chronological position.
Interestingly, videos are saved with the correct date, while images are not.
Related issues
This appears to be related to #10453, which reported photos being saved with incorrect timestamps (appearing as if captured in the "far far future"). That issue described the opposite problem — future dates instead of past dates — but both stem from the same root cause: the inconsistent timestamp handling in SaveAttachmentUtil.kt.
The original issue (#10453) requested that photos be saved with the current timestamp, but the more appropriate behavior would be to use the original sent/received timestamp — this preserves the chronological context of the media and matches how videos are already handled.
Steps to reproduce
- Receive an image in a Signal conversation (e.g., sent days or weeks ago)
- Long-press on the image and select "Save" (or use the save option from the media viewer)
- Open the device's gallery/photos app
- Check the date metadata of the saved image
Actual result: The image appears with today's date (the date it was saved), not the date it was originally sent/received. In the gallery, it shows up among today's photos instead of its original chronological position.
Expected result: The image should retain the original sent/received timestamp, appearing in the gallery at its correct chronological position (like videos already do).
Root cause analysis
The issue is located in SaveAttachmentUtil.kt in the createMediaUri() function. When creating the MediaStore entry for saved attachments, the code sets:
MediaStore.MediaColumns.DATE_ADDED to TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),
MediaStore.MediaColumns.DATE_MODIFIED to TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())This uses the current system time instead of the original message timestamp (attachment.date), which is already available and correctly used for generating the filename.
Additionally, MediaStore.MediaColumns.DATE_TAKEN is not set at all, which is the primary field that gallery apps use for chronological sorting.
Proposed fix
Pass the original timestamp through to createMediaUri() and use it for the MediaStore metadata:
val contentValues = contentValuesOf(
MediaStore.MediaColumns.DISPLAY_NAME to fileName,
MediaStore.MediaColumns.MIME_TYPE to mimeType,
MediaStore.MediaColumns.DATE_ADDED to TimeUnit.MILLISECONDS.toSeconds(timestamp),
MediaStore.MediaColumns.DATE_MODIFIED to TimeUnit.MILLISECONDS.toSeconds(timestamp),
MediaStore.MediaColumns.DATE_TAKEN to timestamp
)Screenshots
No response
Device
Pixel Pro 6
Android version
16
Signal version
7.71.2
Link to debug log
No response