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

Commit e02f912c authored by Jack He's avatar Jack He
Browse files

HFP: Only allows active device to change SCO volume

Bug: 71557297
Test: make phone call over Bluetooth headset
Change-Id: If7a9d99c386678c55fe4554bcf7eb88261024908
(cherry picked from commit 2fc44eb65fdd3d4b73df91038d0e81426b44c93e)
parent 69d31c7c
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1746,11 +1746,10 @@ public class HeadsetStateMachine extends StateMachine {
    }

    private void processVolumeEvent(int volumeType, int volume) {
        // When there is an active call, only device in audio focus can change SCO volume
        if (mSystemInterface.getHeadsetPhoneState().isInCall()
                && getAudioState() != BluetoothHeadset.STATE_AUDIO_CONNECTED) {
            Log.w(TAG, "processVolumeEvent, ignored because " + mDevice
                    + " does not have audio focus");
        // Only current active device can change SCO volume
        if (!mDevice.equals(mHeadsetService.getActiveDevice())) {
            Log.w(TAG, "processVolumeEvent, ignored because " + mDevice + " is not active");
            return;
        }
        if (volumeType == HeadsetHalConstants.VOLUME_TYPE_SPK) {
            mSpeakerVolume = volume;
@@ -1761,7 +1760,7 @@ public class HeadsetStateMachine extends StateMachine {
            // Not used currently
            mMicVolume = volume;
        } else {
            Log.e(TAG, "Bad voluem type: " + volumeType);
            Log.e(TAG, "Bad volume type: " + volumeType);
        }
    }