From 3a425394ca65ed8dcc7c81b93c4fda219f5d5b81 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 24 Jan 2020 09:51:48 +0530 Subject: GoBackend: Ensure we're unmetered on API 29 as well VPN apps targetting Android 10 are treated as metered by default. Source: https://developer.android.com/reference/android/net/VpnService.Builder.html#setMetered(boolean) Signed-off-by: Harsh Shandilya --- app/src/main/java/com/wireguard/android/backend/GoBackend.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/src/main/java/com/wireguard/android') diff --git a/app/src/main/java/com/wireguard/android/backend/GoBackend.java b/app/src/main/java/com/wireguard/android/backend/GoBackend.java index 3c4c8939..cc4684cb 100644 --- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -8,6 +8,7 @@ package com.wireguard.android.backend; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.os.Build; import android.os.ParcelFileDescriptor; import androidx.annotation.Nullable; import androidx.collection.ArraySet; @@ -212,6 +213,10 @@ public final class GoBackend implements Backend { builder.setMtu(config.getInterface().getMtu().orElse(1280)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + builder.setMetered(false); + } + builder.setBlocking(true); try (final ParcelFileDescriptor tun = builder.establish()) { if (tun == null) -- cgit v1.2.3