From 61460a1ab16983b4eb258115576d323caded70dd Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Fri, 17 Sep 2021 07:43:01 +0800 Subject: [PATCH] Accept the pairing request automatically for the set member pairing Check the pairing request from which device that if it's the outgoing set member pairing, accept the pairing request automatically to make the CSIP pairing seamless. Bug: 178981521 Bug: 150670922 Test: Pair one of the CSIP device, and confirm the other set member can paired without the confirmation from user Change-Id: I40afabb09b4cb12a0253035452c9f6974799ed05 Merged-In: I40afabb09b4cb12a0253035452c9f6974799ed05 --- .../android/settings/bluetooth/BluetoothPairingRequest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java index 993f584dd36..4ea433812ff 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java @@ -23,6 +23,8 @@ import android.content.Intent; import android.os.PowerManager; import android.os.UserHandle; +import com.android.settingslib.bluetooth.LocalBluetoothManager; + /** * BluetoothPairingRequest is a receiver for any Bluetooth pairing request. It * checks if the Bluetooth Settings is currently visible and brings up the PIN, the passkey or a @@ -47,9 +49,11 @@ public final class BluetoothPairingRequest extends BroadcastReceiver { boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground( context, deviceAddress, deviceName); + final LocalBluetoothManager mBluetoothManager = Utils.getLocalBtManager(context); // Skips consent pairing dialog if the device was recently associated with CDM if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT - && device.canBondWithoutDialog()) { + && (device.canBondWithoutDialog() + || mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device))) { device.setPairingConfirmation(true); } else if (powerManager.isInteractive() && shouldShowDialog) { // Since the screen is on and the BT-related activity is in the foreground,