Commit graph

659 commits

Author SHA1 Message Date
Torsten Grote
a4cccabc5e
Don't allow changing backup location while backup is running 2024-04-25 09:51:45 -03:00
Torsten Grote
0e4c37e796
Properly track if a backup is running
this is important, so we don't allow more than one backup running at the same time and not swapping out the storage while one is running.

Previously, we had some bare bones tracking, but nothing precise.
2024-04-25 09:51:45 -03:00
Torsten Grote
b1c87a8a9e
Add the UI for the WebDAV plugin
including ViewModel and StoragePluginManager logic
2024-04-25 09:51:45 -03:00
Torsten Grote
7e612cb8e0
Introduce StoragePluginManager to handle storage plugins
and allow changing them dynamically. So far plugins were injected into the dependency graph and couldn't be changed at runtime, only their config could. Now we have the infrastructure in place to really allow for more than one plugin.
2024-04-25 09:51:45 -03:00
Torsten Grote
2489190824
Rename Storage to SafStorage
in preparation for generalization
2024-04-25 09:51:45 -03:00
Torsten Grote
6788d0d25a
Prepare backup destination UI refactoring
Mostly renaming for clarity.
2024-04-25 09:51:44 -03:00
Torsten Grote
ec8190755e
Add a method for testing if storage works
This is especially useful for WebDAV storage where the user can supply whatever URL and before proceeding, we need to know whether that URL and the provided credentials are actually working.
2024-04-25 09:51:44 -03:00
Torsten Grote
4f2ead66a5
Ensure root folder exists when using storage
We use the same root folder for app and files backup. App backup usually creates the root folder, but if only storage backup is used, it will be missing and needs to be created.
2024-04-25 09:51:44 -03:00
Torsten Grote
e6e65d0dd1
WebDAV files backup plugin 2024-04-25 09:51:44 -03:00
Torsten Grote
870d1617d2
Initial implementation of WebDavStoragePlugin 2024-04-25 09:51:43 -03:00
Hosted Weblate
a25ecd1886
Import translations from Weblate
Co-authored-by: Anonymous <noreply@weblate.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Fjuro <ifjuro@proton.me>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Igor Sorocean <sorocean.igor@gmail.com>
Co-authored-by: Kristian Nordin <kristian.po@proton.me>
Co-authored-by: Michael Bestas <mkbestas@gmail.com>
Co-authored-by: Oğuz Ersen <oguz@ersen.moe>
Co-authored-by: Suguru Hirahara <shirahara@users.noreply.hosted.weblate.org>
Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Co-authored-by: Yuya <yuyaj@tutanota.com>
Co-authored-by: ZehRique <zehrique.dev@gmail.com>
Co-authored-by: gallegonovato <fran-carro@hotmail.es>
Co-authored-by: lucasmz <git@lucasmz.dev>
Co-authored-by: lucasmz <github@lucasmz.dev>
Co-authored-by: lucasmz <lucasmz@users.noreply.hosted.weblate.org>
Co-authored-by: nautilusx <translate@disroot.org>
Co-authored-by: rehork <cooky@e.email>
Co-authored-by: 大王叫我来巡山 <hamburger2048@users.noreply.hosted.weblate.org>
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/cs/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/de/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/el/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/es/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/fi/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/he/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/it/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/ja/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/pl/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/pt/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/ro/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/sv/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/tr/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault_contactsbackup/pt/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault_contactsbackup/ro/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault_storage/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault_storage/ro/
Translate-URL: https://hosted.weblate.org/projects/calyxos/seedvault_storage/sv/
Translation: CalyxOS/Seedvault
Translation: CalyxOS/Seedvault contacts backup
Translation: CalyxOS/Seedvault storage backup
2024-04-24 07:31:58 +02:00
Torsten Grote
11fbd450da
Fix nullability for UserManager in AOSP build (#646) 2024-04-17 00:12:29 +05:30
Torsten Grote
c8d21fcf34 Auto-disable apps that cancel the entire backup
This can happen when the app process gets killed while its BackupAgent is running. There are several qcom apps in the wild that have this issue. These are DoSing our backups and are non-free, so we are defending ourselves against them.
2024-04-16 18:30:20 +05:30
Torsten Grote
499126c459 Log pre-flight errors in BackupMonitor 2024-04-16 18:30:20 +05:30
Torsten Grote
87db20e45f Include user profile name in backup name
so it is easier to identify the right backup if more users backup to the same storage medium.

Change-Id: I56fa93899da3764e20b6aee40adfd52722a05a9f
2024-04-16 18:21:27 +05:30
Torsten Grote
6caa01f8c5
Merge pull request #628 from grote/583-scheduling
Move to our own scheduling
2024-03-26 12:23:49 -03:00
Torsten Grote
baef15b2bc
Do live-counting of backed up apps for success notification
Previously, we asked the MetadataManager which also includes historic data and may provide misleading totals.
2024-03-19 14:31:36 -03:00
Torsten Grote
db1fc90589
Merge pull request #609 from seedvault-app/feature/rclone
Add support for RoundSync as a storage provider
2024-03-18 10:53:25 -03:00
Torsten Grote
f7730d3034
Report total number of user apps when showing final notification
Before, we showed the number of apps we requested the backup for which in case of non-d2d may be much lower than the number of installed apps.

In the future we may decide to also include certain system apps in that count.
2024-03-13 09:55:46 -03:00
Torsten Grote
8489753d58
Address review feedback 2024-03-08 09:52:23 -03:00
Torsten Grote
ee581ee652
Initialize backup, when enabling it
For ApkBackup, we need to be initialized. If the system starts with app backup off, we would not initialize which would lead to issues when backing up the APKs.
2024-03-08 09:52:23 -03:00
Torsten Grote
2da989971b
Request @pm@ backup after initialization
to avoid a 2nd restore set being used.

This also changes the initialization behavior to only create the restore set folder and upload the metadata only when we actually need to. This way, double inits are not creating new restore sets on the backup destination.
2024-03-08 09:52:23 -03:00
Torsten Grote
19bfc41d95
Allow backups in metered network, if user wants that 2024-03-08 09:52:07 -03:00
Torsten Grote
4eaa806636
Expose scheduling options in the UI 2024-03-08 09:52:07 -03:00
Torsten Grote
f593b66e00
try more than once to upload metadata after APK backups
Failure to upload metadata after backup up APKs can be critical and flaky I/O can make it fail, so we try again.
2024-03-08 09:52:06 -03:00
Torsten Grote
e7e489e091
Only reschedule next app backup when not on USB storage
Currently, after a manual run, we need to schedule the background backups again, because the scheduling gets lost. However, we need to be careful not to do that when the backup destination is on removable storage. Then we don't want to run.
2024-03-08 09:52:06 -03:00
Torsten Grote
8a870d8942
Use WorkInfo for determining if a backup is already running
Backup and restore is not possible when a backup is running. We used to check notifications for this, but now can use WorkManager's WorkInfo which should be more reliable.

Also, we used to prevent the "Backup now" action when app backup was disabled. But the user may want to do a storage backup. This is now possible.
2024-03-08 09:52:06 -03:00
Torsten Grote
0c1898c198
Properly schedule/cancel backup workers when backup destination changes
When the user changes to USB storage, we need to cancel current schedulings, because the storage is not always available (maybe can use a trigger URI?). And if moving to a non-USB storage, we need to schedule backups again.

Unfortunately, there are two places in the code where we handle storage location changes. Ideally, those get unified at some point.
2024-03-08 09:52:06 -03:00
Torsten Grote
e615402458
During restore, show apps without APK as failed
Previously, we backed up APKs of apps we could not back up (even if APK backup was disabled) so the user had a chance to get at least the apps back when restoring. Now, it is enough to record metadata about the app and the user will be able to manually install the app. The install apps step won't be skipped anymore.
2024-03-08 09:52:06 -03:00
Torsten Grote
6e7bc89e2f
Respect when worker was stopped
and log worker ID as well as object, because we've seen two scheduled workers running at the same time, requesting a backup at the same time. This should not happen.
2024-03-08 09:52:06 -03:00
Torsten Grote
0d7156789e
Guard against BadParcelableException when getting app list
hopefully something rare, but it just happened to me while testing.

It seems it happens when there are many apps installed (>500) and the app list is open while a backup happens. Then, we keep reloading the list and hammer the package manager hard which it seems can't handle it. It does recover on its own though.
2024-03-08 09:52:05 -03:00
Torsten Grote
04fc90e9f7
Migrate to own backup scheduling 2024-03-08 09:52:05 -03:00
Torsten Grote
911a8dabf4
Expose time of next backup in UI
to help debugging scheduling issues
2024-03-08 09:52:05 -03:00
Torsten Grote
8da73ad8d1
Make 'Backup now' action use AppBackupWorker 2024-03-08 09:52:05 -03:00
Torsten Grote
49066be31b
Improve backup notification 2024-03-08 09:52:05 -03:00
Torsten Grote
fcd4e518a5
Move APK backup from BackupCoordinator to new ApkBackupManager
This is a preparation for doing APK backup ourselves in a worker and not hacked into the backup transport. The latter was prone to timeouts by the AOSP backup API. With a worker, we have a bit more control and can schedule backups ourselves.
2024-03-08 09:52:04 -03:00
Torsten Grote
0c8fe3ef20 Fix nullability issues that AOSP is complaining about now 2024-03-07 20:40:09 +05:30
Torsten Grote
c33486ee00 Adjust code for new library versions 2024-03-07 20:40:09 +05:30
Chirayu Desai
635a1ef9b4 strings: Call D2D alpha instead of experimental
Change-Id: I571989a04a2cfaa5684d2d182185799b48b51e9e
2024-02-23 23:37:00 +05:30
Chirayu Desai
2744ccdc7d strings: Call Storage Backup beta instead of experimental
* Let's make it less scary

Change-Id: I889b04eb68df836aea3c5cc4ca97acd3f4c3af54
2024-02-23 23:37:00 +05:30
Torsten Grote
8c27814407
Merge pull request #613 from grote/backup-binder
Use BackupRequester to request backup in chunks
2024-02-22 13:10:23 -03:00
Michael Bestas
a050e73f7d Update SetupWizard dark theme for U
Change-Id: I0a5b1a41cceba2b45b41cfd64e98b8105c8ad6b6
2024-02-22 01:18:45 +05:30
Torsten Grote
b47b4ade1e
Stop cleaning up notification when service is destroyed. 2024-02-13 16:20:02 -03:00
Torsten Grote
4014666c15
Improve notification progress reporting
It is still somewhat buggy when d2d is on, but this is easier to resolve when moving everything to own scheduling.
2024-02-13 16:20:02 -03:00
Torsten Grote
86c603e2d2
Use BackupRequester to request backup in chunks
Otherwise users with lots of installed apps with request a lot of packages causing binder transactions to reach their size limit and crash.
2024-02-13 16:20:02 -03:00
Torsten Grote
81fae1a240 Try to recover from corrupt metadata cache 2024-02-13 23:37:41 +05:30
Torsten Grote
6428399bed Tolerate unexpected exceptions in DocumentsStorage and ApkRestore 2024-02-13 23:36:46 +05:30
Torsten Grote
09b7cabd99 Use own notification ID for success notification
and cancel observer notification when backup is finished. This is because when the success channel is disabled by the user, the observer notification could stick around and would never get removed.
2024-02-13 23:34:59 +05:30
Torsten Grote
fcbd62ba3b Remove warning from d2d expert setting as we now disable system scheduling for d2d 2024-02-13 23:34:59 +05:30
Torsten Grote
c832cd9886 Remove logWorkInfo as some part of it isn't in AOSP version of workmanger
It was meant for debugging only anyway
2024-02-13 23:34:59 +05:30