Loading android/app/src/com/android/bluetooth/btservice/AudioRoutingManager.java +4 −12 Original line number Diff line number Diff line Loading @@ -684,17 +684,9 @@ public class AudioRoutingManager extends ActiveDeviceManager { List<BluetoothDevice> fallbackCandidates = new ArrayList<>(); fallbackCandidates.addAll(mLeAudioConnectedDevices); HeadsetService headsetService = mFactory.getHeadsetService(); switch (mAudioManager.getMode()) { case AudioManager.MODE_NORMAL: if (mAudioManager.getMode() == AudioManager.MODE_NORMAL) { fallbackCandidates.addAll(mA2dpConnectedDevices); break; case AudioManager.MODE_RINGTONE: if (headsetService.isInbandRingingEnabled()) { fallbackCandidates.addAll(hfpFallbackCandidates); } break; default: } else { fallbackCandidates.addAll(hfpFallbackCandidates); } BluetoothDevice device = Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AudioRoutingManagerTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,21 @@ public class AudioRoutingManagerTest { verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); } @Test public void headsetSecondDeviceDisconnected_fallbackDeviceActiveWhileRinging() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_RINGTONE); headsetConnected(mHeadsetDevice, false); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); headsetConnected(mSecondaryAudioDevice, false); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mSecondaryAudioDevice); Mockito.clearInvocations(mHeadsetService); headsetDisconnected(mSecondaryAudioDevice); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); } @Test public void a2dpConnectedButHeadsetNotConnected_setA2dpActive() { mTestLooper.stopAutoDispatchAndIgnoreExceptions(); Loading Loading
android/app/src/com/android/bluetooth/btservice/AudioRoutingManager.java +4 −12 Original line number Diff line number Diff line Loading @@ -684,17 +684,9 @@ public class AudioRoutingManager extends ActiveDeviceManager { List<BluetoothDevice> fallbackCandidates = new ArrayList<>(); fallbackCandidates.addAll(mLeAudioConnectedDevices); HeadsetService headsetService = mFactory.getHeadsetService(); switch (mAudioManager.getMode()) { case AudioManager.MODE_NORMAL: if (mAudioManager.getMode() == AudioManager.MODE_NORMAL) { fallbackCandidates.addAll(mA2dpConnectedDevices); break; case AudioManager.MODE_RINGTONE: if (headsetService.isInbandRingingEnabled()) { fallbackCandidates.addAll(hfpFallbackCandidates); } break; default: } else { fallbackCandidates.addAll(hfpFallbackCandidates); } BluetoothDevice device = Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AudioRoutingManagerTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,21 @@ public class AudioRoutingManagerTest { verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); } @Test public void headsetSecondDeviceDisconnected_fallbackDeviceActiveWhileRinging() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_RINGTONE); headsetConnected(mHeadsetDevice, false); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); headsetConnected(mSecondaryAudioDevice, false); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mSecondaryAudioDevice); Mockito.clearInvocations(mHeadsetService); headsetDisconnected(mSecondaryAudioDevice); verify(mHeadsetService, timeout(TIMEOUT_MS)).setActiveDevice(mHeadsetDevice); } @Test public void a2dpConnectedButHeadsetNotConnected_setA2dpActive() { mTestLooper.stopAutoDispatchAndIgnoreExceptions(); Loading