From 4226415bd9f376c41d85f4cd2e11da59a866d241 Mon Sep 17 00:00:00 2001 From: Henrik Backlund Date: Mon, 30 Aug 2010 11:59:42 +0200 Subject: Fix to get A2DP to connect after unpairing In this fix, A2DP profile will be connected when pairing with a previously paired headset. The reason for this error was that the connection of the A2DP profile was sent before the callback onCreatePairedDeviceResult was receied in BluetoothEventLoop.java. By not going to the state BOND_BONDED until after this callback has been received, the problem is fixed. However the use case is different if the pairing is initiated by the remote device. In these cases state BOND_BONDED will be set when onDevicePropertyChanged instead. Change-Id: I5dedca87d0a6872705ff3a933a99cce6eb37618a --- core/java/android/server/BluetoothEventLoop.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core/java') diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index e1d3f13..094258b 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -404,7 +404,13 @@ class BluetoothEventLoop { mBluetoothService.sendUuidIntent(address); } else if (name.equals("Paired")) { if (propValues[1].equals("true")) { - mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDED); + // If locally initiated pairing, we will + // not go to BOND_BONDED state until we have received a + // successful return value in onCreatePairedDeviceResult + if (null == mBluetoothService.getBondState().getPendingOutgoingBonding()) { + mBluetoothService.getBondState().setBondState(address, + BluetoothDevice.BOND_BONDED); + } } else { mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_NONE); -- cgit v1.1