Skip to content

Replace unsafe overwrites with manually triggering MediaScanner - #256

Merged
chenxiaolong merged 1 commit into
masterfrom
mediastore
Sep 25, 2026
Merged

chenxiaolong merged 1 commit into
masterfrom
mediastore

Conversation

@chenxiaolong

Copy link
Copy Markdown
Owner

It turns out the URI permission revocations were happening in callbacks related to MediaStore database updates, not directly from writes to MediaProvider's FUSE filesystem. This is behavior introduced in API 31. We can disable the automatic MediaStore database updates and just manually trigger a scan when Syncthing sends a RemoteChangeDetected event. This happens after Syncthing has already performed the file replacement, so Android will never observe any renames or deletes.

Issue: syncthing/syncthing#10887

It turns out the URI permission revocations were happening in callbacks
related to MediaStore database updates, not directly from writes to
MediaProvider's FUSE filesystem. This is behavior introduced in API 31.
We can disable the automatic MediaStore database updates and just
manually trigger a scan when Syncthing sends a RemoteChangeDetected
event. This happens after Syncthing has already performed the file
replacement, so Android will never observe any renames or deletes.

Issue: syncthing/syncthing#10887

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong added a commit that referenced this pull request Sep 25, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong
chenxiaolong merged commit 0400993 into master Sep 25, 2026
1 check passed
@chenxiaolong
chenxiaolong deleted the mediastore branch September 25, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant