Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e4f3033 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Fix bond list mismatch between Java and native" am: ac3a6efb

Change-Id: Ibcfb83c8e7a876f3e5399e3dc1b673c25333148e
parents bc61b6ff ac3a6efb
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -1191,6 +1191,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
    // Do not call bond_state_changed_cb yet. Wait until remote service
    // discovery is complete
  } else {
    bool is_bonded_device_removed = false;
    // Map the HCI fail reason  to  bt status
    switch (p_auth_cmpl->fail_reason) {
      case HCI_ERR_PAGE_TIMEOUT:
@@ -1209,14 +1210,16 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
        break;

      case HCI_ERR_PAIRING_NOT_ALLOWED:
        btif_storage_remove_bonded_device(&bd_addr);
        is_bonded_device_removed =
            (btif_storage_remove_bonded_device(&bd_addr) == BT_STATUS_SUCCESS);
        status = BT_STATUS_AUTH_REJECTED;
        break;

      /* map the auth failure codes, so we can retry pairing if necessary */
      case HCI_ERR_AUTH_FAILURE:
      case HCI_ERR_KEY_MISSING:
        btif_storage_remove_bonded_device(&bd_addr);
        is_bonded_device_removed =
            (btif_storage_remove_bonded_device(&bd_addr) == BT_STATUS_SUCCESS);
        [[fallthrough]];
      case HCI_ERR_HOST_REJECT_SECURITY:
      case HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE:
@@ -1247,11 +1250,16 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
      /* Remove Device as bonded in nvram as authentication failed */
      BTIF_TRACE_DEBUG("%s(): removing hid pointing device from nvram",
                       __func__);
      btif_storage_remove_bonded_device(&bd_addr);
      is_bonded_device_removed =
          (btif_storage_remove_bonded_device(&bd_addr) == BT_STATUS_SUCCESS);
    }
    // Report bond state change to java only if we are bonding to a device or
    // a device is removed from the pairing list.
    if (pairing_cb.state == BT_BOND_STATE_BONDING || is_bonded_device_removed) {
      bond_state_changed(status, bd_addr, state);
    }
  }
}

/******************************************************************************
 *