Skip to content

Skip volume-button stop teardown when monitoring was never started#612

Open
bjorkert wants to merge 1 commit intodevfrom
fix/volume-button-snooze-spurious-stop-log
Open

Skip volume-button stop teardown when monitoring was never started#612
bjorkert wants to merge 1 commit intodevfrom
fix/volume-button-snooze-spurious-stop-log

Conversation

@bjorkert
Copy link
Copy Markdown
Contributor

@bjorkert bjorkert commented Apr 25, 2026

Summary

VolumeButtonHandler.alarmStopped() was always logging [Volume Button Snooze] Alarm stop detected and running its teardown on every alarm event — even when the volume-button-snooze feature was disabled and the matching alarmStarted() had early-returned without starting the observer.

The Combine sink on Observable.alarmSoundPlaying is installed unconditionally, so it fires on every true → false transition (sound finishing naturally, manual stop, interruption, snooze). With the feature off, only alarmStopped() logged anything, producing a confusing trail of "Alarm stop detected" lines under a category that suggests the volume-button system was involved when it wasn't.

Guard alarmStopped() on isMonitoring. This makes the start/stop pair symmetric (start is gated on the feature flag; stop is now gated on whether monitoring was engaged) and removes the misleading log noise. The Invalidating volume observer. line inside stopMonitoring() remains as the single, accurate teardown entry when the feature is on.

No behavior change for users with volume-button snooze enabled.

Previously alarmStopped() always logged "Alarm stop detected" under the
Volume Button Snooze category and ran the teardown, even when the
volume-button-snooze feature was disabled and the matching
alarmStarted() had early-returned. The result was a misleading log line
on every alarm event for users who don't use volume-button snooze.

Guard alarmStopped() on isMonitoring so it only runs when the volume
observer was actually started. The "Invalidating volume observer." log
inside stopMonitoring() now serves as the single, accurate teardown
entry.
@bjorkert bjorkert requested a review from codebymini April 25, 2026 09:06
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