summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt6
2 files changed, 7 insertions, 1 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 e98646d34f..b961de947d 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
@@ -87,7 +87,7 @@ class ForegroundNotificationManager(
}
}
- private fun showOnForeground() {
+ fun showOnForeground() {
service.startForeground(
TunnelStateNotification.NOTIFICATION_ID,
tunnelStateNotification.build()
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 9ff1e9f6a5..0a6c29b44e 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
@@ -114,6 +114,12 @@ class MullvadVpnService : TalpidVpnService() {
val startResult = super.onStartCommand(intent, flags, startId)
var quitCommand = false
+ // Always promote to foreground if connect/disconnect actions are provided to mitigate cases
+ // where the service would potentially otherwise be too slow running `startForeground`.
+ if (intent?.action == KEY_CONNECT_ACTION || intent?.action == KEY_DISCONNECT_ACTION) {
+ notificationManager.showOnForeground()
+ }
+
notificationManager.updateNotification()
if (!keyguardManager.isDeviceLocked) {