summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-12 05:42:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-12 05:42:24 +0200
commit61e3441bfb01dfead97102b2e5b3f07aa17182a4 (patch)
treef5b55d0a2a967c3b5cdd2d850bc319acfe981248
parent15e10d8fde986b4956db3905b4ce2f1293779e57 (diff)
Application: require rootshell to use wgquick backend
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--app/src/main/java/com/wireguard/android/Application.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/Application.java b/app/src/main/java/com/wireguard/android/Application.java
index 3ba9814c..f79e4f32 100644
--- a/app/src/main/java/com/wireguard/android/Application.java
+++ b/app/src/main/java/com/wireguard/android/Application.java
@@ -87,9 +87,13 @@ public class Application extends android.app.Application {
sharedPreferences.getBoolean("dark_theme", false) ?
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
- if (new File("/sys/module/wireguard").exists())
- backend = new WgQuickBackend(getApplicationContext());
- else
+ if (new File("/sys/module/wireguard").exists()) {
+ try {
+ rootShell.start();
+ backend = new WgQuickBackend(getApplicationContext());
+ } catch (final Exception ignored) { }
+ }
+ if (backend == null)
backend = new GoBackend(getApplicationContext());
tunnelManager = new TunnelManager(backend, configStore);