Gallery icon indicating copy to clipboard operation
Gallery copied to clipboard

Remember "Skip the Recycle Bin" for session option not honored

Open vertigo220 opened this issue 4 months ago • 7 comments

Checklist

  • [x] I can reproduce the bug with the latest version given here.
  • [x] I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • [x] I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • [x] I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • [x] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • [x] This issue contains only one bug.
  • [x] I have read and understood the contribution guidelines.

Affected app version

1.4.2 (actually past several versions, this is just the current ver)

Affected Android/Custom ROM version

Android 13

Affected device model

Samsung A71 5G

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

  1. Delete photo and check both boxes ("Do not ask again in this session" and "Skip the Recycle Bin, delete files directly")
  2. Wait several minutes
  3. Delete another photo and it will often (not always) ask again, despite having checked the box to not ask again for the session

Expected behavior

When telling it to remember the setting to skip the recycle bin for the session, it should do so.

Actual behavior

It asks again anyways.

Screenshots/Screen recordings

No response

Additional information

I'm not 100% sure, but it seems to be based on time, i.e. if left alone for long enough (seems to be somewhere between a few and several minutes), it times out and forgets/ignores this selection. Not sure if this is a bug or just by design, but it should be designed to do what the user says, and continue to delete by skipping the recycle bin for the entire session. Of course, "session" could be debated. Should switching out of the app or turning off the display end the session? I don't think so. I think it should last as long as the app remains in memory, i.e. until Android frees it up after not using it for a while or the user closes it by removing it from recent apps. This may be a safety feature, meant to prevent users from forgetting after not doing anything for a while that they've set it to permanently delete and causing accidental loss, but I'm not sure having it behave against the user's explicit instructions is really better. At the very least, if it is by design, it should say "for the next x minutes" instead of "in this session."

vertigo220 avatar Aug 28 '25 03:08 vertigo220

~Generally, there's no timer for that.~ This preference is reset on the app restart. Maybe battery optimization has killed the app in the background. Do you have it turned on for Gallery?

Aga-C avatar Aug 28 '25 05:08 Aga-C

It is on, but it happens even when Gallery is open in the foreground. If I'm deleting pics/vids and let it sit for several minutes, it asks again.

vertigo220 avatar Aug 28 '25 06:08 vertigo220

Does it happen with battery optimization turned off?

Aga-C avatar Aug 28 '25 06:08 Aga-C

There is a timer that resets many session-based preferences after ~5 minutes of inactivity:

https://github.com/FossifyOrg/Gallery/blob/1d4f4c87fc487f73f4e62e2dabd5adde24c3a821/app/src/main/kotlin/org/fossify/gallery/activities/MainActivity.kt#L367-L373

I'm thinking about how to handle this properly.

naveensingh avatar Aug 28 '25 07:08 naveensingh

Does it happen with battery optimization turned off?

So far, no, which is strange. I testing after letting it sit with the app in the foreground for several minutes and several hours without interacting with it, and it still remembered the preference. Doesn't really make sense that optimization would have an effect when the app is in the foreground, but somehow it does seem to.

I'm thinking about how to handle this properly.

As mentioned, for some reason it doesn't seem to happen with battery optimization off, though I'd rather not have to disable it for an app that doesn't need to run in the background just for something like this. As for how to handle it, I agree it seems there's no easy answer, though perhaps the best solution would be to only timeout if the app is in the background, so no matter how long it's inactive, if it's in the foreground, it's still the same session, but if it's in the background for > x minutes (at least 5, probably 10-15), then when switching back it would be considered a new session. And as long as it's reopened within that time-frame, the timeout is reset.

vertigo220 avatar Aug 29 '25 06:08 vertigo220

As mentioned, for some reason it doesn't seem to happen with battery optimization off, though I'd rather not have to disable it for an app that doesn't need to run in the background just for something like this.

The problem is that the timer is (incorrectly) tied to the lifecycle of the main activity (i.e., initial screen). As soon as you switch to Settings, About, or another screen in the app, the main activity/screen is stopped, and the timer starts.

As it is now, it should remember the preference as long as the main activity is interactive/visible (until the screen is locked or enough time has passed and Android decides to stop it).

As for how to handle it, I agree it seems there's no easy answer, though perhaps the best solution would be to only timeout if the app is in the background, so no matter how long it's inactive, if it's in the foreground, it's still the same session, but if it's in the background for > x minutes (at least 5, probably 10-15), then when switching back it would be considered a new session. And as long as it's reopened within that time frame, the timeout is reset.

This is how the app locking feature works. It only starts the timer when all app activities are in the background. I'm thinking about doing that here too, and also increasing the timer limit to 10 minutes.

Note that the timer only helps with foreground/background cases. The preference always resets when the app is cleared from recents (or killed).

naveensingh avatar Aug 29 '25 06:08 naveensingh

Note that the timer only helps with foreground/background cases. The preference always resets when the app is cleared from recents (or killed).

And that makes sense, because if it was closed/killed, whether by the user or the system, it's a new session.

vertigo220 avatar Aug 29 '25 17:08 vertigo220