diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/android/backend/GoBackend.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/backend/GoBackend.java | 20 |
1 files changed, 2 insertions, 18 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 77e40e53..6ad5afa4 100644 --- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -5,7 +5,6 @@ package com.wireguard.android.backend; -import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; @@ -25,7 +24,6 @@ import com.wireguard.crypto.KeyFormatException; import java.net.InetAddress; import java.util.Collections; -import java.util.HashSet; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -48,8 +46,6 @@ public final class GoBackend implements Backend { @Nullable private Config currentConfig; private int currentTunnelHandle = -1; - private final Set<TunnelStateChangeNotificationReceiver> notifiers = new HashSet<>(); - public GoBackend(final Context context) { SharedLibraryLoader.loadSharedLibrary(context, "wg-go"); this.context = context; @@ -240,8 +236,7 @@ public final class GoBackend implements Backend { currentConfig = null; } - for (final TunnelStateChangeNotificationReceiver notifier : notifiers) - notifier.tunnelStateChange(tunnel, state); + tunnel.onStateChange(state); } private void startVpnService() { @@ -249,16 +244,6 @@ public final class GoBackend implements Backend { context.startService(new Intent(context, VpnService.class)); } - @Override - public void registerStateChangeNotification(final TunnelStateChangeNotificationReceiver receiver) { - notifiers.add(receiver); - } - - @Override - public void unregisterStateChangeNotification(final TunnelStateChangeNotificationReceiver receiver) { - notifiers.remove(receiver); - } - public static class VpnService extends android.net.VpnService { @Nullable private GoBackend owner; @@ -286,8 +271,7 @@ public final class GoBackend implements Backend { owner.currentTunnel = null; owner.currentTunnelHandle = -1; owner.currentConfig = null; - for (final TunnelStateChangeNotificationReceiver notifier : owner.notifiers) - notifier.tunnelStateChange(tunnel, State.DOWN); + tunnel.onStateChange(State.DOWN); } } vpnService = vpnService.newIncompleteFuture(); |