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 } } 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,