aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-09-18 16:57:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-09-18 20:29:23 +0200
commit12be972fcd909665f07f03fb152ec2d8fcaab404 (patch)
tree3cc60ef6ad1f3802eb31d5bd9722ef55040d0fee /ui/src/main/java
parentui: move to Jetpack DataStore instead of SharedPrefs (diff)
downloadwireguard-android-12be972fcd909665f07f03fb152ec2d8fcaab404.tar.xz
wireguard-android-12be972fcd909665f07f03fb152ec2d8fcaab404.zip
SettingsActivity: account for module present but no root
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java')
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt9
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 214947d..0ece6f4 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 {