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

Commit 00202cbe authored by Yun-hao Chung's avatar Yun-hao Chung Committed by Automerger Merge Worker
Browse files

Merge "Floss: Separate out open failure case from BTA_HH close act" into main am: aa9a114d

parents fef8f468 aa9a114d
Loading
Loading
Loading
Loading
+12 −37
Original line number Diff line number Diff line
@@ -899,7 +899,6 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
 *
 ******************************************************************************/
void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
  tBTA_HH_CONN conn_dat;
  tBTA_HH_CBDATA disc_dat = {BTA_HH_OK, 0};

  uint32_t reason = p_data->hid_cback.data; /* Reason for closing (32-bit) */
@@ -924,29 +923,6 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
                                    hid_status_text(hid_status).c_str(),
                                    overlay_fail.c_str()));

  /* Check reason for closing */
  if ((reason & (HID_L2CAP_CONN_FAIL |
                 HID_L2CAP_REQ_FAIL)) || /* Failure to initialize connection
                                            (page timeout or l2cap error) */
      (reason ==
       HID_ERR_AUTH_FAILED) || /* Authenication error (while initiating) */
      (reason == HID_ERR_L2CAP_FAILED)) /* Failure creating l2cap connection */
  {
    /* Failure in opening connection */
    conn_dat.handle = p_cb->hid_handle;
    conn_dat.status =
        (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
    conn_dat.bda = p_cb->addr;
    HID_HostCloseDev(p_cb->hid_handle);

    /* Report OPEN fail event */
    (*bta_hh_cb.p_cback)(BTA_HH_OPEN_EVT, (tBTA_HH*)&conn_dat);

    bta_hh_trace_dev_db();
    return;
  }
  /* otherwise report CLOSE/VC_UNPLUG event */
  else {
  /* inform role manager */
  bta_sys_conn_close(BTA_ID_HH, p_cb->app_id, p_cb->addr);
  /* update total conn number */
@@ -963,7 +939,6 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
  }

  bta_hh_trace_dev_db();
  }

  /* clean up control block, but retain SDP info and device handle */
  p_cb->vp = false;
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static void bta_hh_better_state_machine(tBTA_HH_DEV_CB* p_cb, uint16_t event,
          bta_hh_open_act(p_cb, p_data);
          break;
        case BTA_HH_INT_CLOSE_EVT:
          bta_hh_close_act(p_cb, p_data);
          bta_hh_open_failure(p_cb, p_data);
          break;
        case BTA_HH_API_MAINT_DEV_EVT:
          bta_hh_maint_dev_act(p_cb, p_data);