From c621ec0c5063555673f35636c0e4e4f82b3929c8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 24 Jan 2020 15:36:27 +0100 Subject: GoBackend: restrict APIs to proper version Signed-off-by: Jason A. Donenfeld --- app/src/main/java/com/wireguard/android/backend/GoBackend.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/src/main/java') 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 cc4684cb..ad45c933 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 { -- cgit v1.2.3