Fix: Auto-exit press controls screen when AirPods disconnect#558
Merged
Conversation
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.
What changed
When AirPods disconnect while you're on the press controls sub-screen (stem action mappings, press timing options), most controls used to silently hide without telling you why — leaving a half-rendered page where any setting tweak would silently fail. The screen now closes back to device settings as soon as the connection ends, where the existing "Not connected" / "Out of range" cards explain what happened.
Also tightens a couple of entry points so press controls can no longer be opened from device settings while AirPods aren't ready in the first place.
Technical Context
state ?: returnearly-exit never fires after init — the VM emits a non-nullStatewithdevice = nullon disconnect. The cached profile fallback keepsmodel.featuresalive, so stem mappings kept rendering while AAP-gated press-timing rows vanished, producing the half-rendered look.device?.isAapConnected(=aap != null), notisAapReady. AAP sessions normally pass throughCONNECTING/HANDSHAKINGstates, soisAapReadywould pop users out during routine re-handshakes —isAapConnectedonly flips when the L2CAP socket actually tears down.hasSeenAapConnected,didAutoNavigate) userememberSaveablekeyed on the profile id. Plainrememberwould lose the seen-connected bit across rotation, so a rotation that lands after disconnect would leave the user stuck on the stale screen.didAutoNavigateis a one-shot guard against aREADY → drop → READY → dropbounce enqueueing twoNavEvent.Upand popping past device settings.navToPressControls()itself now both gate onisAapReady. Stricter than the in-session check on purpose — entry should require a fully ready session, but mid-session brief handshaking shouldn't kick the user out.