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

Commit 0adffb85 authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Change how reject versus missed calls are reported from...

Merge "Change how reject versus missed calls are reported from ImsPhoneCallTracker." into tm-dev am: 93ed722b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/17877166



Change-Id: I1440f9e84d16c75c39b2864469800ac5147c3b9d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 24e0362d 93ed722b
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