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

Commit 19c350b7 authored by Rahul Arya's avatar Rahul Arya Committed by Cherrypicker Worker
Browse files

Supply status on GATT close

aosp/1479124 removed the status variables since they were unused.
aosp/1496554 put them back but hardcoded them to GATT_SUCCESS.

I don't know how this ever worked, since in the initial commit
we read p_data.status to pass to JNI, but populated p_data->close.status.

Nonetheless, this should restore expected behavior.

Test: manual
Bug: 255975734

Change-Id: Ic802ce090172971e7e725abe3bb11446daffe604
(cherry picked from commit 76572b88)
Merged-In: Ic802ce090172971e7e725abe3bb11446daffe604
parent 4e654189
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -596,6 +596,7 @@ void bta_gattc_close_fail(tBTA_GATTC_CLCB* p_clcb,
    cb_data.close.conn_id = p_data->hdr.layer_specific;
    cb_data.close.remote_bda = p_clcb->bda;
    cb_data.close.reason = BTA_GATT_CONN_NONE;
    cb_data.close.status = GATT_ERROR;

    LOG(WARNING) << __func__ << ": conn_id=" << loghex(cb_data.close.conn_id)
                 << ". Returns GATT_ERROR(" << +GATT_ERROR << ").";
@@ -646,7 +647,7 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
  bta_gattc_clcb_dealloc(p_clcb);

  if (p_data->hdr.event == BTA_GATTC_API_CLOSE_EVT) {
    GATT_Disconnect(p_data->hdr.layer_specific);
    cb_data.close.status = GATT_Disconnect(p_data->hdr.layer_specific);
    cb_data.close.reason = GATT_CONN_TERMINATE_LOCAL_HOST;
    LOG_DEBUG("Local close event client_if:%hu conn_id:%hu reason:%s",
              cb_data.close.client_if, cb_data.close.conn_id,
@@ -654,6 +655,7 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
                  static_cast<tGATT_DISCONN_REASON>(cb_data.close.reason))
                  .c_str());
  } else if (p_data->hdr.event == BTA_GATTC_INT_DISCONN_EVT) {
    cb_data.close.status = static_cast<tGATT_STATUS>(p_data->int_conn.reason);
    cb_data.close.reason = p_data->int_conn.reason;
    LOG_DEBUG("Peer close disconnect event client_if:%hu conn_id:%hu reason:%s",
              cb_data.close.client_if, cb_data.close.conn_id,