Fix bluetooth pairing notification could not be removed

Remove the notification when deivce is not bonding.

Bug: 189284833
Test: manually test
Change-Id: Iaa7f04175dac2016777b0de287122108b74b34d8
This commit is contained in:
Hugh Chen
2021-05-27 10:08:24 +08:00
parent 3a55bed8a1
commit b2af6ce1bd

View File

@@ -134,7 +134,8 @@ public final class BluetoothPairingService extends Service {
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (mDevice != null && mDevice.getBondState() != BluetoothDevice.BOND_BONDING) { if (mDevice != null && mDevice.getBondState() != BluetoothDevice.BOND_BONDING) {
Log.w(TAG, "Device " + mDevice + " not bonding: " + mDevice.getBondState()); Log.w(TAG, "Device " + mDevice.getName() + " not bonding: " + mDevice.getBondState());
mNm.cancel(NOTIFICATION_ID);
stopSelf(); stopSelf();
return START_NOT_STICKY; return START_NOT_STICKY;
} }