Check bond state when bluetooth key is missing

Bug: 403847818
Test: local tested
Flag: EXEMPT minor fix
Change-Id: I3f310b5758ebecd7591d76988b351d3c6a7dfc67
This commit is contained in:
Haijie Hong
2025-03-18 18:56:24 +08:00
parent 16fa7c1e33
commit fc10fdf30b
2 changed files with 11 additions and 0 deletions

View File

@@ -127,6 +127,7 @@ public class BluetoothKeyMissingReceiverTest {
public void broadcastReceiver_background_showNotification() {
Intent intent = spy(new Intent(BluetoothDevice.ACTION_KEY_MISSING));
when(intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)).thenReturn(mBluetoothDevice);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
BluetoothKeyMissingReceiver bluetoothKeyMissingReceiver = getReceiver(intent);
bluetoothKeyMissingReceiver.onReceive(mContext, intent);
@@ -141,6 +142,7 @@ public class BluetoothKeyMissingReceiverTest {
when(mLocalBtManager.isForegroundActivity()).thenReturn(true);
Intent intent = spy(new Intent(BluetoothDevice.ACTION_KEY_MISSING));
when(intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)).thenReturn(mBluetoothDevice);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
BluetoothKeyMissingReceiver bluetoothKeyMissingReceiver = getReceiver(intent);
bluetoothKeyMissingReceiver.onReceive(mContext, intent);