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

Commit 21991a7e authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Log calls which were rejected in call log appropriately.

The case for DisconnectCause.REJECTED was not being handled in the call
logging code.  This is important when logging calls locally disconnected
(multiendpoint), and also for calls rejected locally.

Dialer already shows these appropriately in the call log as
"declined call".

Bug: 30474601
Bug: 28813047
Change-Id: Ieb68eed5806658ee975d90c7388e454ae86a0431
parent 6152c97a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ public final class CallLogManager extends CallsManagerListenerBase {
                type = Calls.MISSED_TYPE;
            } else if (disconnectCause == DisconnectCause.ANSWERED_ELSEWHERE) {
                type = Calls.ANSWERED_EXTERNALLY_TYPE;
            } else if (disconnectCause == DisconnectCause.REJECTED) {
                type = Calls.REJECTED_TYPE;
            } else {
                type = Calls.INCOMING_TYPE;
            }
+25 −0
Original line number Diff line number Diff line
@@ -288,6 +288,31 @@ public class CallLogManagerTest extends TelecomTestCase {
        verify(mMissedCallNotifier).showMissedCallNotification(fakeMissedCall);
    }

    @MediumTest
    public void testLogCallDirectionRejected() {
        when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
                .thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
        Call fakeMissedCall = makeFakeCall(
                DisconnectCause.REJECTED, // disconnectCauseCode
                false, // isConference
                true, // isIncoming
                1L, // creationTimeMillis
                1000L, // ageMillis
                TEL_PHONEHANDLE, // callHandle
                mDefaultAccountHandle, // phoneAccountHandle
                NO_VIDEO_STATE, // callVideoState
                POST_DIAL_STRING, // postDialDigits
                VIA_NUMBER_STRING, // viaNumber
                null
        );

        mCallLogManager.onCallStateChanged(fakeMissedCall, CallState.ACTIVE,
                CallState.DISCONNECTED);
        ContentValues insertedValues = verifyInsertionWithCapture(CURRENT_USER_ID);
        assertEquals(insertedValues.getAsInteger(CallLog.Calls.TYPE),
                Integer.valueOf(Calls.REJECTED_TYPE));
    }

    @MediumTest
    public void testCreationTimeAndAge() {
        when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))