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

Commit d516c60a authored by shubang's avatar shubang
Browse files

TIAF: cleanup playback command and remaining public APIs

Bug: 213836031
Test: atest android.media.tv.interactive.cts.TvInteractiveAppViewTest
Test: atest android.media.tv.interactive.cts.TvInteractiveAppManagerTest
Test: atest android.media.tv.interactive.cts.TvInteractiveAppServiceTest
Change-Id: I305c2d98184d5907aec864a5ff7cfa01db2282ba
parent 85aaa4aa
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -1079,12 +1079,13 @@ public class TvView extends ViewGroup {


        /**
        /**
         * This is called when signal strength is updated.
         * This is called when signal strength is updated.
         *
         * @param inputId The ID of the TV input bound to this view.
         * @param inputId The ID of the TV input bound to this view.
         * @param strength The current signal strength.
         * @param strength The current signal strength.
         *
         * @hide
         * @hide
         */
         */
        public void onSignalStrength(String inputId, @TvInputManager.SignalStrength int strength) {
        public void onSignalStrength(
                @NonNull String inputId, @TvInputManager.SignalStrength int strength) {
        }
        }


        /**
        /**
@@ -1093,7 +1094,7 @@ public class TvView extends ViewGroup {
         * @param channelUri The URI of a channel.
         * @param channelUri The URI of a channel.
         * @hide
         * @hide
         */
         */
        public void onTuned(String inputId, Uri channelUri) {
        public void onTuned(@NonNull String inputId, @NonNull Uri channelUri) {
        }
        }
    }
    }


+63 −25
Original line number Original line Diff line number Diff line
@@ -174,17 +174,17 @@ public final class TvInteractiveAppManager {
    public @interface TeletextAppState {}
    public @interface TeletextAppState {}


    /**
    /**
     * Show state of Teletext app.
     * State of Teletext app: show
     * @hide
     * @hide
     */
     */
    public static final int TELETEXT_APP_STATE_SHOW = 1;
    public static final int TELETEXT_APP_STATE_SHOW = 1;
    /**
    /**
     * Hide state of Teletext app.
     * State of Teletext app: hide
     * @hide
     * @hide
     */
     */
    public static final int TELETEXT_APP_STATE_HIDE = 2;
    public static final int TELETEXT_APP_STATE_HIDE = 2;
    /**
    /**
     * Error state of Teletext app.
     * State of Teletext app: error
     * @hide
     * @hide
     */
     */
    public static final int TELETEXT_APP_STATE_ERROR = 3;
    public static final int TELETEXT_APP_STATE_ERROR = 3;
@@ -206,55 +206,93 @@ public final class TvInteractiveAppManager {
    public static final String KEY_CLASS_NAME = "class_name";
    public static final String KEY_CLASS_NAME = "class_name";


    /**
    /**
     * Key for URI scheme in app link.
     * Key for command type in app link command.
     * <p>Type: String
     * <p>Type: String
     *
     *
     * @see #registerAppLinkInfo(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     * @hide
     */
     */
    public static final String KEY_URI_SCHEME = "uri_scheme";
    public static final String KEY_COMMAND_TYPE = "command_type";


    /**
    /**
     * Key for URI host in app link.
     * Key for service ID in app link command.
     * <p>Type: String
     * <p>Type: String
     *
     *
     * @see #registerAppLinkInfo(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     * @hide
     */
     */
    public static final String KEY_URI_HOST = "uri_host";
    public static final String KEY_SERVICE_ID = "service_id";


    /**
    /**
     * Key for URI prefix in app link.
     * Key for back URI in app link command.
     * <p>Type: String
     * <p>Type: String
     *
     *
     * @see #registerAppLinkInfo(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     */
    public static final String KEY_BACK_URI = "back_uri";

    /**
     * Broadcast intent action to send app command to TV app.
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @hide
     * @hide
     */
     */
    public static final String KEY_URI_PREFIX = "uri_prefix";
    public static final String ACTION_APP_LINK_COMMAND =
            "android.media.tv.interactive.action.APP_LINK_COMMAND";


    /**
    /**
     * Key for command type in app link command.
     * Intent key for TV input ID. It's used to send app command to TV app.
     * <p>Type: String
     * <p>Type: String
     *
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #ACTION_APP_LINK_COMMAND
     * @hide
     */
     */
    public static final String KEY_COMMAND_TYPE = "command_type";
    public static final String INTENT_KEY_TV_INPUT_ID = "tv_input_id";


    /**
    /**
     * Key for service ID in app link command.
     * Intent key for TV interactive app ID. It's used to send app command to TV app.
     * <p>Type: String
     * <p>Type: String
     *
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #ACTION_APP_LINK_COMMAND
     * @see android.media.tv.interactive.TvInteractiveAppInfo#getId()
     * @hide
     */
     */
    public static final String KEY_SERVICE_ID = "service_id";
    public static final String INTENT_KEY_INTERACTIVE_APP_SERVICE_ID = "interactive_app_id";


    /**
    /**
     * Key for back URI in app link command.
     * Intent key for TV channel URI. It's used to send app command to TV app.
     * <p>Type: String
     * <p>Type: android.net.Uri
     *
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #ACTION_APP_LINK_COMMAND
     * @hide
     */
     */
    public static final String KEY_BACK_URI = "back_uri";
    public static final String INTENT_KEY_CHANNEL_URI = "channel_uri";

    /**
     * Intent key for broadcast-independent(BI) interactive app type. It's used to send app command
     * to TV app.
     * <p>Type: int
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #ACTION_APP_LINK_COMMAND
     * @see android.media.tv.interactive.TvInteractiveAppInfo#getSupportedTypes()
     * @see Session#createBiInteractiveApp(Uri, Bundle)
     * @hide
     */
    public static final String INTENT_KEY_BI_INTERACTIVE_APP_TYPE = "bi_interactive_app_type";

    /**
     * Intent key for broadcast-independent(BI) interactive app URI. It's used to send app command
     * to TV app.
     * <p>Type: android.net.Uri
     *
     * @see #sendAppLinkCommand(String, Bundle)
     * @see #ACTION_APP_LINK_COMMAND
     * @see Session#createBiInteractiveApp(Uri, Bundle)
     * @hide
     */
    public static final String INTENT_KEY_BI_INTERACTIVE_APP_URI = "bi_interactive_app_uri";


    private final ITvInteractiveAppManager mService;
    private final ITvInteractiveAppManager mService;
    private final int mUserId;
    private final int mUserId;
@@ -351,7 +389,7 @@ public final class TvInteractiveAppManager {


            @Override
            @Override
            public void onCommandRequest(
            public void onCommandRequest(
                    @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                    @TvInteractiveAppService.PlaybackCommandType String cmdType,
                    Bundle parameters,
                    Bundle parameters,
                    int seq) {
                    int seq) {
                synchronized (mSessionCallbackRecordMap) {
                synchronized (mSessionCallbackRecordMap) {
@@ -723,7 +761,7 @@ public final class TvInteractiveAppManager {
    }
    }


    /**
    /**
     * Prepares TV Interactive App service for the given type.
     * Prepares TV Interactive App service environment for the given type.
     * @hide
     * @hide
     */
     */
    public void prepare(@NonNull String tvIAppServiceId, int type) {
    public void prepare(@NonNull String tvIAppServiceId, int type) {
@@ -1557,7 +1595,7 @@ public final class TvInteractiveAppManager {
        }
        }


        void postCommandRequest(
        void postCommandRequest(
                final @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                final @TvInteractiveAppService.PlaybackCommandType String cmdType,
                final Bundle parameters) {
                final Bundle parameters) {
            mHandler.post(new Runnable() {
            mHandler.post(new Runnable() {
                @Override
                @Override
@@ -1705,7 +1743,7 @@ public final class TvInteractiveAppManager {
         */
         */
        public void onCommandRequest(
        public void onCommandRequest(
                Session session,
                Session session,
                @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                @TvInteractiveAppService.PlaybackCommandType String cmdType,
                Bundle parameters) {
                Bundle parameters) {
        }
        }


+108 −55
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.media.tv.AdResponse;
import android.media.tv.BroadcastInfoRequest;
import android.media.tv.BroadcastInfoRequest;
import android.media.tv.BroadcastInfoResponse;
import android.media.tv.BroadcastInfoResponse;
import android.media.tv.TvContentRating;
import android.media.tv.TvContentRating;
import android.media.tv.TvInputInfo;
import android.media.tv.TvInputManager;
import android.media.tv.TvInputManager;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvView;
import android.media.tv.TvView;
@@ -97,42 +98,90 @@ public abstract class TvInteractiveAppService extends Service {


    /** @hide */
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @StringDef(prefix = "INTERACTIVE_APP_SERVICE_COMMAND_TYPE_", value = {
    @StringDef(prefix = "PLAYBACK_COMMAND_TYPE_", value = {
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE,
            PLAYBACK_COMMAND_TYPE_TUNE,
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE_NEXT,
            PLAYBACK_COMMAND_TYPE_TUNE_NEXT,
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE_PREV,
            PLAYBACK_COMMAND_TYPE_TUNE_PREV,
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_STOP,
            PLAYBACK_COMMAND_TYPE_STOP,
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_SET_STREAM_VOLUME,
            PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME,
            INTERACTIVE_APP_SERVICE_COMMAND_TYPE_SELECT_TRACK
            PLAYBACK_COMMAND_TYPE_SELECT_TRACK
    })
    })
    public @interface InteractiveAppServiceCommandType {}
    public @interface PlaybackCommandType {}


    /** @hide */
    /**
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE = "tune";
     * Playback command type: tune to the given channel.
    /** @hide */
     * @see #COMMAND_PARAMETER_KEY_CHANNEL_URI
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE_NEXT = "tune_next";
     * @hide
    /** @hide */
     */
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_TUNE_PREV = "tune_previous";
    public static final String PLAYBACK_COMMAND_TYPE_TUNE = "tune";
    /** @hide */
    /**
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_STOP = "stop";
     * Playback command type: tune to the next channel.
    /** @hide */
     * @hide
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_SET_STREAM_VOLUME =
     */
    public static final String PLAYBACK_COMMAND_TYPE_TUNE_NEXT = "tune_next";
    /**
     * Playback command type: tune to the previous channel.
     * @hide
     */
    public static final String PLAYBACK_COMMAND_TYPE_TUNE_PREV = "tune_previous";
    /**
     * Playback command type: stop the playback.
     * @hide
     */
    public static final String PLAYBACK_COMMAND_TYPE_STOP = "stop";
    /**
     * Playback command type: set the volume.
     * @hide
     */
    public static final String PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME =
            "set_stream_volume";
            "set_stream_volume";
    /** @hide */
    /**
    public static final String INTERACTIVE_APP_SERVICE_COMMAND_TYPE_SELECT_TRACK = "select_track";
     * Playback command type: select the given track.
    /** @hide */
     * @hide
     */
    public static final String PLAYBACK_COMMAND_TYPE_SELECT_TRACK = "select_track";
    /**
     * Playback command parameter: channel URI.
     * <p>Type: android.net.Uri
     *
     * @see #PLAYBACK_COMMAND_TYPE_TUNE
     * @hide
     */
    public static final String COMMAND_PARAMETER_KEY_CHANNEL_URI = "command_channel_uri";
    public static final String COMMAND_PARAMETER_KEY_CHANNEL_URI = "command_channel_uri";
    /** @hide */
    /**
     * Playback command parameter: TV input ID.
     * <p>Type: String
     *
     * @see TvInputInfo#getId()
     * @hide
     */
    public static final String COMMAND_PARAMETER_KEY_INPUT_ID = "command_input_id";
    public static final String COMMAND_PARAMETER_KEY_INPUT_ID = "command_input_id";
    /** @hide */
    /**
     * Playback command parameter: stream volume.
     * <p>Type: float
     *
     * @see #PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME
     * @hide
     */
    public static final String COMMAND_PARAMETER_KEY_VOLUME = "command_volume";
    public static final String COMMAND_PARAMETER_KEY_VOLUME = "command_volume";
    /** @hide */
    /**
     * Playback command parameter: track type.
     * <p>Type: int
     *
     * @see #PLAYBACK_COMMAND_TYPE_SELECT_TRACK
     * @see TvTrackInfo#getType()
     * @hide
     */
    public static final String COMMAND_PARAMETER_KEY_TRACK_TYPE = "command_track_type";
    public static final String COMMAND_PARAMETER_KEY_TRACK_TYPE = "command_track_type";
    /** @hide */
    /**
     * Playback command parameter: track ID.
     * <p>Type: String
     *
     * @see #PLAYBACK_COMMAND_TYPE_SELECT_TRACK
     * @see TvTrackInfo#getId()
     * @hide
     */
    public static final String COMMAND_PARAMETER_KEY_TRACK_ID = "command_track_id";
    public static final String COMMAND_PARAMETER_KEY_TRACK_ID = "command_track_id";
    /** @hide */
    public static final String COMMAND_PARAMETER_KEY_TRACK_SELECT_MODE =
            "command_track_select_mode";
    /**
    /**
     * Command to quiet channel change. No channel banner or channel info is shown.
     * Command to quiet channel change. No channel banner or channel info is shown.
     * <p>Refer to HbbTV Spec 2.0.4 chapter A.2.4.3.
     * <p>Refer to HbbTV Spec 2.0.4 chapter A.2.4.3.
@@ -210,16 +259,14 @@ public abstract class TvInteractiveAppService extends Service {
     * Registers App link info.
     * Registers App link info.
     * @hide
     * @hide
     */
     */
    public void onRegisterAppLinkInfo(AppLinkInfo appLinkInfo) {
    public void onRegisterAppLinkInfo(@NonNull AppLinkInfo appLinkInfo) {
        // TODO: make it abstract when unhide
    }
    }


    /**
    /**
     * Unregisters App link info.
     * Unregisters App link info.
     * @hide
     * @hide
     */
     */
    public void onUnregisterAppLinkInfo(AppLinkInfo appLinkInfo) {
    public void onUnregisterAppLinkInfo(@NonNull AppLinkInfo appLinkInfo) {
        // TODO: make it abstract when unhide
    }
    }


    /**
    /**
@@ -383,7 +430,7 @@ public abstract class TvInteractiveAppService extends Service {


        /**
        /**
         * To toggle Digital Teletext Application if there is one in AIT app list.
         * To toggle Digital Teletext Application if there is one in AIT app list.
         * @param enable
         * @param enable {@code true} to enable teletext app; {@code false} otherwise.
         * @hide
         * @hide
         */
         */
        public void onSetTeletextAppEnabled(boolean enable) {
        public void onSetTeletextAppEnabled(boolean enable) {
@@ -404,7 +451,7 @@ public abstract class TvInteractiveAppService extends Service {
        }
        }


        /**
        /**
         * Receives stream volume.
         * Receives current stream volume.
         * @hide
         * @hide
         */
         */
        public void onStreamVolume(float volume) {
        public void onStreamVolume(float volume) {
@@ -495,14 +542,14 @@ public abstract class TvInteractiveAppService extends Service {
         * Called when the corresponding TV input selected to a track.
         * Called when the corresponding TV input selected to a track.
         * @hide
         * @hide
         */
         */
        public void onTrackSelected(int type, String trackId) {
        public void onTrackSelected(@TvTrackInfo.Type int type, @NonNull String trackId) {
        }
        }


        /**
        /**
         * Called when the tracks are changed.
         * Called when the tracks are changed.
         * @hide
         * @hide
         */
         */
        public void onTracksChanged(List<TvTrackInfo> tracks) {
        public void onTracksChanged(@NonNull List<TvTrackInfo> tracks) {
        }
        }


        /**
        /**
@@ -516,7 +563,7 @@ public abstract class TvInteractiveAppService extends Service {
         * Called when video is unavailable.
         * Called when video is unavailable.
         * @hide
         * @hide
         */
         */
        public void onVideoUnavailable(int reason) {
        public void onVideoUnavailable(@TvInputManager.VideoUnavailableReason int reason) {
        }
        }


        /**
        /**
@@ -530,7 +577,7 @@ public abstract class TvInteractiveAppService extends Service {
         * Called when content is blocked.
         * Called when content is blocked.
         * @hide
         * @hide
         */
         */
        public void onContentBlocked(TvContentRating rating) {
        public void onContentBlocked(@NonNull TvContentRating rating) {
        }
        }


        /**
        /**
@@ -553,40 +600,33 @@ public abstract class TvInteractiveAppService extends Service {
        public void onAdResponse(@NonNull AdResponse response) {
        public void onAdResponse(@NonNull AdResponse response) {
        }
        }


        /**
         * TODO: JavaDoc of APIs related to input events.
         * @hide
         */
        @Override
        @Override
        public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
        public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
            return false;
            return false;
        }
        }


        /**
         * @hide
         */
        @Override
        @Override
        public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event) {
        public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event) {
            return false;
            return false;
        }
        }


        /**
         * @hide
         */
        @Override
        @Override
        public boolean onKeyMultiple(int keyCode, int count, @NonNull KeyEvent event) {
        public boolean onKeyMultiple(int keyCode, int count, @NonNull KeyEvent event) {
            return false;
            return false;
        }
        }


        /**
         * @hide
         */
        @Override
        @Override
        public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
        public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
            return false;
            return false;
        }
        }


        /**
        /**
         * Implement this method to handle touch screen motion events on the current session.
         *
         * @param event The motion event being received.
         * @return If you handled the event, return {@code true}. If you want to allow the event to
         *         be handled by the next receiver, return {@code false}.
         * @see View#onTouchEvent
         * @hide
         * @hide
         */
         */
        public boolean onTouchEvent(@NonNull MotionEvent event) {
        public boolean onTouchEvent(@NonNull MotionEvent event) {
@@ -594,6 +634,12 @@ public abstract class TvInteractiveAppService extends Service {
        }
        }


        /**
        /**
         * Implement this method to handle trackball events on the current session.
         *
         * @param event The motion event being received.
         * @return If you handled the event, return {@code true}. If you want to allow the event to
         *         be handled by the next receiver, return {@code false}.
         * @see View#onTrackballEvent
         * @hide
         * @hide
         */
         */
        public boolean onTrackballEvent(@NonNull MotionEvent event) {
        public boolean onTrackballEvent(@NonNull MotionEvent event) {
@@ -601,6 +647,12 @@ public abstract class TvInteractiveAppService extends Service {
        }
        }


        /**
        /**
         * Implement this method to handle generic motion events on the current session.
         *
         * @param event The motion event being received.
         * @return If you handled the event, return {@code true}. If you want to allow the event to
         *         be handled by the next receiver, return {@code false}.
         * @see View#onGenericMotionEvent
         * @hide
         * @hide
         */
         */
        public boolean onGenericMotionEvent(@NonNull MotionEvent event) {
        public boolean onGenericMotionEvent(@NonNull MotionEvent event) {
@@ -691,13 +743,14 @@ public abstract class TvInteractiveAppService extends Service {
        }
        }


        /**
        /**
         * requests a specific command to be processed by the related TV input.
         * Sends a specific playback command to be processed by the related TV input.
         *
         * @param cmdType type of the specific command
         * @param cmdType type of the specific command
         * @param parameters parameters of the specific command
         * @param parameters parameters of the specific command
         * @hide
         * @hide
         */
         */
        public void requestCommand(
        public void sendPlaybackCommandRequest(
                @InteractiveAppServiceCommandType String cmdType, Bundle parameters) {
                @PlaybackCommandType @NonNull String cmdType, @Nullable Bundle parameters) {
            executeOrPostRunnableOnMainThread(new Runnable() {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
                @MainThread
                @Override
                @Override
@@ -721,7 +774,7 @@ public abstract class TvInteractiveAppService extends Service {
         * Sets broadcast video bounds.
         * Sets broadcast video bounds.
         * @hide
         * @hide
         */
         */
        public void setVideoBounds(Rect rect) {
        public void setVideoBounds(@NonNull Rect rect) {
            executeOrPostRunnableOnMainThread(new Runnable() {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
                @MainThread
                @Override
                @Override
+36 −12
Original line number Original line Diff line number Diff line
@@ -213,7 +213,7 @@ public class TvInteractiveAppView extends ViewGroup {


    /** @hide */
    /** @hide */
    @Override
    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
    protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);
        super.onVisibilityChanged(changedView, visibility);
        mSurfaceView.setVisibility(visibility);
        mSurfaceView.setVisibility(visibility);
        if (visibility == View.VISIBLE) {
        if (visibility == View.VISIBLE) {
@@ -330,6 +330,11 @@ public class TvInteractiveAppView extends ViewGroup {


    /**
    /**
     * Dispatches an unhandled input event to the next receiver.
     * Dispatches an unhandled input event to the next receiver.
     *
     * It gives the host application a chance to dispatch the unhandled input events.
     *
     * @param event The input event.
     * @return {@code true} if the event was handled by the view, {@code false} otherwise.
     * @hide
     * @hide
     */
     */
    public boolean dispatchUnhandledInputEvent(@NonNull InputEvent event) {
    public boolean dispatchUnhandledInputEvent(@NonNull InputEvent event) {
@@ -356,14 +361,24 @@ public class TvInteractiveAppView extends ViewGroup {
    }
    }


    /**
    /**
     * Registers a callback to be invoked when an input event is not handled
     * Sets a listener to be invoked when an input event is not handled
     * by the TV Interactive App.
     * by the TV Interactive App.
     *
     *
     * @param listener The callback to be invoked when the unhandled input event is received.
     * @param listener The callback to be invoked when the unhandled input event is received.
     * @hide
     * @hide
     */
     */
    public void setOnUnhandledInputEventListener(@NonNull OnUnhandledInputEventListener listener) {
    public void setOnUnhandledInputEventListener(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull OnUnhandledInputEventListener listener) {
        mOnUnhandledInputEventListener = listener;
        mOnUnhandledInputEventListener = listener;
        // TODO: handle CallbackExecutor
    }
    /**
     * Clears the {@link OnUnhandledInputEventListener}
     * @hide
     */
    public void clearOnUnhandledInputEventListener() {
        mOnUnhandledInputEventListener = null;
    }
    }


    @Override
    @Override
@@ -440,9 +455,12 @@ public class TvInteractiveAppView extends ViewGroup {


    /**
    /**
     * Sends current channel URI to related TV interactive app.
     * Sends current channel URI to related TV interactive app.
     *
     * @param channelUri The current channel URI; {@code null} if there is no currently tuned
     *                   channel.
     * @hide
     * @hide
     */
     */
    public void sendCurrentChannelUri(Uri channelUri) {
    public void sendCurrentChannelUri(@Nullable Uri channelUri) {
        if (DEBUG) {
        if (DEBUG) {
            Log.d(TAG, "sendCurrentChannelUri");
            Log.d(TAG, "sendCurrentChannelUri");
        }
        }
@@ -481,7 +499,7 @@ public class TvInteractiveAppView extends ViewGroup {
     * Sends track info list to related TV interactive app.
     * Sends track info list to related TV interactive app.
     * @hide
     * @hide
     */
     */
    public void sendTrackInfoList(List<TvTrackInfo> tracks) {
    public void sendTrackInfoList(@Nullable List<TvTrackInfo> tracks) {
        if (DEBUG) {
        if (DEBUG) {
            Log.d(TAG, "sendTrackInfoList");
            Log.d(TAG, "sendTrackInfoList");
        }
        }
@@ -588,7 +606,11 @@ public class TvInteractiveAppView extends ViewGroup {


    /**
    /**
     * To toggle Digital Teletext Application if there is one in AIT app list.
     * To toggle Digital Teletext Application if there is one in AIT app list.
     * @param enable
     *
     * <p>A Teletext Application is a broadcast-related application to display text and basic
     * graphics.
     *
     * @param enable {@code true} to enable Teletext app; {@code false} to disable it.
     * @hide
     * @hide
     */
     */
    public void setTeletextAppEnabled(boolean enable) {
    public void setTeletextAppEnabled(boolean enable) {
@@ -607,17 +629,18 @@ public class TvInteractiveAppView extends ViewGroup {
        // TODO: unhide the following public APIs
        // TODO: unhide the following public APIs


        /**
        /**
         * This is called when a command is requested to be processed by the related TV input.
         * This is called when a playback command is requested to be processed by the related TV
         * input.
         *
         *
         * @param iAppServiceId The ID of the TV interactive app service bound to this view.
         * @param iAppServiceId The ID of the TV interactive app service bound to this view.
         * @param cmdType type of the command
         * @param cmdType type of the command
         * @param parameters parameters of the command
         * @param parameters parameters of the command
         * @hide
         * @hide
         */
         */
        public void onCommandRequest(
        public void onPlaybackCommandRequest(
                @NonNull String iAppServiceId,
                @NonNull String iAppServiceId,
                @NonNull @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                @NonNull @TvInteractiveAppService.PlaybackCommandType String cmdType,
                @Nullable Bundle parameters) {
                @NonNull Bundle parameters) {
        }
        }


        /**
        /**
@@ -818,7 +841,7 @@ public class TvInteractiveAppView extends ViewGroup {
        @Override
        @Override
        public void onCommandRequest(
        public void onCommandRequest(
                Session session,
                Session session,
                @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                @TvInteractiveAppService.PlaybackCommandType String cmdType,
                Bundle parameters) {
                Bundle parameters) {
            if (DEBUG) {
            if (DEBUG) {
                Log.d(TAG, "onCommandRequest (cmdType=" + cmdType + ", parameters="
                Log.d(TAG, "onCommandRequest (cmdType=" + cmdType + ", parameters="
@@ -833,7 +856,8 @@ public class TvInteractiveAppView extends ViewGroup {
                    mCallbackExecutor.execute(() -> {
                    mCallbackExecutor.execute(() -> {
                        synchronized (mCallbackLock) {
                        synchronized (mCallbackLock) {
                            if (mCallback != null) {
                            if (mCallback != null) {
                                mCallback.onCommandRequest(mIAppServiceId, cmdType, parameters);
                                mCallback.onPlaybackCommandRequest(
                                        mIAppServiceId, cmdType, parameters);
                            }
                            }
                        }
                        }
                    });
                    });
+1 −1
Original line number Original line Diff line number Diff line
@@ -2095,7 +2095,7 @@ public class TvInteractiveAppManagerService extends SystemService {


        @Override
        @Override
        public void onCommandRequest(
        public void onCommandRequest(
                @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
                @TvInteractiveAppService.PlaybackCommandType String cmdType,
                Bundle parameters) {
                Bundle parameters) {
            synchronized (mLock) {
            synchronized (mLock) {
                if (DEBUG) {
                if (DEBUG) {