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 <me@msfjarvis.dev>
This commit is contained in:
parent
d98ba463ad
commit
3a425394ca
@ -8,6 +8,7 @@ package com.wireguard.android.backend;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.collection.ArraySet;
|
import androidx.collection.ArraySet;
|
||||||
@ -212,6 +213,10 @@ public final class GoBackend implements Backend {
|
|||||||
|
|
||||||
builder.setMtu(config.getInterface().getMtu().orElse(1280));
|
builder.setMtu(config.getInterface().getMtu().orElse(1280));
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
builder.setMetered(false);
|
||||||
|
}
|
||||||
|
|
||||||
builder.setBlocking(true);
|
builder.setBlocking(true);
|
||||||
try (final ParcelFileDescriptor tun = builder.establish()) {
|
try (final ParcelFileDescriptor tun = builder.establish()) {
|
||||||
if (tun == null)
|
if (tun == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user