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

Commit aff38178 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Merge "Make headset buttons work with simulated ringing" am: 091fcc1b am: 2fd2d727

am: 63770be1

Change-Id: I9e97f4be007c489b17502821ce1c8adfb4b82b67
parents 5442ec21 63770be1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2755,7 +2755,8 @@ public class CallsManager extends Call.ListenerBase
    @VisibleForTesting
    public boolean onMediaButton(int type) {
        if (hasAnyCalls()) {
            Call ringingCall = getFirstCallWithState(CallState.RINGING);
            Call ringingCall = getFirstCallWithState(CallState.RINGING,
                    CallState.SIMULATED_RINGING);
            if (HeadsetMediaButton.SHORT_PRESS == type) {
                if (ringingCall == null) {
                    Call activeCall = getFirstCallWithState(CallState.ACTIVE);
@@ -2777,7 +2778,7 @@ public class CallsManager extends Call.ListenerBase
                        return true;
                    }
                } else {
                    ringingCall.answer(VideoProfile.STATE_AUDIO_ONLY);
                    answerCall(ringingCall, VideoProfile.STATE_AUDIO_ONLY);
                    return true;
                }
            } else if (HeadsetMediaButton.LONG_PRESS == type) {
+4 −0
Original line number Diff line number Diff line
@@ -894,6 +894,10 @@ public class CallsManagerTest extends TelecomTestCase {
        mCallsManager.onMediaButton(HeadsetMediaButton.SHORT_PRESS);

        // THEN the incoming call is answered
        ArgumentCaptor<CallsManager.RequestCallback> captor = ArgumentCaptor.forClass(
                CallsManager.RequestCallback.class);
        verify(mConnectionSvrFocusMgr).requestFocus(eq(incomingCall), captor.capture());
        captor.getValue().onRequestFocusDone(incomingCall);
        verify(incomingCall).answer(VideoProfile.STATE_AUDIO_ONLY);
    }