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

Commit 076d7da0 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaController2: Add fastForward() / rewind()

Following CLs are included
  - Add MediaController2#fastForward() / rewind()
  - Add MediaSession2.SessionCallback#onFastForward() / rewind()

Bug: 74724709
Test: Build
Change-Id: Ic987132d69bd3d3ec707ede82c006fd001fb8de3
parent f5e51004
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -638,12 +638,14 @@ public class MediaController2Impl implements MediaController2Provider {

    @Override
    public void fastForward_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_FAST_FORWARD);
        // TODO(jaewan): Implement this. Note that fast forward isn't a transport command anymore
        //sendTransportControlCommand(MediaSession2.COMMAND_CODE_SESSION_FAST_FORWARD);
    }

    @Override
    public void rewind_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_REWIND);
        // TODO(jaewan): Implement this. Note that rewind isn't a transport command anymore
        //sendTransportControlCommand(MediaSession2.COMMAND_CODE_SESSION_REWIND);
    }

    @Override
+0 −22
Original line number Diff line number Diff line
@@ -624,28 +624,6 @@ public class MediaSession2Impl implements MediaSession2Provider {
        }
    }

    @Override
    public void fastForward_impl() {
        ensureCallingThread();
        final MediaPlayerBase player = mPlayer;
        if (player != null) {
            player.fastForward();
        } else if (DEBUG) {
            Log.d(TAG, "API calls after the close()", new IllegalStateException());
        }
    }

    @Override
    public void rewind_impl() {
        ensureCallingThread();
        final MediaPlayerBase player = mPlayer;
        if (player != null) {
            player.rewind();
        } else if (DEBUG) {
            Log.d(TAG, "API calls after the close()", new IllegalStateException());
        }
    }

    @Override
    public void seekTo_impl(long pos) {
        ensureCallingThread();
+0 −6
Original line number Diff line number Diff line
@@ -495,12 +495,6 @@ public class MediaSession2Stub extends IMediaSession2.Stub {
                case MediaSession2.COMMAND_CODE_PLAYBACK_PREPARE:
                    session.getInstance().prepare();
                    break;
                case MediaSession2.COMMAND_CODE_PLAYBACK_FAST_FORWARD:
                    session.getInstance().fastForward();
                    break;
                case MediaSession2.COMMAND_CODE_PLAYBACK_REWIND:
                    session.getInstance().rewind();
                    break;
                case MediaSession2.COMMAND_CODE_PLAYBACK_SEEK_TO:
                    session.getInstance().seekTo(args.getLong(ARGUMENT_KEY_POSITION));
                    break;