Use isConnected in CachedBluetoothDevice
This method check whether it has connected profile, not physical connection between devices. It make more sense to use it in settings: 1. We only care about whether it has active profile(i.e. A2dp, hfp..) 2. Sometime when profile is disconnected, BluetoothDevice.isConnected() still return true. This may make UI flaky. Bug: 79947085 Test: RunSettingsRoboTests Change-Id: I44039704508a742c7a8aef0a035afcf169b08939
This commit is contained in:
@@ -161,7 +161,7 @@ public class BluetoothDeviceUpdaterTest {
|
||||
@Test
|
||||
public void isDeviceConnected_deviceConnected() {
|
||||
doReturn(BluetoothDevice.BOND_BONDED).when(mBluetoothDevice).getBondState();
|
||||
doReturn(true).when(mBluetoothDevice).isConnected();
|
||||
doReturn(true).when(mCachedBluetoothDevice).isConnected();
|
||||
|
||||
assertThat(mBluetoothDeviceUpdater.isDeviceConnected(mCachedBluetoothDevice)).isTrue();
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class BluetoothDeviceUpdaterTest {
|
||||
@Test
|
||||
public void isDeviceConnected_deviceNotConnected() {
|
||||
doReturn(BluetoothDevice.BOND_BONDED).when(mBluetoothDevice).getBondState();
|
||||
doReturn(false).when(mBluetoothDevice).isConnected();
|
||||
doReturn(false).when(mCachedBluetoothDevice).isConnected();
|
||||
|
||||
assertThat(mBluetoothDeviceUpdater.isDeviceConnected(mCachedBluetoothDevice)).isFalse();
|
||||
}
|
||||
|
Reference in New Issue
Block a user