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

Commit b15287b0 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Fix setting handed-over calls to ANSWERED state am: a5b57f02 am: 1c85e665

am: 59a665b2

Change-Id: Ia76aa373149bc8de83be150899e2ff23eee74c1f
parents 24ff5144 59a665b2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3929,7 +3929,9 @@ public class CallsManager extends Call.ListenerBase
            // We do not update the UI until we get confirmation of the answer() through
            // {@link #markCallAsActive}.
            mCall.answer(mVideoState);
            if (mCall.getState() == CallState.RINGING) {
                setCallState(mCall, CallState.ANSWERED, "answered");
            }
            if (isSpeakerphoneAutoEnabledForVideoCalls(mVideoState)) {
                mCall.setStartWithSpeakerphoneOn(true);
            }
+19 −0
Original line number Diff line number Diff line
@@ -624,6 +624,25 @@ public class CallsManagerTest extends TelecomTestCase {
        verify(incomingCall).answer(VideoProfile.STATE_AUDIO_ONLY);
    }

    @SmallTest
    @Test
    public void testAnswerAlreadyActiveCall() {
        // GIVEN a CallsManager with no ongoing call.

        // WHEN answer an already active call
        Call incomingCall = addSpyCall();
        mCallsManager.answerCall(incomingCall, VideoProfile.STATE_AUDIO_ONLY);

        // THEN the focus request for incoming call is sent
        verifyFocusRequestAndExecuteCallback(incomingCall);

        // and the incoming call is answered.
        verify(incomingCall).answer(VideoProfile.STATE_AUDIO_ONLY);

        // and the incoming call's state is still ACTIVE
        assertEquals(CallState.ACTIVE, incomingCall.getState());
    }

    @SmallTest
    @Test
    public void testSetActiveCallWhenOngoingCallCanNotBeHeldAndFromDifferentConnectionService() {