From 5eac0880edfc21796dcaaa7892437f2fb08bf146 Mon Sep 17 00:00:00 2001 From: yostyle Date: Fri, 15 Nov 2024 20:15:27 +0100 Subject: [PATCH] Restore android call service --- .../app/core/services/CallAndroidService.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/services/CallAndroidService.kt b/vector/src/main/java/im/vector/app/core/services/CallAndroidService.kt index b14c5604eb..1f5b0f7b5c 100644 --- a/vector/src/main/java/im/vector/app/core/services/CallAndroidService.kt +++ b/vector/src/main/java/im/vector/app/core/services/CallAndroidService.kt @@ -182,8 +182,11 @@ class CallAndroidService : VectorAndroidService() { title = callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId, fromBg = fromBg ) - // TCHAP fix crash when a call incoming on Androd 14 and higher - notificationManager.notify(callId.hashCode(), notification) + if (knownCalls.isEmpty()) { + startForegroundCompat(callId.hashCode(), notification) + } else { + notificationManager.notify(callId.hashCode(), notification) + } knownCalls[callId] = callInformation } @@ -200,8 +203,7 @@ class CallAndroidService : VectorAndroidService() { } val notification = notificationUtils.buildCallEndedNotification(false) val notificationId = callId.hashCode() - // TCHAP fix crash when a call incoming on Androd 14 and higher - notificationManager.notify(notificationId, notification) + startForegroundCompat(notificationId, notification) if (knownCalls.isEmpty()) { Timber.tag(loggerTag.value).v("No more call, stop the service") stopForegroundCompat() @@ -262,8 +264,11 @@ class CallAndroidService : VectorAndroidService() { call = call, title = callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId ) - // TCHAP fix crash when a call incoming on Androd 14 and higher - startForegroundCompat(callId.hashCode(), notification) + if (knownCalls.isEmpty()) { + startForegroundCompat(callId.hashCode(), notification) + } else { + notificationManager.notify(callId.hashCode(), notification) + } knownCalls[callId] = callInformation }