diff options
author | Srinu Jella <sjella@codeaurora.org> | 2013-12-02 15:48:45 +0530 |
---|---|---|
committer | Nitin Shivpure <nshivpur@codeaurora.org> | 2014-02-19 15:04:08 +0530 |
commit | 68926914213742311fbab28da7883f9ea3f341b6 (patch) | |
tree | d0dd6cced676c8c0d4ec7355d6dc5869480f633b /src/com/android/settings/bluetooth | |
parent | 1f37bff7d26aeb3d1f16deb4368f8387e2d4530f (diff) | |
download | packages_apps_Settings-68926914213742311fbab28da7883f9ea3f341b6.tar.gz packages_apps_Settings-68926914213742311fbab28da7883f9ea3f341b6.tar.bz2 packages_apps_Settings-68926914213742311fbab28da7883f9ea3f341b6.zip |
Bluetooth: GAP: Cancel the pairing notification on bond state change
Cancel the pairing notification on bond state change happens from
BOND_BONDING to BOND_NONE. Otherwise it will present in the
notification area until it gets cancelled by opening it and press
cancel on pairing dialog.
Change-Id: I96f673e29e612cd748165a1323a5b4a4276a843c
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rw-r--r-- | src/com/android/settings/bluetooth/BluetoothPairingRequest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java index 838e7b1b0..ea36fee42 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java @@ -103,6 +103,19 @@ public final class BluetoothPairingRequest extends BroadcastReceiver { NotificationManager manager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); manager.cancel(NOTIFICATION_ID); + + } else if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) { + int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, + BluetoothDevice.ERROR); + int oldState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, + BluetoothDevice.ERROR); + if((oldState == BluetoothDevice.BOND_BONDING) && + (bondState == BluetoothDevice.BOND_NONE)) { + // Remove the notification + NotificationManager manager = (NotificationManager) context + .getSystemService(Context.NOTIFICATION_SERVICE); + manager.cancel(NOTIFICATION_ID); + } } } } |