Loading android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java +42 −22 Original line number Original line Diff line number Diff line Loading @@ -783,7 +783,7 @@ public class HeadsetServiceAndStateMachineTest { mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); verify(mSystemInterface).activateVoiceRecognition(); verify(mSystemInterface).activateVoiceRecognition(); verify(mNativeInterface).atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); verify(mNativeInterface).atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); verifyZeroInteractions(mAudioManager); verifyZeroInteractions(mAudioManager); } } Loading Loading @@ -826,7 +826,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(device)); eq(device)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); verifyZeroInteractions(mAudioManager); verifyZeroInteractions(mAudioManager); } } Loading Loading @@ -996,9 +996,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1039,7 +1044,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1058,11 +1063,16 @@ public class HeadsetServiceAndStateMachineTest { InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); BluetoothDevice deviceA = TestUtils.getTestDevice(mAdapter, 0); BluetoothDevice deviceA = TestUtils.getTestDevice(mAdapter, 0); connectTestDevice(deviceA); connectTestDevice(deviceA); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1104,7 +1114,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1124,9 +1134,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading @@ -1153,7 +1168,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceB)); eq(deviceB)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1173,9 +1188,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1211,7 +1231,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading Loading @@ -1334,7 +1354,7 @@ public class HeadsetServiceAndStateMachineTest { verify(mNativeInterface, times(2)) verify(mNativeInterface, times(2)) .enableSwb( .enableSwb( eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(false), eq(device)); eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(false), eq(device)); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); configureHeadsetServiceForAptxVoice(false); configureHeadsetServiceForAptxVoice(false); } } Loading Loading @@ -1418,7 +1438,7 @@ public class HeadsetServiceAndStateMachineTest { verify(mNativeInterface, times(2)) verify(mNativeInterface, times(2)) .enableSwb( .enableSwb( eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(true), eq(device)); eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(true), eq(device)); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); configureHeadsetServiceForAptxVoice(false); configureHeadsetServiceForAptxVoice(false); } } Loading Loading @@ -1719,7 +1739,7 @@ public class HeadsetServiceAndStateMachineTest { device, device, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); BluetoothHeadset.STATE_AUDIO_CONNECTING); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } private void startVoiceRecognitionFromHf_ScoManagedByAudio(BluetoothDevice device) { private void startVoiceRecognitionFromHf_ScoManagedByAudio(BluetoothDevice device) { Loading Loading @@ -1774,7 +1794,7 @@ public class HeadsetServiceAndStateMachineTest { device, device, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); BluetoothHeadset.STATE_AUDIO_CONNECTING); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } private void startVoiceRecognitionFromAg_ScoManagedByAudio() { private void startVoiceRecognitionFromAg_ScoManagedByAudio() { Loading Loading
android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java +42 −22 Original line number Original line Diff line number Diff line Loading @@ -783,7 +783,7 @@ public class HeadsetServiceAndStateMachineTest { mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); verify(mSystemInterface).activateVoiceRecognition(); verify(mSystemInterface).activateVoiceRecognition(); verify(mNativeInterface).atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); verify(mNativeInterface).atResponseCode(device, HeadsetHalConstants.AT_RESPONSE_ERROR, 0); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); verifyZeroInteractions(mAudioManager); verifyZeroInteractions(mAudioManager); } } Loading Loading @@ -826,7 +826,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(device)); eq(device)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); verifyZeroInteractions(mAudioManager); verifyZeroInteractions(mAudioManager); } } Loading Loading @@ -996,9 +996,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1039,7 +1044,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1058,11 +1063,16 @@ public class HeadsetServiceAndStateMachineTest { InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); BluetoothDevice deviceA = TestUtils.getTestDevice(mAdapter, 0); BluetoothDevice deviceA = TestUtils.getTestDevice(mAdapter, 0); connectTestDevice(deviceA); connectTestDevice(deviceA); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1104,7 +1114,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1124,9 +1134,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading @@ -1153,7 +1168,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceB)); eq(deviceB)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading @@ -1173,9 +1188,14 @@ public class HeadsetServiceAndStateMachineTest { BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); BluetoothDevice deviceB = TestUtils.getTestDevice(mAdapter, 1); connectTestDevice(deviceB); connectTestDevice(deviceB); InOrder inOrder = inOrder(mNativeInterface); InOrder inOrder = inOrder(mNativeInterface); if (!Flags.updateActiveDeviceInBandRingtone()) { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); } else { inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false)); inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false)); } // Set active device to device B // Set active device to device B assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue(); mTestLooper.dispatchAll(); mTestLooper.dispatchAll(); Loading Loading @@ -1211,7 +1231,7 @@ public class HeadsetServiceAndStateMachineTest { anyBoolean(), anyBoolean(), eq(deviceA)); eq(deviceA)); } } verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } /** /** Loading Loading @@ -1334,7 +1354,7 @@ public class HeadsetServiceAndStateMachineTest { verify(mNativeInterface, times(2)) verify(mNativeInterface, times(2)) .enableSwb( .enableSwb( eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(false), eq(device)); eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(false), eq(device)); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); configureHeadsetServiceForAptxVoice(false); configureHeadsetServiceForAptxVoice(false); } } Loading Loading @@ -1418,7 +1438,7 @@ public class HeadsetServiceAndStateMachineTest { verify(mNativeInterface, times(2)) verify(mNativeInterface, times(2)) .enableSwb( .enableSwb( eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(true), eq(device)); eq(HeadsetHalConstants.BTHF_SWB_CODEC_VENDOR_APTX), eq(true), eq(device)); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); configureHeadsetServiceForAptxVoice(false); configureHeadsetServiceForAptxVoice(false); } } Loading Loading @@ -1719,7 +1739,7 @@ public class HeadsetServiceAndStateMachineTest { device, device, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); BluetoothHeadset.STATE_AUDIO_CONNECTING); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } private void startVoiceRecognitionFromHf_ScoManagedByAudio(BluetoothDevice device) { private void startVoiceRecognitionFromHf_ScoManagedByAudio(BluetoothDevice device) { Loading Loading @@ -1774,7 +1794,7 @@ public class HeadsetServiceAndStateMachineTest { device, device, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); BluetoothHeadset.STATE_AUDIO_CONNECTING); verifyNoMoreInteractions(mNativeInterface); verifyNoMoreInteractions(ignoreStubs(mNativeInterface)); } } private void startVoiceRecognitionFromAg_ScoManagedByAudio() { private void startVoiceRecognitionFromAg_ScoManagedByAudio() { Loading