Loading src/com/android/server/telecom/CallsManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -753,11 +753,10 @@ public class CallsManager extends Call.ListenerBase @Override @VisibleForTesting public void onSuccessfulOutgoingCall(Call call, int callState) { Log.v(this, "onSuccessfulOutgoingCall, %s", call); Log.v(this, "onSuccessfulOutgoingCall, call=[%s], state=[%d]", call, callState); call.setPostCallPackageName(getRoleManagerAdapter().getDefaultCallScreeningApp( call.getAssociatedUser())); setCallState(call, callState, "successful outgoing call"); if (!mCalls.contains(call)) { // Call was not added previously in startOutgoingCall due to it being a potential MMI // code, so add it now. Loading @@ -769,8 +768,14 @@ public class CallsManager extends Call.ListenerBase listener.onConnectionServiceChanged(call, null, call.getConnectionService()); } // Allow the ConnectionService to start the call in the active state. This case is helpful // for conference calls or meetings that can skip the dialing stage. if (callState == CallState.ACTIVE) { setCallState(call, callState, "skipping the dialing state and setting active"); } else { markCallAsDialing(call); } } @Override public void onFailedOutgoingCall(Call call, DisconnectCause disconnectCause) { Loading tests/src/com/android/server/telecom/tests/CallsManagerTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -2508,6 +2508,30 @@ public class CallsManagerTest extends TelecomTestCase { assertEquals(DEFAULT_CALL_SCREENING_APP, outgoingCall.getPostCallPackageName()); } /** * Verify the only call state set from calling onSuccessfulOutgoingCall is CallState.DIALING. */ @SmallTest @Test public void testOutgoingCallStateIsSetToAPreviousStateAndIgnored() { Call outgoingCall = addSpyCall(CallState.CONNECTING); mCallsManager.onSuccessfulOutgoingCall(outgoingCall, CallState.NEW); verify(outgoingCall, never()).setState(eq(CallState.NEW), any()); verify(outgoingCall, times(1)).setState(eq(CallState.DIALING), any()); } /** * Verify a ConnectionService can start the call in the active state and avoid the dialing state */ @SmallTest @Test public void testOutgoingCallStateCanAvoidDialingAndGoStraightToActive() { Call outgoingCall = addSpyCall(CallState.CONNECTING); mCallsManager.onSuccessfulOutgoingCall(outgoingCall, CallState.ACTIVE); verify(outgoingCall, never()).setState(eq(CallState.DIALING), any()); verify(outgoingCall, times(1)).setState(eq(CallState.ACTIVE), any()); } @SmallTest @Test public void testRejectIncomingCallOnPAHInactive_SecondaryUser() throws Exception { Loading Loading
src/com/android/server/telecom/CallsManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -753,11 +753,10 @@ public class CallsManager extends Call.ListenerBase @Override @VisibleForTesting public void onSuccessfulOutgoingCall(Call call, int callState) { Log.v(this, "onSuccessfulOutgoingCall, %s", call); Log.v(this, "onSuccessfulOutgoingCall, call=[%s], state=[%d]", call, callState); call.setPostCallPackageName(getRoleManagerAdapter().getDefaultCallScreeningApp( call.getAssociatedUser())); setCallState(call, callState, "successful outgoing call"); if (!mCalls.contains(call)) { // Call was not added previously in startOutgoingCall due to it being a potential MMI // code, so add it now. Loading @@ -769,8 +768,14 @@ public class CallsManager extends Call.ListenerBase listener.onConnectionServiceChanged(call, null, call.getConnectionService()); } // Allow the ConnectionService to start the call in the active state. This case is helpful // for conference calls or meetings that can skip the dialing stage. if (callState == CallState.ACTIVE) { setCallState(call, callState, "skipping the dialing state and setting active"); } else { markCallAsDialing(call); } } @Override public void onFailedOutgoingCall(Call call, DisconnectCause disconnectCause) { Loading
tests/src/com/android/server/telecom/tests/CallsManagerTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -2508,6 +2508,30 @@ public class CallsManagerTest extends TelecomTestCase { assertEquals(DEFAULT_CALL_SCREENING_APP, outgoingCall.getPostCallPackageName()); } /** * Verify the only call state set from calling onSuccessfulOutgoingCall is CallState.DIALING. */ @SmallTest @Test public void testOutgoingCallStateIsSetToAPreviousStateAndIgnored() { Call outgoingCall = addSpyCall(CallState.CONNECTING); mCallsManager.onSuccessfulOutgoingCall(outgoingCall, CallState.NEW); verify(outgoingCall, never()).setState(eq(CallState.NEW), any()); verify(outgoingCall, times(1)).setState(eq(CallState.DIALING), any()); } /** * Verify a ConnectionService can start the call in the active state and avoid the dialing state */ @SmallTest @Test public void testOutgoingCallStateCanAvoidDialingAndGoStraightToActive() { Call outgoingCall = addSpyCall(CallState.CONNECTING); mCallsManager.onSuccessfulOutgoingCall(outgoingCall, CallState.ACTIVE); verify(outgoingCall, never()).setState(eq(CallState.DIALING), any()); verify(outgoingCall, times(1)).setState(eq(CallState.ACTIVE), any()); } @SmallTest @Test public void testRejectIncomingCallOnPAHInactive_SecondaryUser() throws Exception { Loading