r/androiddev • u/nufftools • 2d ago
Question MediaStore.createTrashRequest on Samsung Android 16: 23 photos approved, only 3 visible in trash
I develop a screenshot organizer and received a report from a user on a Samsung Galaxy S25 Ultra (SM-S9380), running Android 16. Has anyone encountered this behavior with the native MediaStore trash API?
The user reviewed 50 screenshots: 23 marked for deletion and 27 marked for later. The later action only records a decision in the app; it does not copy, move, or delete those 27 files.
For the 23 deletion targets, the app calls:
val pendingIntent = MediaStore.createTrashRequest(context.contentResolver, mediaUris.toList(), true)
activity.startIntentSenderForResult(pendingIntent.intentSender, DELETE_MEDIA_REQUEST, null, 0, 0, 0)
The user provided a screenshot of the Samsung system dialog explicitly asking permission to move 23 photos to trash, and says they tapped Allow. Afterwards, only 3 of those photos were visible in Samsung Gallery's trash. The other 20 were no longer visible in the normal gallery either. According to the user, the 3 visible items were newer screenshots and the missing items were older.
What I have checked:
- This organizer deletion path uses createTrashRequest(..., true), not createDeleteRequest. It does not call ContentResolver.delete() or File.delete() on those MediaStore originals after approval, and has no permanent-delete fallback if the trash request throws.
- Free and paid versions use the same deletion path.
- The activity-result handler currently treats RESULT_OK as success for the requested batch; it does not re-query each URI's IS_TRASHED state. I understand that this leaves us without per-item verification. I do not have a recorded resultCode or post-operation MediaStore query from this user's device.
- The user enabled hidden-file display and searched for .trashed- files in internal storage / Pictures / Screenshots, but reported no results. This was a manual file-manager check, not a MediaStore query.
- Samsung My Files' trash shows the same 3 original screenshots. Google Photos' trash shows additional items not shown in Samsung's trash, but we have not established whether those are the missing 20 or whether cloud backup / Gallery cloud sync is enabled.
I have not reproduced this locally.
Has anyone encountered partial or inconsistent trash visibility after createTrashRequest on Samsung devices? If so, did you identify a MediaProvider issue, a Gallery indexing issue, or a Google Photos sync interaction?
For diagnosing future occurrences, is re-querying each original URI with QUERY_ARG_MATCH_TRASHED = MATCH_INCLUDE and reading IS_TRASHED / DATE_EXPIRES the right approach on Android 16? Are there manufacturer-specific limitations or additional checks worth making?
I am interested in firsthand experience, relevant issue-tracker links, and practical safeguards around the existing trash request, rather than building a separate trash or backup system.
1
u/redpiapps 2d ago
samsung gallery trash is its own thing tbh, the mediastore flag and what gallery shows do not always line up. requery after the request and log how many actually flipped, that tells you if gallery is lying or the request dropped most of them
0
1d ago
[removed] — view removed comment
1
u/androiddev-ModTeam 1d ago
Use your own voice when writing. Posts and comments which appear to be generated, including those with excessive flourish, gushing or emojis, will be removed.
1
u/AutoModerator 2d ago
Please note that we also have a very active Discord server where you can interact directly with other community members!
Join us on Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.