From bc24c7804d4cf7119dbeb96220c81412d7d9127d Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Wed, 28 Jul 2021 19:37:47 +0200 Subject: [PATCH 1/2] Don't backup on metered networks * We better not overuse metered networks as such connections * are usually sensitive to heavy data usage due to monetary costs and/or data limitations. --- .../com/stevesoltys/seedvault/settings/SettingsManager.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsManager.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsManager.kt index 727f7d83..bb28b149 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsManager.kt @@ -175,13 +175,14 @@ data class Storage( * but it isn't available right now. */ fun isUnavailableNetwork(context: Context): Boolean { - return requiresNetwork && !hasInternet(context) + return requiresNetwork && !hasUnmeteredInternet(context) } - private fun hasInternet(context: Context): Boolean { + private fun hasUnmeteredInternet(context: Context): Boolean { val cm = context.getSystemService(ConnectivityManager::class.java) + val isMetered = cm.isActiveNetworkMetered() val capabilities = cm.getNetworkCapabilities(cm.activeNetwork) ?: return false - return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) + return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) && !isMetered } } From acc332b0fdd36823332f7d003adf80bc49378027 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Fri, 11 Jun 2021 20:04:51 +0300 Subject: [PATCH 2/2] Move LocalContactsBackup to product partition Change-Id: I0f463d4310647765266b948276d62171a7f46243 --- contactsbackup/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contactsbackup/Android.bp b/contactsbackup/Android.bp index 9a4e2e60..e0d60206 100644 --- a/contactsbackup/Android.bp +++ b/contactsbackup/Android.bp @@ -13,11 +13,13 @@ android_app { required: [ "default-permissions_org.calyxos.backup.contacts", ], + product_specific: true, sdk_version: "current", } prebuilt_etc { name: "default-permissions_org.calyxos.backup.contacts", + product_specific: true, sub_dir: "default-permissions", src: "default-permissions_org.calyxos.backup.contacts.xml", filename_from_src: true,