diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-02-06 14:49:15 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-02-06 14:49:15 -0300 |
| commit | 54796fa13112d2185a90edbc05d043c137c835a6 (patch) | |
| tree | 6e2ff5e7d2fbc98709492c631a71b4ab119ac794 | |
| parent | e498f07e2322d581e1e0a5b5fc0243fa919eedb3 (diff) | |
| parent | 0b5705b9e7271c8d18d177e1128b96216c03e010 (diff) | |
| download | mullvadvpn-54796fa13112d2185a90edbc05d043c137c835a6.tar.xz mullvadvpn-54796fa13112d2185a90edbc05d043c137c835a6.zip | |
Merge branch 'fix-stop-foreground-crash'
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c410e9686..49e36a5b68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ Line wrap the file at 100 chars. Th - Only reconnect when settings change if a relevant tunnel protocol is used. - Adjust padding of tray icon on Windows and Linux to better match other icons. +### Fixed +#### Android +- Fix crash when removing the service from foreground on Android versions below API level 24. + ## [2020.1-beta1] - 2020-02-05 ### Added diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt index 0a9a48e3fa..34ccb59bfd 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt @@ -207,7 +207,12 @@ class ForegroundNotificationManager(val service: Service, val connectionProxy: C service.startForeground(FOREGROUND_NOTIFICATION_ID, buildNotification()) onForeground = true } else if (!shouldBeOnForeground) { - service.stopForeground(Service.STOP_FOREGROUND_DETACH) + if (Build.VERSION.SDK_INT >= 24) { + service.stopForeground(Service.STOP_FOREGROUND_DETACH) + } else { + service.stopForeground(false) + } + onForeground = false } } |
