From 557ef5820e33a7d8a6bbe73d23042d56314edd4e Mon Sep 17 00:00:00 2001 From: Clark Date: Tue, 25 Jul 2023 11:30:54 -0400 Subject: [PATCH] Fix bad notification for start foreground when hanging up. --- .../securesms/service/webrtc/WebRtcCallService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcCallService.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcCallService.java index 5f7a97c159..e4e0a0ae63 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcCallService.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/WebRtcCallService.java @@ -168,7 +168,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent == null || intent.getAction() == null) { - setCallNotification(); + setCallNotification(true); stop(); return START_NOT_STICKY; } @@ -200,7 +200,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag } return START_STICKY; case ACTION_STOP: - setCallNotification(); + setCallNotification(true); stop(); return START_NOT_STICKY; case ACTION_DENY_CALL: @@ -217,7 +217,10 @@ public final class WebRtcCallService extends Service implements SignalAudioManag } private void setCallNotification() { - if (lastNotificationId != INVALID_NOTIFICATION_ID) { + setCallNotification(false); + } + private void setCallNotification(boolean stopping) { + if (!stopping && lastNotificationId != INVALID_NOTIFICATION_ID) { startForegroundCompat(lastNotificationId, lastNotification); } else { Log.w(TAG, "Service running without having called start first, show temp notification and terminate service.");