OSDN Git Service

Reduce error conditions which cause link key deletion on auth complete
authorAndre Eisenbach <eisenbach@google.com>
Wed, 19 Jul 2017 22:33:07 +0000 (15:33 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 21 Jul 2017 20:51:45 +0000 (20:51 +0000)
This inverts previous conditions which attempt to limit what error
conditions cause link key deletion and instead of excluding error codes
it provides a shorter list of codes which actually DO cause link key
deletion.

As a result, temporary failures caused by page timeouts, random
disconnects etc. should no longer cause link key deletion by accident.

Fixes: 63507123
Test: manual
Change-Id: I8d51403b8d233a3c335313b8f257a562c3d01109
(cherry picked from commit 51fb9c0e0cfbda559bf6377c183928ae48a24629)

bta/dm/bta_dm_act.cc

index a215c49..f708cc6 100644 (file)
@@ -2612,10 +2612,9 @@ static uint8_t bta_dm_authentication_complete_cback(
     if (bta_dm_cb.p_sec_cback)
       bta_dm_cb.p_sec_cback(BTA_DM_AUTH_CMPL_EVT, &sec_event);
 
-    if (result != HCI_ERR_LMP_RESPONSE_TIMEOUT &&
-        result != HCI_ERR_PAGE_TIMEOUT && result != HCI_ERR_CONNECTION_TOUT &&
-        result != HCI_ERR_CONN_FAILED_ESTABLISHMENT &&
-        result != HCI_ERR_KEY_MISSING) {
+    if (result == HCI_ERR_AUTH_FAILURE || result == HCI_ERR_KEY_MISSING ||
+        result == HCI_ERR_HOST_REJECT_SECURITY ||
+        result == HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE) {
       bdstr_t bd_addr_str;
       APPL_TRACE_WARNING("%s deleting %s - result: 0x%02x", __func__,
                          bdaddr_to_string((bt_bdaddr_t*)bd_addr, bd_addr_str,