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

Commit a6c90eed authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by Gerrit Code Review
Browse files

Merge "AVRCP Controller media session queue"

parents 45a18a1f 5a70486e
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -47,6 +47,7 @@ static jmethodID method_handleChangeFolderRsp;
static jmethodID method_handleSetBrowsedPlayerRsp;
static jmethodID method_handleSetBrowsedPlayerRsp;
static jmethodID method_handleSetAddressedPlayerRsp;
static jmethodID method_handleSetAddressedPlayerRsp;
static jmethodID method_handleAddressedPlayerChanged;
static jmethodID method_handleAddressedPlayerChanged;
static jmethodID method_handleNowPlayingContentChanged;


static jclass class_MediaBrowser_MediaItem;
static jclass class_MediaBrowser_MediaItem;
static jclass class_AvrcpPlayer;
static jclass class_AvrcpPlayer;
@@ -591,6 +592,17 @@ static void btavrcp_addressed_player_changed_callback(const RawAddress& bd_addr,
                               method_handleAddressedPlayerChanged, (jint)id);
                               method_handleAddressedPlayerChanged, (jint)id);
}
}


static void btavrcp_now_playing_content_changed_callback(
    const RawAddress& bd_addr) {
  ALOGI("%s", __func__);

  CallbackEnv sCallbackEnv(__func__);
  if (!sCallbackEnv.valid()) return;

  sCallbackEnv->CallVoidMethod(sCallbacksObj,
                               method_handleNowPlayingContentChanged);
}

static btrc_ctrl_callbacks_t sBluetoothAvrcpCallbacks = {
static btrc_ctrl_callbacks_t sBluetoothAvrcpCallbacks = {
    sizeof(sBluetoothAvrcpCallbacks),
    sizeof(sBluetoothAvrcpCallbacks),
    btavrcp_passthrough_response_callback,
    btavrcp_passthrough_response_callback,
@@ -609,7 +621,8 @@ static btrc_ctrl_callbacks_t sBluetoothAvrcpCallbacks = {
    btavrcp_change_path_callback,
    btavrcp_change_path_callback,
    btavrcp_set_browsed_player_callback,
    btavrcp_set_browsed_player_callback,
    btavrcp_set_addressed_player_callback,
    btavrcp_set_addressed_player_callback,
    btavrcp_addressed_player_changed_callback};
    btavrcp_addressed_player_changed_callback,
    btavrcp_now_playing_content_changed_callback};


static void classInitNative(JNIEnv* env, jclass clazz) {
static void classInitNative(JNIEnv* env, jclass clazz) {
  method_handlePassthroughRsp =
  method_handlePassthroughRsp =
@@ -673,6 +686,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
      env->GetMethodID(clazz, "handleSetAddressedPlayerRsp", "(I)V");
      env->GetMethodID(clazz, "handleSetAddressedPlayerRsp", "(I)V");
  method_handleAddressedPlayerChanged =
  method_handleAddressedPlayerChanged =
      env->GetMethodID(clazz, "handleAddressedPlayerChanged", "(I)V");
      env->GetMethodID(clazz, "handleAddressedPlayerChanged", "(I)V");
  method_handleNowPlayingContentChanged =
      env->GetMethodID(clazz, "handleNowPlayingContentChanged", "()V");


  ALOGI("%s: succeeds", __func__);
  ALOGI("%s: succeeds", __func__);
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -237,6 +237,7 @@
    <string name="process" translate="false"><xliff:g id="x" /></string>
    <string name="process" translate="false"><xliff:g id="x" /></string>




    <string name="bluetooth_a2dp_sink_queue_name">Now Playing</string>
    <string name="bluetooth_map_settings_save">Save</string>
    <string name="bluetooth_map_settings_save">Save</string>
    <string name="bluetooth_map_settings_cancel">Cancel</string>
    <string name="bluetooth_map_settings_cancel">Cancel</string>
    <string name="bluetooth_map_settings_intro">Select the accounts you want to share through Bluetooth. You still have to accept any access to the accounts when connecting.</string>
    <string name="bluetooth_map_settings_intro">Select the accounts you want to share through Bluetooth. You still have to accept any access to the accounts when connecting.</string>
+8 −0
Original line number Original line Diff line number Diff line
@@ -904,6 +904,14 @@ public class AvrcpControllerService extends ProfileService {
        mAvrcpCtSm.sendMessage(msg);
        mAvrcpCtSm.sendMessage(msg);
    }
    }


    private void handleNowPlayingContentChanged() {
        if (DBG) {
            Log.d(TAG, "handleNowPlayingContentChanged");
        }
        mAvrcpCtSm.sendMessage(
                AvrcpControllerStateMachine.MESSAGE_PROCESS_NOW_PLAYING_CONTENTS_CHANGED);
    }

    @Override
    @Override
    public void dump(StringBuilder sb) {
    public void dump(StringBuilder sb) {
        super.dump(sb);
        super.dump(sb);
+7 −1
Original line number Original line Diff line number Diff line
@@ -68,6 +68,7 @@ class AvrcpControllerStateMachine extends StateMachine {
    static final int MESSAGE_PROCESS_SET_BROWSED_PLAYER = 113;
    static final int MESSAGE_PROCESS_SET_BROWSED_PLAYER = 113;
    static final int MESSAGE_PROCESS_SET_ADDRESSED_PLAYER = 114;
    static final int MESSAGE_PROCESS_SET_ADDRESSED_PLAYER = 114;
    static final int MESSAGE_PROCESS_ADDRESSED_PLAYER_CHANGED = 115;
    static final int MESSAGE_PROCESS_ADDRESSED_PLAYER_CHANGED = 115;
    static final int MESSAGE_PROCESS_NOW_PLAYING_CONTENTS_CHANGED = 116;


    // commands for connection
    // commands for connection
    static final int MESSAGE_PROCESS_RC_FEATURES = 301;
    static final int MESSAGE_PROCESS_RC_FEATURES = 301;
@@ -361,7 +362,6 @@ class AvrcpControllerStateMachine extends StateMachine {
                        boolean updateTrack =
                        boolean updateTrack =
                                mAddressedPlayer.updateCurrentTrack((TrackInfo) msg.obj);
                                mAddressedPlayer.updateCurrentTrack((TrackInfo) msg.obj);
                        if (updateTrack) {
                        if (updateTrack) {
                            mBrowseTree.mNowPlayingNode.setCached(false);
                            broadcastMetaDataChanged(
                            broadcastMetaDataChanged(
                                    mAddressedPlayer.getCurrentTrack().getMediaMetaData());
                                    mAddressedPlayer.getCurrentTrack().getMediaMetaData());
                        }
                        }
@@ -398,6 +398,12 @@ class AvrcpControllerStateMachine extends StateMachine {
                        sendMessage(MESSAGE_PROCESS_SET_ADDRESSED_PLAYER);
                        sendMessage(MESSAGE_PROCESS_SET_ADDRESSED_PLAYER);
                        break;
                        break;


                    case MESSAGE_PROCESS_NOW_PLAYING_CONTENTS_CHANGED:
                        mBrowseTree.mNowPlayingNode.setCached(false);
                        mGetFolderList.setFolder(mBrowseTree.mNowPlayingNode.getID());
                        transitionTo(mGetFolderList);
                        break;

                    default:
                    default:
                        Log.d(TAG, "Unhandled message" + msg.what);
                        Log.d(TAG, "Unhandled message" + msg.what);
                        return false;
                        return false;
+2 −1
Original line number Original line Diff line number Diff line
@@ -118,7 +118,8 @@ class AvrcpPlayer {
                break;
                break;
        }
        }
        return new PlaybackState.Builder().setState(mPlayStatus, position, speed)
        return new PlaybackState.Builder().setState(mPlayStatus, position, speed)
            .setActions(mAvailableActions).build();
            .setActions(mAvailableActions).setActiveQueueItemId(mCurrentTrack.mTrackNum - 1)
            .build();
    }
    }


    public synchronized boolean updateCurrentTrack(TrackInfo update) {
    public synchronized boolean updateCurrentTrack(TrackInfo update) {
Loading