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

Commit 25bd25de authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSession2: Polish command codes

This is the preliminary step toward permission check.

Bug: 72618604
Test: Run all MediaComponents test once
Change-Id: I48e61fd5db8a1b878c546c641a474ac62fd207f6
parent a6020341
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ public class MediaController2Impl implements MediaController2Provider {

    @Override
    public void play_impl() {
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_START);
        sendTransportControlCommand(MediaSession2.COMMAND_CODE_PLAYBACK_PLAY);
    }

    @Override
+4 −14
Original line number Diff line number Diff line
@@ -641,20 +641,10 @@ public class MediaSession2Impl implements MediaSession2Provider {

        @Override
        public void addAllPredefinedCommands_impl() {
            // TODO(jaewan): Is there any better way than this?
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_START));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_PAUSE));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_STOP));
            mCommands.add(new Command(mContext,
                    MediaSession2.COMMAND_CODE_PLAYBACK_SKIP_NEXT_ITEM));
            mCommands.add(new Command(mContext,
                    MediaSession2.COMMAND_CODE_PLAYBACK_SKIP_PREV_ITEM));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_PREPARE));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_FAST_FORWARD));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_REWIND));
            mCommands.add(new Command(mContext, MediaSession2.COMMAND_CODE_PLAYBACK_SEEK_TO));
            mCommands.add(new Command(mContext,
                    MediaSession2.COMMAND_CODE_PLAYBACK_SET_CURRENT_PLAYLIST_ITEM));
            final int COMMAND_CODE_MAX = 22;
            for (int i = 1; i <= COMMAND_CODE_MAX; i++) {
                mCommands.add(new Command(mContext, i));
            }
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ public class MediaSession2Stub extends IMediaSession2.Stub {
            }

            switch (commandCode) {
                case MediaSession2.COMMAND_CODE_PLAYBACK_START:
                case MediaSession2.COMMAND_CODE_PLAYBACK_PLAY:
                    session.getInstance().play();
                    break;
                case MediaSession2.COMMAND_CODE_PLAYBACK_PAUSE: