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

Commit 9f5e82ff authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8492870 from 77474bd6 to tm-d1-release

Change-Id: If36325cccf5f2f0072c0022d589ddace76d0b969
parents a7db6c11 77474bd6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1262,7 +1262,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        }
    }

    boolean isRingbackRequested() {
    public boolean isRingbackRequested() {
        return mRingbackRequested;
    }

+4 −0
Original line number Diff line number Diff line
@@ -107,6 +107,10 @@ public class CallAudioManager extends CallsManagerListenerBase {
            // No audio management for calls in a conference, or external calls.
            return;
        }
        if (oldState == newState) {
            // State did not change, so no need to do anything.
            return;
        }
        Log.d(LOG_TAG, "Call state changed for TC@%s: %s -> %s", call.getId(),
                CallState.toString(oldState), CallState.toString(newState));

+1 −1
Original line number Diff line number Diff line
@@ -145,9 +145,9 @@ public class CallScreeningServiceHelper {

        if (!bindCallScreeningService(mContext, mUserHandle, mPackageName, serviceConnection)) {
            Log.i(this, "bindAndGetCallIdentification - bind failed");
            Log.addEvent(mCall, LogUtils.Events.BIND_SCREENING, mPackageName);
            mFuture.complete(null);
        }
        Log.addEvent(mCall, LogUtils.Events.BIND_SCREENING, mPackageName);

        // Set up a timeout so that we're not waiting forever for the caller ID information.
        Handler handler = new Handler();
+54 −0
Original line number Diff line number Diff line
@@ -294,6 +294,60 @@ public class CallAudioManagerTest extends TelecomTestCase {
        verifyProperCleanup();
    }

    @MediumTest
    @Test
    public void testRingbackStartStop() {
        Call call = mock(Call.class);
        ArgumentCaptor<CallAudioModeStateMachine.MessageArgs> captor = makeNewCaptor();
        when(call.getState()).thenReturn(CallState.CONNECTING);
        when(call.isRingbackRequested()).thenReturn(true);

        mCallAudioManager.onCallAdded(call);
        assertEquals(call, mCallAudioManager.getForegroundCall());
        verify(mCallAudioRouteStateMachine).sendMessageWithSessionInfo(
                CallAudioRouteStateMachine.UPDATE_SYSTEM_AUDIO_ROUTE);
        verify(mCallAudioModeStateMachine).sendMessageWithArgs(
                eq(CallAudioModeStateMachine.NEW_ACTIVE_OR_DIALING_CALL), captor.capture());
        CallAudioModeStateMachine.MessageArgs expectedArgs =
                new Builder()
                        .setHasActiveOrDialingCalls(true)
                        .setHasRingingCalls(false)
                        .setHasHoldingCalls(false)
                        .setIsTonePlaying(false)
                        .setHasAudioProcessingCalls(false)
                        .setForegroundCallIsVoip(false)
                        .setSession(null)
                        .build();
        assertMessageArgEquality(expectedArgs, captor.getValue());

        when(call.getState()).thenReturn(CallState.DIALING);
        mCallAudioManager.onCallStateChanged(call, CallState.CONNECTING, CallState.DIALING);
        verify(mCallAudioModeStateMachine, times(2)).sendMessageWithArgs(
                eq(CallAudioModeStateMachine.NEW_ACTIVE_OR_DIALING_CALL), captor.capture());
        assertMessageArgEquality(expectedArgs, captor.getValue());
        verify(mCallAudioModeStateMachine, times(2)).sendMessageWithArgs(
                anyInt(), any(CallAudioModeStateMachine.MessageArgs.class));

        // Ensure we started ringback.
        verify(mRingbackPlayer).startRingbackForCall(any(Call.class));

        // Report state change from dialing to dialing, which happens when a call is locally
        // disconnected.
        mCallAudioManager.onCallStateChanged(call, CallState.DIALING, CallState.DIALING);
        // Should not have stopped ringback.
        verify(mRingbackPlayer, never()).stopRingbackForCall(any(Call.class));
        // Should still only have initial ringback start
        verify(mRingbackPlayer, times(1)).startRingbackForCall(any(Call.class));

        // Report state to disconnected
        when(call.getState()).thenReturn(CallState.DISCONNECTED);
        mCallAudioManager.onCallStateChanged(call, CallState.DIALING, CallState.DISCONNECTED);
        // Now we should have stopped ringback.
        verify(mRingbackPlayer).stopRingbackForCall(any(Call.class));
        // Should still only have initial ringback start recorded from before (don't restart it).
        verify(mRingbackPlayer, times(1)).startRingbackForCall(any(Call.class));
    }

    @SmallTest
    @Test
    public void testNewCallGoesToAudioProcessing() {