Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41d8e5f7 authored by Bhasker Neti's avatar Bhasker Neti Committed by Linux Build Service Account
Browse files

Bluetooth: Handle pairing Cancel intent.

Receive Pairing cancel intent and clear pairing request
from notification window.

CRs-fixed: 463362

Change-Id: I63c9299edca4356485f26cbc6332e3be9bdfbf17
(cherry picked from commit fc82c5a6a3e74aeba6139e0ccf48f634fd970e62)
(cherry picked from commit dc299471edd42a5b30c0f54ef8d33730e33d03a3)
(cherry picked from commit 32f973cbe79d2474d0815d7dd90c6960af120b3c)
parent 8d7a38ea
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
                        .setTicker(res.getString(R.string.bluetooth_notif_ticker));

                PendingIntent pending = PendingIntent.getActivity(context, 0,
                        pairingIntent, PendingIntent.FLAG_ONE_SHOT);
                        pairingIntent, PendingIntent.FLAG_UPDATE_CURRENT);

                String name = intent.getStringExtra(BluetoothDevice.EXTRA_NAME);
                if (TextUtils.isEmpty(name)) {
@@ -98,6 +98,16 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
            }

        } else if (action.equals(BluetoothDevice.ACTION_PAIRING_CANCEL)) {
            Intent pairingIntent = new Intent();

            pairingIntent.setClass(context, BluetoothPairingDialog.class);
            pairingIntent.setAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
            pairingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            PendingIntent pending = PendingIntent.getActivity(context, 0,
                                      pairingIntent, PendingIntent.FLAG_NO_CREATE);
            if (pending != null) {
                pending.cancel();
            }

            // Remove the notification
            NotificationManager manager = (NotificationManager) context