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

Commit 4f348de3 authored by Gopi Sakshihally Bhuthaiah's avatar Gopi Sakshihally Bhuthaiah Committed by Himanshu Rawat
Browse files

Dead code removed from btif_hh.cc

btif_hh_find_connected_dev_by_link_spec() returns devices in BTHH_CONN_STATE_CONNECTED state. There is no point in checking for the device state after that.

Bug: 332236441
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT code clean up
Change-Id: I418014a1ef45efdf0e1e2630cb1d158e3b24a362
parent 6b9f6fe4
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -1581,17 +1581,10 @@ static bt_status_t connect(RawAddress* bd_addr, tBLE_ADDR_TYPE addr_type,
  }

  btif_hh_device_t* p_dev = btif_hh_find_connected_dev_by_link_spec(link_spec);
  if (p_dev) {
    if (p_dev->dev_status == BTHH_CONN_STATE_CONNECTED ||
        p_dev->dev_status == BTHH_CONN_STATE_CONNECTING) {
  if (p_dev != nullptr) {
    log::warn("device {} already connected",
              p_dev->link_spec.ToRedactedStringForLogging());
    return BT_STATUS_DONE;
    } else if (p_dev->dev_status == BTHH_CONN_STATE_DISCONNECTING) {
      log::warn("device {} is busy with disconnecting",
                p_dev->link_spec.ToRedactedStringForLogging());
      return BT_STATUS_BUSY;
    }
  }

  if (link_spec.transport == BT_TRANSPORT_AUTO) {
@@ -1658,17 +1651,6 @@ static bt_status_t disconnect(RawAddress* bd_addr, tBLE_ADDR_TYPE addr_type,
    return BT_STATUS_UNHANDLED;
  }

  if (p_dev->dev_status == BTHH_CONN_STATE_DISCONNECTED ||
      p_dev->dev_status == BTHH_CONN_STATE_DISCONNECTING) {
    log::error("device {} already disconnected.",
               p_dev->link_spec.ToRedactedStringForLogging());
    return BT_STATUS_DONE;
  } else if (p_dev->dev_status == BTHH_CONN_STATE_CONNECTING) {
    log::error("device {} is busy with disconnecting.",
               p_dev->link_spec.ToRedactedStringForLogging());
    return BT_STATUS_BUSY;
  }

  return btif_transfer_context(btif_hh_handle_evt, BTIF_HH_DISCONNECT_REQ_EVT,
                               (char*)&p_dev->link_spec, sizeof(tAclLinkSpec),
                               NULL);