From 7b15e017e4209ad2c5fed692ad6d438d76d1ca7f Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 13 Oct 2022 22:42:07 -0500 Subject: [PATCH] Do not show double notification during dialler integration call --- .../conversations/services/XmppConnectionService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 802a834d3b6865aac6b1bc8c6c0ca306678b15d8..f8ca42db270c5916f52bcdd59c56c8a2eec4449d 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1364,10 +1364,11 @@ public class XmppConnectionService extends Service { private void toggleForegroundService(boolean force) { final boolean status; final OngoingCall ongoing = ongoingCall.get(); - if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) { + final boolean showOngoing = ongoing != null && !diallerIntegrationActive.get(); + if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || showOngoing || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) { final Notification notification; final int id; - if (ongoing != null) { + if (showOngoing) { notification = this.mNotificationService.getOngoingCallNotification(ongoing); id = NotificationService.ONGOING_CALL_NOTIFICATION_ID; startForeground(id, notification); @@ -1389,7 +1390,7 @@ public class XmppConnectionService extends Service { if (!mForceForegroundService.get()) { mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID); } - if (ongoing == null) { + if (!showOngoing) { mNotificationService.cancel(NotificationService.ONGOING_CALL_NOTIFICATION_ID); } Log.d(Config.LOGTAG, "ForegroundService: " + (status ? "on" : "off"));