VPN+Wifi, not treated as metered (#5613)
This commit is contained in:
parent
a399702da2
commit
7768aea11d
|
@ -96,6 +96,16 @@ public class NetworkUtils {
|
|||
|
||||
private static boolean isNetworkMetered() {
|
||||
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
NetworkCapabilities capabilities = connManager.getNetworkCapabilities(
|
||||
connManager.getActiveNetwork());
|
||||
|
||||
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
|
||||
&& capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return connManager.isActiveNetworkMetered();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue