Conversation
…g call OEMs like Xiaomi signal ConnectivityResult.none to backgrounded apps even when the network interface stays active, setting the cached _netConnected to false. When the app returns to foreground the stream may not re-emit, leaving the cache stale. Trusting a cached true is safe (fast path); trusting a cached false is not — always re-check so a genuine connectivity event can clear it.
digiboridev
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Xiaomi (Android 15 / HyperOS), after restoring the app from background:
Logcat shows the socket opens at ~11:16:36, yet six seconds later the call is blocked with
"Cannot create call: no network connectivity"— while the network hardware reportsinetCondition = 1.Root Cause
CallControllercaches connectivity state in_netConnected: bool?, updated only viaconnectivityService.connectionStreamevents.While the app is in background, Xiaomi (OEM aggressive battery/network management) signals
ConnectivityResult.noneeven when the network interface stays up — setting_netConnected = false. When the app returns to foreground the stream does not immediately re-emit, leaving the cache stale. The call attempt reads the stalefalseand blocks without re-checking actual network state.The signaling layer is unaffected because
SignalingReconnectControlleralready handlesAppLifecycleState.resumedproactively.Fix
Only trust the cached value when it says
true. When the cached value isfalseornull, always perform a freshcheckConnection()before blocking the call.When genuinely offline,
checkConnectivity()(native OS call) returnsConnectivityResult.noneand short-circuits before the HTTP health check — no meaningful latency added for the truly-offline case.