Neo-Backup icon indicating copy to clipboard operation
Neo-Backup copied to clipboard

[Bug] App looses access to backup folders, thus finds no backups

Open hatelamers opened this issue 1 year ago • 7 comments

Description After configuring a backup folder and performing backups of some apps, at first everything seems ok: backups are listed and can be restored. However, after a while of device inactivity, the app cannot find any of the backups.

Steps To Reproduce

  1. Select a backup folder
  2. Backup one or two apps
  3. Backups are seen in the app list
  4. Close Neo Backup (even force close from settings)
  5. Open Neo Backup
  6. Backups are stil listed and restorable
  7. Close Neo Backup or switch to different app
  8. Leave the device alone for ~30 min
  9. Open Neo Backup
  10. All backups are missing (but clearly exist in the files system)

Expected behavior Backups remain accessible in the app as long as they are not deleted by the user or the retention rule.

System Information(please complete the following information):

  • Device: Lenovo Tab M11
  • Android Version: 13
  • ROM: Stock rooted with Magisk
  • App's Version: 8.3.6

Additional Notes Nothing I tried, fixed the issue:

  • created the backup folder from within Neo Backup, in file manager app or in adb shell
  • used internal storage, primary SDCard, secondary SDCard, USB stick
  • switced allowShadowDefault and shadowRoot on and off

The behavior remains the same: after a while all backups disappear.

hatelamers avatar Mar 23 '24 20:03 hatelamers

Additional info

I managed to assemble a working setup: external USB hub with an USB stick, of course this is not a solution.

Several other apps using content: URL to access files have similar problems on this device. Apparently it is kind of Lenovo's "feature", all "internal" FS handles (and their permissions) acquierd via Content Manager API get ivalidated after a period of inactivity and have to be requested again. Apps using file: URL or native OS API are not affected.

hatelamers avatar Mar 24 '24 21:03 hatelamers

Apparently it is kind of Lenovo's "feature", all "internal" FS handles (and their permissions) acquierd via Content Manager API get ivalidated after a period of inactivity and have to be requested again

yes, this sounds like the reason of that behavior.

It also sounds insane, because request again would mean that the file picker must be invoked again (as far as I know). Is it like this for other apps? we do not expect such behavior and I don't see such a thing in the documentation.

hg42 avatar Oct 09 '24 01:10 hg42

Apparently it is kind of Lenovo's "feature", all "internal" FS handles (and their permissions) acquierd via Content Manager API get ivalidated after a period of inactivity and have to be requested again

yes, this sounds like the reason of that behavior.

It also sounds insane, because request again would mean that the file picker must be invoked again (as far as I know). Is it like this for other apps? we do not expect such behavior and I don't see such a thing in the documentation.

Well, actually - no, other apps function normally. However, like I stated before the most apps won't try to keep a handle to a directory for listing (they store file lists they require in their internal DB), and those who do don't utilize Content Manager at all.

hatelamers avatar Oct 09 '24 12:10 hatelamers

well if using SAF or not is another discussion. I have some plans to allow NB to work without using SAF at all, but that future music (as we say here).

Currently, NB is using SAF for the backup directory. It should be obvious, that it needs access to it, otherwise it cannot do it's backup and restore jobs.

It has a database maintaining the entries but the backups are intentionally designed as normal directories, that can be managed by a file manager, so it needs to scan the files at certain occasions. That could theoretically be reduced (some of this was already enabled lately).

But in your case this would not be helpful. At the end when doing creating backups, the access must be granted.

You did not say, if apps using SAF need to reopen the file picker to get access to the directory or if they can get back their previous access rights without asking you? But that seems to be contradictory to the purpose of removing the rights, anyways.

hg42 avatar Oct 09 '24 14:10 hg42

Actually Neo Backup doesn't lose access to the directory, it only loses listing of its contents, when I backup again to the same directory (without changing settings), it works and this backup - but only this - is listed and can be restored too. After about 30 min Neo Backup being in the background, this last backup fails to be seen by the app either.

hatelamers avatar Oct 09 '24 15:10 hatelamers