Skip to content

feat: improve connection animation, audio auto-connect, battery detection, and tray exit - #262

Open
aaroncheungzy wants to merge 3 commits into
SpriteOvO:mainfrom
aaroncheungzy:codex/playback-battery-reliability
Open

aaroncheungzy wants to merge 3 commits into
SpriteOvO:mainfrom
aaroncheungzy:codex/playback-battery-reliability

Conversation

@aaroncheungzy

Copy link
Copy Markdown
Contributor

Summary

Improve four parts of the Windows connection experience: connection animation and feedback, automatic connection on audio playback, battery detection, and the tray Quit button. This replaces the closed, unmerged #261 and includes the subsequent battery and charging-state fixes confirmed by the user. It also carries forward the tray feedback work from #253.

1. Connection animation and feedback

  • Replace Windows system notifications with an application-owned card styled consistently with the battery window, including light and dark themes.
  • Show animated indeterminate progress while connecting and reuse the card for connection errors.
  • After a successful connection, dismiss the progress card and show battery information without an extra connected notification.
  • Make a single tray click connect when disconnected or show battery information when already connected; remove the dedicated double-click action.
  • Update setting descriptions and all existing translation catalogs.

2. Automatic connection on audio playback

  • Add Connect automatically when audio starts playing, off by default and independent of the tray-click setting. Both options use the selected paired Bluetooth audio device.
  • Connect a disconnected device when playback starts. Automatic checks stay silent when already connected, and concurrent requests reuse the in-flight connection attempt.
  • After a failure, require a 30-second cooldown and a new playback start before retrying, preventing repeated attempts during continuous playback.
  • Check Windows output audio sessions on a background worker every 250 ms, excluding this application's own audio. Stop monitoring when the setting is disabled.
  • Treat running streams as playback through quiet passages and muted output. Recognize a stop after 1.5 seconds of inactivity; applications that keep streams running while paused can delay recognition of another playback start.

The new audio_auto_connect_enabled configuration key defaults to false.

3. Battery detection and source filtering

  • Reject conflicting pod battery reports from different advertisement sources, addressing the observed left-ear 40%/90% oscillation.
  • Prevent another address's partial report from erasing fresh, valid pod readings and enabling the later 10%/90%/unavailable loop.
  • Correct address-change comparisons to use 10-percentage-point broadcast buckets rather than a 1-percentage-point threshold.
  • Recover from an incorrect startup source when a complete report with a signal at least 10 dB stronger arrives, even when the initially selected report was also complete. Apply the selected report's battery and charging fields together.
  • Preserve compatible complementary reports from the two sides, including case battery and charging information. Keep same-source partial updates and the existing ten-second expiry behavior.
  • Add anonymized two-source and three-source capture replays, startup arrival-order tests, charging-state assertions, address-change coverage, expiry coverage, and a complementary case-data regression.

Source selection remains a heuristic: unauthenticated advertisements alone cannot establish which physical pair owns a broadcast. Capture fixtures include decoded readings, flags, timing, and signal strength, with no Bluetooth addresses or encrypted payloads. The fixtures replay packet order; a separate timed regression covers expiry.

4. Tray Quit button

  • Fix Quit being canceled by the battery window's close-to-tray handler.
  • Queue an explicit QCoreApplication::exit(0) on the GUI thread, preserving normal destruction and worker cleanup.
  • Preserve ordinary battery-window closing and hiding behavior.
  • Cover the real tray Quit action in a child-process test with the battery window visible.

No new dependencies are introduced.

Validation

  • Local Windows x64 RelWithDebInfo build passed with Qt 6.8.3 and MSVC Build Tools.
  • Full CTest run: 12/12 test targets passed. The optional native audio tone smoke test remains opt-in.
  • Regression tests reproduced the battery-source failures before the fixes and pass after the fixes, including battery and charging-state selection.
  • The user confirmed the updated battery and charging display is now working normally on their setup.
  • Existing coverage includes playback edges, independent settings, cooldown, duplicate requests, already-connected behavior, monitor shutdown, concurrent manual requests, tray exit, and UI rendering.
  • Production settings and device binding were verified unchanged across the final implementation test run.
  • C++ formatting and git diff --check passed.

Screenshots

Screenshots captured by the local UI tests:

Light connection notification Dark connection notification
Light connection notification Dark connection notification

Tray and playback auto-connect settings

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.

1 participant