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

Commit 94844259 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Add stack/btm/btm_sco::btm_sco_on_disconnected am: 71de37e4 am: 3de25313 am: fb0f6981

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1553561

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5d12fc18309f1afaa44fb79e93395baed3e39446
parents 39ba0014 fb0f6981
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -852,6 +852,35 @@ bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) {
  return false;
}

void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) {
  tSCO_CONN* p_sco = btm_cb.sco_cb.get_sco_connection_from_handle(hci_handle);
  if (p_sco == nullptr) {
    LOG_ERROR("Unable to find sco connection");
    return;
  }

  if (!p_sco->is_active()) {
    LOG_ERROR("Connection is not active handle:0x%04x reason:%s", hci_handle,
              hci_reason_code_text(reason).c_str());
    return;
  }

  if (p_sco->state == SCO_ST_LISTENING) {
    LOG_ERROR("Connection is in listening state handle:0x%04x reason:%s",
              hci_handle, hci_reason_code_text(reason).c_str());
    return;
  }

  p_sco->state = SCO_ST_UNUSED;
  p_sco->hci_handle = HCI_INVALID_HANDLE;
  p_sco->rem_bd_known = false;
  p_sco->esco.p_esco_cback = NULL; /* Deregister eSCO callback */
  btm_cb.sco_cb.sco_disc_reason = reason;
  (*p_sco->p_disc_cb)(btm_cb.sco_cb.get_index(p_sco));
  LOG_DEBUG("Disconnected SCO link handle:%hu reason:%s", hci_handle,
            hci_reason_code_text(reason).c_str());
}

/*******************************************************************************
 *
 * Function         btm_sco_acl_removed