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

Commit b12101eb authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Change how reject versus missed calls are reported from ImsPhoneCallTracker.

The old logic assumed the modem would return an appropriate disconnect
cause based on missed or rejected disconnect causes reported from the IMS
stack.  Unfortunately there are some disconnect causes we were seeing in
practice which this code couldn't handle and we were mis-categorizing some
missed calls as rejected even though they were not.

Realistically we know the user's intention already, so we should just use
that to set the disconnect cause to missed or reject.

Test: Manual test on carrier network.
Test: Added new unit tests
Fixes: 228336056
Change-Id: I4c56ae2f9f52e1c0a8197ced1b26d92de33f8464
parent ff75ab6c
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -3259,12 +3259,16 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {

                } else if (conn.isIncoming() && conn.getConnectTime() == 0
                        && cause != DisconnectCause.ANSWERED_ELSEWHERE) {
                    // Missed
                    if (cause == DisconnectCause.NORMAL
                            || cause == DisconnectCause.INCOMING_AUTO_REJECTED) {
                        cause = DisconnectCause.INCOMING_MISSED;
                    } else {

                    if (conn.getDisconnectCause() == DisconnectCause.LOCAL) {
                        // 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
                        // ImsPhoneConnection#onHangupLocal
                        cause = DisconnectCause.INCOMING_REJECTED;
                    } else {
                        // Otherwise in all other cases consider it missed.
                        cause = DisconnectCause.INCOMING_MISSED;
                    }
                    if (DBG) log("Incoming connection of 0 connect time detected - translated " +
                            "cause = " + cause);
+1 −2
Original line number Diff line number Diff line
@@ -542,8 +542,7 @@ public class ImsPhoneConnection extends Connection implements
    /**
     * Called when this Connection is being hung up locally (eg, user pressed "end")
     */
    void
    onHangupLocal() {
    public void onHangupLocal() {
        mCause = DisconnectCause.LOCAL;
    }

+26 −0
Original line number Diff line number Diff line
@@ -484,6 +484,31 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
    @Test
    @SmallTest
    public void testImsMTCall() {
        ImsPhoneConnection connection = setupRingingConnection();
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_PASSED,
                connection.getNumberVerificationStatus());
    }

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

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

    private ImsPhoneConnection setupRingingConnection() {
        mImsCallProfile.setCallerNumberVerificationStatus(
                ImsCallProfile.VERIFICATION_STATUS_PASSED);
        assertEquals(PhoneConstants.State.IDLE, mCTUT.getState());
@@ -500,6 +525,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        connection.addListener(mImsPhoneConnectionListener);
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_PASSED,
                connection.getNumberVerificationStatus());
        return connection;
    }

    @Test