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

Commit f32c7af7 authored by Hall Liu's avatar Hall Liu
Browse files

Transition between sim call and voip call states

When the foreground call switches between a sim call and a third-party
voip call, check the foreground call voip state and transition states
based off that.

Fixes: 135665715
Test: unit, manual
Change-Id: I0f0565e3e57cb601146734ad349f633248fb2e70
parent ce0e300d
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -327,18 +327,25 @@ public class CallAudioModeStateMachine extends StateMachine {
                    }
                    return HANDLED;
                case NO_MORE_HOLDING_CALLS:
                    // Do nothing.
                    if (args.foregroundCallIsVoip) {
                        transitionTo(mVoipCallFocusState);
                    }
                    return HANDLED;
                case NEW_ACTIVE_OR_DIALING_CALL:
                    // Do nothing. Already active.
                    if (args.foregroundCallIsVoip) {
                        transitionTo(mVoipCallFocusState);
                    }
                    return HANDLED;
                case NEW_RINGING_CALL:
                    // Don't make a call ring over an active call, but do play a call waiting tone.
                    mCallAudioManager.startCallWaiting("call already active");
                    return HANDLED;
                case NEW_HOLDING_CALL:
                    // Don't do anything now. Putting an active call on hold will be handled when
                    // Just check the voip mode. Putting an active call on hold will be handled when
                    // NO_MORE_ACTIVE_CALLS is processed.
                    if (args.foregroundCallIsVoip) {
                        transitionTo(mVoipCallFocusState);
                    }
                    return HANDLED;
                case FOREGROUND_VOIP_MODE_CHANGE:
                    if (args.foregroundCallIsVoip) {
@@ -382,18 +389,25 @@ public class CallAudioModeStateMachine extends StateMachine {
                    }
                    return HANDLED;
                case NO_MORE_HOLDING_CALLS:
                    // Do nothing.
                    if (!args.foregroundCallIsVoip) {
                        transitionTo(mSimCallFocusState);
                    }
                    return HANDLED;
                case NEW_ACTIVE_OR_DIALING_CALL:
                    // Do nothing. Already active.
                    if (!args.foregroundCallIsVoip) {
                        transitionTo(mSimCallFocusState);
                    }
                    return HANDLED;
                case NEW_RINGING_CALL:
                    // Don't make a call ring over an active call, but do play a call waiting tone.
                    mCallAudioManager.startCallWaiting("call already active");
                    return HANDLED;
                case NEW_HOLDING_CALL:
                    // Don't do anything now. Putting an active call on hold will be handled when
                    // Just check the voip mode. Putting an active call on hold will be handled when
                    // NO_MORE_ACTIVE_CALLS is processed.
                    if (!args.foregroundCallIsVoip) {
                        transitionTo(mSimCallFocusState);
                    }
                    return HANDLED;
                case FOREGROUND_VOIP_MODE_CHANGE:
                    if (!args.foregroundCallIsVoip) {
+76 −0
Original line number Diff line number Diff line
@@ -413,6 +413,82 @@ public class CallAudioModeTransitionTests extends TelecomTestCase {
                NO_CHANGE // expectedCallWaitingInteraction
        ));

        result.add(new ModeTestParameters(
                "Swap between voip and sim calls - 1",
                CallAudioModeStateMachine.ENTER_CALL_FOCUS_FOR_TESTING, // initialAudioState
                CallAudioModeStateMachine.NEW_HOLDING_CALL, // messageType
                new CallAudioModeStateMachine.MessageArgs(
                        false, // hasActiveOrDialingCalls
                        false, // hasRingingCalls
                        true, // hasHoldingCalls
                        false, // isTonePlaying
                        true, // foregroundCallIsVoip
                        null // session
                ),
                CallAudioModeStateMachine.COMMS_STATE_NAME, // expectedFinalStateName
                FOCUS_VOICE, // expectedFocus
                AudioManager.MODE_IN_COMMUNICATION, // expectedMode
                NO_CHANGE, // expectedRingingInteraction
                NO_CHANGE // expectedCallWaitingInteraction
        ));

        result.add(new ModeTestParameters(
                "Swap between voip and sim calls - 2",
                CallAudioModeStateMachine.ENTER_COMMS_FOCUS_FOR_TESTING, // initialAudioState
                CallAudioModeStateMachine.NEW_HOLDING_CALL, // messageType
                new CallAudioModeStateMachine.MessageArgs(
                        false, // hasActiveOrDialingCalls
                        false, // hasRingingCalls
                        true, // hasHoldingCalls
                        false, // isTonePlaying
                        false, // foregroundCallIsVoip
                        null // session
                ),
                CallAudioModeStateMachine.CALL_STATE_NAME, // expectedFinalStateName
                FOCUS_VOICE, // expectedFocus
                AudioManager.MODE_IN_CALL, // expectedMode
                NO_CHANGE, // expectedRingingInteraction
                NO_CHANGE // expectedCallWaitingInteraction
        ));

        result.add(new ModeTestParameters(
                "Swap between voip and sim calls - 3",
                CallAudioModeStateMachine.ENTER_COMMS_FOCUS_FOR_TESTING, // initialAudioState
                CallAudioModeStateMachine.NEW_ACTIVE_OR_DIALING_CALL, // messageType
                new CallAudioModeStateMachine.MessageArgs(
                        false, // hasActiveOrDialingCalls
                        false, // hasRingingCalls
                        true, // hasHoldingCalls
                        false, // isTonePlaying
                        false, // foregroundCallIsVoip
                        null // session
                ),
                CallAudioModeStateMachine.CALL_STATE_NAME, // expectedFinalStateName
                FOCUS_VOICE, // expectedFocus
                AudioManager.MODE_IN_CALL, // expectedMode
                NO_CHANGE, // expectedRingingInteraction
                NO_CHANGE // expectedCallWaitingInteraction
        ));

        result.add(new ModeTestParameters(
                "Swap between voip and sim calls - 4",
                CallAudioModeStateMachine.ENTER_CALL_FOCUS_FOR_TESTING, // initialAudioState
                CallAudioModeStateMachine.NEW_HOLDING_CALL, // messageType
                new CallAudioModeStateMachine.MessageArgs(
                        false, // hasActiveOrDialingCalls
                        false, // hasRingingCalls
                        true, // hasHoldingCalls
                        false, // isTonePlaying
                        true, // foregroundCallIsVoip
                        null // session
                ),
                CallAudioModeStateMachine.COMMS_STATE_NAME, // expectedFinalStateName
                FOCUS_VOICE, // expectedFocus
                AudioManager.MODE_IN_COMMUNICATION, // expectedMode
                NO_CHANGE, // expectedRingingInteraction
                NO_CHANGE // expectedCallWaitingInteraction
        ));

        result.add(new ModeTestParameters(
                "Call is taken off hold - 1",
                CallAudioModeStateMachine.ENTER_TONE_OR_HOLD_FOCUS_FOR_TESTING, // initialAudioState