android: Don't default to marking VPN connections as metered

For apps targeting Android 10, where a method to change this was added, the
default changed so that all VPN connections are marked as metered.  This means
certain background operations (e.g. syncing data) are not performed anymore
even when connected to a WiFi.  By setting this to false, the metered state
of the VPN connection reflects that of the underlying networks.
This commit is contained in:
Tobias Brunner 2020-12-01 15:54:35 +01:00
parent b58740996f
commit b32a9be419

View File

@ -822,6 +822,12 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
PendingIntent pending = PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setConfigureIntent(pending);
/* mark all VPN connections as unmetered (default changed for Android 10) */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
builder.setMetered(false);
}
return builder;
}