Loading src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,10 @@ public class BluetoothDeviceManager { mHearingAidDeviceSyncIds.put(device, hiSyncId); targetDeviceMap = mHearingAidDevicesByAddress; } else { if (mBluetoothHeadsetService == null) { Log.w(this, "Headset service null when receiving device added broadcast"); return; } targetDeviceMap = mHfpDevicesByAddress; } if (!targetDeviceMap.containsKey(device.getAddress())) { Loading tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,20 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testAddDeviceFailsWhenServicesAreNull() { mBluetoothDeviceManager.setHeadsetServiceForTesting(null); mBluetoothDeviceManager.setHearingAidServiceForTesting(null); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false)); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true)); assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testMultiDeviceConnectAndDisconnect() { Loading Loading
src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,10 @@ public class BluetoothDeviceManager { mHearingAidDeviceSyncIds.put(device, hiSyncId); targetDeviceMap = mHearingAidDevicesByAddress; } else { if (mBluetoothHeadsetService == null) { Log.w(this, "Headset service null when receiving device added broadcast"); return; } targetDeviceMap = mHfpDevicesByAddress; } if (!targetDeviceMap.containsKey(device.getAddress())) { Loading
tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,20 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testAddDeviceFailsWhenServicesAreNull() { mBluetoothDeviceManager.setHeadsetServiceForTesting(null); mBluetoothDeviceManager.setHearingAidServiceForTesting(null); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false)); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true)); assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testMultiDeviceConnectAndDisconnect() { Loading