Skip to content

fix: case-open popup re-appears after the case is closed#605

Closed
mvanhorn wants to merge 1 commit into
d4rken-org:mainfrom
mvanhorn:fix/598-capod-case-popup-reappear
Closed

fix: case-open popup re-appears after the case is closed#605
mvanhorn wants to merge 1 commit into
d4rken-org:mainfrom
mvanhorn:fix/598-capod-case-popup-reappear

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The case-open popup no longer re-appears after the case has been closed, fixing the inconsistency lilnug143 reported in #598. The popup decision logic in PopUpReaction.kt treated a case-close event as a full reset, so residual lid-state updates arriving after close could re-trigger the popup within the same session. Closing now hides the popup without resetting the cooldown, and the cooldown window has to genuinely elapse before a new open shows it again.

Why this matters

#598 describes the popup randomly coming back after putting the AirPods case away, which makes the reaction feature feel broken precisely at the moment the user is done with it. The two-line logic change keeps the existing show-on-open behavior intact; only the close path changes.

Testing

Extended PopUpReactionLogicTest with the residual-open-after-close case (popup stays hidden, cooldown preserved) and the cooldown-expiry case (a real re-open after the window shows the popup again). Gradle was not runnable on this host (no JVM); CI covers the build and the new tests.

AI was used for assistance.

Fixes #598

@d4rken

d4rken commented Jun 7, 2026

Copy link
Copy Markdown
Member

Hey @mvanhorn, thanks for digging into this! 😄 Funny timing — we both went after #598 at basically the same moment today; your PR and #606 landed within a couple of hours of each other.

Quick note on how the two relate, so we don't accidentally double-merge:

Your change is a neat minimal mitigation: by not resetting the cooldown on close, the flapping re-open gets throttled by the existing 10s window, which knocks out the "popup comes back" symptom.

#606 goes after the root cause. I pulled live BLE captures (the reporter's AirPods Pro 1 log + my own Pro 3) and the lid state is genuinely oscillating: when one pod is out of the case, the out-of-case pod broadcasts a frame whose lid byte is stale and decodes to a phantom OPEN even while the case is shut — interleaved ~1:1 with the correct in-case frames. So the effective lid flaps OPEN↔CLOSED and keeps re-triggering the popup. #606 stops trusting that frame (only in-case / both-in-case frames drive the lid state), which also fixes the "sometimes won't dismiss" half of the report and the same phantom that was feeding auto-connect's CASE_OPEN and the overview.

Because of that, the two touch the same cooldown logic in opposite directions — yours preserves the cooldown across a close, #606 keeps the reset but removes the flapping at the source — so they're really alternative fixes rather than complementary, and we'd want to pick one.

Would you be up for reviewing #606? You clearly know this corner of the code now, and a second pair of eyes on the decoder change would be very welcome. Either way, thanks a lot for the contribution and sorry for the collision!

d4rken added a commit that referenced this pull request Jun 8, 2026
@mvanhorn independently fixed #598 in #605 by no longer resetting the
case cooldown on close, throttling the re-pop. We cherry-picked that
commit above to keep his authorship/credit, but this PR instead removes
the underlying lid-state flapping at its source (out-of-case pod's stale
lid byte -> UNKNOWN), so the cooldown can keep resetting on close and a
genuine close->reopen still shows the popup. Reverting his change here so
the two approaches don't stack; thanks @mvanhorn for the parallel work.
@d4rken d4rken closed this Jun 8, 2026
d4rken added a commit that referenced this pull request Jun 8, 2026
@mvanhorn independently fixed #598 in #605 by no longer resetting the
case cooldown on close, throttling the re-pop. We cherry-picked that
commit above to keep his authorship/credit, but this PR instead removes
the underlying lid-state flapping at its source (out-of-case pod's stale
lid byte -> UNKNOWN), so the cooldown can keep resetting on close and a
genuine close->reopen still shows the popup. Reverting his change here so
the two approaches don't stack; thanks @mvanhorn for the parallel work.
@d4rken

d4rken commented Jun 8, 2026

Copy link
Copy Markdown
Member

Superseded by #606, which is now merged. To make sure your work isn't lost, I cherry-picked your commit into #606, so your fix is preserved on main and credited to you (2cce9ae) 🙏

#606 ended up going the root-cause route (the out-of-case pod's stale lid byte was making the lid flap), which also covers the "won't dismiss" half of the report and the same glitch that was feeding auto-connect. Closing this one since that landed — but thank you again for jumping on #598 so quickly, and please keep the contributions coming!

@blipsodaacumen

Copy link
Copy Markdown

Case-open popup works flawlessly as of v5.1.7-rc0!
Many thanks.

-blipsodaacumen (Formerly: lilnug143)

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.

Case popup inconsistency.

3 participants