summaryrefslogtreecommitdiffhomepage
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
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SplitTunneling.kt8
2 files changed, 6 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34dc9d17ae..0b6a6bab4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -102,6 +102,7 @@ Line wrap the file at 100 chars. Th
- Fix erasing wireguard MTU value in some scenarious.
- Fix initial state of Split tunneling excluded apps list. Previously it was not notified the daemon
properly after initialization.
+- Fix reconnect on app resume.
#### macOS
- Prevent app from showing when dragging tray icon on macOS.
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())