Merge "AudioService: fix muting of aliased volume streams" into tm-qpr-dev am: 9705323f41 am: 6f86018b4c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21179538

Change-Id: Ie899f89036fa2acb2a46bcea78f1bfc31946ee7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Eric Laurent
2023-02-02 21:34:21 +00:00
committed by Automerger Merge Worker

View File

@@ -3647,11 +3647,12 @@ public class AudioService extends IAudioService.Stub
synchronized (VolumeStreamState.class) {
List<Integer> streamsToMute = new ArrayList<>();
for (int stream = 0; stream < mStreamStates.length; stream++) {
if (streamAlias == mStreamVolumeAlias[stream]) {
VolumeStreamState vss = mStreamStates[stream];
if (streamAlias == mStreamVolumeAlias[stream] && vss.isMutable()) {
if (!(readCameraSoundForced()
&& (mStreamStates[stream].getStreamType()
&& (vss.getStreamType()
== AudioSystem.STREAM_SYSTEM_ENFORCED))) {
boolean changed = mStreamStates[stream].mute(state, /* apply= */ false);
boolean changed = vss.mute(state, /* apply= */ false);
if (changed) {
streamsToMute.add(stream);
}
@@ -8478,7 +8479,7 @@ public class AudioService extends IAudioService.Stub
}
mVolumeGroupState.updateVolumeIndex(groupIndex, device);
// Only propage mute of stream when applicable
if (mIndexMin == 0 || isCallStream(mStreamType)) {
if (isMutable()) {
// For call stream, align mute only when muted, not when index is set to 0
mVolumeGroupState.mute(forceMuteState ? mIsMuted : groupIndex == 0);
}
@@ -8529,6 +8530,12 @@ public class AudioService extends IAudioService.Stub
return mIsMuted || mIsMutedInternally;
}
private boolean isMutable() {
return isStreamAffectedByMute(mStreamType)
&& (mIndexMin == 0 || isCallStream(mStreamType));
}
/**
* Mute/unmute the stream
* @param state the new mute state