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

Commit c4f0725d authored by Myles Watson's avatar Myles Watson
Browse files

Remove unused paging code

Bug: 286460419
Test: mma -j32
Change-Id: I92a70be583ffbef0d35c0343258aad9d8392e853
parent 6b5028ec
Loading
Loading
Loading
Loading
+0 −77
Original line number Diff line number Diff line
@@ -552,8 +552,6 @@ void btm_acl_device_down(void) {
  BTM_db_reset();
}

void btm_acl_set_paging(bool value) { btm_cb.is_paging = value; }

void btm_acl_update_inquiry_status(uint8_t status) {
  btm_cb.is_inquiry = status == BTM_INQUIRY_STARTED;
  BTIF_dm_report_inquiry_status_change(status);
@@ -2273,79 +2271,6 @@ void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
  }
}

/*******************************************************************************
 *
 * Function         btm_acl_resubmit_page
 *
 * Description      send pending page request
 *
 ******************************************************************************/
void btm_acl_resubmit_page(void) {
  BT_HDR* p_buf;
  uint8_t* pp;
  /* If there were other page request schedule can start the next one */
  p_buf = (BT_HDR*)fixed_queue_try_dequeue(btm_cb.page_queue);
  if (p_buf != NULL) {
    /* skip 3 (2 bytes opcode and 1 byte len) to get to the bd_addr
     * for both create_conn and rmt_name */
    pp = (uint8_t*)(p_buf + 1) + p_buf->offset + 3;

    RawAddress bda;
    STREAM_TO_BDADDR(bda, pp);

    btm_cb.connecting_bda = bda;
    memcpy(btm_cb.connecting_dc, btm_get_dev_class(bda), DEV_CLASS_LEN);

    btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p_buf);
  } else {
    btm_cb.paging = false;
  }
}

/*******************************************************************************
 *
 * Function         btm_acl_reset_paging
 *
 * Description      set paging to false and free the page queue - called at
 *                  hci_reset
 *
 ******************************************************************************/
void btm_acl_reset_paging(void) {
  BT_HDR* p;
  /* If we sent reset we are definitely not paging any more */
  while ((p = (BT_HDR*)fixed_queue_try_dequeue(btm_cb.page_queue)) != NULL)
    osi_free(p);

  btm_cb.paging = false;
}

/*******************************************************************************
 *
 * Function         btm_acl_paging
 *
 * Description      send a paging command or queue it in btm_cb
 *
 ******************************************************************************/
void btm_acl_paging(BT_HDR* p, const RawAddress& bda) {
  if (!BTM_IsAclConnectionUp(bda, BT_TRANSPORT_BR_EDR)) {
    VLOG(1) << "connecting_bda: "
            << ADDRESS_TO_LOGGABLE_STR(btm_cb.connecting_bda);
    if (btm_cb.paging && bda == btm_cb.connecting_bda) {
      fixed_queue_enqueue(btm_cb.page_queue, p);
    } else {
      btm_cb.connecting_bda = bda;
      memcpy(btm_cb.connecting_dc, btm_get_dev_class(bda), DEV_CLASS_LEN);

      btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
    }

    btm_cb.paging = true;
  } else /* ACL is already up */
  {
    btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
  }
}

/*******************************************************************************
 *
 * Function         btm_acl_notif_conn_collision
@@ -2685,7 +2610,6 @@ void on_acl_br_edr_connected(const RawAddress& bda, uint16_t handle,
    btm_sec_connected(bda, handle, HCI_SUCCESS, enc_mode);
  }
  delayed_role_change_ = nullptr;
  btm_acl_set_paging(false);
  l2c_link_hci_conn_comp(HCI_SUCCESS, handle, bda);
  uint16_t link_supervision_timeout =
      osi_property_get_int32(PROPERTY_LINK_SUPERVISION_TIMEOUT, 8000);
@@ -2719,7 +2643,6 @@ void on_acl_br_edr_failed(const RawAddress& bda, tHCI_STATUS status,
    btm_sec_connected(bda, HCI_INVALID_HANDLE, status, false);
  }
  delayed_role_change_ = nullptr;
  btm_acl_set_paging(false);
  l2c_link_hci_conn_comp(status, HCI_INVALID_HANDLE, bda);

  acl_set_locally_initiated(locally_initiated);
+1 −4
Original line number Diff line number Diff line
@@ -859,10 +859,7 @@ static bool btm_pm_device_in_scan_state(void) {
  /* Scan state-paging, inquiry, and trying to connect */

  /* Check for paging */
  if (btm_cb.is_paging || !fixed_queue_is_empty(btm_cb.page_queue)) {
    BTM_TRACE_DEBUG("btm_pm_device_in_scan_state- paging");
    return true;
  }
  // TODO: Get this information from connection manager?

  /* Check for inquiry */
  if ((btm_cb.btm_inq_vars.inq_active &
+0 −13
Original line number Diff line number Diff line
@@ -289,16 +289,7 @@ typedef struct tBTM_CB {
  RawAddress connecting_bda;
  DEV_CLASS connecting_dc;
  uint8_t trace_level;
  bool is_paging{false};  /* true, if paging is in progess */
  bool is_inquiry{false}; /* true, if inquiry is in progess */
  fixed_queue_t* page_queue{nullptr};

  bool paging{false};
  void set_paging() { paging = true; }
  void reset_paging() { paging = false; }
  bool is_paging_active() const {
    return paging;
  }  // TODO remove all this paging state

  fixed_queue_t* sec_pending_q{nullptr}; /* pending sequrity requests in
                                            tBTM_SEC_QUEUE_ENTRY format */
@@ -345,7 +336,6 @@ typedef struct tBTM_CB {
    acl_cb_ = {};
    neighbor = {};

    page_queue = fixed_queue_new(SIZE_MAX);
    sec_pending_q = fixed_queue_new(SIZE_MAX);
    sec_collision_timer = alarm_new("btm.sec_collision_timer");
    pairing_timer = alarm_new("btm.pairing_timer");
@@ -384,9 +374,6 @@ typedef struct tBTM_CB {
    sco_cb.Free();
    btm_inq_vars.Free();

    fixed_queue_free(page_queue, nullptr);
    page_queue = nullptr;

    fixed_queue_free(sec_pending_q, nullptr);
    sec_pending_q = nullptr;

+0 −5
Original line number Diff line number Diff line
@@ -2289,7 +2289,6 @@ void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr,
       !BTM_IsAclConnectionUp(btm_cb.connecting_bda, BT_TRANSPORT_BR_EDR)) ||
      (p_bd_addr && !BTM_IsAclConnectionUp(*p_bd_addr, BT_TRANSPORT_BR_EDR))) {
    LOG_WARN("Remote read request complete with no underlying link connection");
    btm_acl_resubmit_page();
  }

  /* If remote name request failed, p_bd_addr is null and we need to search */
@@ -3558,8 +3557,6 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle,
  bool addr_matched;
  uint8_t bit_shift = 0;

  btm_acl_resubmit_page();

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
  if (!p_dev_rec) {
    LOG_DEBUG(
@@ -3860,8 +3857,6 @@ void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason,
             hci_error_code_text(reason).c_str(), handle, comment.c_str());
  }

  btm_acl_resubmit_page();

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_handle(handle);
  if (p_dev_rec == nullptr) {
    LOG_WARN("Got disconnect for unknown device record handle:0x%04x", handle);
+0 −2
Original line number Diff line number Diff line
@@ -304,8 +304,6 @@ bool acl_peer_supports_ble_connection_subrating(const RawAddress& remote_bda);
bool acl_peer_supports_ble_connection_subrating_host(
    const RawAddress& remote_bda);

void btm_acl_set_paging(bool value);

void btm_process_cancel_complete(uint8_t status, uint8_t mode);

uint8_t btm_handle_to_acl_index(uint16_t hci_handle);
Loading