From 12be972fcd909665f07f03fb152ec2d8fcaab404 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 18 Sep 2020 16:57:50 +0200 Subject: [PATCH] SettingsActivity: account for module present but no root Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/activity/SettingsActivity.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt index 214947d4..0ece6f4b 100644 --- a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt @@ -83,6 +83,15 @@ class SettingsActivity : ThemeChangeAwareActivity() { moduleInstaller?.isVisible = false if (ModuleLoader.isModuleLoaded()) { moduleInstaller?.parent?.removePreference(moduleInstaller) + lifecycleScope.launch { + if (Application.getBackend() !is WgQuickBackend) { + try { + withContext(Dispatchers.IO) { Application.getRootShell().start() } + } catch (_: Throwable) { + kernelModuleDisabler?.parent?.removePreference(kernelModuleDisabler) + } + } + } } else { kernelModuleDisabler?.parent?.removePreference(kernelModuleDisabler) lifecycleScope.launch {