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

Commit 8b987c5e authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Transition between sim call and voip call states"

parents e4b693b7 fdbe416c
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -328,18 +328,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) {
@@ -383,18 +390,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
@@ -424,6 +424,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