Device: Fix battery card flickering near other people's AirPods#616
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
Fixed the battery/status card flickering — signal bars, in-ear and "worn" state briefly dropping
out — that could happen in busy places (a gym, a train) where other people nearby have the same
model of AirPods. Your own AirPods stay rock-solid on the card now.
Technical Context
binding to your profile, and a separate "stable id" recovery that survives address rotation. The
stable-id recovery has weak fallbacks (case-ignored markings, fuzzy markers) that match on
low-entropy broadcast data only — model + battery nibbles + colour. A stranger's same-model
AirPods at a similar battery level satisfies those fallbacks, so its frame (which fails your IRK,
so it carries no profile) was recovered as your device's id. It then overwrote your device's BLE
cache slot, and the merged device flapped to cached-only (
ble = null) until your next real framere-bound — the visible flicker. Confirmed deterministically by the new test (a foreign frame
adopting the keyed device's exact identity).
a frame that didn't resolve to the same profile. The strong address/IRK recovery paths are
untouched, so your device's identity still survives RPA rotation.
left exactly as before — their devices were never IRK-backed, so the gate is a no-op for them.
This does not fix the same flicker for keyless setups; without a key there's no strong identity
to disambiguate two same-model devices, which is inherent.
from the trimmed history window), so it can't erode over a long session.
an exact socket-close count that races between two cleanup paths, and used a tight latch timeout) —
it was failing intermittently on loaded CI runners, unrelated to this fix.
Review checklist
baseSearch, case-ignoredsearch); strongaddress/IRK recovery unchanged
boundProfileIdis latched on any IRK-matched frame and never cleared by a later unbound frameboundProfileId == null) keep identical fuzzy-matching behaviourknownDevicesgrowth beyond the 30s prune)