Loading src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class BluetoothDeviceManager { void onDeviceConnected(BluetoothDevice device) { synchronized (mLock) { if (mBluetoothHeadsetService == null) { Log.w(this, "Headset service null when receiving device added broadcast"); return; } if (!mConnectedDevicesByAddress.containsKey(device.getAddress())) { mConnectedDevicesByAddress.put(device.getAddress(), device); mBluetoothRouteManager.onDeviceAdded(device.getAddress()); Loading tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,17 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { assertNull(mBluetoothDeviceManager.getMostRecentlyConnectedDevice(null)); } @SmallTest @Test public void testAddDeviceFailsWhenServicesAreNull() { mBluetoothDeviceManager.setHeadsetServiceForTesting(null); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1)); assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testMultiDeviceConnectAndDisconnect() { Loading Loading
src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class BluetoothDeviceManager { void onDeviceConnected(BluetoothDevice device) { synchronized (mLock) { if (mBluetoothHeadsetService == null) { Log.w(this, "Headset service null when receiving device added broadcast"); return; } if (!mConnectedDevicesByAddress.containsKey(device.getAddress())) { mConnectedDevicesByAddress.put(device.getAddress(), device); mBluetoothRouteManager.onDeviceAdded(device.getAddress()); Loading
tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,17 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { assertNull(mBluetoothDeviceManager.getMostRecentlyConnectedDevice(null)); } @SmallTest @Test public void testAddDeviceFailsWhenServicesAreNull() { mBluetoothDeviceManager.setHeadsetServiceForTesting(null); receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1)); assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices()); } @SmallTest @Test public void testMultiDeviceConnectAndDisconnect() { Loading