From 46582a685b93dc27b9420217ebd099153afd0f00 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Tue, 17 Feb 2026 12:28:14 -0500 Subject: [PATCH] Fix weird screen transition when accepting an incoming call. Co-authored-by: Alex Hart --- .../webrtc/v2/WebRtcCallActivity.kt | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallActivity.kt index 518df0bc3c..b453bb0a8d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallActivity.kt @@ -118,6 +118,7 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re private var enterPipOnResume: Boolean = false private var lastProcessedIntentTimestamp = 0L private var previousEvent: WebRtcViewModel? = null + private var answeredFromNotification: Boolean = false private var ephemeralStateDisposable = Disposable.empty() private val callPermissionsDialogController = CallPermissionsDialogController() @@ -393,7 +394,15 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re viewModel.setRecipient(event.recipient) callScreen.setRecipient(event.recipient) event.isRemoteVideoOffer - callScreen.setWebRtcCallState(event.state) + + if (answeredFromNotification && event.state == WebRtcViewModel.State.CALL_INCOMING) { + Log.d(TAG, "Suppressing CALL_INCOMING UI state because call was already answered from notification") + } else { + if (event.state != WebRtcViewModel.State.CALL_INCOMING) { + answeredFromNotification = false + } + callScreen.setWebRtcCallState(event.state) + } if (event.state != previousCallState) { setTurnScreenOnForCallState(event.state) @@ -687,8 +696,18 @@ class WebRtcCallActivity : BaseActivity(), SafetyNumberChangeDialog.Callback, Re private fun processIntent(callIntent: CallIntent) { when (callIntent.action) { - CallIntent.Action.ANSWER_AUDIO -> handleAnswerWithAudio() - CallIntent.Action.ANSWER_VIDEO -> handleAnswerWithVideo() + CallIntent.Action.ANSWER_AUDIO -> { + handleAnswerWithAudio() + if (!callIntent.isStartedFromFullScreen) { + answeredFromNotification = true + } + } + CallIntent.Action.ANSWER_VIDEO -> { + handleAnswerWithVideo() + if (!callIntent.isStartedFromFullScreen) { + answeredFromNotification = true + } + } CallIntent.Action.DENY -> handleDenyCall() CallIntent.Action.END_CALL -> handleEndCall() else -> Unit