Bluetooth: Dismiss pairing dialog on user click

* Existing pairing dialog should be dismissed when user clicks on Yes/No
* In a pairing session with multiple pairing dialogs, this is necessary
  as otherwise the second pairing dialog will not be shown
* Modified unit test to test this behavior
* Launch pairing dialog as UserHandle.CURRENT to avoid Context warnings

Bug: 35833536
Test: make, unit test, pair with Bluetooth devices
Change-Id: I1823b78d287134505f59eab7caca2329ecc3a36f
This commit is contained in:
Jack He
2017-04-25 12:53:33 -07:00
parent d796fda4bf
commit 2a67cf0465
4 changed files with 118 additions and 18 deletions

View File

@@ -52,7 +52,7 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
if (powerManager.isInteractive() && shouldShowDialog) {
// Since the screen is on and the BT-related activity is in the foreground,
// just open the dialog
context.startActivity(pairingIntent);
context.startActivityAsUser(pairingIntent, UserHandle.CURRENT);
} else {
// Put up a notification that leads to the dialog
intent.setClass(context, BluetoothPairingService.class);