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

Commit eab3f4b6 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Jakub Pawlowski
Browse files

avrcp: Fix MediaPlayerList's circular dependency

MediaPlayerList should depend on the interfaces it defines and not their
derivatives from avrcp.

We need to decouple this to use this code in new upcoming media control
service.

Tag: #feature
Test: atest MediaPlayerListTest BrowserPlayerWrapperTest MediaPlayerWrapperTest
Bug: 150670922
Change-Id: Id879b427618b95973844bdf191deab57a6f4ded0
parent 33841a7c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -68,8 +68,7 @@ public class AvrcpTargetService extends ProfileService {

    private static AvrcpTargetService sInstance = null;

    class ListCallback implements MediaPlayerList.MediaUpdateCallback,
            MediaPlayerList.FolderUpdateCallback {
    class ListCallback implements MediaPlayerList.MediaUpdateCallback {
        @Override
        public void run(MediaData data) {
            if (mNativeInterface == null) return;
+3 −7
Original line number Diff line number Diff line
@@ -102,14 +102,14 @@ public class MediaPlayerList {
            Collections.synchronizedMap(new HashMap<Integer, BrowsedPlayerWrapper>());
    private int mActivePlayerId = NO_ACTIVE_PLAYER;

    @VisibleForTesting
    private MediaUpdateCallback mCallback;
    private boolean mAudioPlaybackIsActive = false;

    private AvrcpTargetService.ListCallback mCallback;
    private BrowsablePlayerConnector mBrowsablePlayerConnector;

    interface MediaUpdateCallback {
        void run(MediaData data);
        void run(boolean availablePlayers, boolean addressedPlayers, boolean uids);
    }

    interface GetPlayerRootCallback {
@@ -120,10 +120,6 @@ public class MediaPlayerList {
        void run(String parentId, List<ListItem> items);
    }

    interface FolderUpdateCallback {
        void run(boolean availablePlayers, boolean addressedPlayers, boolean uids);
    }

    MediaPlayerList(Looper looper, Context context) {
        Log.v(TAG, "Creating MediaPlayerList");

@@ -150,7 +146,7 @@ public class MediaPlayerList {
                mContext.getMainExecutor(), mMediaKeyEventSessionChangedListener);
    }

    void init(AvrcpTargetService.ListCallback callback) {
    void init(MediaUpdateCallback callback) {
        Log.v(TAG, "Initializing MediaPlayerList");
        mCallback = callback;