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

Commit d961e78f authored by jbelloua's avatar jbelloua
Browse files

ignore telephony call state if telephony mgr state is idle

When re-connecting a BT headset, the headset state machine requests
telephony stack call state (through queryPhoneState) once
SLC is established. The answer is received asynchronously.

If there is a virtual call (e.g. voip/hang out/skype) ongoing while
connecting BT headset, the audio will be switched automatically to BT SCO
path once connected.

Issue: if the call state from telephony is received while the BT headset
is being used for a virtual call, then the virtual call is stopped,
even if there is no call ongoing, and audio will be routed back to primary
device (speaker/headset).

Proposal: ignore the telephony state in case there is a virtual
call ongoing, but no CSV call, and keep audio routed to the BT
SCO path.

Change-Id: If0ebe8c5cd08f48dd56a593e37f3f05a4fccfc97
jean-marie.bellouard <jean-marie.bellouard@intel.com>
parent 08c8891e
Loading
Loading
Loading
Loading
+22 −8
Original line number Diff line number Diff line
@@ -1517,16 +1517,30 @@ final class HeadsetStateMachine extends StateMachine {
        log("mNumActive: " + callState.mNumActive + " mNumHeld: " +
            callState.mNumHeld +" mCallState: " + callState.mCallState);
        log("mNumber: " + callState.mNumber + " mType: " + callState.mType);
        if(!isVirtualCall) {
            /* Not a Virtual call request. End the virtual call, if running,
            before sending phoneStateChangeNative to BTIF */

        if (isVirtualCall) {
            // virtual call state update
            if (getCurrentState() != mDisconnected) {
                phoneStateChangeNative(callState.mNumActive, callState.mNumHeld,
                    callState.mCallState, callState.mNumber, callState.mType);
            }
        } else {
            // circuit-switch voice call update
            // stop virtual voice call if there is a CSV call ongoing
            if (callState.mNumActive > 0 || callState.mNumHeld > 0
                    || callState.mCallState != HeadsetHalConstants.CALL_STATE_IDLE) {
                terminateScoUsingVirtualVoiceCall();
            }
            // at this step: if there is virtual call ongoing, it means there is no CSV call
            // let virtual call continue and skip phone state update
            if (!isVirtualCallInProgress()) {
                if (getCurrentState() != mDisconnected) {
                    phoneStateChangeNative(callState.mNumActive, callState.mNumHeld,
                        callState.mCallState, callState.mNumber, callState.mType);
                }
            }
        }
    }

    // enable 1 enable noice reduction
    //        0 disable noice reduction