Commit graph

233 commits

Author SHA1 Message Date
Torsten Grote
80187c8c70 Show percentages in progress notification and x of n status at the end
Fine-grained progress reporting causes apps to show up twice which is
confusing. Also @pm@ metadata and opt-out APKs are too much detail for
normal users. So we decided to only show a percentage in the progress
notification.

When the backup finished, the app now shows "x of n apps backed up"
which is more positive when the previous negative message of how many
apps were not backed up.

Some further minor tweets were done to app counting to report proper
totals.
2020-09-11 19:04:38 +05:30
Torsten Grote
983f917391 Let backup notification report more fine-grained progress
This adds @pm@ record backup and APK backup of opt-out apps to the
progress reporting since these two operations are slow when using a
cloud storage SAF backend.
2020-09-11 19:04:38 +05:30
Torsten Grote
7bda3eb12b Improve DocumentsProvider tests against Nextcloud 2020-09-11 19:04:38 +05:30
Torsten Grote
25962ed307 Explain better how we force initialization via the SettingsManager 2020-09-11 19:04:38 +05:30
Torsten Grote
3a717b109d Make app blacklist accessible by multiple threads
Might fix #83
2020-09-11 19:04:38 +05:30
Torsten Grote
73e969a0bd Only consider apps that really opt-out of backup for early APK backup 2020-09-11 19:04:38 +05:30
Torsten Grote
e7a13fdb5c Ensure streams get closed eventually 2020-09-11 19:04:38 +05:30
Torsten Grote
91daa8e051 Fix icon color of storage locations (Nextcloud icon got tinted) 2020-09-11 19:04:38 +05:30
Torsten Grote
e138e0a4e2 Make PluginTest work for Nextcloud as well
Only issue left was a different maximum file name length for Nextcloud
2020-09-11 19:04:38 +05:30
Torsten Grote
7fdefda85f Replace all instances of DocumentFile#findFile with #findFileBlocking
Also start sticking closer to the official Kotlin formatting style
2020-09-11 19:04:38 +05:30
Torsten Grote
f7df78d2f3 Check for loading cursor also when checking if files exist
Loading cursors can happen with cloud-based documents providers
such as Nextcloud.
When they return a cursor that is still loading,
we might continue with stale information.
So now we wait for a loading cursor to be fully loaded
before continuing.
2020-09-11 19:04:38 +05:30
Torsten Grote
b1b522807c Add test to reproduce the loading cursor phenomena with Nextcloud
See: https://commonsware.com/blog/2019/12/14/scoped-storage-stories-listfiles-woe.html
2020-09-11 19:04:38 +05:30
Torsten Grote
b505425525 Add instrumentation tests for storage plugin (SAF) 2020-09-11 19:04:38 +05:30
Torsten Grote
f68095a463 Upgrade gradle 2020-09-11 19:04:38 +05:30
Michael Bestas
46cd13a55c String improvements
* Don't use camel case, following AOSP applications
* Set app name and Nextcloud as untranslatable
2020-09-11 19:04:38 +05:30
Robin Schneider
a51fcfc0b4 Remove wrongly inserted "g" char from AndroidManifest.xml
Introduced in: 78e217c7d8
2020-09-11 19:04:38 +05:30
Steve Soltys
78e217c7d8 Bump version code in Android manifest 2020-03-07 15:46:02 -05:00
Steve Soltys
bd52749c76 Version bump - 1.0.0 2020-03-07 15:41:49 -05:00
Torsten Grote
65905a7160
Hide navigation bar in SetupWizard for more visual consistency 2020-01-22 12:31:14 -03:00
Torsten Grote
3cdd381b51
Don't cache notification builders to always show the right icon 2020-01-22 12:25:32 -03:00
Torsten Grote
c52d372442
Don't make the app immersive in SetupWizard
Fixes third item in #63
2020-01-20 11:58:38 -03:00
Torsten Grote
324da2a9e9
Allow the user to exclude apps from backup
Closes #70
2020-01-20 11:58:38 -03:00
Torsten Grote
c92b9a3606
Credit Glenn Sorrentino on About page 2020-01-20 10:01:44 -03:00
Torsten Grote
5d38f061d9
Make some app status list tweaks suggested by our designer Glenn 2020-01-20 09:53:51 -03:00
Torsten Grote
a98364efbe
Back up APKs as early as possible to not miss any
Fixes #68
2020-01-18 16:42:26 -03:00
Torsten Grote
fcf17fe23a
Show list of apps and their backup status 2020-01-18 16:38:55 -03:00
Torsten Grote
de16032905
Don't use wildcard imports, because they are considered harmful 2020-01-14 15:40:56 -03:00
Torsten Grote
6ed522bfb7
Show one single progress bar in the notification
Also don't show individual package results,
but a single dismissible status notification in the end.

Closes #59, #61
2020-01-14 15:18:16 -03:00
Torsten Grote
2bcf82d607
Show heads-up notification when auto-restore fails due to removed storage 2020-01-14 10:17:38 -03:00
Torsten Grote
783e676be2
Optimize the restore of a single application (e.g. auto restore)
This restores only the @pm@ keys that are really needed
and thus speeds up installation with auto restore considerably
when using cloud storage such as NextCloud for example.
2020-01-14 10:17:37 -03:00
Torsten Grote
43184f4d23
Add note to auto-restore setting in case removable storage is used
This warns the user that auto-restore will only work when their storage
is plugged in.
2020-01-14 10:17:37 -03:00
Torsten Grote
22be36e2a7
When an app could not be restored, show the likely reason for it 2020-01-14 10:11:17 -03:00
Torsten Grote
74183d40d6
Add system app flag to metadata and check before installing system apps
that they are present as an older system app on the restore system.

Also ignore system apps without data to backup.
2020-01-14 10:11:17 -03:00
Torsten Grote
2a4ff39531
Simplify PackageService and use standard PackageManager
@stevesoltys this removes your old way of retreiving installed packages
via getInstalledPackages(0, UserHandle.USER_SYSTEM) as I couldn't find a
difference to the official way.

Also IGNORED_PACKAGES isn't needed anymore since
filterAppsEligibleForBackupForUser() already filters those out.
2020-01-14 07:45:41 -03:00
Torsten Grote
fea53a759f
Also back-up APKs of apps that are not allowed to have their data backed up 2020-01-14 07:45:41 -03:00
Torsten Grote
3d296e1335
Also back up APKs of apps that have no data or are above quota
This should also affect apps that have other errors during the backup
process, but it does not affect apps that opt-out of backup completely.

First part of #65
2020-01-14 07:45:41 -03:00
Torsten Grote
3f73119b52
Show restore data progress bar and improve readability of log messages 2020-01-14 07:45:40 -03:00
Torsten Grote
1924db7779
Move date restore view state into ViewModel to survive configuration changes 2020-01-14 07:45:40 -03:00
Torsten Grote
5632f11878
Show when package restore failed 2020-01-14 07:45:40 -03:00
Torsten Grote
9f01d09962
Don't get or write to full backup output stream before we are not sure there will be data to write 2020-01-14 07:45:39 -03:00
Torsten Grote
7b27242625
Show apps that we could not restore data for 2020-01-14 07:45:39 -03:00
Torsten Grote
690017c050
Only back up APK and write metadata when app was actually backed up
Apps that have nothing to back up start a backup but then get a call to cancelFullBackup()
and never even call finishBackup().
Do not write metadata for such apps, the call got moved to finishBackup().
2020-01-14 07:45:39 -03:00
Torsten Grote
2f352fe828
Show list of packages that we could restore data for 2020-01-14 07:45:39 -03:00
Torsten Grote
96a4642f4f
Show list of re-installed apps and let the user review it before restoring data 2020-01-14 07:45:38 -03:00
Torsten Grote
debaca0e2c
Ignore RestoreSets with no last backup time 2020-01-14 07:45:38 -03:00
Torsten Grote
f562857514
Expose APK backup feature as a setting, so the user can disable it
The user might not want to have their apps copied to the storage,
because it is very slow or for other reasons.
2020-01-14 07:45:38 -03:00
Torsten Grote
7605762631
Re-install backed-up APKs before restoring from backup 2020-01-14 07:45:37 -03:00
Torsten Grote
569e3db385
Fix device initialization and generation of new backup tokens 2020-01-14 07:45:37 -03:00
Torsten Grote
81c2031ce7
Back up APKs to storage (when they changed) and save metadata about them 2020-01-14 07:45:37 -03:00
Torsten Grote
b9cac5ea87
Introduce MetadataManager to handle all metadata related to backups
This now updates the metadata on remote storage and internal cache
after each successful package backup.
2020-01-14 07:45:36 -03:00
Torsten Grote
e1d55c8a4e
Add information about packages to backup metadata
This will be needed when backing up APKs.

ATTENTION: This is a breaking change, we only do because the app hasn't
been released.
2020-01-14 07:45:36 -03:00
Steve Soltys
01098a4d97
Merge pull request #60 from grote/check-messages
Encrypt values of key/value backups with multiple segments if needed
2019-12-22 20:24:33 -05:00
Torsten Grote
58a8f29b51
Encrypt values of key/value backups with multiple segments if needed
This turned out to be necessary, because some values on production
devices are exceeding the maximum segment size.
2019-12-19 08:55:57 -03:00
Torsten Grote
177e714001
Add error messages for unexpected state to ease debugging 2019-12-18 15:50:34 -03:00
Torsten Grote
94c7663daf
Use dependency injection with Koin 2019-12-17 09:56:45 -03:00
Torsten Grote
137e8033a7
Update time of backup progress notifications 2019-12-16 09:11:53 -03:00
Torsten Grote
d30cb309ca
Be more forgiving when checking available restore sets 2019-12-16 09:11:53 -03:00
Torsten Grote
440491425a
Work around DocumentFile bug happening with cloud-based DocumentsProviders
These might return outdated or now content when queried,
then check their cloud storage and report back with up-to-date content.
We now detect this (when looking for backups on newly setup storage)
and wait until the content has been loaded before acting on the
response.

This is affecting and was tested with NextCloud.
2019-12-16 09:11:52 -03:00
Torsten Grote
bbc8bdfaa5
Allow the user to leave the recovery code input if called from setup wizard 2019-12-11 13:48:00 -03:00
Torsten Grote
791f68300d
Allow to setup NextCloud account during restore
This is especially useful when restore is only allowed during
SetupWizard and the backup was stored on a NextCloud account.
2019-12-11 13:48:00 -03:00
Steve Soltys
cf86c57760
Merge pull request #52 from grote/about-page
Add About page
2019-12-07 15:13:01 -05:00
Torsten Grote
88a250ff5c
Use separate dev config and document existing config
Attention: This also changes the action to launch restore activity
2019-12-06 12:33:50 -03:00
Torsten Grote
49ce4b393f
Add a configurable white-list for backup storage 2019-12-06 12:21:49 -03:00
Torsten Grote
3093e3a789
Add About DialogFragment reachable from main overflow menu 2019-12-06 09:31:48 -03:00
Steve Soltys
32f558faf1 Rebrand application as 'Seedvault' 2019-10-28 21:57:47 -04:00
Torsten Grote
c9a29810fc
Remove unused code and resources 2019-09-25 11:04:24 -03:00
Torsten Grote
d81c355799
Advance a step when returning to SetupWizard from restore 2019-09-25 11:04:23 -03:00
Torsten Grote
470b5a2ccf
Tolerate backup attempts when flash drive is not plugged in
Also remove hardcoding of PACKAGE_MANAGER_SENTINEL constant
2019-09-23 10:29:01 -03:00
Torsten Grote
08018fcc9b
Do not allow manual backup/restore operations when removable storage is not available 2019-09-23 10:10:28 -03:00
Torsten Grote
cc2bb4a651
When selecting USB storage, do a backup right away
This is because USB drives are rarely plugged in,
so we should use every chance we get to do a backup.
2019-09-23 10:10:27 -03:00
Torsten Grote
26f23e95fe
Disable automatic backups when a removable USB flash drive is used
as storage location.

The backup backoff time is not reliable for this as the system still
attempts to backup the magic @pm@ package without checking for the
backoff value.
2019-09-23 10:10:27 -03:00
Torsten Grote
2c4d44c5b9
Grant MANAGE_USB permission, so we can get USB serial numbers
This is needed to reliably identify USB mass storage devices.
If someone has several identical thumb drives,
this prevents a backup from being performed when non-backup drives get attached.
2019-09-23 10:10:27 -03:00
Torsten Grote
007dd7759d
Save the time of the last backup and only do automatic flash drive backups once a day
This commit also turns SettingsManager into a class, so we can mock
and later also inject it.
2019-09-23 10:10:27 -03:00
Torsten Grote
b0386c8b66
Start backup automatically when flash drive used for backup is plugged in 2019-09-23 10:10:26 -03:00
Torsten Grote
650642068e
Don't try to do backups if storage is not available 2019-09-23 10:10:26 -03:00
Torsten Grote
bf28bc3338
Truncate files when writing to them explicitly
For some reason this wasn't an issue on Pie,
but an instrumentation test caught the change in behavior on Q.
2019-09-20 09:42:59 -03:00
Torsten Grote
e659892278
Fix CI by running tests with newer Java version, but target JDK 8 2019-09-19 12:52:31 -03:00
Torsten Grote
37ffacbafe
Upgrade to Android 10 (Q)
If somebody wants the backup app to work on a lower Android version,
they need to maintain a branch for that which uses and targets the old API.
2019-09-19 09:17:42 -03:00
Torsten Grote
8adb94c6c9
Explicitly tint storage root icons for system dark theme 2019-09-19 07:54:28 -03:00
Torsten Grote
0e5f9cff0f
Remove the progress bar for restore operation as progress reporting is bugyy
This also adds an additional warning when the user is using ejectable storage
2019-09-18 09:26:32 -03:00
Torsten Grote
55d92aec39
Adapt UI and text to the different use-cases (backup vs. restore) 2019-09-17 15:48:59 -03:00
Torsten Grote
10ad6d6b2d
Improve error message when no backups could be found for restore 2019-09-17 12:14:53 -03:00
Torsten Grote
54ad762eb1
Save more information about current storage location
Show storage name in settings
2019-09-17 12:14:53 -03:00
Torsten Grote
c6f83647b2
Show recovery code from top to bottom instead of from left to right
This way it is easier to enter it.
2019-09-17 12:14:53 -03:00
Torsten Grote
4efaa08881
Show notification right away when requesting manual backup 2019-09-17 12:14:53 -03:00
Torsten Grote
6d8178f6b1
Use the MANAGE_DOCUMENTS permission to show possible storage locations
This also auto-grants the needed Uri permission,
so the user does not need to go through the OS folder selection activity.
2019-09-17 12:14:51 -03:00
Torsten Grote
7455f4afb9
Remove READ_PHONE_STATE permission 2019-09-17 12:14:41 -03:00
Torsten Grote
9cede639f3
When restoring, ask for location first and then restore code
This also checks if there's a backup at the chosen location
and requires the user to select another once,
if we can not find a backup.
2019-09-11 17:26:03 -03:00
Torsten Grote
af43c6154d
Get rid of device folders, use unix epoch as backup token and store it 2019-09-11 15:26:10 -03:00
Torsten Grote
8b6656a350
Read RestoreSets from encrypted backup metadata file 2019-09-10 16:46:26 -03:00
Torsten Grote
f9c8b657a0
Write an encrypted metadata file for each restore set 2019-09-10 16:46:25 -03:00
Torsten Grote
044ef01ba1
Do not generate new 12-word code when restoring
Also allow auto-completion when entering the 12-word code.
This makes testing and entering the code easier
and does not compromise security as the word list is public anyway.
2019-09-10 13:35:58 -03:00
Torsten Grote
1a7fdfa59a
Implement restoring of backup and show progress in UI
Note that the progress view is not exact as the progress reporting of
AOSP seems to be buggy.
2019-09-10 13:35:58 -03:00
Torsten Grote
491789e8e0
Add a RestoreActivity that lists available RestoreSets (backups)
and allows the user to select one to get restored.
2019-09-10 13:35:57 -03:00
Torsten Grote
aa3aad8fb3
Return actually available RestoreSets
Before, we were always returnign a dummy RestoreSet,
if one was actually available or not.

Now, we also include the device name.
Note that it is planned to store the actual device name
and other metadata in an encrypted file
so that the backup server will not learn it.
2019-09-10 13:35:57 -03:00
Torsten Grote
c714a4e7e1
Show error notification when backup fails
The implementation is rudimentary for now.
E.g. The notification is only shown when a device init fails
which seems to be triggered after the first failure.
2019-09-02 17:07:21 -03:00
Torsten Grote
683268a15f
Add a unit test for checking word list integrity
Also does minor clean-ups
2019-09-02 17:03:44 -03:00
Torsten Grote
74aa62a264
Add instrumentation test for testing AES/GCM nonces are really unique 2019-09-02 09:47:53 -03:00
Torsten Grote
e955e021fd
Add a simple instrumentation test for testing on real devices 2019-09-02 09:47:52 -03:00
Torsten Grote
2685f2b48a
Don't show rejected packages (usually 0 size) as failed
Also change notification ID to not collide with Nextcloud's ID.
2019-09-02 09:47:52 -03:00