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

Commit 3487aa45 authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by android-build-merger
Browse files

Merge "AVRCP controller browsing range limit"

am: 522041df

Change-Id: I1915e8e32d89c305d3f6c2bdcb433f5aaf83722e
parents 65e69cbc 522041df
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -545,7 +545,7 @@ static void btavrcp_get_folder_items_callback(
  }
}

static void btavrcp_change_path_callback(RawAddress* bd_addr, uint8_t count) {
static void btavrcp_change_path_callback(RawAddress* bd_addr, uint32_t count) {
  ALOGI("%s count %d", __func__, count);
  CallbackEnv sCallbackEnv(__func__);
  if (!sCallbackEnv.valid()) return;
@@ -882,8 +882,7 @@ static void getPlaybackStateNative(JNIEnv* env, jobject object,
}

static void getNowPlayingListNative(JNIEnv* env, jobject object,
                                    jbyteArray address, jbyte start,
                                    jbyte items) {
                                    jbyteArray address, jint start, jint end) {
  if (!sBluetoothAvrcpInterface) return;
  jbyte* addr = env->GetByteArrayElements(address, NULL);
  if (!addr) {
@@ -892,7 +891,7 @@ static void getNowPlayingListNative(JNIEnv* env, jobject object,
  }
  ALOGV("%s: sBluetoothAvrcpInterface: %p", __func__, sBluetoothAvrcpInterface);
  bt_status_t status = sBluetoothAvrcpInterface->get_now_playing_list_cmd(
      (RawAddress*)addr, (uint8_t)start, (uint8_t)items);
      (RawAddress*)addr, start, end);
  if (status != BT_STATUS_SUCCESS) {
    ALOGE("Failed sending getNowPlayingListNative command, status: %d", status);
  }
@@ -900,7 +899,7 @@ static void getNowPlayingListNative(JNIEnv* env, jobject object,
}

static void getFolderListNative(JNIEnv* env, jobject object, jbyteArray address,
                                jbyte start, jbyte items) {
                                jint start, jint end) {
  if (!sBluetoothAvrcpInterface) return;
  jbyte* addr = env->GetByteArrayElements(address, NULL);
  if (!addr) {
@@ -909,7 +908,7 @@ static void getFolderListNative(JNIEnv* env, jobject object, jbyteArray address,
  }
  ALOGV("%s: sBluetoothAvrcpInterface: %p", __func__, sBluetoothAvrcpInterface);
  bt_status_t status = sBluetoothAvrcpInterface->get_folder_list_cmd(
      (RawAddress*)addr, (uint8_t)start, (uint8_t)items);
      (RawAddress*)addr, start, end);
  if (status != BT_STATUS_SUCCESS) {
    ALOGE("Failed sending getFolderListNative command, status: %d", status);
  }
@@ -917,7 +916,7 @@ static void getFolderListNative(JNIEnv* env, jobject object, jbyteArray address,
}

static void getPlayerListNative(JNIEnv* env, jobject object, jbyteArray address,
                                jbyte start, jbyte items) {
                                jint start, jint end) {
  if (!sBluetoothAvrcpInterface) return;
  jbyte* addr = env->GetByteArrayElements(address, NULL);
  if (!addr) {
@@ -927,7 +926,7 @@ static void getPlayerListNative(JNIEnv* env, jobject object, jbyteArray address,
  ALOGI("%s: sBluetoothAvrcpInterface: %p", __func__, sBluetoothAvrcpInterface);

  bt_status_t status = sBluetoothAvrcpInterface->get_player_list_cmd(
      (RawAddress*)addr, (uint8_t)start, (uint8_t)items);
      (RawAddress*)addr, start, end);
  if (status != BT_STATUS_SUCCESS) {
    ALOGE("Failed sending getPlayerListNative command, status: %d", status);
  }
@@ -1035,9 +1034,9 @@ static JNINativeMethod sMethods[] = {
    {"sendRegisterAbsVolRspNative", "([BBII)V",
     (void*)sendRegisterAbsVolRspNative},
    {"getPlaybackStateNative", "([B)V", (void*)getPlaybackStateNative},
    {"getNowPlayingListNative", "([BBB)V", (void*)getNowPlayingListNative},
    {"getFolderListNative", "([BBB)V", (void*)getFolderListNative},
    {"getPlayerListNative", "([BBB)V", (void*)getPlayerListNative},
    {"getNowPlayingListNative", "([BII)V", (void*)getNowPlayingListNative},
    {"getFolderListNative", "([BII)V", (void*)getFolderListNative},
    {"getPlayerListNative", "([BII)V", (void*)getPlayerListNative},
    {"changeFolderPathNative", "([BB[B)V", (void*)changeFolderPathNative},
    {"playItemNative", "([BB[BI)V", (void*)playItemNative},
    {"setBrowsedPlayerNative", "([BI)V", (void*)setBrowsedPlayerNative},
+3 −3
Original line number Diff line number Diff line
@@ -1120,13 +1120,13 @@ public class AvrcpControllerService extends ProfileService {
    static native void getPlaybackStateNative(byte[] address);

    /* API used to fetch the current now playing list */
    static native void getNowPlayingListNative(byte[] address, byte start, byte end);
    static native void getNowPlayingListNative(byte[] address, int start, int end);

    /* API used to fetch the current folder's listing */
    static native void getFolderListNative(byte[] address, byte start, byte end);
    static native void getFolderListNative(byte[] address, int start, int end);

    /* API used to fetch the listing of players */
    static native void getPlayerListNative(byte[] address, byte start, byte end);
    static native void getPlayerListNative(byte[] address, int start, int end);

    /* API used to change the folder */
    static native void changeFolderPathNative(byte[] address, byte direction, byte[] uid);
+14 −4
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ class AvrcpControllerStateMachine extends StateMachine {

                    case MESSAGE_PROCESS_SET_ADDRESSED_PLAYER:
                        AvrcpControllerService.getPlayerListNative(
                                mRemoteDevice.getBluetoothAddress(), (byte) 0, (byte) 255);
                                mRemoteDevice.getBluetoothAddress(), 0, 255);
                        transitionTo(mGetPlayerListing);
                        sendMessageDelayed(MESSAGE_INTERNAL_CMD_TIMEOUT, CMD_TIMEOUT_MILLIS);
                        break;
@@ -602,7 +602,7 @@ class AvrcpControllerStateMachine extends StateMachine {
                        transitionTo(mConnected);
                    } else {
                        // Fetch the next set of items.
                        callNativeFunctionForScope((byte) mCurrInd, (byte) Math.min(mEndInd,
                        callNativeFunctionForScope(mCurrInd, Math.min(mEndInd,
                                mCurrInd + GET_FOLDER_ITEMS_PAGINATION_SIZE - 1));
                        // Reset the timeout message since we are doing a new fetch now.
                        removeMessages(MESSAGE_INTERNAL_CMD_TIMEOUT);
@@ -624,6 +624,16 @@ class AvrcpControllerStateMachine extends StateMachine {
                    transitionTo(mConnected);
                    break;

                case MESSAGE_CHANGE_FOLDER_PATH:
                case MESSAGE_FETCH_ATTR_AND_PLAY_ITEM:
                case MESSAGE_GET_PLAYER_LIST:
                case MESSAGE_GET_NOW_PLAYING_LIST:
                case MESSAGE_SET_BROWSED_PLAYER:
                    // A new request has come in, no need to fetch more.
                    mEndInd = 0;
                    deferMessage(msg);
                    break;

                case MESSAGE_SEND_PASS_THROUGH_CMD:
                case MESSAGE_SEND_GROUP_NAVIGATION_CMD:
                case MESSAGE_PROCESS_SET_ABS_VOL_CMD:
@@ -677,11 +687,11 @@ class AvrcpControllerStateMachine extends StateMachine {
            switch (mScope) {
                case AvrcpControllerService.BROWSE_SCOPE_NOW_PLAYING:
                    AvrcpControllerService.getNowPlayingListNative(
                            mRemoteDevice.getBluetoothAddress(), (byte) start, (byte) end);
                            mRemoteDevice.getBluetoothAddress(), start, end);
                    break;
                case AvrcpControllerService.BROWSE_SCOPE_VFS:
                    AvrcpControllerService.getFolderListNative(mRemoteDevice.getBluetoothAddress(),
                            (byte) start, (byte) end);
                            start, end);
                    break;
                default:
                    Log.e(STATE_TAG, "Scope " + mScope + " cannot be handled here.");