fix(voip): auto-decline second incoming call as busy#7284
Conversation
When a second caller rings while IncomingCallActivity is already visible, the singleInstance delivery via onNewIntent previously left the activity's intent pointer mismatched, risking answering the wrong call. The override now silently rejects the new call as busy without touching the on-screen UI.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🔇 Additional comments (1)
WalkthroughAdds Changes
Sequence DiagramsequenceDiagram
participant Android as Android System
participant Activity as IncomingCallActivity
participant Payload as VoipPayload
participant Notif as VoipNotification
participant UI as UI/Buttons
Android->>Activity: onNewIntent(intent)
Activity->>Payload: parse intent -> VoipPayload?
alt invalid payload
Activity->>Activity: log debug, return
else valid payload
alt existing voipPayload && payload.callId != current.callId
Activity->>Notif: rejectBusyCall(callId)
Notif-->>Activity: rejection sent
else new or same callId
Activity->>Activity: set voipPayload
Activity->>UI: updateUI()
Activity->>UI: setupButtons()
Activity->>Activity: scheduleTimeout()
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@android/app/src/main/java/chat/rocket/reactnative/voip/IncomingCallActivity.kt`:
- Around line 331-338: In onNewIntent / the refresh path, avoid re-arming the
call timeout when user action has already started by checking the
acceptDeclineGuard before calling scheduleTimeout; wrap the
scheduleTimeout(newPayload) call in a conditional like if (!acceptDeclineGuard)
{ scheduleTimeout(newPayload) } (leave updateUI and setupButtons as-is so UI
updates still occur).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3c41e1e8-993c-4501-ae9b-972e69bdd746
📒 Files selected for processing (1)
android/app/src/main/java/chat/rocket/reactnative/voip/IncomingCallActivity.kt
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ESLint and Test / run-eslint-and-test
🔇 Additional comments (1)
android/app/src/main/java/chat/rocket/reactnative/voip/IncomingCallActivity.kt (1)
320-329: Good isolation of second-call handling.This branch correctly keeps the current UI state intact and rejects only the new call as busy, which matches the blocker’s intended behavior.
|
Android Build Available Rocket.Chat Experimental 4.72.0.108745 Internal App Sharing: https://play.google.com/apps/test/RQVpXLytHNc/ahAO29uNRMN_1Cvalw-VMhsCkgdb2fL1CmlRwnvXqxzrIFKjrPiApaCtFlaoP4tEw_XNxegrAW_1kgPs3u2zKBh9t- |
Proposed changes
When a second incoming-call FCM push arrives while
IncomingCallActivityis already showing the first caller, Android delivers the newIntentto the existingsingleInstanceActivity viaonNewIntent. Without an override the activity's intent pointer silently shifts to the new call, so if the user taps Accept they answer the wrong caller.This fix overrides
onNewIntentto handle the two cases correctly:VoipNotification.rejectBusyCall, leaving the on-screen UI untouched.Issue(s)
Related to PR #6918 — blocker B4 (busy-decline on second incoming call).
How to test or reproduce
Screenshots
N/A — no visual change; the on-screen UI remains unchanged for the primary caller.
Types of changes
Checklist
Summary by CodeRabbit