aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-01-24 15:36:27 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-01-24 15:36:27 +0100
commitdfd003513f3d2bccaf9ed2aaf8b312f097a69c39 (patch)
treef91c1da8e1cefa404ff8672ab7815df44e3af82c
parentUpgrade to Gradle 6.1 (diff)
downloadwireguard-android-dfd003513f3d2bccaf9ed2aaf8b312f097a69c39.tar.xz
wireguard-android-dfd003513f3d2bccaf9ed2aaf8b312f097a69c39.zip
GoBackend: restrict APIs to proper version
-rw-r--r--app/src/main/java/com/wireguard/android/backend/GoBackend.java6
1 files changed, 3 insertions, 3 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 cc4684c..ad45c93 100644
--- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -213,9 +213,10 @@ public final class GoBackend implements Backend {
builder.setMtu(config.getInterface().getMtu().orElse(1280));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
builder.setMetered(false);
- }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
+ service.setUnderlyingNetworks(null);
builder.setBlocking(true);
try (final ParcelFileDescriptor tun = builder.establish()) {
@@ -229,7 +230,6 @@ public final class GoBackend implements Backend {
currentTunnel = tunnel;
- service.setUnderlyingNetworks(null);
service.protect(wgGetSocketV4(currentTunnelHandle));
service.protect(wgGetSocketV6(currentTunnelHandle));
} else {