AudioService: fix stream aliasing update

When updating the stream aliases table, mStreamVolumeAlias
should point to a copy of the default alias table it's starting
from, not its reference.
This fixes an issue where changing the aliasing between ring
and notification would work when unaliasing, but not when
aliasing, as the contents of the alias table had been overwritten
already.

Bug: 265076070
Test: atest android.media.audio.cts.AudioManagerTest#testStreamTypeAliasChange
Change-Id: I74bc7fdf054ef295876c8a5503111c14d084e8d2
Merged-In: I74bc7fdf054ef295876c8a5503111c14d084e8d2
(cherry picked from commit e620bc2a8e)
This commit is contained in:
Jean-Michel Trivi
2023-01-31 05:30:36 +00:00
parent 5f3bb10877
commit d8817a74de

View File

@@ -2194,19 +2194,19 @@ public class AudioService extends IAudioService.Stub
AudioSystem.STREAM_ASSISTANT : AudioSystem.STREAM_MUSIC;
if (mIsSingleVolume) {
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_TELEVISION;
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_TELEVISION.clone();
dtmfStreamAlias = AudioSystem.STREAM_MUSIC;
} else if (mUseVolumeGroupAliases) {
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_NONE;
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_NONE.clone();
dtmfStreamAlias = AudioSystem.STREAM_DTMF;
} else {
switch (mPlatformType) {
case AudioSystem.PLATFORM_VOICE:
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_VOICE;
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_VOICE.clone();
dtmfStreamAlias = AudioSystem.STREAM_RING;
break;
default:
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_DEFAULT;
mStreamVolumeAlias = STREAM_VOLUME_ALIAS_DEFAULT.clone();
dtmfStreamAlias = AudioSystem.STREAM_MUSIC;
}
if (!mNotifAliasRing) {