summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/server/telecom
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2019-04-09 01:37:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-09 01:37:33 +0000
commitf1a141982f7e3b459d5b2f7c79bd88ce8ca6b08f (patch)
treef87d9784ed06bd7b9c4b8a722f71e0b3d903fc67 /tests/src/com/android/server/telecom
parent94cae4ac7c5bef8b969e7ebae51965ad24720650 (diff)
parent6f1beb8f6ffd92704f72fc3bba8bc43380ba27b3 (diff)
downloadandroid_packages_services_Telecomm-f1a141982f7e3b459d5b2f7c79bd88ce8ca6b08f.tar.gz
android_packages_services_Telecomm-f1a141982f7e3b459d5b2f7c79bd88ce8ca6b08f.tar.bz2
android_packages_services_Telecomm-f1a141982f7e3b459d5b2f7c79bd88ce8ca6b08f.zip
Merge "Fix the audio-on device detection logic" into qt-dev
Diffstat (limited to 'tests/src/com/android/server/telecom')
-rw-r--r--tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java18
-rw-r--r--tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java2
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java b/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
index 060031d8..93c29097 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
@@ -114,6 +114,22 @@ public class BluetoothRouteManagerTest extends TelecomTestCase {
@SmallTest
@Test
+ public void testAudioOnDeviceWithScoOffActiveDevice() {
+ BluetoothRouteManager sm = setupStateMachine(
+ BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX, DEVICE1);
+ setupConnectedDevices(new BluetoothDevice[]{DEVICE1}, null, DEVICE1, null);
+ when(mHeadsetProxy.getAudioState(DEVICE1))
+ .thenReturn(BluetoothHeadset.STATE_AUDIO_DISCONNECTED);
+ executeRoutingAction(sm, BluetoothRouteManager.BT_AUDIO_LOST, DEVICE1.getAddress());
+
+ verifyConnectionAttempt(DEVICE1, 0);
+ assertEquals(BluetoothRouteManager.AUDIO_OFF_STATE_NAME,
+ sm.getCurrentState().getName());
+ sm.quitNow();
+ }
+
+ @SmallTest
+ @Test
public void testConnectHfpRetryWhileConnectedToAnotherDevice() {
BluetoothRouteManager sm = setupStateMachine(
BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX, DEVICE1);
@@ -164,6 +180,8 @@ public class BluetoothRouteManagerTest extends TelecomTestCase {
when(mDeviceManager.getConnectedDevices()).thenReturn(allDevices);
when(mHeadsetProxy.getConnectedDevices()).thenReturn(Arrays.asList(hfpDevices));
when(mHeadsetProxy.getActiveDevice()).thenReturn(hfpActiveDevice);
+ when(mHeadsetProxy.getAudioState(hfpActiveDevice))
+ .thenReturn(BluetoothHeadset.STATE_AUDIO_CONNECTED);
when(mBluetoothHearingAid.getConnectedDevices())
.thenReturn(Arrays.asList(hearingAidDevices));
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java b/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
index 2f68ac27..2584f330 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
@@ -341,6 +341,8 @@ public class BluetoothRouteTransitionTests extends TelecomTestCase {
when(mHeadsetProxy.getActiveDevice()).thenReturn(activeDevice);
if (audioOnDevice != null) {
when(mHeadsetProxy.getActiveDevice()).thenReturn(audioOnDevice);
+ when(mHeadsetProxy.getAudioState(audioOnDevice))
+ .thenReturn(BluetoothHeadset.STATE_AUDIO_CONNECTED);
}
}