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

Commit 3349cac8 authored by Sanket Agarwal's avatar Sanket Agarwal
Browse files

[AVRCP1.6 CT] Add reply status to get_folder_items_callback.

It is useful to know what error code the get_folder_items_cmd gets back
with since it can help the UI decide if to keep fetching more. For ex.
if the return code is out of range then the UI does not need to keep
fetching anymore. This is useful for folders where we do not know the
size before hand (Media Player List or Now Playing List).

Bug: b/31253501

Change-Id: I0f43167d00bcf2e1e320be086fd9cacd163906a1
(cherry picked from commit e3a032a89ac2f20e96808fe2bded2c42fa3afb14)
parent 590370a8
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -4115,7 +4115,10 @@ static void handle_get_folder_items_response(tBTA_AV_META_MSG* pmeta_msg,
      }
    }

    HAL_CBACK(bt_rc_ctrl_callbacks, get_folder_items_cb, &rc_addr,
    HAL_CBACK(bt_rc_ctrl_callbacks,
              get_folder_items_cb,
              &rc_addr,
              BTRC_STS_NO_ERROR,
              /* We want to make the ownership explicit in native */
              (const btrc_folder_items_t*)btrc_items, item_count);
    BTIF_TRACE_DEBUG("%s HAL CBACK get_folder_items_cb finished", __func__);
@@ -4124,6 +4127,11 @@ static void handle_get_folder_items_response(tBTA_AV_META_MSG* pmeta_msg,
    osi_free(btrc_items);
  } else {
    BTIF_TRACE_ERROR("%s: Error %d", __func__, p_rsp->status);
    HAL_CBACK(bt_rc_ctrl_callbacks,
              get_folder_items_cb,
              &rc_addr,
              (btrc_status_t) p_rsp->status,
              NULL, 0);
  }
}

@@ -5006,7 +5014,7 @@ static bt_status_t set_browsed_player_cmd(bt_bdaddr_t* bd_addr, uint16_t id) {
 *
 **************************************************************************/
static bt_status_t get_folder_items_cmd(bt_bdaddr_t* bd_addr, uint8_t scope,
                                        uint8_t start_item, uint8_t num_items) {
                                        uint8_t start_item, uint8_t end_item) {
  BTIF_TRACE_DEBUG("%s", __func__);
  /* Check that both avrcp and browse channel are connected. */
  btif_rc_device_cb_t* p_dev = btif_rc_get_device_by_bda(bd_addr);
@@ -5027,7 +5035,7 @@ static bt_status_t get_folder_items_cmd(bt_bdaddr_t* bd_addr, uint8_t scope,
    avrc_cmd.get_items.status = AVRC_STS_NO_ERROR;
    avrc_cmd.get_items.scope = scope;
    avrc_cmd.get_items.start_item = start_item;
    avrc_cmd.get_items.end_item = (start_item + num_items - 1);
    avrc_cmd.get_items.end_item = end_item;
    avrc_cmd.get_items.attr_count = 0; /* p_attr_list does not matter hence */

    if (AVRC_BldCommand(&avrc_cmd, &p_msg) == AVRC_STS_NO_ERROR) {
+2 −1
Original line number Diff line number Diff line
@@ -390,7 +390,8 @@ static tAVRC_STS avrc_bld_get_play_status_cmd(BT_HDR * p_pkt)
*******************************************************************************/
static tAVRC_STS avrc_bld_get_folder_items_cmd(BT_HDR *p_pkt, const tAVRC_GET_ITEMS_CMD *cmd)
{
    AVRC_TRACE_API("avrc_bld_get_folder_items_cmd");
    AVRC_TRACE_API("avrc_bld_get_folder_items_cmd scope %d, start_item %d, end_item %d",
                   cmd->scope, cmd->start_item, cmd->end_item);
    uint8_t *p_start = (uint8_t *)(p_pkt + 1) + p_pkt->offset;
    /* This is where the PDU specific for AVRC starts
     * AVRCP Spec 1.4 section 22.19 */
+5 −0
Original line number Diff line number Diff line
@@ -196,6 +196,11 @@ static tAVRC_STS avrc_pars_browse_rsp(tAVRC_MSG_BROWSE *p_msg, tAVRC_RESPONSE *p
                            __func__, get_item_rsp->pdu, get_item_rsp->status, pkt_len,
                            get_item_rsp->uid_counter, get_item_rsp->item_count);

        if (get_item_rsp->status != AVRC_STS_NO_ERROR) {
            AVRC_TRACE_WARNING("%s returning error %d", __func__, get_item_rsp->status);
            return get_item_rsp->status;
        }

        /* get each of the items */
        get_item_rsp->p_item_list =
            (tAVRC_ITEM *) osi_malloc (get_item_rsp->item_count * (sizeof(tAVRC_ITEM)));