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

Commit 0042debc authored by David Zhao's avatar David Zhao Committed by Android (Google) Code Review
Browse files

Merge "Add setVideoFrozen and new playback command" into main

parents 18cdd062 a6dc90e6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -149,4 +149,7 @@ interface ITvInputManager {
    // For CTS purpose only. Add/remove a TvInputHardware device
    void addHardwareDevice(in int deviceId);
    void removeHardwareDevice(in int deviceId);

    // For freezing video playback
    void setVideoFrozen(in IBinder sessionToken, boolean isFrozen, int userId);
}
+3 −0
Original line number Diff line number Diff line
@@ -83,4 +83,7 @@ oneway interface ITvInputSession {
    // For TV messages
    void notifyTvMessage(int type, in Bundle data);
    void setTvMessageEnabled(int type, boolean enabled);

    // For freezing video
    void setVideoFrozen(boolean isFrozen);
}
+10 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    private static final int DO_NOTIFY_TV_MESSAGE = 32;
    private static final int DO_STOP_PLAYBACK = 33;
    private static final int DO_START_PLAYBACK = 34;
    private static final int DO_SET_VIDEO_FROZEN = 35;

    private final boolean mIsRecordingSession;
    private final HandlerCaller mCaller;
@@ -296,6 +297,10 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.startPlayback();
                break;
            }
            case DO_SET_VIDEO_FROZEN: {
                mTvInputSessionImpl.setVideoFrozen((Boolean) msg.obj);
                break;
            }
            default: {
                Log.w(TAG, "Unhandled message code: " + msg.what);
                break;
@@ -482,6 +487,11 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_NOTIFY_AD_BUFFER, buffer));
    }

    @Override
    public void setVideoFrozen(boolean isFrozen) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_VIDEO_FROZEN, isFrozen));
    }

    @Override
    public void notifyTvMessage(int type, Bundle data) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_NOTIFY_TV_MESSAGE, type, data));
+12 −0
Original line number Diff line number Diff line
@@ -3334,6 +3334,18 @@ public final class TvInputManager {
            }
        }

        void setVideoFrozen(boolean isFrozen) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.setVideoFrozen(mToken, isFrozen, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

        /**
         * Sends TV messages to the service for testing purposes
         */
+18 −0
Original line number Diff line number Diff line
@@ -1557,6 +1557,17 @@ public abstract class TvInputService extends Service {
        public void onStartPlayback() {
        }

        /**
         * Called when a request to freeze the video is received from the TV app. The audio should
         * continue playback while the video is frozen.
         *
         * <p> This should freeze the video to the last frame when the state is set to {@code true}.
         * @param isFrozen whether or not the video should be frozen.
         * @hide
         */
        public void onSetVideoFrozen(boolean isFrozen) {
        }

        /**
         * Called when the application requests to play a given recorded TV program.
         *
@@ -2033,6 +2044,13 @@ public abstract class TvInputService extends Service {
            onStartPlayback();
        }

        /**
         * Calls {@link #onSetVideoFrozen(boolean)}.
         */
        void setVideoFrozen(boolean isFrozen) {
            onSetVideoFrozen(isFrozen);
        }

        /**
         * Calls {@link #onTimeShiftPlay(Uri)}.
         */
Loading