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

Commit 2906e54e authored by pramod kotreshappa's avatar pramod kotreshappa Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth: Set folder depth 0 to fix IOT browsing issue

Some carkits try to do Change path when folder depth is 1 in
setBrowsePlayer resp assuming folder depth 1 is not the root
folder. DUT responds to change path with folder doesnot exit as a
result remote does not send GetFolderItem cmd.

Change-Id: I3689bbeebde1c1549924a3807ff39db7e5b33f74
CRs-fixed: 918831
parent b322cab6
Loading
Loading
Loading
Loading
+11 −16
Original line number Original line Diff line number Diff line
@@ -773,8 +773,8 @@ public final class Avrcp {
                String[] ExternalPath = stringUri.split("/");
                String[] ExternalPath = stringUri.split("/");
                if (ExternalPath.length < 4) {
                if (ExternalPath.length < 4) {
                    Log.d(TAG, "Wrong entries.");
                    Log.d(TAG, "Wrong entries.");
                    handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, 0, null)
                    handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, INTERNAL_ERROR,
                                                                        .sendToTarget();
                                                                  null).sendToTarget();
                    return;
                    return;
                }
                }
                Uri uri = Uri.parse(stringUri);
                Uri uri = Uri.parse(stringUri);
@@ -793,11 +793,11 @@ public final class Avrcp {
                    // Don't send the complete path to CK as few gets confused by that
                    // Don't send the complete path to CK as few gets confused by that
                    // Send only the name of the root folder
                    // Send only the name of the root folder
                    handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, NUM_ROOT_ELEMENTS,
                    handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, NUM_ROOT_ELEMENTS,
                                                1, SplitPath).sendToTarget();
                                                OPERATION_SUCCESSFUL, SplitPath).sendToTarget();
                }
                }
            } else {
            } else {
                handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, 0, null)
                handler.obtainMessage(MSG_UPDATE_BROWSED_PLAYER_FOLDER, 0, INTERNAL_ERROR,
                                                                    .sendToTarget();
                                                                  null).sendToTarget();
            }
            }
        }
        }


@@ -1766,8 +1766,9 @@ public final class Avrcp {
        updateResetNotification(NOW_PALYING_CONTENT_CHANGED_NOTIFICATION);
        updateResetNotification(NOW_PALYING_CONTENT_CHANGED_NOTIFICATION);
    }
    }


    void updateBrowsedPlayerFolder(int numOfItems, int folderDepth, String[] folderNames) {
    void updateBrowsedPlayerFolder(int numOfItems, int status, String[] folderNames) {
        Log.v(TAG, "updateBrowsedPlayerFolder: folderDepth: " + folderDepth);
        Log.v(TAG, "updateBrowsedPlayerFolder: numOfItems =  " + numOfItems
              + " status = " + status);
        if (mBrowserDevice == null) {
        if (mBrowserDevice == null) {
            Log.e(TAG,"mBrowserDevice is null for music player called api");
            Log.e(TAG,"mBrowserDevice is null for music player called api");
        }
        }
@@ -1781,15 +1782,9 @@ public final class Avrcp {
        deviceFeatures[deviceIndex].mCurrentPathUid = null;
        deviceFeatures[deviceIndex].mCurrentPathUid = null;
        deviceFeatures[deviceIndex].mMediaUri = mMediaUriStatic;
        deviceFeatures[deviceIndex].mMediaUri = mMediaUriStatic;
        mMediaUriStatic = null;
        mMediaUriStatic = null;
        if (folderDepth > 0) {

            setBrowsedPlayerRspNative((byte)OPERATION_SUCCESSFUL ,
        setBrowsedPlayerRspNative((byte)status, 0x0, numOfItems, 0x0, CHAR_SET_UTF8,
                    0x0, numOfItems, folderDepth, CHAR_SET_UTF8,
                    folderNames, getByteAddress(device));
        } else {
            setBrowsedPlayerRspNative((byte)INTERNAL_ERROR ,
                    0x0, numOfItems, folderDepth, CHAR_SET_UTF8,
                                   folderNames, getByteAddress(device));
                                   folderNames, getByteAddress(device));
        }
        mBrowserDevice = null;
        mBrowserDevice = null;
    }
    }