summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2021-10-05 17:34:16 +0200
committerAlbin <albin@mullvad.net>2021-10-06 16:36:15 +0200
commit76607030e390d09a8664b443e0432d0de0750f45 (patch)
tree391df6b2e4981ecc3429e955ed3b85889e848019 /android/src
parent5f949dbcc4bc619372bedf284e7f68205f14b769 (diff)
downloadmullvadvpn-76607030e390d09a8664b443e0432d0de0750f45.tar.xz
mullvadvpn-76607030e390d09a8664b443e0432d0de0750f45.zip
Fix reconnect on app resume
Fixes an issue with the app automatically reconnecting each time it's resumed from the background. The issue was caused by the app and service being out-of-sync in terms of split tunneling state during app resume, which was fixed by comparing the new and old state in the service before notifying other components.
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt8
1 files changed, 5 insertions, 3 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt
index a2e574a359..d6455ea9a3 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt
@@ -9,9 +9,11 @@ import net.mullvad.talpid.util.EventNotifier
class SplitTunneling(persistence: SplitTunnelingPersistence, endpoint: ServiceEndpoint) {
private val excludedApps = persistence.excludedApps.toMutableSet()
- private var enabled by observable(persistence.enabled) { _, _, isEnabled ->
- persistence.enabled = isEnabled
- update()
+ private var enabled by observable(persistence.enabled) { _, wasEnabled, isEnabled ->
+ if (wasEnabled != isEnabled) {
+ persistence.enabled = isEnabled
+ update()
+ }
}
val onChange = EventNotifier<List<String>?>(excludedApps.toList())