aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt')
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt b/ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt
index 6c28907..ad93efa 100644
--- a/ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt
+++ b/ui/src/main/java/com/wireguard/android/preference/KernelModuleDisablerPreference.kt
@@ -15,8 +15,8 @@ import com.wireguard.android.R
import com.wireguard.android.activity.SettingsActivity
import com.wireguard.android.backend.Tunnel
import com.wireguard.android.backend.WgQuickBackend
+import com.wireguard.android.util.lifecycleScope
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
@@ -28,7 +28,7 @@ class KernelModuleDisablerPreference(context: Context, attrs: AttributeSet?) : P
private var state = State.UNKNOWN
init {
isVisible = false
- GlobalScope.launch(Dispatchers.Main.immediate) {
+ lifecycleScope.launch(Dispatchers.Main.immediate) {
setState(if (Application.getBackend() is WgQuickBackend) State.ENABLED else State.DISABLED)
}
}
@@ -46,7 +46,7 @@ class KernelModuleDisablerPreference(context: Context, attrs: AttributeSet?) : P
setState(State.DISABLING)
Application.getSharedPreferences().edit().putBoolean("disable_kernel_module", true).commit()
}
- GlobalScope.launch(Dispatchers.Main.immediate) {
+ lifecycleScope.launch(Dispatchers.Main.immediate) {
val observableTunnels = Application.getTunnelManager().getTunnels()
val downings = observableTunnels.map { async(SupervisorJob()) { it.setStateAsync(Tunnel.State.DOWN) } }
try {