From 14ac54c2de200527affd3befbaf3a9267314df4d Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 15 Dec 2017 12:18:35 -0800 Subject: [PATCH] Add support for Auto Backup for Apps --- mobile/src/main/AndroidManifest.xml | 2 ++ .../main/java/com/github/shadowsocks/ConfigBackupHelper.kt | 1 + mobile/src/main/res/xml/backup_descriptor.xml | 5 +++++ 3 files changed, 8 insertions(+) create mode 100644 mobile/src/main/res/xml/backup_descriptor.xml diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index 11956866..c8f7fc76 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -20,6 +20,8 @@ android:name=".App" android:icon="@mipmap/ic_launcher" android:backupAgent=".ConfigBackupHelper" + android:fullBackupContent="@xml/backup_descriptor" + android:fullBackupOnly="true" android:label="@string/app_name" android:supportsRtl="true" android:networkSecurityConfig="@xml/network_security_config" diff --git a/mobile/src/main/java/com/github/shadowsocks/ConfigBackupHelper.kt b/mobile/src/main/java/com/github/shadowsocks/ConfigBackupHelper.kt index 98f62969..f7f91982 100644 --- a/mobile/src/main/java/com/github/shadowsocks/ConfigBackupHelper.kt +++ b/mobile/src/main/java/com/github/shadowsocks/ConfigBackupHelper.kt @@ -25,6 +25,7 @@ import android.app.backup.FileBackupHelper import com.github.shadowsocks.acl.Acl import com.github.shadowsocks.utils.Key +@Deprecated("Only used in API level < 23. For 6.0+, Auto Backup for Apps is used.") class ConfigBackupHelper : BackupAgentHelper() { override fun onCreate() = addHelper("com.github.shadowsocks.database.profile", FileBackupHelper(this, "../databases/" + Key.PROFILE, Acl.CUSTOM_RULES + ".acl")) diff --git a/mobile/src/main/res/xml/backup_descriptor.xml b/mobile/src/main/res/xml/backup_descriptor.xml new file mode 100644 index 00000000..96554ae6 --- /dev/null +++ b/mobile/src/main/res/xml/backup_descriptor.xml @@ -0,0 +1,5 @@ + + + + +