Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -484,6 +484,10 @@ public class BluetoothEventManager { return; } final CachedBluetoothDevice activeDevice = mDeviceManager.findDevice(device); if (activeDevice == null) { Log.w(TAG, "AclStateChangedHandler: activeDevice is null"); return; } final int state; switch (action) { case BluetoothDevice.ACTION_ACL_CONNECTED: Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -181,4 +181,17 @@ public class BluetoothEventManagerTest { verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice, BluetoothAdapter.STATE_CONNECTED); } @Test public void dispatchAclConnectionStateChanged_findDeviceReturnNull_shouldNotDispatchCallback() { when(mCachedDeviceManager.findDevice(mBluetoothDevice)).thenReturn(null); mBluetoothEventManager.registerCallback(mBluetoothCallback); mIntent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED); mIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mBluetoothDevice); mContext.sendBroadcast(mIntent); verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice, BluetoothAdapter.STATE_CONNECTED); } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -484,6 +484,10 @@ public class BluetoothEventManager { return; } final CachedBluetoothDevice activeDevice = mDeviceManager.findDevice(device); if (activeDevice == null) { Log.w(TAG, "AclStateChangedHandler: activeDevice is null"); return; } final int state; switch (action) { case BluetoothDevice.ACTION_ACL_CONNECTED: Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -181,4 +181,17 @@ public class BluetoothEventManagerTest { verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice, BluetoothAdapter.STATE_CONNECTED); } @Test public void dispatchAclConnectionStateChanged_findDeviceReturnNull_shouldNotDispatchCallback() { when(mCachedDeviceManager.findDevice(mBluetoothDevice)).thenReturn(null); mBluetoothEventManager.registerCallback(mBluetoothCallback); mIntent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED); mIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mBluetoothDevice); mContext.sendBroadcast(mIntent); verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice, BluetoothAdapter.STATE_CONNECTED); } }