Replace unsafe overwrites with manually triggering MediaScanner - #256
Merged
Merged
Conversation
This was referenced Sep 25, 2026
chenxiaolong
force-pushed
the
mediastore
branch
3 times, most recently
from
September 25, 2026 16:03
fd2e0c0 to
b603bc9
Compare
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
force-pushed
the
mediastore
branch
from
September 25, 2026 16:06
b603bc9 to
0400993
Compare
chenxiaolong
added a commit
that referenced
this pull request
Sep 25, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
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.
It turns out the URI permission revocations were happening in callbacks related to
MediaStoredatabase updates, not directly from writes toMediaProvider's FUSE filesystem. This is behavior introduced in API 31. We can disable the automaticMediaStoredatabase updates and just manually trigger a scan when Syncthing sends aRemoteChangeDetectedevent. This happens after Syncthing has already performed the file replacement, so Android will never observe any renames or deletes.Issue: syncthing/syncthing#10887