mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-02 18:19:21 +01:00
The inactivity disconnector parks idle controllers with disconnect(forget: true, persistForget: false) so they stay off the ignore list and the user can reconnect. But controllers auto-connect unconditionally at the addDevices() choke point, so the controller reconnected the instant it was rediscovered (scan result / getSystemDevices / the disconnect listener's performScanning) — right after being parked, defeating the battery saver. Track parked controllers in a session-scoped _suppressedAutoReconnect set, populated before each inactivity disconnect and filtered at the addDevices() choke point. Clear it only on explicit intent — the alert's Reconnect action and connectDevice() — and wholesale in disconnectAll(). Clearing on every successful _connect raced: a connect still in flight when the timeout fires resolved afterwards and wiped the fresh suppression, so the controller looped straight back. disconnectAll() clears the set (BT off / full reset makes it moot), and the integration harness reset routes through it so a parked controller can't leak into the next test and block its connect. Tests: a parked controller is not auto-reconnected on rediscovery, and the Reconnect action lifts the suppression and brings it back. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>