From 786d5916270b902a273ce5070bfa1e1598649be7 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 3 Aug 2023 15:41:51 +0200 Subject: [PATCH] Android 12: add device-to-device backup rules, include database. Instead drop auto-backup files for Cloud backup. --- app/src/main/AndroidManifest.xml | 3 +- .../dataliberation/AutoBackupTools.kt | 4 ++- app/src/main/res/xml/sg_backup_rules.xml | 16 ++++++++++ .../res/xml/sg_backup_rules_android_12.xml | 30 +++++++++++++++++++ app/src/main/res/xml/sg_full_backup_rules.xml | 9 ------ 5 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/xml/sg_backup_rules.xml create mode 100644 app/src/main/res/xml/sg_backup_rules_android_12.xml delete mode 100644 app/src/main/res/xml/sg_full_backup_rules.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8169a7aa94..82fb08a47e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -44,7 +44,8 @@ android:name="com.battlelancer.seriesguide.SgApp" android:allowBackup="true" android:backupAgent="com.battlelancer.seriesguide.SgBackupAgent" - android:fullBackupContent="@xml/sg_full_backup_rules" + android:dataExtractionRules="@xml/sg_backup_rules_android_12" + android:fullBackupContent="@xml/sg_backup_rules" android:fullBackupOnly="true" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" diff --git a/app/src/main/java/com/battlelancer/seriesguide/dataliberation/AutoBackupTools.kt b/app/src/main/java/com/battlelancer/seriesguide/dataliberation/AutoBackupTools.kt index b42e3e7453..25a16dd264 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/dataliberation/AutoBackupTools.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/dataliberation/AutoBackupTools.kt @@ -11,6 +11,8 @@ import java.util.Calendar object AutoBackupTools { + private const val BACKUP_FOLDER_NAME = "Backups" + @Throws(AutoBackupException::class) fun getBackupDirectory(context: Context): File { val storage = context.getExternalFilesDir(null) @@ -20,7 +22,7 @@ object AutoBackupTools { throw AutoBackupException("Storage not mounted.") } - return File(storage, "Backups") + return File(storage, BACKUP_FOLDER_NAME) } fun deleteOldBackups(context: Context) { diff --git a/app/src/main/res/xml/sg_backup_rules.xml b/app/src/main/res/xml/sg_backup_rules.xml new file mode 100644 index 0000000000..0fe533e853 --- /dev/null +++ b/app/src/main/res/xml/sg_backup_rules.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/sg_backup_rules_android_12.xml b/app/src/main/res/xml/sg_backup_rules_android_12.xml new file mode 100644 index 0000000000..ebacbc07c3 --- /dev/null +++ b/app/src/main/res/xml/sg_backup_rules_android_12.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/sg_full_backup_rules.xml b/app/src/main/res/xml/sg_full_backup_rules.xml deleted file mode 100644 index 23cba65f2a..0000000000 --- a/app/src/main/res/xml/sg_full_backup_rules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file