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

Commit 11c2c9a7 authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Support TOGGLE_MUTE in CallAudioRouteController

Add explicit support to handle the TOGGLE_MUTE request. This was found
in a bug where the user was unable to mute the call via the headset.
Upon further investigation, I found that we aren't explicitly supporting
handling the request so it ends up being a no-op.

Bug: 372402585
Test: atest CallAudioRouteControllerTest
Test: Manual verification with usb headset
Flag: EXEMPT bugfix
Change-Id: I750c682a2ea348b2e4bcc03f18a9d561c9338652
parent 9b314bc9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -343,6 +343,9 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
                        case MUTE_EXTERNALLY_CHANGED:
                            handleMuteChanged(mAudioManager.isMicrophoneMute());
                            break;
                        case TOGGLE_MUTE:
                            handleMuteChanged(!mIsMute);
                            break;
                        case SWITCH_FOCUS:
                            focus = msg.arg1;
                            handleEndTone = (int) ((SomeArgs) msg.obj).arg2;
+12 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import static com.android.server.telecom.CallAudioRouteAdapter.STREAMING_FORCE_D
import static com.android.server.telecom.CallAudioRouteAdapter.STREAMING_FORCE_ENABLED;
import static com.android.server.telecom.CallAudioRouteAdapter.SWITCH_BASELINE_ROUTE;
import static com.android.server.telecom.CallAudioRouteAdapter.SWITCH_FOCUS;
import static com.android.server.telecom.CallAudioRouteAdapter.TOGGLE_MUTE;
import static com.android.server.telecom.CallAudioRouteAdapter.USER_SWITCH_BASELINE_ROUTE;
import static com.android.server.telecom.CallAudioRouteAdapter.USER_SWITCH_BLUETOOTH;
import static com.android.server.telecom.CallAudioRouteAdapter.USER_SWITCH_EARPIECE;
@@ -644,6 +645,17 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
                anyInt(), anyString());
        verify(mCallsManager, timeout(TEST_TIMEOUT)).onCallAudioStateChanged(
                any(CallAudioState.class), eq(expectedState));

        // Send TOGGLE_MUTE
        when(mAudioManager.isMicrophoneMute()).thenReturn(false);
        mController.sendMessageWithSessionInfo(TOGGLE_MUTE);
        expectedState = new CallAudioState(true, CallAudioState.ROUTE_EARPIECE,
                CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_SPEAKER, null,
                new HashSet<>());
        verify(mAudioService, timeout(TEST_TIMEOUT)).setMicrophoneMute(eq(true), anyString(),
                anyInt(), anyString());
        verify(mCallsManager, timeout(TEST_TIMEOUT)).onCallAudioStateChanged(
                any(CallAudioState.class), eq(expectedState));
    }

    @SmallTest