Add support for participating in Android's backup system

This adds an option for participating in Android's backup system. Two items are
backed up: the ``files/aegis.json`` file and the entire ``shared_prefs``
directory. The option is disabled by default and can only be enabled if
encryption is enabled as well.

I tested this with Local Transport and Seedvault. To test with Local Transport,
see: https://developer.android.com/guide/topics/data/testingbackup.
This commit is contained in:
Alexander Bakker 2021-01-03 18:19:16 +01:00
parent 07c768893a
commit f080eaa8f9
10 changed files with 199 additions and 23 deletions

View file

@ -164,6 +164,14 @@ public class Preferences {
return new Locale(parts[0], parts[1]);
}
public boolean isAndroidBackupsEnabled() {
return _prefs.getBoolean("pref_android_backups", false);
}
public void setIsAndroidBackupsEnabled(boolean enabled) {
_prefs.edit().putBoolean("pref_android_backups", enabled).apply();
}
public boolean isBackupsEnabled() {
return _prefs.getBoolean("pref_backups", false);
}