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

Commit 8515256a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Handle seek requests in AudioService" into jb-mr2-dev

parents c37b63d6 3fbf67e2
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -3534,6 +3534,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    onNewPlaybackStateForRcc(msg.arg1 /* rccId */, msg.arg2 /* state */,
                            (RccPlaybackState)msg.obj /* newState */);
                    break;
                case MSG_RCC_SEEK_REQUEST:
                    onSetRemoteControlClientPlaybackPosition(msg.arg1 /* generationId */,
                            ((Long)msg.obj).longValue() /* timeMs */);

                case MSG_SET_RSX_CONNECTION_STATE:
                    onSetRsxConnectionState(msg.arg1/*available*/, msg.arg2/*address*/);
@@ -5867,7 +5870,16 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
    }

    public void setRemoteControlClientPlaybackPosition(int generationId, long timeMs) {
        sendMsg(mAudioHandler, MSG_RCC_SEEK_REQUEST, SENDMSG_QUEUE, generationId /* arg1 */,
        // ignore position change requests if invalid generation ID
        synchronized(mRCStack) {
            synchronized(mCurrentRcLock) {
                if (mCurrentRcClientGen != generationId) {
                    return;
                }
            }
        }
        // discard any unprocessed seek request in the message queue, and replace with latest
        sendMsg(mAudioHandler, MSG_RCC_SEEK_REQUEST, SENDMSG_REPLACE, generationId /* arg1 */,
                0 /* arg2 ignored*/, new Long(timeMs) /* obj */, 0 /* delay */);
    }

+4 −1
Original line number Diff line number Diff line
@@ -683,9 +683,12 @@ public class RemoteControlClient
        /**
         * Called on the implementer to notify it that the playback head should be set at the given
         * position. If the position can be changed from its current value, the implementor of
         * the interface should also update the playback position using
         * the interface must also update the playback position using
         * {@link RemoteControlClient#setPlaybackState(int, long, int)} to reflect the actual new
         * position being used, regardless of whether it differs from the requested position.
         * Failure to do so would cause the system to not know the new actual playback position,
         * and user interface components would fail to show the user where playback resumed after
         * the position was updated.
         * @param newPositionMs the new requested position in the current media, expressed in ms.
         */
        void onPlaybackPositionUpdate(long newPositionMs);