From 5e03c33577039dc6096cff3fd39072a84774c172 Mon Sep 17 00:00:00 2001 From: Andrei Gorelov <25506529+AndreiGorelov@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:01:05 +0300 Subject: [PATCH] fix(call): keep call notification when screen turns off CallNotificationActivity.onStop() cancelled the call notification unconditionally. With a Samsung Smart View cover closed, the main display goes back to sleep right after the full-screen intent starts the activity, so onStop() fires within milliseconds. The notification (which also provides the ringtone and vibration through its channel) was cancelled and the incoming call was silently dropped. Cancel the notification only when the user actually leaves the call screen: - onUserLeaveHint(): Home, recents, or starting CallActivity - onStop() when isFinishing: decline, back, or the notification was already removed A display turning off no longer dismisses the call notification. Also replace the notificationTimestamp!! assertion with a null-safe call. Refs nextcloud/talk-android#7046 Signed-off-by: Andrei Gorelov <25506529+AndreiGorelov@users.noreply.github.com> --- .../callnotification/CallNotificationActivity.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt diff --git a/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt b/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt old mode 100644 new mode 100755 index 28e65726787..856c34f98c7 --- a/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt @@ -204,9 +204,17 @@ class CallNotificationActivity : CallBaseActivity() { private fun isInCallWithVideo(callFlag: Int): Boolean = (callFlag and ParticipantDto.InCallFlags.WITH_VIDEO) > 0 + private fun dismissCallNotification() { + notificationTimestamp?.let { NotificationManagerCompat.from(context).cancel(it) } + } + + override fun onUserLeaveHint() { + dismissCallNotification() + super.onUserLeaveHint() + } + override fun onStop() { - val notificationManager = NotificationManagerCompat.from(context) - notificationManager.cancel(notificationTimestamp!!) + if (isFinishing) dismissCallNotification() super.onStop() }