diff options
3 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/com/wireguard/android/Application.java b/app/src/main/java/com/wireguard/android/Application.java index bd848e66..9b40fcd6 100644 --- a/app/src/main/java/com/wireguard/android/Application.java +++ b/app/src/main/java/com/wireguard/android/Application.java @@ -73,7 +73,7 @@ public class Application extends android.app.Application { if (app.backend == null) { Backend backend = null; boolean didStartRootShell = false; - if (!app.moduleLoader.isModuleLoaded() && app.moduleLoader.moduleMightExist()) { + if (!ModuleLoader.isModuleLoaded() && app.moduleLoader.moduleMightExist()) { try { app.rootShell.start(); didStartRootShell = true; @@ -81,7 +81,7 @@ public class Application extends android.app.Application { } catch (final Exception ignored) { } } - if (app.moduleLoader.isModuleLoaded()) { + if (ModuleLoader.isModuleLoaded()) { try { if (!didStartRootShell) app.rootShell.start(); diff --git a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java index 442c93e6..f545c371 100644 --- a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java @@ -20,6 +20,7 @@ import android.view.MenuItem; import com.wireguard.android.Application; import com.wireguard.android.R; import com.wireguard.android.backend.WgQuickBackend; +import com.wireguard.android.util.ModuleLoader; import java.util.ArrayList; import java.util.Arrays; @@ -113,7 +114,7 @@ public class SettingsActivity extends ThemeChangeAwareActivity { final Preference moduleInstaller = getPreferenceManager().findPreference("module_downloader"); moduleInstaller.setVisible(false); - if (Application.getModuleLoader().isModuleLoaded()) { + if (ModuleLoader.isModuleLoaded()) { screen.removePreference(moduleInstaller); } else { Application.getAsyncWorker().runAsync(Application.getRootShell()::start).whenComplete((v, e) -> { diff --git a/app/src/main/java/com/wireguard/android/util/ModuleLoader.java b/app/src/main/java/com/wireguard/android/util/ModuleLoader.java index f5bca0f2..7794dd5c 100644 --- a/app/src/main/java/com/wireguard/android/util/ModuleLoader.java +++ b/app/src/main/java/com/wireguard/android/util/ModuleLoader.java @@ -59,7 +59,7 @@ public class ModuleLoader { Application.getRootShell().run(null, String.format("insmod \"%s/wireguard-$(sha256sum /proc/version|cut -d ' ' -f 1).ko\"", moduleDir.getAbsolutePath())); } - public boolean isModuleLoaded() { + public static boolean isModuleLoaded() { return new File("/sys/module/wireguard").exists(); } |