Add error handle for device that not support Bluetooth
- Add LocalBluetoothManager null check for device that not support Bluetooth - Add test to verify when LocalBluetoothManager is null will not crash Bug: 110712414 Test: make -j42 RunSettingsRoboTests Change-Id: Ib506a0206cfcfdfec60bdfcf9a1944338a7ab729
This commit is contained in:
@@ -167,4 +167,20 @@ public class BluetoothDeviceUpdaterTest {
|
||||
|
||||
assertThat(mBluetoothDeviceUpdater.isDeviceConnected(mCachedBluetoothDevice)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerCallback_localBluetoothManagerNull_shouldNotCrash() {
|
||||
mBluetoothDeviceUpdater.mLocalManager = null;
|
||||
|
||||
// Shouldn't crash
|
||||
mBluetoothDeviceUpdater.registerCallback();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unregisterCallback_localBluetoothManagerNull_shouldNotCrash() {
|
||||
mBluetoothDeviceUpdater.mLocalManager = null;
|
||||
|
||||
// Shouldn't crash
|
||||
mBluetoothDeviceUpdater.unregisterCallback();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user