Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fbd16d4 authored by Ted Wang's avatar Ted Wang
Browse files

Fix volume control failed when switching active a2dp device

Add AudioManager.FLAG_BLUETOOTH_ABS_VOLUME when mute/un-mute stream
volume to avoid AudioService update volume to AVRCP during switching
active device to avoid wrong volume level setting.

Bug: 132416679
Test: Manual swicth a2dp device.
Merged-In: Idc7a701c754edfe87ba72bb83d6b3809572eaaa5
Change-Id: Idc7a701c754edfe87ba72bb83d6b3809572eaaa5
parent def2301a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -571,7 +571,7 @@ public class A2dpService extends ProfileService {
                if (previousActiveDevice != null) {
                    if (!mAudioManager.isStreamMute(AudioManager.STREAM_MUSIC)) {
                        mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                                                         AudioManager.ADJUST_MUTE, 0);
                                AudioManager.ADJUST_MUTE, AudioManager.FLAG_BLUETOOTH_ABS_VOLUME);
                        wasMuted = true;
                    }
                    mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
@@ -595,7 +595,7 @@ public class A2dpService extends ProfileService {
                mAudioManager.handleBluetoothA2dpDeviceConfigChange(mActiveDevice);
                if (wasMuted) {
                    mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
                                                     AudioManager.ADJUST_UNMUTE, 0);
                                AudioManager.ADJUST_MUTE, AudioManager.FLAG_BLUETOOTH_ABS_VOLUME);
                }
            }
        }