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

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

Merge "Unhide watermarking APIs"

parents 51ec8b02 b30ebf4a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -27073,6 +27073,8 @@ package android.media.tv {
    field public static final int TIME_SHIFT_STATUS_UNAVAILABLE = 2; // 0x2
    field public static final int TIME_SHIFT_STATUS_UNKNOWN = 0; // 0x0
    field public static final int TIME_SHIFT_STATUS_UNSUPPORTED = 1; // 0x1
    field public static final String TV_MESSAGE_TYPE_CLOSED_CAPTION = "CC";
    field public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark";
    field public static final int VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY = 4; // 0x4
    field public static final int VIDEO_UNAVAILABLE_REASON_BUFFERING = 3; // 0x3
    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT = 16; // 0x10
@@ -27160,6 +27162,7 @@ package android.media.tv {
    method public void notifyTrackSelected(int, String);
    method public void notifyTracksChanged(java.util.List<android.media.tv.TvTrackInfo>);
    method public void notifyTuned(@NonNull android.net.Uri);
    method public void notifyTvMessage(@NonNull String, @NonNull android.os.Bundle);
    method public void notifyVideoAvailable();
    method public void notifyVideoUnavailable(int);
    method public void onAdBuffer(@NonNull android.media.tv.AdBuffer);
@@ -27181,6 +27184,7 @@ package android.media.tv {
    method public void onSetInteractiveAppNotificationEnabled(boolean);
    method public abstract void onSetStreamVolume(@FloatRange(from=0.0, to=1.0) float);
    method public abstract boolean onSetSurface(@Nullable android.view.Surface);
    method public void onSetTvMessageEnabled(@NonNull String, boolean);
    method public void onSurfaceChanged(int, int, int);
    method public long onTimeShiftGetCurrentPosition();
    method public long onTimeShiftGetStartPosition();
@@ -27320,6 +27324,7 @@ package android.media.tv {
    method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener);
    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(@NonNull String, boolean);
    method public void setZOrderMediaOverlay(boolean);
    method public void setZOrderOnTop(boolean);
    method public void timeShiftPause();
@@ -27356,6 +27361,7 @@ package android.media.tv {
    method public void onTrackSelected(String, int, String);
    method public void onTracksChanged(String, java.util.List<android.media.tv.TvTrackInfo>);
    method public void onTuned(@NonNull String, @NonNull android.net.Uri);
    method public void onTvMessage(@NonNull String, @NonNull String, @NonNull android.os.Bundle);
    method public void onVideoAvailable(String);
    method public void onVideoSizeChanged(String, int, int);
    method public void onVideoUnavailable(String, int);
@@ -27489,6 +27495,7 @@ package android.media.tv.interactive {
    method public boolean onTrackballEvent(@NonNull android.view.MotionEvent);
    method public void onTracksChanged(@NonNull java.util.List<android.media.tv.TvTrackInfo>);
    method public void onTuned(@NonNull android.net.Uri);
    method public void onTvMessage(@NonNull String, @NonNull android.os.Bundle);
    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();
@@ -27538,6 +27545,7 @@ package android.media.tv.interactive {
    method public void notifyError(@NonNull String, @NonNull android.os.Bundle);
    method public void notifyRecordingStarted(@NonNull String);
    method public void notifyRecordingStopped(@NonNull String);
    method public void notifyTvMessage(@NonNull String, @NonNull android.os.Bundle);
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void onLayout(boolean, int, int, int, int);
+6 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    private static final int DO_NOTIFY_AD_BUFFER = 28;
    private static final int DO_SELECT_AUDIO_PRESENTATION = 29;
    private static final int DO_TIME_SHIFT_SET_MODE = 30;
    private static final int DO_SET_TV_MESSAGE_ENABLED = 31;

    private final boolean mIsRecordingSession;
    private final HandlerCaller mCaller;
@@ -263,6 +264,11 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.setInteractiveAppNotificationEnabled((Boolean) msg.obj);
                break;
            }
            case DO_SET_TV_MESSAGE_ENABLED: {
                SomeArgs args = (SomeArgs) msg.obj;
                mTvInputSessionImpl.setTvMessageEnabled((String) args.arg1, (Boolean) args.arg2);
                break;
            }
            case DO_REQUEST_AD: {
                mTvInputSessionImpl.requestAd((AdRequest) msg.obj);
                break;
+9 −12
Original line number Diff line number Diff line
@@ -133,18 +133,15 @@ public final class TvInputManager {
            VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING, VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN})
    public @interface VideoUnavailableReason {}

    /**
     * @hide
     */
    /** Indicates that this TV message contains watermarking data */
    public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark";
    /**
     * @hide
     */
    public static final String TV_MESSAGE_TYPE_ATSC_CC = "ATSC_CC";

    /** Indicates that this TV message contains Closed Captioning data */
    public static final String TV_MESSAGE_TYPE_CLOSED_CAPTION = "CC";

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @StringDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_ATSC_CC})
    @StringDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_CLOSED_CAPTION})
    public @interface TvMessageType {}

    static final int VIDEO_UNAVAILABLE_REASON_START = 0;
@@ -792,11 +789,11 @@ public final class TvInputManager {
        }

        /**
         * This is called when the session receives a new Tv Message
         * This is called when the session receives a new TV Message
         *
         * @param type the type of {@link TvMessageType}
         * @param data the raw data of the message
         * @hide
         * @param session A {@link TvInputManager.Session} associated with this callback.
         * @param type The type of message received, such as {@link #TV_MESSAGE_TYPE_WATERMARK}
         * @param data The raw data of the message
         */
        public void onTvMessage(Session session, @TvInputManager.TvMessageType String type,
                Bundle data) {
+43 −21
Original line number Diff line number Diff line
@@ -1025,6 +1025,31 @@ public abstract class TvInputService extends Service {
            });
        }

        /**
         * Sends the raw data from the received TV message as well as the type of message received.
         *
         * @param type The of message that was sent, such as
         * {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
         * @param data The data sent with the message.
         */
        public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType String type,
                @NonNull Bundle data) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
                @Override
                public void run() {
                    try {
                        if (DEBUG) Log.d(TAG, "notifyTvMessage");
                        if (mSessionCallback != null) {
                            mSessionCallback.onTvMessage(type, data);
                        }
                    } catch (RemoteException e) {
                        Log.w(TAG, "error in notifyTvMessage", e);
                    }
                }
            });
        }

        private void notifyTimeShiftStartPositionChanged(final long timeMs) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
@@ -1457,6 +1482,17 @@ public abstract class TvInputService extends Service {
            return null;
        }

        /**
         * Called when the application enables or disables the detection of the specified message
         * type.
         * @param type The {@link TvInputManager.TvMessageType} of message that was sent.
         * @param enabled {@code true} if TV message detection is enabled,
         *                {@code false} otherwise.
         */
        public void onSetTvMessageEnabled(@NonNull @TvInputManager.TvMessageType String type,
                boolean enabled){
        }

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

        /**
         * Calls {@link #onSetTvMessageEnabled(String, boolean)}.
         */
        void setTvMessageEnabled(String type, boolean enabled) {
            onSetTvMessageEnabled(type, enabled);
        }

        /**
         * Calls {@link #onAppPrivateCommand}.
         */
@@ -2277,27 +2320,6 @@ public abstract class TvInputService extends Service {
            });
        }

        /**
         * Informs the application of the raw data from the TV message.
         * @param type The {@link TvInputManager.TvMessageType} of message that was sent.
         * @param data The data sent with the message.
         * @hide
         */
        public void notifyTvMessage(@TvInputManager.TvMessageType String type, Bundle data) {
        }

        /**
         * Called when the application enables or disables the detection of the specified message
         * type.
         * @param type The {@link TvInputManager.TvMessageType} of message that was sent.
         * @param enabled {@code true} if you want to enable TV message detecting
         *                {@code false} otherwise.
         * @hide
         */
        public void onSetTvMessageEnabled(@TvInputManager.TvMessageType String type,
                boolean enabled) {
        }

        /**
         * Called when the application requests to tune to a given channel for TV program recording.
         *
+8 −8
Original line number Diff line number Diff line
@@ -722,14 +722,14 @@ public class TvView extends ViewGroup {
    }

    /**
     * Enables or disables TV message detecting in the streams of bound TV input.
     * Enables or disables TV message detection in the stream of the bound TV input.
     *
     * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType}
     * @param enabled {@code true} if you want to enable TV message detecting
     * @param enabled {@code true} if you want to enable TV message detection
     *                {@code false} otherwise.
     * @hide
     */
    public void setTvMessageEnabled(@TvInputManager.TvMessageType String type, boolean enabled) {
    public void setTvMessageEnabled(@NonNull @TvInputManager.TvMessageType String type,
            boolean enabled) {
    }

    @Override
@@ -1233,14 +1233,14 @@ public class TvView extends ViewGroup {
        }

        /**
         * This is called when the session has been tuned to the given channel.
         * This is called when a new TV Message has been received.
         *
         * @param inputId The ID of the TV input bound to this view.
         * @param type The type of {@link android.media.tv.TvInputManager.TvMessageType}
         * @param data The raw data of the message
         * @hide
         */
        public void onTvMessage(@NonNull String inputId, @TvInputManager.TvMessageType String type,
                Bundle data) {
        public void onTvMessage(@NonNull String inputId,
                @NonNull @TvInputManager.TvMessageType String type, @NonNull Bundle data) {
        }
    }

Loading