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

Commit b3ed8dc5 authored by Mallikarjuna GB's avatar Mallikarjuna GB Committed by Andre Eisenbach
Browse files

Handle SCO volume change in multihfpending state.

Use case:
1. Connect one headset.
2. Make MO/MT call.
3. While connecting second headset, change
   call volume on the phone.

Failure:
SCO volume changed is not updated to first headset.

Root cause:
Volume change is not handled in MultHFPending state.

Fix:
Added handling volume change in MultiHFPending state.

Change-Id: I6ac3cb2968b99de194fa7c0114d45f9d81dcb663
parent 380f0dbc
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1302,7 +1302,9 @@ final class HeadsetStateMachine extends StateMachine {
                    processLocalVrEvent(HeadsetHalConstants.VR_STATE_STOPPED);
                    break;
                case INTENT_SCO_VOLUME_CHANGED:
                    if (mActiveScoDevice != null) {
                        processIntentScoVolume((Intent) message.obj, mActiveScoDevice);
                    }
                    break;
                case CALL_STATE_CHANGED:
                    processCallState((HeadsetCallState) message.obj, ((message.arg1 == 1)?true:false));
@@ -1642,6 +1644,11 @@ final class HeadsetStateMachine extends StateMachine {
                        processLocalVrEvent(HeadsetHalConstants.VR_STATE_STOPPED);
                    }
                    break;
                case INTENT_SCO_VOLUME_CHANGED:
                    if (mActiveScoDevice != null) {
                        processIntentScoVolume((Intent) message.obj, mActiveScoDevice);
                    }
                    break;
                case INTENT_BATTERY_CHANGED:
                    processIntentBatteryChanged((Intent) message.obj);
                    break;
@@ -2015,6 +2022,14 @@ final class HeadsetStateMachine extends StateMachine {
                            BluetoothProfile.STATE_DISCONNECTED);
        }

        private void processIntentScoVolume(Intent intent, BluetoothDevice device) {
            int volumeValue = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, 0);
            if (mPhoneState.getSpeakerVolume() != volumeValue) {
                mPhoneState.setSpeakerVolume(volumeValue);
                setVolumeNative(HeadsetHalConstants.VOLUME_TYPE_SPK,
                                    volumeValue, getByteAddress(device));
            }
        }
    }