Skip to content

fix: session status stuck on Connection in progress on devices without GMS#1092

Merged
SERDUN merged 2 commits into
developfrom
fix/session-status-stuck-no-gms
Apr 10, 2026
Merged

fix: session status stuck on Connection in progress on devices without GMS#1092
SERDUN merged 2 commits into
developfrom
fix/session-status-stuck-no-gms

Conversation

@SERDUN

@SERDUN SERDUN commented Apr 10, 2026

Copy link
Copy Markdown
Member

Problem

On devices without Google Mobile Services (e.g. Huawei MAO-LX9N Android 12), the app shows "Connection in progress" permanently, even though the signaling connection and SIP registration complete successfully.

Root cause (two-part):

  1. PushTokensBloc never emits after initialization on no-GMS devices — _retrieveAndStoreFcmToken checks GMS availability, gets a terminal status, and returns early without any emit() or add().

  2. SessionStatusCubit constructor called _emitCombinedStatus(pushTokensBloc.state, callBloc.state) passing initial states as parameters, but never stored them in _lastPushTokensState / _lastCallState. All subsequent calls from _onCallChanged used _lastPushTokensState = null, so the condition pushTokens != null && call != null was always false — the UI status was never updated from its initial SessionStatus.inProgress.

On GMS devices this goes unnoticed because PushTokensBloc emits when the FCM token arrives, which triggers _onPushTokensChanged, seeds _lastPushTokensState, and unblocks future _onCallChanged emissions.

Fix

Seed _lastPushTokensState and _lastCallState directly from the blocs' current states in the constructor, before subscribing to their streams.

_lastPushTokensState = pushTokensBloc.state;
_lastCallState = callBloc.state;

This way, even if PushTokensBloc never emits (no GMS), _onCallChanged can still update the UI status correctly.

Affected devices

Reproduces on any Android device without Google Play Services where PushTokensBloc stays in its initial state (pushToken: null, errorMessage: null).

Confirmed via logcat: HUAWEI-MAO-LX9N-Android-12_2026-04-10_120728.logcat — signaling reaches registered at 12:07:02 but _lastPushTokensState is null throughout the entire session.

On devices without Google Mobile Services (e.g. Huawei), PushTokensBloc
never emits after initialization because GMS availability check returns a
terminal status and aborts token retrieval without emitting any state.

As a result, _lastPushTokensState remained null indefinitely, causing
the condition `pushTokens != null && call != null` in _emitCombinedStatus
to never pass — so the UI was stuck at SessionStatus.inProgress regardless
of the actual signaling/registration state.

Fix: seed _lastPushTokensState and _lastCallState from the blocs' initial
states in the constructor, so subsequent _onCallChanged callbacks can
emit the correct status even when PushTokensBloc never emits.
@SERDUN SERDUN requested a review from Copilot April 10, 2026 09:21
@SERDUN SERDUN requested a review from digiboridev April 10, 2026 09:23
@SERDUN SERDUN marked this pull request as ready for review April 10, 2026 09:23

This comment was marked as resolved.

SERDUN

This comment was marked as resolved.

@SERDUN

SERDUN commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

Addressed: removed the unused optional parameters initialPushTokens / initialCall from _emitCombinedStatus and simplified the method body to read directly from _lastPushTokensState / _lastCallState.

@SERDUN SERDUN merged commit 07b3a66 into develop Apr 10, 2026
1 check passed
@SERDUN SERDUN deleted the fix/session-status-stuck-no-gms branch April 10, 2026 09:30
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.

3 participants