diff options
| author | 2020-06-11 15:49:07 -0700 | |
|---|---|---|
| committer | 2020-06-12 01:56:21 +0000 | |
| commit | b94b9c60f1c3c8c2ae5760c0124dbc1fba41787b (patch) | |
| tree | 4872133538cb6eb3d490ff1072166fa0afc21110 | |
| parent | c357f2cafd2aa85cd238cb4b9b9b78eb2a0bd042 (diff) | |
AudioService: fix volume group mute
Make sure the volume applied to audio policy by a volume group follows
the mute state of the associated public stream if any.
Bug: 156559315
Test: repro steps in bug
Test: atest AudioManagerTest#testVolume
Test: atest AudioVolumeGroupTest
Change-Id: I95e96f3524b27600c59a2cf093cd3309430d28ca
| -rwxr-xr-x | services/core/java/com/android/server/audio/AudioService.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 6d45abaf0234..36272278e0e4 100755 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -5322,6 +5322,15 @@ public class AudioService extends IAudioService.Stub } private void setVolumeIndexInt(int index, int device, int flags) { + // Reflect mute state of corresponding stream by forcing index to 0 if muted + // Only set audio policy BT SCO stream volume to 0 when the stream is actually muted. + // This allows RX path muting by the audio HAL only when explicitly muted but not when + // index is just set to 0 to repect BT requirements + if (mStreamStates[mPublicStreamType].isFullyMuted()) { + index = 0; + } else if (mPublicStreamType == AudioSystem.STREAM_BLUETOOTH_SCO && index == 0) { + index = 1; + } // Set the volume index AudioSystem.setVolumeIndexForAttributes(mAudioAttributes, index, device); } |