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

Commit f2d1e335 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Make transition of DIALING->DISCONNECTED similar logic as...

Merge "Make transition of DIALING->DISCONNECTED similar logic as ACTIVE->DISCONNECTED, so that disconnect reason is updated and handled by CallDiagnosticService" into sc-dev am: ef2e556b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/15404357

Change-Id: I53c607932b6b0c4f0eeeee2e970f01891d1b8c19
parents 989022b9 ef2e556b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3131,7 +3131,8 @@ public class CallsManager extends Call.ListenerBase
        // If a call diagnostic service is in use, we will log the original telephony-provided
        // disconnect cause, inform the CDS of the disconnection, and then chain the update of the
        // call state until AFTER the CDS reports it's result back.
        if (oldState == CallState.ACTIVE && disconnectCause.getCode() != DisconnectCause.MISSED
        if ((oldState == CallState.ACTIVE || oldState == CallState.DIALING)
                && disconnectCause.getCode() != DisconnectCause.MISSED
                && mCallDiagnosticServiceController.isConnected()
                && mCallDiagnosticServiceController.onCallDisconnected(call, disconnectCause)) {
            Log.i(this, "markCallAsDisconnected; callid=%s, postingToFuture.", call.getId());
+20 −0
Original line number Diff line number Diff line
@@ -1605,6 +1605,26 @@ public class CallsManagerTest extends TelecomTestCase {
        verify(callSpy, never()).setDisconnectCause(any(DisconnectCause.class));
    }
    
    /**
     * Verifies that if call state goes from DIALING to DISCONNECTED, and a call diagnostic service
     * IS in use, it would call onCallDisconnected of the CallDiagnosticService
     * @throws Exception
     */
    @MediumTest
    @Test
    public void testDisconnectDialingCall() throws Exception {
        Call callSpy = addSpyCall(CallState.DIALING);
        callSpy.setIsSimCall(true);
        when(mCallDiagnosticServiceController.isConnected()).thenReturn(true);
        when(mCallDiagnosticServiceController.onCallDisconnected(any(Call.class),
                any(DisconnectCause.class))).thenReturn(true);
        mCallsManager.markCallAsDisconnected(callSpy, new DisconnectCause(DisconnectCause.ERROR));

        verify(mCallDiagnosticServiceController).onCallDisconnected(any(Call.class),
                any(DisconnectCause.class));
        verify(callSpy, never()).setDisconnectCause(any(DisconnectCause.class));
    }

    private Call addSpyCall() {
        return addSpyCall(SIM_2_HANDLE, CallState.ACTIVE);
    }