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

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

Merge "Add notifyVideoFreezeUpdated" into main

parents ceda1701 feaa4b57
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ oneway interface ITvInputClient {
    void onTrackSelected(int type, in String trackId, int seq);
    void onVideoAvailable(int seq);
    void onVideoUnavailable(int reason, int seq);
    void onVideoFreezeUpdated(boolean isFrozen, int seq);
    void onContentAllowed(int seq);
    void onContentBlocked(in String rating, int seq);
    void onLayoutSurface(int left, int top, int right, int bottom, int seq);
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ oneway interface ITvInputSessionCallback {
    void onTrackSelected(int type, in String trackId);
    void onVideoAvailable();
    void onVideoUnavailable(int reason);
    void onVideoFreezeUpdated(boolean isFrozen);
    void onContentAllowed();
    void onContentBlocked(in String rating);
    void onLayoutSurface(int left, int top, int right, int bottom);
+34 −0
Original line number Diff line number Diff line
@@ -739,6 +739,15 @@ public final class TvInputManager {
        public void onVideoUnavailable(Session session, int reason) {
        }

        /**
         * This is called when the video freeze state has been updated.
         * If {@code true}, the video is frozen on the last frame while audio playback continues.
         * @param session A {@link TvInputManager.Session} associated with this callback.
         * @param isFrozen Whether the video is frozen
         */
        public void onVideoFreezeUpdated(Session session, boolean isFrozen) {
        }

        /**
         * This is called when the current program content turns out to be allowed to watch since
         * its content rating is not blocked by parental controls.
@@ -1030,6 +1039,19 @@ public final class TvInputManager {
            });
        }

        void postVideoFreezeUpdated(boolean isFrozen) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mSessionCallback.onVideoFreezeUpdated(mSession, isFrozen);
                    if (mSession.mIAppNotificationEnabled
                            && mSession.getInteractiveAppSession() != null) {
                        mSession.getInteractiveAppSession().notifyVideoFreezeUpdated(isFrozen);
                    }
                }
            });
        }

        void postContentAllowed() {
            mHandler.post(new Runnable() {
                @Override
@@ -1545,6 +1567,18 @@ public final class TvInputManager {
                }
            }

            @Override
            public void onVideoFreezeUpdated(boolean isFrozen, int seq) {
                synchronized (mSessionCallbackRecordMap) {
                    SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
                    if (record == null) {
                        Log.e(TAG, "Callback not found for seq " + seq);
                        return;
                    }
                    record.postVideoFreezeUpdated(isFrozen);
                }
            }

            @Override
            public void onContentAllowed(int seq) {
                synchronized (mSessionCallbackRecordMap) {
+28 −0
Original line number Diff line number Diff line
@@ -762,6 +762,34 @@ 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
         * active.
         *
         * @param isFrozen Whether or not the video is frozen
         * @hide
         */
        public void notifyVideoFreezeUpdated(boolean isFrozen) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
                @Override
                public void run() {
                    try {
                        if (DEBUG) {
                            Log.d(TAG, "notifyVideoFreezeUpdated");
                        }
                        if (mSessionCallback != null) {
                            mSessionCallback.onVideoFreezeUpdated(isFrozen);
                        }
                    } catch (RemoteException e) {
                        Log.e(TAG, "error in notifyVideoFreezeUpdated", e);
                    }
                }
            });
        }

        /**
         * Sends an updated list of all audio presentations available from a Next Generation Audio
         * service. This is used by the framework to maintain the audio presentation information for
+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ interface ITvInteractiveAppManager {
    void notifyTracksChanged(in IBinder sessionToken, in List<TvTrackInfo> tracks, int userId);
    void notifyVideoAvailable(in IBinder sessionToken, int userId);
    void notifyVideoUnavailable(in IBinder sessionToken, int reason, int userId);
    void notifyVideoFreezeUpdated(in IBinder sessionToken, boolean isFrozen, int userId);
    void notifyContentAllowed(in IBinder sessionToken, int userId);
    void notifyContentBlocked(in IBinder sessionToken, in String rating, int userId);
    void notifySignalStrength(in IBinder sessionToken, int stength, int userId);
Loading