Repository navigation
fix: show newly captured photos without manual refresh - #1219
Closed
KopiasCsaba wants to merge 1 commit into
Closed
KopiasCsaba wants to merge 1 commit into
KopiasCsaba wants to merge 1 commit into
Conversation
Camera apps insert new photos as pending MediaStore rows and finalize them a few seconds later. When the reload on resume ran while a photo was still pending, the photo did not show up until the next refresh. - take the latest-media snapshot before fetching instead of after, so media finalized during the fetch is detected by the periodic check - check for changes shortly (debounced) on MediaStore notifications while the folder is visible, and reload once more if a reload is already running
Contributor
|
Fossify accepts code contributions only for open issues labeled |
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.
Type of change(s)
What changed and why
Camera apps (e.g. Google Camera) insert a new photo as an
IS_PENDING=1MediaStore row first and finalize it a few seconds later. If you switch back to the gallery quickly, the reload on resume often runs while the photo is still pending, and the photo then doesn't show up until the next resume or a pull-to-refresh.MediaActivity.gotMedia()stored the "latest media ID" baseline used bycheckLastMediaChanged()after the fetch had finished. A photo finalized during the fetch was already part of the baseline but missing from the list, so the periodic check never saw a change. The baseline is now taken right before the fetch, using a new optionalonBeforeFetchhook ofGetMediaAsynctaskthat runs on the task's background thread. The cache path already took it before the fetch and is unchanged.onResume–onPause),MediaActivityobserves MediaStore and runs the existing latest-media check shortly after a change (debounced by 500 ms, so bursts of notifications cause one check), instead of waiting up to 3 s for the next periodic check. If a reload is already running, it schedules exactly one follow-up reload after it instead of dropping the request. The periodic check stays as a fallback.This PR only fixes the detection.
Tests performed
adb shell contentcommands (pending insert → write data → finalize), with the finalize timed to land during the reload on resume.assembleFossDebug,:app:testFossDebugUnitTest,detektandlintpass locally.Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).