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

Commit 41e053d9 authored by Hall Liu's avatar Hall Liu Committed by Automerger Merge Worker
Browse files

Don't track speakerphone state outside calls am: 5e714ec8

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telecomm/+/1371054

Change-Id: If50d079e1e6fc671044fbdacceaedc4988e9819f
parents 5ee7e936 5e714ec8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -459,6 +459,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
            switch (msg.what) {
                case SWITCH_EARPIECE:
                case USER_SWITCH_EARPIECE:
                case SPEAKER_ON:
                    // Ignore speakerphone state changes outside of calls.
                case SPEAKER_OFF:
                    // Nothing to do here
                    return HANDLED;
@@ -484,7 +486,6 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    return HANDLED;
                case SWITCH_SPEAKER:
                case USER_SWITCH_SPEAKER:
                case SPEAKER_ON:
                    transitionTo(mQuiescentSpeakerRoute);
                    return HANDLED;
                case SWITCH_FOCUS:
@@ -677,12 +678,13 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    return HANDLED;
                case SWITCH_HEADSET:
                case USER_SWITCH_HEADSET:
                case SPEAKER_ON:
                    // Ignore speakerphone state changes outside of calls.
                case SPEAKER_OFF:
                    // Nothing to do
                    return HANDLED;
                case SWITCH_SPEAKER:
                case USER_SWITCH_SPEAKER:
                case SPEAKER_ON:
                    transitionTo(mQuiescentSpeakerRoute);
                    return HANDLED;
                case SWITCH_FOCUS:
@@ -1012,6 +1014,8 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    return HANDLED;
                case SWITCH_BLUETOOTH:
                case USER_SWITCH_BLUETOOTH:
                case SPEAKER_ON:
                    // Ignore speakerphone state changes outside of calls.
                case SPEAKER_OFF:
                    // Nothing to do
                    return HANDLED;
@@ -1025,7 +1029,6 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    return HANDLED;
                case SWITCH_SPEAKER:
                case USER_SWITCH_SPEAKER:
                case SPEAKER_ON:
                    transitionTo(mQuiescentSpeakerRoute);
                    return HANDLED;
                case SWITCH_FOCUS:
+5 −1
Original line number Diff line number Diff line
@@ -384,8 +384,12 @@ public class CallAudioRouteTransitionTests extends TelecomTestCase {
        // rest of the system
        verifyNoSystemAudioChanges();

        // Special case for SPEAKER_ON -- we don't expect any route transitions to happen when
        // there are no calls, so set the expected state to the initial route.
        int expectedRoute = (mParams.action == CallAudioRouteStateMachine.SPEAKER_ON)
                ? mParams.initialRoute : mParams.expectedRoute;
        // Verify the end state
        CallAudioState expectedState = new CallAudioState(false, mParams.expectedRoute,
        CallAudioState expectedState = new CallAudioState(false, expectedRoute,
                mParams.expectedAvailableRoutes | CallAudioState.ROUTE_SPEAKER,
                mParams.expectedBluetoothDevice, mParams.availableBluetoothDevices);
        assertEquals(expectedState, stateMachine.getCurrentCallAudioState());