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

Commit aeec2c93 authored by Josh Wu's avatar Josh Wu
Browse files

HFP: Check volume before changing

Tag: #stability
Bug: 193439465
Test: atest BluetoothInstrumentationTests
Change-Id: I901687f195d2d7f2e0b8abf94a12a001cc90b3d2
parent c4e9aa36
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1624,8 +1624,12 @@ public class HeadsetStateMachine extends StateMachine {
        if (volumeType == HeadsetHalConstants.VOLUME_TYPE_SPK) {
            mSpeakerVolume = volume;
            int flag = (mCurrentState == mAudioOn) ? AudioManager.FLAG_SHOW_UI : 0;
            int currentVol = mSystemInterface.getAudioManager().getStreamVolume(
                    AudioManager.STREAM_BLUETOOTH_SCO);
            if (volume != currentVol) {
                mSystemInterface.getAudioManager()
                        .setStreamVolume(AudioManager.STREAM_BLUETOOTH_SCO, volume, flag);
            }
        } else if (volumeType == HeadsetHalConstants.VOLUME_TYPE_MIC) {
            // Not used currently
            mMicVolume = volume;