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

Commit 83a086d0 authored by David Zhao's avatar David Zhao
Browse files

Unhide FreezeVideo APIs

Also fills in a missing notification in TvView

Test: atest TvInputServiceTest
Bug: 309553570
Change-Id: I50766a275ab3580546eec37289ba984a07ed9a4c
parent fb00f828
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27398,6 +27398,7 @@ package android.media.tv {
    method public void notifyTuned(@NonNull android.net.Uri);
    method public void notifyTvMessage(int, @NonNull android.os.Bundle);
    method public void notifyVideoAvailable();
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void notifyVideoFreezeUpdated(boolean);
    method public void notifyVideoUnavailable(int);
    method public void onAdBufferReady(@NonNull android.media.tv.AdBuffer);
    method public void onAppPrivateCommand(@NonNull String, android.os.Bundle);
@@ -27566,6 +27567,7 @@ package android.media.tv {
    method public void setStreamVolume(@FloatRange(from=0.0, to=1.0) float);
    method public void setTimeShiftPositionCallback(@Nullable android.media.tv.TvView.TimeShiftPositionCallback);
    method public void setTvMessageEnabled(int, boolean);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void setVideoFrozen(boolean);
    method public void setZOrderMediaOverlay(boolean);
    method public void setZOrderOnTop(boolean);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void stopPlayback(int);
@@ -27609,6 +27611,7 @@ package android.media.tv {
    method public void onTuned(@NonNull String, @NonNull android.net.Uri);
    method public void onTvMessage(@NonNull String, int, @NonNull android.os.Bundle);
    method public void onVideoAvailable(String);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void onVideoFreezeUpdated(@NonNull String, boolean);
    method public void onVideoSizeChanged(String, int, int);
    method public void onVideoUnavailable(String, int);
  }
@@ -27779,6 +27782,7 @@ package android.media.tv.interactive {
    method public void onTvRecordingInfo(@Nullable android.media.tv.TvRecordingInfo);
    method public void onTvRecordingInfoList(@NonNull java.util.List<android.media.tv.TvRecordingInfo>);
    method public void onVideoAvailable();
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void onVideoFreezeUpdated(boolean);
    method public void onVideoUnavailable(int);
    method @CallSuper public void removeBroadcastInfo(int);
    method @CallSuper public void requestAd(@NonNull android.media.tv.AdRequest);
@@ -27841,6 +27845,7 @@ package android.media.tv.interactive {
    method public void notifyTimeShiftStartPositionChanged(@NonNull String, long);
    method public void notifyTimeShiftStatusChanged(@NonNull String, int);
    method public void notifyTvMessage(@NonNull int, @NonNull android.os.Bundle);
    method @FlaggedApi("android.media.tv.flags.tiaf_v_apis") public void notifyVideoFreezeUpdated(boolean);
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void onLayout(boolean, int, int, int, int);
+2 −2
Original line number Diff line number Diff line
@@ -768,12 +768,12 @@ public abstract class TvInputService extends Service {
        /**
         * Informs the application that the video freeze state has been updated.
         *
         * When {@code true}, the video is frozen on the last frame but audio playback remains
         * <p>When {@code true}, the video is frozen on the last frame but audio playback remains
         * active.
         *
         * @param isFrozen Whether or not the video is frozen
         * @hide
         */
        @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
        public void notifyVideoFreezeUpdated(boolean isFrozen) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
+29 −3
Original line number Diff line number Diff line
@@ -687,9 +687,11 @@ public class TvView extends ViewGroup {
     * received with the command to freeze the video.
     *
     * <p>This will freeze the video to the last frame when the state is set to {@code true}.
     *
     * @see TvView.TvInputCallback#setVideoFrozen(boolean)
     * @param isFrozen whether or not the video is frozen.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
    public void setVideoFrozen(boolean isFrozen) {
        if (mSession != null) {
            mSession.setVideoFrozen(isFrozen);
@@ -1325,6 +1327,16 @@ public class TvView extends ViewGroup {
        public void onTvMessage(@NonNull String inputId,
                @TvInputManager.TvMessageType int type, @NonNull Bundle data) {
        }

        /**
         * This is called when the video freeze status is updated.
         *
         * @see #setVideoFrozen(boolean)
         * @param inputId The ID of the TV input bound to this view.
         * @param isFrozen Whether or not the video is currently frozen on the las
         */
        @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
        public void onVideoFreezeUpdated(@NonNull String inputId, boolean isFrozen) {}
    }

    /**
@@ -1753,5 +1765,19 @@ public class TvView extends ViewGroup {
                mCallback.onTvMessage(mInputId, type, data);
            }
        }

        @Override
        public void onVideoFreezeUpdated(Session session, boolean isFrozen) {
            if (DEBUG) {
                Log.d(TAG, "onVideoFreezeUpdated(isFrozen=" + isFrozen + ")");
            }
            if (this != mSessionCallback) {
                Log.w(TAG, "onVideoFreezeUpdated - session not created");
                return;
            }
            if (mCallback != null) {
                mCallback.onVideoFreezeUpdated(mInputId, isFrozen);
            }
        }
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -896,13 +896,13 @@ public abstract class TvInteractiveAppService extends Service {
        }

        /**
         * Called when video becomes frozen or unfrozen. Audio playback will continue while
         * video will be frozen to the last frame if {@code true}.
         * Called when video becomes frozen or unfrozen. Audio playback will continue while video
         * will be frozen to the last frame if {@code true}.
         *
         * @param isFrozen Whether or not the video is frozen.
         * @hide
         */
        public void onVideoFreezeUpdated(boolean isFrozen) {
        }
        @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
        public void onVideoFreezeUpdated(boolean isFrozen) {}

        /**
         * Called when content is allowed.
+3 −3
Original line number Diff line number Diff line
@@ -723,12 +723,12 @@ public class TvInteractiveAppView extends ViewGroup {
    }

    /**
     * Alerts the TV Interactive app that the video freeze state has been updated.
     * If {@code true}, the video is frozen on the last frame while audio playback continues.
     * Alerts the TV Interactive app that the video freeze state has been updated. If {@code true},
     * the video is frozen on the last frame while audio playback continues.
     *
     * @param isFrozen Whether the video is frozen.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_TIAF_V_APIS)
    public void notifyVideoFreezeUpdated(boolean isFrozen) {
        if (DEBUG) {
            Log.d(TAG, "notifyVideoFreezeUpdated");