ModuleLoader: Staticize isModuleLoaded
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
44fc0228a9
commit
5e94adc73a
@ -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();
|
||||
|
@ -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) -> {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user