Skip to content

Commit a79c829

Browse files
Henrik BacklundJohan Redestig
authored andcommitted
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
1 parent bd6abed commit a79c829

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/java/android/server/BluetoothEventLoop.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,13 @@ private void onDevicePropertyChanged(String deviceObjectPath, String[] propValue
414414
mBluetoothService.sendUuidIntent(address);
415415
} else if (name.equals("Paired")) {
416416
if (propValues[1].equals("true")) {
417-
mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDED);
417+
// If locally initiated pairing, we will
418+
// not go to BOND_BONDED state until we have received a
419+
// successful return value in onCreatePairedDeviceResult
420+
if (null == mBluetoothService.getBondState().getPendingOutgoingBonding()) {
421+
mBluetoothService.getBondState().setBondState(address,
422+
BluetoothDevice.BOND_BONDED);
423+
}
418424
} else {
419425
mBluetoothService.getBondState().setBondState(address,
420426
BluetoothDevice.BOND_NONE);

0 commit comments

Comments
 (0)