diff options
author | Aurélien Chabot <aurelien@chabot.fr> | 2018-02-19 08:16:26 +1100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-17 02:15:24 +0200 |
commit | 9dfab4d60f5dc06445df53d675a458dfae8cb5f6 (patch) | |
tree | e03f535972727ad83ff8daf1a33a7393ad749b57 /app/src/main/java/com/wireguard/android/activity | |
parent | 19aec7c5c68ae5f8763004d3673c57d0722db39a (diff) |
GoBackend: Use the android VpnService to encapsulate the go backend
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/activity')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/BaseActivity.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java index 10c7bca9..f6f56601 100644 --- a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java @@ -1,11 +1,13 @@ package com.wireguard.android.activity; import android.app.Activity; +import android.content.Intent; import android.databinding.CallbackRegistry; import android.databinding.CallbackRegistry.NotifierCallback; import android.os.Bundle; import com.wireguard.android.Application; +import com.wireguard.android.backend.GoBackend; import com.wireguard.android.model.Tunnel; import com.wireguard.android.model.TunnelManager; @@ -42,8 +44,16 @@ public abstract class BaseActivity extends Activity { final TunnelManager tunnelManager = Application.getComponent().getTunnelManager(); selectedTunnel = tunnelManager.getTunnels().get(savedTunnelName); } + // The selected tunnel must be set before the superclass method recreates fragments. super.onCreate(savedInstanceState); + + if (Application.getComponent().getBackendType() == GoBackend.class) { + Intent intent = GoBackend.VpnService.prepare(this); + if (intent != null) { + startActivityForResult(intent, 0); + } + } } @Override |