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

Commit 9cb194c4 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

AVRCP Controller getFolderItems

Fix the getFolderItems end item to be 0 indexed rather than 1 indexed.
This was causing fetching to end with an out of range error.

Bug: 113104809
Test: Perform browsing of folders.
Change-Id: Ica7713f8cf2d6a08919df15965cc59b992206b4a
parent a6c90eed
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -564,21 +564,21 @@ class AvrcpControllerStateMachine extends StateMachine {
        }

        private void fetchContents(BrowseTree.BrowseNode target) {
            int start = target.getChildrenCount();
            int end = Math.min(target.getExpectedChildren(), target.getChildrenCount()
                            + GET_FOLDER_ITEMS_PAGINATION_SIZE) - 1;
            switch (target.getScope()) {
                case AvrcpControllerService.BROWSE_SCOPE_PLAYER_LIST:
                    AvrcpControllerService.getPlayerListNative(mRemoteDevice.getBluetoothAddress(),
                            0, 255);
                            start, end);
                    break;
                case AvrcpControllerService.BROWSE_SCOPE_NOW_PLAYING:
                    AvrcpControllerService.getNowPlayingListNative(
                            mRemoteDevice.getBluetoothAddress(), target.getChildrenCount(),
                            Math.min(target.getExpectedChildren(), target.getChildrenCount()
                            + GET_FOLDER_ITEMS_PAGINATION_SIZE - 1));
                            mRemoteDevice.getBluetoothAddress(), start, end);
                    break;
                case AvrcpControllerService.BROWSE_SCOPE_VFS:
                    AvrcpControllerService.getFolderListNative(mRemoteDevice.getBluetoothAddress(),
                            target.getChildrenCount(), Math.min(target.getExpectedChildren(),
                                target.getChildrenCount() + GET_FOLDER_ITEMS_PAGINATION_SIZE - 1));
                            start, end);
                    break;
                default:
                    Log.e(STATE_TAG, "Scope " + target.getScope() + " cannot be handled here.");
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class BrowseTree {
        mRootNode = new BrowseNode(new MediaItem(new MediaDescription.Builder().setExtras(mdBundle)
              .setMediaId(ROOT).setTitle(ROOT).build(), MediaItem.FLAG_BROWSABLE));
        mRootNode.mBrowseScope = AvrcpControllerService.BROWSE_SCOPE_PLAYER_LIST;
        mRootNode.setExpectedChildren(255);

        Bundle upnodeBundle = new Bundle();
        upnodeBundle.putString(AvrcpControllerService.MEDIA_ITEM_UID_KEY, UP);