Fallback when glasses mic stops streaming#3189
Conversation
📋 PR Review Helper📱 Mobile App Build✅ Ready to test! (commit 🕶️ ASG Client Build⏳ Waiting for build... 🔀 Test Locallygh pr checkout 3189 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d292e51. Configure here.
| */ | ||
| fun handleGlassesMicData(rawLC3Data: ByteArray, frameSize: Int = 40) { | ||
| lastLc3Event = System.currentTimeMillis() | ||
| glassesMicDegradedUntilMs = 0L |
There was a problem hiding this comment.
Degrade cleared before decode
Medium Severity
glassesMicDegradedUntil is cleared at the very start of handleGlassesMicData, before LC3 decode or validation succeeds. Failed, invalid, or undecodable frames still reset the degraded state and refresh lastLc3Event, so the app can treat a broken stream as recovered and select the glasses mic again without usable audio.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit d292e51. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d292e51600
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| glassesMicDegradedUntilMs = System.currentTimeMillis() + 15_000 | ||
| Bridge.log( | ||
| "MAN: No audio activity in the last 5 seconds from glasses, temporarily falling back from glasses mic" | ||
| ) | ||
| updateMicState() |
There was a problem hiding this comment.
Re-arm the glasses mic after fallback expires
When this auto-mode fallback path runs, updateMicState() skips glasses, selects the phone mic, and the cleanup loop disables the non-selected glasses mic with setMicEnabled(false). The watchdog then returns early on future ticks because glasses.micEnabled is false, and nothing calls updateMicState() when glassesMicDegradedUntilMs expires, so the intended 15-second fallback can persist indefinitely until an unrelated route or setting change occurs and the preferred auto glasses mic may never recover.
Useful? React with 👍 / 👎.
| glassesMicDegradedUntil = Date().addingTimeInterval(15) | ||
| Bridge.log( | ||
| "MAN: No audio activity in the last 5 seconds from glasses, temporarily falling back from glasses mic" | ||
| ) | ||
| updateMicState() |
There was a problem hiding this comment.
Re-arm the glasses mic after fallback expires
When this auto-mode fallback path runs, updateMicState() skips glasses, selects the phone mic, and the cleanup loop disables the non-selected glasses mic with setMicEnabled(false). The watchdog then returns early on future ticks because glasses.micEnabled is false, and nothing calls updateMicState() when glassesMicDegradedUntil expires, so the intended 15-second fallback can persist indefinitely until an unrelated route or setting change occurs and the preferred auto glasses mic may never recover.
Useful? React with 👍 / 👎.


Summary
Test
Note
Medium Risk
Changes runtime mic routing and STT/audio capture on the native Bluetooth path; behavior is gated by connection state and mic preference but should be verified on physical devices.
Overview
When the glasses LC3 stream goes quiet for more than five seconds while the app is on the glasses mic, Android and iOS
DeviceManagernow temporarily degrades that source (15s) and callsupdateMicState()so the next mic inmicRankingcan take over—instead of only re-enabling the glasses mic. Users who forcepreferredMicto glasses or have no alternate in the ranking still get the reinit path.Mic selection skips
GLASSES_CUSTOMwhenglasses.connectedis false, and while the degraded window is active (same preference/ranking exceptions). Incoming LC3 clears the degraded flag so the glasses mic can be chosen again as soon as frames return.On iOS, the inactivity watchdog treats never-seen LC3 as infinite idle (not ~0s vs
Date()), aligning with Android’s “no frame yet” behavior.Reviewed by Cursor Bugbot for commit d292e51. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds an automatic fallback when the glasses mic stops streaming so audio continues via phone/system mic.
MicTypes.GLASSES_CUSTOMfor 15s and switch to a higher-ranked mic whenpreferredMicisn’t"glasses"; clear the degraded state as soon as LC3 resumes.Written for commit d292e51. Summary will update on new commits.