summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-01-29 16:12:05 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-01-29 16:12:05 +0000
commite43865310f96ad9b5f7f81f5924ff680fc5c9b81 (patch)
treef534c5a4c28aeca18a330549f7a68e5ce04c7fd3 /android
parent84bfdd604187f348dc098461ff41b6a95eab8958 (diff)
downloadmullvadvpn-e43865310f96ad9b5f7f81f5924ff680fc5c9b81.tar.xz
mullvadvpn-e43865310f96ad9b5f7f81f5924ff680fc5c9b81.zip
Only unsubscribe listeners if destroying activity
Previously, `MainActivity` would unsubscribe all service listeners when it was stopping (i.e., going to the background). However, that meant that once it resumed all UI fragments that were sub-classes of `ServiceAwareFragment` would still reference the old service, which might have been stopped or replaced, and wouldn't receive any updates if the service connection is dropped or replaced.
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt3
1 files changed, 1 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
index 6e0314612e..08137ea93c 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
@@ -90,14 +90,13 @@ class MainActivity : FragmentActivity() {
}
override fun onStop() {
- serviceNotifier.unsubscribeAll()
-
unbindService(serviceConnectionManager)
super.onStop()
}
override fun onDestroy() {
+ serviceNotifier.unsubscribeAll()
serviceConnection?.onDestroy()
super.onDestroy()