From b4bbe9488a8402013894e4f4f8d799c81bd5ef9c Mon Sep 17 00:00:00 2001 From: Sumit Deshmukh Date: Thu, 28 Mar 2019 14:31:45 +0530 Subject: [PATCH] Settings: [BT] Wrong Pairing Popup is shown on new pairing request. Usecase: 1. Start advertising from DUT (using BLE Smartertooth app). 2. Scan and connect from central device. 3. Now initiate bond from central and accept pairing request. (Consent Pairing Dialog will be shown on DUT) 4. Notification will be received for PASSKEY CONFIRMATION Dialog. Do not open notification and let it timeout. 5. Repeat steps 2 and 3. At step 3, Passkey Confirmation pairing dialog is show instead of Consent pairing dialog. Issue: Wrong Pairing Popup is shown. Passkey Confirmation pairing dialog is show instead of Consent pairing dialog. Reproducible Rate: 100% Root Cause: PendingIntent created for showing pairing notification are getting reused as only FLAG_ONE_SHOT is used. This flag is not updating new extra's in the pending intent. Fix: Use flag FLAG_UPDATE_CURRENT in pending Intent. Test: Tested above mentioned testcase and pairing scenarios. Bug: 129456113 Change-Id: I46813f355cd796cee1b472774b494c8580b39784 --- .../android/settings/bluetooth/BluetoothPairingService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/BluetoothPairingService.java b/src/com/android/settings/bluetooth/BluetoothPairingService.java index 4fedb6d4f32..08577192b7d 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingService.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingService.java @@ -124,7 +124,8 @@ public final class BluetoothPairingService extends Service { .setLocalOnly(true); PendingIntent pairIntent = PendingIntent.getActivity(this, 0, - getPairingDialogIntent(this, intent), PendingIntent.FLAG_ONE_SHOT); + getPairingDialogIntent(this, intent), + PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent dismissIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_DISMISS_PAIRING), PendingIntent.FLAG_ONE_SHOT);