aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-01-24 09:51:48 +0530
committerHarsh Shandilya <msfjarvis@gmail.com>2020-01-24 09:51:48 +0530
commitf0059618b03ee82c33c3811ff1e35bf4d9122db9 (patch)
treeb1e039f41b71bc349f7717ab745e5e1af2dd8e03
parentversion: bump (diff)
downloadwireguard-android-f0059618b03ee82c33c3811ff1e35bf4d9122db9.tar.xz
wireguard-android-f0059618b03ee82c33c3811ff1e35bf4d9122db9.zip
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 <msfjarvis@gmail.com>
-rw-r--r--app/src/main/java/com/wireguard/android/backend/GoBackend.java5
1 files changed, 5 insertions, 0 deletions
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 3c4c893..cc4684c 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)