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

Commit 2fc67cdf authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Fix issue where remotely disconnected calls show up as missed." into tm-dev am: e4e6b563

parents 65968524 e4e6b563
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -3292,12 +3292,20 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {

                } else if (conn.isIncoming() && conn.getConnectTime() == 0
                        && cause != DisconnectCause.ANSWERED_ELSEWHERE) {

                    if (conn.getDisconnectCause() == DisconnectCause.LOCAL) {
                    // Two cases where the call is declared as rejected.
                    // 1. The disconnect was initiated by the user.  I.e. the connection's
                    // disconnect cause is LOCAL at this point.
                    // 2. The network provided disconnect cause is INCOMING_REJECTED.  This will be
                    // the case for ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE and
                    // ImsReasonInfo.CODE_REJECTED_ELSEWHERE.
                    if (conn.getDisconnectCause() == DisconnectCause.LOCAL
                            || cause == DisconnectCause.INCOMING_REJECTED) {
                        // If the user initiated a disconnect of this connection, then we will treat
                        // this is a rejected call.
                        // Note; the record the fact that this is a local disconnect in
                        // Note; we record the fact that this is a local disconnect in
                        // ImsPhoneConnection#onHangupLocal
                        // Alternatively, the network can specify INCOMING_REJECTED as a result of
                        // remote reject on another device; we'll still treat as rejected.
                        cause = DisconnectCause.INCOMING_REJECTED;
                    } else {
                        // Otherwise in all other cases consider it missed.
+18 −0
Original line number Diff line number Diff line
@@ -508,6 +508,24 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause());
    }

    @Test
    @SmallTest
    public void testRejectedElsewhereIsRejected() {
        ImsPhoneConnection connection = setupRingingConnection();
        mImsCallListener.onCallTerminated(connection.getImsCall(),
                new ImsReasonInfo(ImsReasonInfo.CODE_REJECTED_ELSEWHERE, 0));
        assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause());
    }

    @Test
    @SmallTest
    public void testRemoteCallDeclineIsRejected() {
        ImsPhoneConnection connection = setupRingingConnection();
        mImsCallListener.onCallTerminated(connection.getImsCall(),
                new ImsReasonInfo(ImsReasonInfo.CODE_REMOTE_CALL_DECLINE, 0));
        assertEquals(DisconnectCause.INCOMING_REJECTED, connection.getDisconnectCause());
    }

    private ImsPhoneConnection setupRingingConnection() {
        mImsCallProfile.setCallerNumberVerificationStatus(
                ImsCallProfile.VERIFICATION_STATUS_PASSED);