summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2021-01-22 13:53:47 -0800
committerHall Liu <hallliu@google.com>2021-01-22 13:55:06 -0800
commit53e4d9d3b35a8d846ac026dbd46d82663bb56da5 (patch)
tree83c9dbebac3a1e806377296a6034fa427132d8f8 /tests/src
parent83ade72360e043fc64c063e13650ed59ed2099b8 (diff)
downloadplatform_packages_services_Telecomm-53e4d9d3b35a8d846ac026dbd46d82663bb56da5.tar.gz
platform_packages_services_Telecomm-53e4d9d3b35a8d846ac026dbd46d82663bb56da5.tar.bz2
platform_packages_services_Telecomm-53e4d9d3b35a8d846ac026dbd46d82663bb56da5.zip
Turn on speaker when transitioning from quiescent
When going from the quiescent speaker state to the active speaker state, turn the speakerphone on. Fixes: 176199784 Test: atest CallRouteStateMachineTest Change-Id: I33149a6a5be6397640cd2989939608ddb96040a9
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java b/tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java
index 24476f066..5592cf416 100644
--- a/tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallAudioRouteStateMachineTest.java
@@ -455,6 +455,37 @@ public class CallAudioRouteStateMachineTest extends TelecomTestCase {
@SmallTest
@Test
+ public void testFocusChangeFromQuiescentSpeaker() {
+ CallAudioRouteStateMachine stateMachine = new CallAudioRouteStateMachine(
+ mContext,
+ mockCallsManager,
+ mockBluetoothRouteManager,
+ mockWiredHeadsetManager,
+ mockStatusBarNotifier,
+ mAudioServiceFactory,
+ CallAudioRouteStateMachine.EARPIECE_FORCE_ENABLED,
+ mThreadHandler.getLooper());
+ stateMachine.setCallAudioManager(mockCallAudioManager);
+
+ when(mockAudioManager.isSpeakerphoneOn()).thenReturn(false);
+
+ CallAudioState initState = new CallAudioState(false, CallAudioState.ROUTE_SPEAKER,
+ CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_SPEAKER);
+ stateMachine.initialize(initState);
+
+ // Switch to active, pretending that a call came in.
+ stateMachine.sendMessageWithSessionInfo(CallAudioRouteStateMachine.SWITCH_FOCUS,
+ CallAudioRouteStateMachine.ACTIVE_FOCUS);
+ waitForHandlerAction(stateMachine.getHandler(), TEST_TIMEOUT);
+
+ // Make sure that we've successfully switched to the active speaker route and that we've
+ // called setSpeakerOn
+ assertTrue(stateMachine.isInActiveState());
+ verify(mockAudioManager).setSpeakerphoneOn(true);
+ }
+
+ @SmallTest
+ @Test
public void testFocusChangeWithAlreadyActiveBtDevice() {
CallAudioRouteStateMachine stateMachine = new CallAudioRouteStateMachine(
mContext,