Diff between e099ed45afa7754db7d050d298dd706ab595d824 and 2a07e06b099a9c1bcbb0ca3678cf5782aa817d83

Changed Files

File Additions Deletions Status
android/bluetooth.c +7 -2 modified

Full Patch

diff --git a/android/bluetooth.c b/android/bluetooth.c
index b105ac8..d74d792 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1279,6 +1279,7 @@ static void mgmt_auth_failed_event(uint16_t index, uint16_t length,
 					const void *param, void *user_data)
 {
 	const struct mgmt_ev_auth_failed *ev = param;
+	struct device *dev;
 
 	if (length < sizeof(*ev)) {
 		error("Too small auth failed mgmt event (%u bytes)", length);
@@ -1287,8 +1288,12 @@ static void mgmt_auth_failed_event(uint16_t index, uint16_t length,
 
 	DBG("");
 
-	set_device_bond_state(&ev->addr.bdaddr, status_mgmt2hal(ev->status),
-							HAL_BOND_STATE_NONE);
+	dev = find_device(&ev->addr.bdaddr);
+
+	if (dev && dev->bond_state == HAL_BOND_STATE_BONDING)
+		set_device_bond_state(&ev->addr.bdaddr,
+						status_mgmt2hal(ev->status),
+						HAL_BOND_STATE_NONE);
 }
 
 static void mgmt_device_unpaired_event(uint16_t index, uint16_t length,