Skip to content

fix(android): keep a new call dialing or ringing - #913

Merged
sboily merged 1 commit into
masterfrom
fix/android-connection-state
Oct 18, 2026
Merged

sboily merged 1 commit into
masterfrom
fix/android-connection-state

Conversation

@sboily

@sboily sboily commented Oct 18, 2026

Copy link
Copy Markdown
Member

Problem

onCreateOutgoingConnection called setInitialized() after setDialing(), and onCreateIncomingConnection after setRinging(). setInitialized() sets STATE_NEW, which ConnectionService doesn't forward to Telecom: Telecom showed the call dialing or ringing, while the connection's own state, read with VoiceConnectionService.getConnection(uuid).getState(), was STATE_NEW (1).

The calls come from 32b7fe5 (2019), which moved setInitialized() from the end of createConnection() to after setDialing() and setRinging(). Since 3ad5345, Samsung devices skip it for outgoing calls, where it kept the native UI from showing.

Fix

Remove both calls. createConnection() leaves the connection initializing, and setDialing() or setRinging() moves it on. Every device now does what Samsung devices already did for outgoing calls.

Moving setInitialized() before setDialing() would change nothing visible: Telecom doesn't listen to the connection until it is returned, so it would see the same state, behind a Samsung check that no longer does anything.

Tests

tests/android/CallKeepConnectionStateTest.kt (instrumentation, real Telecom) places an outgoing and an incoming call, in managed and self-managed mode. It waits for Telecom to show the call dialing or ringing (dumpsys telecom), then checks the connection's state, then makes the call active.

Device master this PR
Emulator, Android 10 (API 29) 4 failures: expected:<3> but was:<1> (outgoing), expected:<2> but was:<1> (incoming) OK (4 tests)
Emulator, Android 16 (API 36) 4 failures, same OK (4 tests)
Galaxy S24, Android 16 2 failures (incoming); outgoing passes, Samsung already skipped setInitialized() OK (4 tests)

On master, every failure comes after the Telecom check passed: Telecom showed the call dialing or ringing while the connection said STATE_NEW.

onCreateOutgoingConnection called setInitialized() after setDialing(),
and onCreateIncomingConnection after setRinging(). setInitialized() sets
STATE_NEW, which ConnectionService doesn't forward to Telecom: Telecom
showed the call dialing or ringing while the connection's own state,
read with VoiceConnectionService.getConnection(uuid).getState(), was
STATE_NEW.

The calls are removed: createConnection() leaves the connection
initializing, and setDialing() or setRinging() moves it on. Samsung
devices already skipped the outgoing call's setInitialized(), so they
are unchanged for outgoing calls.

CallKeepConnectionStateTest checks both states, in managed and
self-managed mode.
@sboily
sboily merged commit ba85628 into master Oct 18, 2026
4 checks passed
@sboily
sboily deleted the fix/android-connection-state branch October 18, 2026 15:26
@sboily sboily mentioned this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant