Commit graph

600 commits

Author SHA1 Message Date
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
Torsten Grote
e2a3e3d2b7
Raise importance of backup notifications to show them in status bar 2019-09-02 09:47:52 -03:00
Torsten Grote
bd968be0b1
Remove BackupJobService as the OS is scheduling its own backups 2019-09-02 09:47:52 -03:00
Torsten Grote
a6e971609c
Implement clearing full backup data from storage 2019-09-02 09:47:51 -03:00
Torsten Grote
1ee443a3d8
Add a unique ID to the device folder name to avoid collisions
when using several devices of the same model with the same account
2019-09-02 09:47:51 -03:00
Torsten Grote
2ce625ac87
Huge refactoring of backup transport
* to get rid of global state
* to have a testable architecture
* to allow for authenticated encryption
* to have a backup format version
* to potentially allow for other storage plugins
2019-09-02 09:47:49 -03:00
Chirayu Desai
6136f589c1 Android.mk: Download prebuilt apk instead of building it
* With the upcoming changes, and the increasing number of external
  libraries being used, plus the usage of Kotlin, it's getting harder
  and harder to build this with the AOSP build system.
* It's best to leverage the existing gradle build system instead,
  and use the apk that builds.
* Add a script which downloads the apk matching the tag if a tag is
  checked out, otherwise downloads the latest.
2019-07-31 23:22:35 +05:30
Torsten Grote
7b1e63a37f
Fix Travis CI and add build cache
Also remove relicts from Android.mk file
2019-07-26 11:41:45 +02:00
Torsten Grote
87b25aa4ec
Re-implement manual backup run and show notification during manual backups 2019-07-09 10:41:58 +02:00
Torsten Grote
4c79d41963
Show Backup Location screen before letting user choose backup folder
This screen can also be reached by tapping the previously inactive backup location setting.
2019-07-09 10:25:30 +02:00
Torsten Grote
3e64c3686f
Use Android's hardware-backed keystore to store backup key
This commit also disables the old UI as it does not work with the new key
2019-07-08 13:21:32 +02:00
Torsten Grote
66c0919eb5
Let user write down recovery code on first start 2019-07-08 13:21:32 +02:00
Torsten Grote
ee6cf38312
Migrate SettingsActivity and Fragment to Kotlin 2019-07-04 08:45:23 +02:00
Torsten Grote
c801502e81
Migrate SettingsManager to Kotlin 2019-07-04 08:25:37 +02:00
Torsten Grote
3d5911d41d
Add a SettingsViewModel in Kotlin including the Kotlin deps 2019-07-03 19:44:37 +02:00
Torsten Grote
b983414295
Add custom settings UI 2019-07-03 12:46:55 +02:00
Torsten Grote
3981d3d8cc
Use latest stable AndroidX libraries 2019-07-03 12:46:54 +02:00
Torsten Grote
7fd3810fbf
Add AndroidX dependencies 2019-06-17 10:34:49 -03:00
Torsten Grote
7b95256ba5
Fix detection of the end of backup
For the current transport it is important to know when the backup ends,
because it resets its state only then and closes the ZIP file.

The detection was broken,
because some packages didn't have data to back up (LOG_EVENT_ID_NO_DATA_TO_SEND),
so the transport's methods weren't called and the package counter not updated.

The hacky solution is to use the BackupObserver to call back into the
transport at the end of backup.
Ideally, future transports won't need to know when the backup finishes.
2019-06-14 16:33:05 -03:00
Torsten Grote
84d91290ac
Let the BackupManager know that we use client-side encryption 2019-06-14 16:33:04 -03:00
Torsten Grote
2f2fba8305
Pre-select all packages and give option to unselect all 2019-06-14 16:33:04 -03:00
Torsten Grote
ad89ea4187
Use new IBackupManager API to filter eligable packages
There's also a bit of refactoring for simplifying the PackageService
usage.

Fixes #26 by adding com.android.externalstorage to ignore list
2019-06-14 07:04:21 -03:00
Torsten Grote
3a9aec56b2
Upgrade android.jar to API 28 2019-06-14 07:04:19 -03:00
Torsten Grote
d678566967
Exclude key-value backup apps for now
We do this as a temporary fix, because our backup methods are not called
which are updating the package counter. So our mechanism to find out
about the end of the backup is broken. Excluding key-value backups fixes
it for now.
2019-06-12 11:01:56 -03:00
Torsten Grote
7fcd9aa091
Resolve review comments about backup compontent refactoring 2019-06-12 09:19:38 -03:00
Torsten Grote
92ce6c1a5c
Refactor transport components to eliminate need to initialize and reset transport 2019-06-11 20:53:44 -03:00
Torsten Grote
b17a55ac57
Target API 28 2019-06-11 11:57:10 -03:00
Torsten Grote
2037291f81
Don't start transport service in foreground
Start it on-deman instead.

This way, we don't need a foreground service and thus can target API 28
2019-06-11 10:18:20 -03:00
Torsten Grote
540147470d
Allow the user to schedule full background backups 2019-06-11 09:28:03 -03:00
Torsten Grote
8a0fe3c513
Store backup passphrase insecurely for now
This is being done to implement automatic background updates
and not supposed to be part of a release.

The backup key will later be generated and shown to the user instead of
allowing them to choose their own.
2019-06-05 16:45:04 -03:00
Torsten Grote
6da59c8192 Use Android's logging instead of printing stacktraces to STDERR 2019-06-04 16:54:46 -04:00
Torsten Grote
b8e9e60666 Add a button to change the backup storage location 2019-06-04 16:54:46 -04:00
Torsten Grote
b3c744b872 Store backup folder Uri in default shared preferences
and keep using it as long as it continues to be available.
2019-06-04 16:54:46 -04:00
Torsten Grote
f192e640fb Choose a backup folder instead of a file
Backup files will be created within this folder
2019-06-04 16:54:46 -04:00
Torsten Grote
1e00d2c0a3
Downgrade Android Gradle plugin
as new version require us to remove targetSdkVersion from Manifest
2019-06-04 12:36:53 -03:00
Torsten Grote
d1f5986e39
Add signing config for faster testing 2019-06-04 09:04:25 -03:00
Torsten Grote
2434fe30f4
Several small nitpicks and fixes 2019-06-04 09:04:25 -03:00
Steve Soltys
cdaf842866 Version bump - 0.3.0 2019-03-14 21:33:50 -04:00
Steve Soltys
04543a1014 Fix transport encryption
Prior to this commit, some of the application data was not included during encryption. This is a breaking change, any backups made prior to this commit can no longer be restored.

1. Encrypt 'full' backup data.
2. Increase number of key generation iterations to 32767.
3. Change cipher to 'AES/CBC/PKCS5Padding'.
2019-03-14 20:09:06 -04:00
Steve Soltys
b16fcf5d87 Clean up backup service 2019-03-14 17:07:23 -04:00
Steve Soltys
3e2e75a9b5 Ignore 'calendar' and 'contacts' Android provider packages 2019-03-14 17:06:53 -04:00
Steve Soltys
571cecfa2f Version bump - 0.2.0 2019-03-01 23:48:03 -05:00
Steve Soltys
828f257426 Clean up package and class structure significantly
1. Add service layer for backup / restore operations.
2. Reduce amount of duplicate code in activity classes.
2019-03-01 23:34:04 -05:00
Steve Soltys
0b5cc1a798 Fix logging in content provider restore component 2019-02-22 01:11:05 -05:00
Steve Soltys
03c92efc24 Add initialization message to loading popup window 2019-02-22 01:05:55 -05:00
Steve Soltys
bd0c41c2d3 Stop regenerating secret key for each package 2019-02-22 01:02:06 -05:00
Steve Soltys
1519580a36 Reduce number of key generation iterations to 25 2019-02-22 01:00:08 -05:00
Steve Soltys
b0465f7aae Add 'com.stevesoltys.backup' to ignored packages 2019-02-21 23:50:50 -05:00
Steve Soltys
0fd4c7833d Reduce number of key generation iterations to 100 2019-02-21 22:42:16 -05:00
Steve Soltys
023750be6e Add loading popup when fetching packages for backup or restore 2019-02-21 22:41:54 -05:00
Steve Soltys
9b979b3693 Move cipher logic out of backup and restore components 2019-02-21 21:51:46 -05:00
Steve Soltys
b182e743e8 Add support for encrypted backups
1. Add prompt for entering password during backup and restore.
2. Use PBKDF2 to generate a secret key that is used to encrypt backups.
3. Store salt in backup zip file.
4. Fetch salt from backup zip file during restore and use it to decrypt restoration data.
2019-02-15 02:46:24 -05:00
Steve Soltys
f21e687a6d Version bump - 0.1.2 2019-02-11 22:41:50 -05:00
Steve Soltys
31bc653cfb Version bump - 0.1.1 2019-02-11 22:25:01 -05:00
Steve Soltys
8fe694a2df Fix version code 2019-02-11 22:10:09 -05:00
Steve Soltys
656b7702e0 Allow user to select all packages during backup and restore 2019-02-11 22:07:57 -05:00
Steve Soltys
b714952b85 Ignore 'com.android.providers.downloads.ui' to resolve #14 2019-02-11 22:06:46 -05:00
Steve Soltys
df0b3d6287 Update SDK version to 28 2019-02-11 22:00:33 -05:00
Steve Soltys
09c8aad237 Update launcher icon 2018-12-15 03:41:50 -05:00
Steve Soltys
7c3bff31f0 Make transport service start in foreground to resolve #13 2018-12-15 03:34:34 -05:00
Steve Soltys
98297537df Pull commons-io from Maven repository for Gradle builds 2018-11-14 21:40:05 -05:00
Steve Soltys
22db4579e8 Add application version to Android manifest 2018-11-13 18:15:21 -05:00
Steve Soltys
ab4ae56def Add commons-io dependency to Android makefile 2018-11-13 17:58:27 -05:00
Steve Soltys
cc4b629a89 Automatically start transport service when application launches 2018-11-11 21:00:00 -05:00
Steve Soltys
2fa09be854 Merge branch 'master' into feature/standalone 2018-11-11 20:53:57 -05:00
Steve Soltys
e8720189f3 Add experimental support for standalone builds 2018-11-07 22:04:37 -05:00
Steve Soltys
072e9a1b02 Remove Gradle as build system
This application must be compiled with the operating system, so Gradle is unnecessary.
2017-11-08 23:56:49 -05:00
Steve Soltys
0bd1596056 Fix #2
The output file descriptor was not being closed after each chunk was written.
1. The output stream will no longer be stored in the restore state.
2. The output file descriptor will be closed after a chunk is transferred.
2017-11-08 23:21:27 -05:00
Steve Soltys
09ff3ba493 Clean up packaging of content provider backup/restore components 2017-10-23 20:02:40 -04:00
Steve Soltys
b9239143e0 Clean up ContentProviderBackupComponent 2017-10-23 20:00:25 -04:00
Steve Soltys
765b8b2540 Stop clearing the backup state after a package is rejected 2017-10-18 23:00:20 -04:00
Steve Soltys
312a13a913 Clean up logging in ContentProviderBackupComponent 2017-10-17 23:39:30 -04:00
Steve Soltys
f5e723b1a1 Clean up full transport logic in ContentProviderBackupComponent 2017-10-17 23:34:59 -04:00
Steve Soltys
93c91db524 Move full restore logic into separate function 2017-10-09 21:21:15 -04:00
Steve Soltys
f41d211ddc Add support for incremental and full backup directory configuration 2017-10-09 20:40:25 -04:00
Steve Soltys
677b950dea Switch selected package list data type to Set 2017-10-09 20:25:40 -04:00
Steve Soltys
facb7029b9 Add initialization functions to ConfigurableBackupTransport 2017-10-09 20:02:41 -04:00
Steve Soltys
0a978c37e8 Clean up transport logic in ContentProviderRestoreComponent 2017-10-04 21:11:02 -04:00
Steve Soltys
a1a8329299 Clean up logging in ContentProviderRestoreComponent 2017-10-03 22:38:09 -04:00
Steve Soltys
e0b106537a Add priv-app permissions configuration 2017-10-01 16:43:24 -04:00
Steve Soltys
3e973fa91f Rename backup transport whitelist configuration 2017-10-01 16:40:43 -04:00
Steve Soltys
7a9c510390 Remove target/source compatibility entries in build.gradle 2017-09-22 00:34:35 -04:00
Steve Soltys
e27a8b308f Switch to builder pattern for ContentProviderBackupConfiguration 2017-09-22 00:10:30 -04:00
Steve Soltys
2497a94e4c Initial commit 2017-09-21 00:30:28 -04:00