From 99e86bf9bdcec6122ddbb640ccf30ea4ea1ad54d Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Wed, 11 Jan 2023 04:44:24 +0000 Subject: [PATCH] AudioService: fix CTS verifier for stream mute When changing volume, only change the mute state when the device for which the volume is being changed, is the current device the stream alias is routed to. Bug: 264013194 Test: CTS Verifier Ringer Mode Tests Change-Id: I45e54db86dbfd8a8cbb307e74f7452cf6bbfaf58 --- .../core/java/com/android/server/audio/AudioService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 148797f21834d..1bd8f1ea1c18a 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -3603,9 +3603,11 @@ public class AudioService extends IAudioService.Stub setRingerMode(getNewRingerMode(stream, index, flags), TAG + ".onSetStreamVolume", false /*external*/); } - // setting non-zero volume for a muted stream unmutes the stream and vice versa, + // setting non-zero volume for a muted stream unmutes the stream and vice versa + // (only when changing volume for the current device), // except for BT SCO stream where only explicit mute is allowed to comply to BT requirements - if (streamType != AudioSystem.STREAM_BLUETOOTH_SCO) { + if ((streamType != AudioSystem.STREAM_BLUETOOTH_SCO) + && (getDeviceForStream(stream) == device)) { mStreamStates[stream].mute(index == 0); } }