Skip volume-button stop teardown when monitoring was never started#612
Open
Skip volume-button stop teardown when monitoring was never started#612
Conversation
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.
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.
Summary
VolumeButtonHandler.alarmStopped()was always logging[Volume Button Snooze] Alarm stop detectedand running its teardown on every alarm event — even when the volume-button-snooze feature was disabled and the matchingalarmStarted()had early-returned without starting the observer.The Combine sink on
Observable.alarmSoundPlayingis installed unconditionally, so it fires on everytrue → falsetransition (sound finishing naturally, manual stop, interruption, snooze). With the feature off, onlyalarmStopped()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()onisMonitoring. 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. TheInvalidating volume observer.line insidestopMonitoring()remains as the single, accurate teardown entry when the feature is on.No behavior change for users with volume-button snooze enabled.