Loading src/com/android/server/telecom/CallAudioModeStateMachine.java +20 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) { Loading tests/src/com/android/server/telecom/tests/CallAudioModeTransitionTests.java +76 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
src/com/android/server/telecom/CallAudioModeStateMachine.java +20 −6 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) { Loading
tests/src/com/android/server/telecom/tests/CallAudioModeTransitionTests.java +76 −0 Original line number Diff line number Diff line Loading @@ -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 Loading