Fix audio volume UI indicator under silent system environments - #559
Open
temcguir wants to merge 4 commits into
Open
Fix audio volume UI indicator under silent system environments#559temcguir wants to merge 4 commits into
temcguir wants to merge 4 commits into
Conversation
temcguir
force-pushed
the
fix-cuttlefish-audio-ui-silent
branch
from
August 10, 2026 17:55
91a37ed to
dd69560
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors video recording states to use a new AudioStreamState sealed interface instead of a raw amplitude value, allowing more granular tracking of the audio stream (e.g., active, silenced, muted). However, several critical issues were identified: throwing an IllegalStateException on duplicate start events combined with enabling the capture button during the initialization phase creates a high risk of application crashes due to race conditions. Additionally, the logic for isAudioStreamActive should be updated to include the Silenced state to support silent environments properly, and the KDoc for AudioUiState.Enabled.On needs to be updated to document the new parameter.
During video recording, Jetpack Camera visually indicates whether the audio stream is currently capturing sound. Previously, this indicator relied solely on checking if the audio amplitude was strictly greater than 0.0. However, in certain environments (like cuttlefish emulators) or completely silent physical spaces, CameraX can report an active audio stream that accurately returns an amplitude of 0.0 or a state of AUDIO_STATE_SOURCE_SILENCED. This PR decouples the audio stream status from its mathematical amplitude by modeling the CameraX AudioStats explicitly as an AudioStreamState, evaluating it for UI display logic independent of the visualizer amplitude metric.
temcguir
force-pushed
the
fix-cuttlefish-audio-ui-silent
branch
from
August 10, 2026 18:01
dd69560 to
3a255da
Compare
Kimblebee
requested changes
Aug 12, 2026
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.
During video recording, Jetpack Camera visually indicates whether the audio stream is currently capturing sound. Previously, this indicator relied solely on checking if the audio amplitude was strictly greater than 0.0. However, in certain environments (like cuttlefish emulators) or completely silent physical spaces, CameraX can report an active audio stream that accurately returns an amplitude of 0.0 or a state of AUDIO_STATE_SOURCE_SILENCED.
This PR decouples the audio stream status from its mathematical amplitude by:
AudioStreamStateas a modeled state corresponding toandroidx.camera.video.AudioStats.isAudioStreamActivealongside the numerical amplitude insideAudioUiState.CaptureScreenComponentsto display the active microphone toggle if the stream is confirmed active, even if the realtime amplitude happens to be zero.