seedvault-app / seedvault

A backup application for the Android Open Source Project.
1.26k stars 74 forks source link

Seedvault disables Framework Backup unconditionally even if it is not the active transport #679

Closed olifre closed 2 months ago

olifre commented 3 months ago

After a recent LineageOS update, I noted my scheduled backups using another transport (not Seedvault) stopped being scheduled. I found that framework scheduling was disabled — it seems this happens whenever I reboot my device, even if I activate scheduling manually again.

This is likely a consequence of: #628

It seems Seedvault is disabling framework scheduling even if it is not the active transport, breaking other backup transports which may rely on framework scheduling.

olifre commented 3 months ago

Note: Another side effect appears to be that Seedvault actually runs backups if it is configured but not the active transport. This is quite irritating.

olifre commented 3 months ago

In case an affected user ends up here, the following commands (in an adb shell) worked around the issue for me:

pm disable-user --user 0 com.stevesoltys.seedvault
bmgr scheduling true

In case you want to switch back to Seedvault at some point, use:

pm enable com.stevesoltys.seedvault
senposage commented 3 months ago

why is there no in-app or system option to disable seedvault there is no reality where needing adb to disable an app should be required

pgaskin commented 3 months ago

I've noticed the same thing, which I started investigating when receiving phantom notifications, which turned out to be the Seedvault "Backup running" notification.

I have never started or configured Seedvault since installing Lineage.

The entry in the JobScheduler workdb shows it was added the same day I did the LineageOS update.

grote commented 3 months ago

Another side effect appears to be that Seedvault actually runs backups if it is configured but not the active transport.

Does it run its own backup? If so, does it seem to work/succeed?

olifre commented 3 months ago

Does it run its own backup? If so, does it seem to work/succeed?

Yes, as far as I tested, it seemed to work — note that's only if it is configured and then another transport was chosen afterwards.

Full story:

I did not "fully" test, i.e. did not try to restore, but significant backup data was present.

olifre commented 3 months ago

@grote Thanks for the PR!

However, I believe that this is not a full "fix" for the common case described here — other backup transports usually do not touch framework scheduling nor expose a way to do so, so it might never be reactivated.

Test case (which would still leave the "normal" user in a problematic situation after this patch):

  1. Enable Seedvault as active transport. It will disable framework scheduling.
  2. Switch to Google One Backup. It will not touch Framework scheduling, but leave it disabled, even when disabling Google One Backup and re-enabling it or when rebooting the phone.

I simulated this by:

  1. Switching to Google One Backup.
  2. Executing bmgr scheduling false .
  3. Rebooting / disabling and re-enabling Google One Backup.
  4. dumpsys backup still reports framework scheduling is disabled.

(this was on a system with the seedvault app disabled via pm disable-user --user 0 com.stevesoltys.seedvault to ensure there is no interference to the test)

I am not sure what the best fix would be:

Good ideas welcome.

grote commented 3 months ago

Yes, as far as I tested, it seemed to work

Thanks for the full story!

However, I believe that this is not a full "fix" for the common case described here — other backup transports usually do not touch framework scheduling nor expose a way to do so, so it might never be reactivated.

I am aware that this may be an issue. However, we suffer a lot from the undocumented backup API in AOSP. There are so many corner cases and surprising behavior. Being able to do our own scheduling was a great relive in one small area. Since Google introduced the ability to turn off framework scheduling in Android 14, I was imagining that they do this for their own proprietary backup transport. They usually don't put much thought into coexistence of different transports either and I don't think we even get notified that the user has chosen a different transport and we are no longer active which would be the moment to turn framework scheduling back on.

Long story short, in absence of better ideas, I prefer to leave it to other transports to set the framework scheduling to a state they need.

Document the issue and advice users to re-enable framework scheduling themselves if switching away from Seedvault to a transport which does not toggle framework scheduling. But it's questionable where to document this (as users which have issues with another transport will likely not check Seedvault's documentation).

Yeah it is tricky. We have a wiki, in case you'd want to put something there: https://github.com/seedvault-app/seedvault/wiki

grote commented 3 months ago

@mikeNG potential issue for LineageOS to be aware about ^

olifre commented 3 months ago

Yeah it is tricky. We have a wiki, in case you'd want to put something there: https://github.com/seedvault-app/seedvault/wiki

Thanks, I fully agree with all the points you raised — I'll look into adding something to the wiki. While it is questionable whether users will look there, I think a short explanation e.g. in the FAQ may be helpful, even if only for linking from threads whete users ask about the problem.

What is your preferred way for Wiki contributions (since GitHub does not offer PRs for that as far as I am aware)?

I've added a patch file below, but of course I can also push the Wiki change into a fork and ping you to pull from there.

0001-FAQ-add-FAQ-entry-on-framework-scheduling-and-other-.patch.txt

chirayudesai commented 3 months ago

One way to handle this would be the Settings app. We already patch it to offer backup transport selection, and it's also how you switch transports anyways - which is when you need to handle scheduling.

So, we could expand that patch to also tweak framework scheduling based on currently selected transport (mainly just enable it if disabled for any non-seedvault transport)