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

Commit b6f673ff authored by Ayan Ghosh's avatar Ayan Ghosh Committed by Gerrit - the friendly Code Review server
Browse files

Introduce new interface class for Avrcp Browsing feature

Separate out Avrcp Browsing Apis from SDK interface class to
ensure compatibility with all available apps implementing the
mentioned SDK interface class.

CRs-Fixed: 803375
Change-Id: I713527ee3622ba28fe92d5bc743b9471632299b3
parent d684b41b
Loading
Loading
Loading
Loading
+57 −53
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import java.util.List;
    private boolean mIsRegistered = false;
    private PendingIntent mClientPendingIntentCurrent;
    private OnClientUpdateListener mOnClientUpdateListener;
    private OnClientAvrcpUpdateListener mOnClientAvrcpUpdateListener;
    private PlaybackInfo mLastPlaybackInfo;
    private int mArtworkWidth = -1;
    private int mArtworkHeight = -1;
@@ -150,6 +151,25 @@ import java.util.List;
        }
    }

    /**
     * @hide
     */
    public RemoteController(Context context, OnClientUpdateListener updateListener, Looper looper,
                OnClientAvrcpUpdateListener avrcpUpdateListener) throws IllegalArgumentException {
        this(context, updateListener, looper);
        mOnClientAvrcpUpdateListener = avrcpUpdateListener;
    }

    /**
     * @hide
     */
    public interface OnClientAvrcpUpdateListener {
        public void onClientFolderInfoBrowsedPlayer(String stringUri);
        public void onClientUpdateNowPlayingEntries(long[] playList);
        public void onClientNowPlayingContentChange();
        public void onClientPlayItemResponse(boolean success);
    };


    /**
     * Interface definition for the callbacks to be invoked whenever media events, metadata
@@ -205,27 +225,6 @@ import java.util.List;
         * @param metadataEditor the container of the new metadata.
         */
        public void onClientMetadataUpdate(MetadataEditor metadataEditor);

        /**
         * @hide
         */
        public void onClientFolderInfoBrowsedPlayer(String stringUri);

        /**
         * @hide
         */
        public void onClientUpdateNowPlayingEntries(long[] playList);

        /**
         * @hide
         */
        public void onClientNowPlayingContentChange();

        /**
         * @hide
         */
        public void onClientPlayItemResponse(boolean success);

    };


@@ -1171,67 +1170,72 @@ import java.util.List;
        }
    }

    /**
     * @hide
     */
    public void onFolderInfoBrowsedPlayer(String stringUri) {
    private void onFolderInfoBrowsedPlayer(String stringUri) {
        Log.d(TAG, "RemoteController: onFolderInfoBrowsedPlayer");
        final OnClientUpdateListener l;
        final OnClientAvrcpUpdateListener l;

        synchronized(mInfoLock) {
            l = mOnClientUpdateListener;
            l = mOnClientAvrcpUpdateListener;
        }

        try {
            if (l != null) {
                l.onClientFolderInfoBrowsedPlayer(stringUri);
            }
        } catch (Exception e) {
            Log.e(TAG, "Error Updating AVRCP on receiving Browsed player response", e);
        }
    }

    /**
     * @hide
     */
    public void onNowPlayingEntriesUpdate(long[] playList) {
    private void onNowPlayingEntriesUpdate(long[] playList) {
        Log.d(TAG, "RemoteController: onUpdateNowPlayingEntries");
        final OnClientUpdateListener l;
        final OnClientAvrcpUpdateListener l;

        synchronized(mInfoLock) {
            l = mOnClientUpdateListener;
            l = mOnClientAvrcpUpdateListener;
        }

        try {
            if (l != null) {
                l.onClientUpdateNowPlayingEntries(playList);
            }
        } catch (Exception e) {
            Log.e(TAG, "Error Updating AVRCP on receiving Now Playing Entries", e);
        }
    }

    /**
     * @hide
     */
    public void onNowPlayingContentChange() {
    private void onNowPlayingContentChange() {
        Log.d(TAG, "RemoteController: onNowPlayingContentChange");
        final OnClientUpdateListener l;
        final OnClientAvrcpUpdateListener l;

        synchronized(mInfoLock) {
            l = mOnClientUpdateListener;
            l = mOnClientAvrcpUpdateListener;
        }

        try {
            if (l != null) {
                l.onClientNowPlayingContentChange();
            }
        } catch (Exception e) {
            Log.e(TAG, "Error Updating AVRCP on Now Playing Content Change", e);
        }
    }

    /**
     * @hide
     */
    public void onSetPlayItemResponse(boolean success) {
    private void onSetPlayItemResponse(boolean success) {
        Log.d(TAG, "RemoteController: onPlayItemResponse");
        final OnClientUpdateListener l;
        final OnClientAvrcpUpdateListener l;

        synchronized(mInfoLock) {
            l = mOnClientUpdateListener;
            l = mOnClientAvrcpUpdateListener;
        }

        try {
            if (l != null) {
                l.onClientPlayItemResponse(success);
            }
        } catch (Exception e) {
            Log.e(TAG, "Error Updating AVRCP on receiving Play Item response", e);
        }
    }

    //==================================================
+0 −12
Original line number Diff line number Diff line
@@ -138,18 +138,6 @@ public class KeyguardTransportControlView extends FrameLayout {
        public void onClientMetadataUpdate(RemoteController.MetadataEditor metadataEditor) {
            updateMetadata(metadataEditor);
        }

        @Override
        public void onClientFolderInfoBrowsedPlayer(String stringUri) { }

        @Override
        public void onClientUpdateNowPlayingEntries(long[] playList) { }

        @Override
        public void onClientNowPlayingContentChange() { }

        @Override
        public void onClientPlayItemResponse(boolean success) { }
    };

    private class UpdateSeekBarRunnable implements  Runnable {