Skip to content

Reload upon activity resume #284

Open

Description

@KopiasCsaba

Checklist

  • I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one feature request.
  • I have read and understood the contribution guidelines.
  • I optionally donated to support the Fossify mission.

Feature description

Upon starting the app or reactivating it (if it was running just switched away and came back), it'd be nice to have an automatic reload of images in that directory. Due to performance reasons I understand if it gets a setting buried somewhere and default off as well.

Why do you want this feature?

So on graphene OS on pixel phones, thankfully we can use the awesome(ly working) factory camera app the google camera app without the google ecosystem. But, it is hardcoded to open google's photo gallery, so if it's not installed it will not open the gallery from the app just whine.

What we (including my wife) do now is manually switching to Fossify gallery. But there is an extra step to update the pictures (pull down), and that could be eliminated with this.

I also wonder to rename the package somehow to get it working straight from the camera app, but that's off topic.

Additional information

I'm very thankful for this project, thank you guys.

Activity

  1. added
    feature requestIssue is about a new feature or improving existing feature/behavior.
    needs triageIssue is not yet ready for PR authors to take up
    on Aug 15, 2024
  2. Aga-C commented on Aug 16, 2024

    @Aga-C
    Contributor

    It should already work like this, see the video below (on my two non-rooted devices it works the same):

    qemu-system-x86_64_nrhWGHWvfD.mp4

    Are you doing it the same way? If so, maybe it's a problem with loading working too slow. Have you tried to wait a bit more? We have known performance issues related to the image list.

  3. added
    waiting for authorIf the author does not respond, the issue will be closed. Otherwise, the label will be removed.
    on Aug 16, 2024
  4. KopiasCsaba commented on Aug 16, 2024

    @KopiasCsaba
    Author

    Dear @Aga-C ,

    Thank you for your swift and kind reply, i looked around a bit more to see whats going on, and it is a funny racecondition between the camera app and fossify gallery.

    I have made a screenrecording but im on the go, anyhow i switched between the two apps slowly to be visible on the recording. And voila, indeed on activity resume it reloads.

    But!

    If i make a photo and immediately switch to the gallery app, it refreshes BEFORE the picture is saved back in the camera app. And then it will never show up.

    So, steps to reproduce:

    • Open f.g., select camera dir
    • Open the camera
    • Snap a photo and switch back to f.g. as fast as you can.

    (With gesture nav its very easy to switch fast, probably you can't reproduce it with the three button nav)

    If you can't reproduce or curious, at night i'll upload a video where you can see it happening.

    So i wonder what would be a nice solution. The absolute nerd option would be two settings parameter:

    • Extra reload after resume
    • Extra reload delay
      But it might be confusing for many:)

    So maybe an "extra reloads after resume" option that would reload 4 time after resume with one second delay could be something inbetween?

    So it would reload asap as the activity is resumed, then 4 more times after a second delay each might be good for most use cases.

    Let me know what do you think!

  5. removed
    waiting for authorIf the author does not respond, the issue will be closed. Otherwise, the label will be removed.
    on Aug 16, 2024
  6. added
    bugSomething is not working
    nicheOnly relevant to a very small amount of people
    and removed
    feature requestIssue is about a new feature or improving existing feature/behavior.
    needs triageIssue is not yet ready for PR authors to take up
    on Aug 16, 2024
  7. KopiasCsaba commented on Aug 16, 2024

    @KopiasCsaba
    Author

    Here is a video to show it: https://www.youtube.com/watch?v=w_KBMJ048GI

    I also wonder that a loading indicator would be nice to be seen when reloading is in progress when it's just because of the activity resume.

  8. removed
    nicheOnly relevant to a very small amount of people
    on Aug 16, 2024
  9. Aga-C commented on Aug 16, 2024

    @Aga-C
    Contributor

    I could only reproduce it by switching quickly between the apps, at the pace you've shown in the video it was working fine. What device model do you have?

  10. naveensingh commented on Aug 17, 2024

    @naveensingh
    Member

    New items should show up regardless because we have a content observer listening for changes:

    val observer = object : ContentObserver(null) {
    override fun onChange(selfChange: Boolean, uri: Uri?) {
    super.onChange(selfChange, uri)
    if (uri != null) {
    val path = getRealPathFromURI(uri)
    if (path != null) {
    updateDirectoryPath(path.getParentPath())
    addPathToDB(path)
    }
    }
    }
    }

    Evidently, it doesn't seem to be working correctly.

  11. KopiasCsaba commented on Aug 19, 2024

    @KopiasCsaba
    Author

    I could only reproduce it by switching quickly between the apps, at the pace you've shown in the video it was working fine. What device model do you have?

    Yeah, it probably depends on the device and the camera app. I'm using Pixel 7A with the Google Camera. It appears to think around quite a bit before saving the image to the storage apparently.

    But it's good news that there is a pub/sub going on although it might be broken at the moment, but then no need to do extra refreshes.

  12. paskalito commented on Mar 20, 2025

    @paskalito

    Info:
    Oneplus 6
    Linage OS
    Googlecamera (same picture viewing situation)

    Happy to have found this:
    Not sure if i should still make a new FR, pls tell me if i should:
    But the thing i was going to report is.
    It never "reloads"/"Advertises" New pictures if you are watching the till then newest one in full screen.
    Meaning i cannot see newest pictures until i go to Picture overview and back again.

    Made a little video to show the behaviour:

    screen-20250320-211424.mp4
  13. naveensingh commented on Mar 20, 2025

    @naveensingh
    Member

    Not sure if i should still make a new FR, pls tell me if i should:

    It is related, no need for a new issue :)

  14. KopiasCsaba commented on Mar 20, 2025

    @KopiasCsaba
    Author

    Just now i:

    • I had Camera listing open
    • switched to camera shot 3 images
    • switched back, after some delay they showed up
    • switched back to cam, shot 3 more
    • switched back to listing

    And those new images never showed up!

    So sometimes it works, sometimes it doesnt.

  15. self-assigned this
    on Sep 13, 2025
  16. KopiasCsaba commented on Jun 9, 2026

    @KopiasCsaba
    Author

    I was working on something just now, that had to do with the same problem.

    So TLDR it seems that there are multiple notifications, the first would show IS_PENDING=1 (without readable image) and then an IS_PENDING=0 would arrive. Unsure of fossify gallery's logic, but maybe thats what is throwing it off.

    Here is some proper AI slop that I think might be useful for the dev wanting to fix this.

    details.md

  17. KopiasCsaba commented on Nov 8, 2026

    @KopiasCsaba
    Author

    @naveensingh:

    I dug into this and found the root cause. I've prepared fixes I'd like to contribute.

    Root cause: Google Camera inserts a new photo as a pending MediaStore row and finalizes it a few seconds later. When you switch back quickly, the reload on resume runs while the photo is still pending. MediaActivity.gotMedia() stores the "latest media ID" baseline used by the periodic check after the fetch has finished. So a photo finalized during the fetch ends up in the baseline but not in the list, and the check never sees a change. The photo then only shows up after the next resume or a pull-to-refresh. On my Pixel 7a this happens almost every time.

    While measuring, I also found why it takes so long even when it works. On a folder with ~5700 items, one refresh took 4–5 s, and each new photo triggered several extra full rescans of the same folder (from the MediaStore observer and NewPhotoFetcher) that ran in parallel with that refresh. The fullscreen viewer issue mentioned above by @paskalito is separate: the viewer never refreshes its list.

    I split this into four small, independent PRs. Each is one commit on top of main, passes build/tests/detekt/lint locally, and was tested on an emulator and on my Pixel 7a:

    1. New photos show up (closes this issue): take the baseline before the fetch, check right away on MediaStore notifications while the folder is open, and reload once more if a change arrives during a reload. compare
    2. Fewer queries per folder refresh (related to Slow Loading Thumbnails and File Propogation #54): one query for all video durations of the folder instead of one per video, and last-modified dates for the opened folder only. On my phone: 4.4–5.0 s → 2.3–2.8 s per refresh, with identical results. compare
    3. No redundant folder rescans (related to Slow Loading Thumbnails and File Propogation #54): coalesce the rescans and defer them while the folder is open, since it reloads anyway. Together with 1 and 2, the time until a new photo appears went from "never" (or 19–30 s) to 5–12 s on my phone. compare
    4. Fullscreen viewer shows new photos: refresh on resume and periodically while visible, keeping the current photo selected. compare

    Since the contribution guidelines ask for the help wanted label first: would you add it here (and to #54 if you'd like 2 and 3 too), so I can open these as PRs? If you'd prefer a different split, or only some of them, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions