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

Commit 51988f32 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12664851 from 6d5a6a84 to 25Q1-release

Change-Id: I882a0f38b7d34fa87ecfbabed302dfb86a2d6f3f
parents f92d2806 6d5a6a84
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -879,12 +879,11 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        mFocusType = focus;
        switch (focus) {
            case NO_FOCUS -> {
                if (mIsActive) {
                // Notify the CallAudioModeStateMachine that audio operations are complete so
                // that we can relinquish audio focus.
                mCallAudioManager.notifyAudioOperationsComplete();

                    // Reset mute state after call ends.
                // Reset mute state after call ends. This should remain unaffected if audio routing
                // never went active.
                handleMuteChanged(false);
                // Ensure we reset call audio state at the end of the call (i.e. if we're on
                // speaker, route back to earpiece). If we're on BT, remain on BT if it's still
@@ -897,7 +896,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
                mPendingAudioRoute.clearPendingMessages();
                clearRingingBluetoothAddress();
            }
            }
            case ACTIVE_FOCUS -> {
                // Route to active baseline route (we may need to change audio route in the case
                // when a video call is put on hold). Ignore route changes if we're handling playing
+1 −2
Original line number Diff line number Diff line
@@ -892,8 +892,7 @@ public class TelecomServiceImpl {
                                            PhoneAccount.CAPABILITY_CONNECTION_MANAGER) ||
                                    account.hasCapabilities(
                                            PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
                                throw new SecurityException("Self-managed ConnectionServices and "
                                        + "transactional voip apps "
                                throw new SecurityException("Self-managed ConnectionServices "
                                        + "cannot also be call capable, connection managers, or "
                                        + "SIM accounts.");
                            }
+32 −0
Original line number Diff line number Diff line
@@ -1099,6 +1099,38 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
                any(CallAudioState.class), eq(expectedState));
    }

    @Test
    @SmallTest
    public void testAbandonCallAudioFocusAfterCallEnd() {
        // Make sure in-band ringing is disabled so that route never becomes active
        when(mBluetoothRouteManager.isInbandRingEnabled(eq(BLUETOOTH_DEVICE_1))).thenReturn(false);

        mController.initialize();
        mController.sendMessageWithSessionInfo(BT_DEVICE_ADDED, AudioRoute.TYPE_BLUETOOTH_SCO,
                BLUETOOTH_DEVICE_1);

        CallAudioState expectedState = new CallAudioState(false, CallAudioState.ROUTE_BLUETOOTH,
                CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH
                        | CallAudioState.ROUTE_SPEAKER, BLUETOOTH_DEVICE_1, BLUETOOTH_DEVICES);
        mController.sendMessageWithSessionInfo(BT_ACTIVE_DEVICE_PRESENT,
                AudioRoute.TYPE_BLUETOOTH_SCO, BT_ADDRESS_1);
        verify(mCallsManager, timeout(TEST_TIMEOUT)).onCallAudioStateChanged(
                any(CallAudioState.class), eq(expectedState));
        assertFalse(mController.isActive());

        // Verify route never went active due to in-band ringing being disabled.
        mController.sendMessageWithSessionInfo(SWITCH_FOCUS, RINGING_FOCUS, 0);
        assertFalse(mController.isActive());

        // Emulate scenario of rejecting an incoming call so that call focus is lost and verify
        // that we abandon the call audio focus that was gained from when the call went to
        // ringing state.
        mController.sendMessageWithSessionInfo(SWITCH_FOCUS, NO_FOCUS, 0);
        // Ensure we tell the CallAudioManager that audio operations are done so that we can ensure
        // audio focus is relinquished.
        verify(mCallAudioManager, timeout(TEST_TIMEOUT)).notifyAudioOperationsComplete();
    }

    private void verifyConnectBluetoothDevice(int audioType) {
        mController.initialize();
        mController.setActive(true);