diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-18 16:57:50 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-18 20:29:23 +0200 |
commit | 12be972fcd909665f07f03fb152ec2d8fcaab404 (patch) | |
tree | 3cc60ef6ad1f3802eb31d5bd9722ef55040d0fee /ui/src/main/java/com/wireguard/android | |
parent | d200437813ae09769dc90820ded3911a324601ca (diff) |
SettingsActivity: account for module present but no root
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java/com/wireguard/android')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt | 9 |
1 files changed, 9 insertions, 0 deletions
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 { |