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

Commit 3691df5c authored by Josh Wu's avatar Josh Wu Committed by Gerrit Code Review
Browse files

Merge "HFP: Check volume before changing"

parents 2ab09299 aeec2c93
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;