Show Bluetooth dialog in a specific case

If the application that initiate the bonding with
BluetoothDevice#createBond is in foreground, then should dialog only
instead of showing the notification & dialog

Bug: 175931562
Tag: #refactor
Test: manual
Change-Id: I3673a0b58cbf9caabf62c951b84b49e17cfb13b8
This commit is contained in:
My Name
2023-02-07 01:58:16 +00:00
committed by Hieu Dang
parent b0ddc1833d
commit 2e552331e9
3 changed files with 22 additions and 8 deletions

View File

@@ -50,10 +50,8 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
PowerManager powerManager = context.getSystemService(PowerManager.class);
int pairingVariant = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT,
BluetoothDevice.ERROR);
String deviceAddress = device != null ? device.getAddress() : null;
String deviceName = device != null ? device.getName() : null;
boolean shouldShowDialog = LocalBluetoothPreferences.shouldShowDialogInForeground(
context, deviceAddress, deviceName);
context, device);
// Skips consent pairing dialog if the device was recently associated with CDM
if (pairingVariant == BluetoothDevice.PAIRING_VARIANT_CONSENT