summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2014-11-04 15:23:02 -0800
committerThe Android Automerger <android-build@google.com>2014-11-07 13:38:11 -0800
commit97204af05941a3dbbc0a2f6d49457c3ace5f7f86 (patch)
tree3fbc079bc8d33e4ae7964980b018305366f4475c
parent352e2a2ec30f651bf69c6f947c5c4531f945a495 (diff)
downloadbluedroid-linaro-5.0.0_r7-gcc-4.9.tar.gz
If the encryption times out during the re-connect process for a HOGP device, the device is removed from the whitelist and thus will not reconnect until it is added back to the list. On platforms that do not have a way to reconnect to a device manually, this means the device will never reconnect again until the stack is restarted. This patch checks the reason for the encryption failure and does not remove the device from the whitelist if the encryption failed to a non authentication/key related error. Bug: 18233442 Change-Id: Ifaec4a9224ff9281956715b38d34c2d7c3fecb01
-rwxr-xr-xbta/gatt/bta_gattc_act.c7
-rw-r--r--bta/hh/bta_hh_int.h1
-rw-r--r--bta/hh/bta_hh_le.c9
3 files changed, 13 insertions, 4 deletions
diff --git a/bta/gatt/bta_gattc_act.c b/bta/gatt/bta_gattc_act.c
index 91204fc..546a56f 100755
--- a/bta/gatt/bta_gattc_act.c
+++ b/bta/gatt/bta_gattc_act.c
@@ -1791,8 +1791,11 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id,
{
tBTA_GATTC_DATA *p_buf;
- APPL_TRACE_DEBUG("bta_gattc_conn_cback: cif = %d connected = %d conn_id = %d reaosn = 0x%04x",
- gattc_if, connected, conn_id, reason);
+ if (reason != 0)
+ {
+ APPL_TRACE_WARNING("%s() - cif=%d connected=%d conn_id=%d reason=0x%04x",
+ __FUNCTION__, gattc_if, connected, conn_id, reason);
+ }
if ((p_buf = (tBTA_GATTC_DATA *) GKI_getbuf(sizeof(tBTA_GATTC_DATA))) != NULL)
{
diff --git a/bta/hh/bta_hh_int.h b/bta/hh/bta_hh_int.h
index b010bca..ac9bb61 100644
--- a/bta/hh/bta_hh_int.h
+++ b/bta/hh/bta_hh_int.h
@@ -266,6 +266,7 @@ typedef struct
UINT8 disc_active;
tBTA_HH_STATUS status;
+ tBTA_GATT_REASON reason;
BOOLEAN is_le_device;
tBTA_HH_LE_HID_SRVC hid_srvc[BTA_HH_LE_HID_SRVC_MAX];
UINT16 conn_id;
diff --git a/bta/hh/bta_hh_le.c b/bta/hh/bta_hh_le.c
index bd42553..7cbf09c 100644
--- a/bta/hh/bta_hh_le.c
+++ b/bta/hh/bta_hh_le.c
@@ -1265,6 +1265,7 @@ void bta_hh_le_encrypt_cback(BD_ADDR bd_addr, tBTA_GATT_TRANSPORT transport,
return;
}
p_dev_cb->status = (result == BTM_SUCCESS) ? BTA_HH_OK : BTA_HH_ERR_SEC;
+ p_dev_cb->reason = result;
bta_hh_sm_execute(p_dev_cb, BTA_HH_ENC_CMPL_EVT, NULL);
}
@@ -1314,8 +1315,12 @@ void bta_hh_security_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf)
}
}
else
- bta_hh_le_api_disc_act(p_cb);
-
+ {
+ APPL_TRACE_ERROR("%s() - encryption failed; status=0x%04x, reason=0x%04x",
+ __FUNCTION__, p_cb->status, p_cb->reason);
+ if (!(p_cb->status == BTA_HH_ERR_SEC && p_cb->reason == BTM_ERR_PROCESSING))
+ bta_hh_le_api_disc_act(p_cb);
+ }
}
/*******************************************************************************