summaryrefslogtreecommitdiff
path: root/android/bluetooth.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-09-02 15:55:01 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-09-02 18:00:06 +0200
commit14453fcd0e4169e3c0959ffb2e751d5f3cffb2e7 (patch)
tree95c3af5e15289a19e2c4f93d1df3c41c13fd0302 /android/bluetooth.c
parent121bb927f2728fdc9902b52967d46209ae49adae (diff)
downloadbluez-14453fcd0e4169e3c0959ffb2e751d5f3cffb2e7.tar.gz
android/bluetooth: Improve sending bond state notification
This patch makes sure that any bond state changes of remote device is corretly distributed to Android framework.
Diffstat (limited to 'android/bluetooth.c')
-rw-r--r--android/bluetooth.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/android/bluetooth.c b/android/bluetooth.c
index f1ceda35d..5526924ff 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -886,13 +886,14 @@ static void update_bond_state(struct device *dev, uint8_t status,
return;
/*
- * For incoming just works bonding we will switch here from
- * non bonded to bonded directly. This is something Android
- * will not handle in their bond state machine. To make Android
- * handle it corretly we need to send BONDING state before BOND
+ * When internal bond state changes from bond to non-bond or other way,
+ * BfA needs to send bonding state to Android in the middle. Otherwise
+ * Android will not handle it correctly
*/
- if (old_bond == HAL_BOND_STATE_NONE &&
- new_bond == HAL_BOND_STATE_BONDED)
+ if ((old_bond == HAL_BOND_STATE_NONE &&
+ new_bond == HAL_BOND_STATE_BONDED) ||
+ (old_bond == HAL_BOND_STATE_BONDED &&
+ new_bond == HAL_BOND_STATE_NONE))
send_bond_state_change(dev, HAL_STATUS_SUCCESS,
HAL_BOND_STATE_BONDING);