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

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

Re-align read remote version information on legacy am: 765a293b

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

Change-Id: Id708d38839dbf2d8e7187f24930aefc2bd4f6acb
parents 0068a6d3 765a293b
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -810,13 +810,33 @@ void BTM_default_block_role_switch() {
 * Returns          void
 *
 ******************************************************************************/
static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
static void maybe_chain_more_commands_after_read_remote_version_complete(
    uint8_t status, uint16_t handle) {
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  if (p_acl_cb == nullptr) {
    LOG_WARN("Received remote version complete for unknown device");
    return;
  }

  switch (p_acl_cb->transport) {
    case BT_TRANSPORT_LE:
      l2cble_notify_le_connection(p_acl_cb->remote_addr);
      l2cble_use_preferred_conn_params(p_acl_cb->remote_addr);
      break;
    case BT_TRANSPORT_BR_EDR:
      if (status == HCI_SUCCESS) {
        internal_.btm_read_remote_features(p_acl_cb->hci_handle);
      }
  }
}

void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
                                         uint8_t lmp_version,
                                         uint16_t manufacturer,
                                         uint16_t lmp_subversion) {
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  if (p_acl_cb == nullptr) {
    LOG_WARN("Received remote version complete for unknown device");
    LOG_WARN("Received remote version complete for unknown acl");
    return;
  }

@@ -825,19 +845,11 @@ static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
    p_acl_cb->manufacturer = manufacturer;
    p_acl_cb->lmp_subversion = lmp_subversion;

    if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) {
      internal_.btm_read_remote_features(p_acl_cb->hci_handle);
    }
    bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version,
                                            manufacturer, lmp_subversion);
  } else {
    bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0);
  }

  if (p_acl_cb->transport == BT_TRANSPORT_LE) {
    l2cble_notify_le_connection(p_acl_cb->remote_addr);
    l2cble_use_preferred_conn_params(p_acl_cb->remote_addr);
  }
}

void btm_read_remote_version_complete(uint8_t* p) {
@@ -855,6 +867,7 @@ void btm_read_remote_version_complete(uint8_t* p) {

  btm_process_remote_version_complete(status, handle, lmp_version, manufacturer,
                                      lmp_subversion);
  maybe_chain_more_commands_after_read_remote_version_complete(status, handle);
}

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