summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-01-21 15:54:38 +0100
committerAlbin <albin@mullvad.net>2022-01-24 13:44:45 +0100
commit965c2c703f2905019b93abab6c1645a0917cd679 (patch)
tree5d269649f1b58b8dc6d747e4ddde17fd4237e23c
parent4aabd4c0701002162a720944cd5be716b1337920 (diff)
downloadmullvadvpn-965c2c703f2905019b93abab6c1645a0917cd679.tar.xz
mullvadvpn-965c2c703f2905019b93abab6c1645a0917cd679.zip
Cleanup notification when task removed
Remove the tunnel state notification if the task is removed (app swiped away from recent apps) while the tunnel is disconnected.
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt1
2 files changed, 5 insertions, 0 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
index 09ccf1677a..2592b17529 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
@@ -128,6 +128,10 @@ class ForegroundNotificationManager(
}
}
+ fun cancelNotification() {
+ tunnelStateNotification.visible = false
+ }
+
private fun updateNotificationAction() {
tunnelStateNotification.showAction = loggedIn && deviceIsUnlocked
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
index d09472fa3d..9e52bebdd5 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
@@ -174,6 +174,7 @@ class MullvadVpnService : TalpidVpnService() {
connectionProxy.onStateChange.latestEvent.let { tunnelState ->
Log.d(TAG, "Task removed (tunnelState=$tunnelState)")
if (tunnelState == TunnelState.Disconnected) {
+ notificationManager.cancelNotification()
stop()
}
}