Accept the pairing request automatically for the set member pairing am: 61460a1ab1 am: 6aa53808f3 am: c932678888

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1903832

Change-Id: I205a7824d84a42128be5be2e77974689510d190a
This commit is contained in:
Alice Kuo
2021-11-29 03:04:12 +00:00
committed by Automerger Merge Worker

View File

@@ -23,6 +23,8 @@ import android.content.Intent;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.UserHandle; import android.os.UserHandle;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
/** /**
* BluetoothPairingRequest is a receiver for any Bluetooth pairing request. It * 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 * 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( boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground(
context, deviceAddress, deviceName); context, deviceAddress, deviceName);
final LocalBluetoothManager mBluetoothManager = Utils.getLocalBtManager(context);
// Skips consent pairing dialog if the device was recently associated with CDM // Skips consent pairing dialog if the device was recently associated with CDM
if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT
&& device.canBondWithoutDialog()) { && (device.canBondWithoutDialog()
|| mBluetoothManager.getCachedDeviceManager().isOngoingPairByCsip(device))) {
device.setPairingConfirmation(true); device.setPairingConfirmation(true);
} else if (powerManager.isInteractive() && shouldShowDialog) { } else if (powerManager.isInteractive() && shouldShowDialog) {
// Since the screen is on and the BT-related activity is in the foreground, // Since the screen is on and the BT-related activity is in the foreground,