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

Commit 0c127204 authored by shubang's avatar shubang
Browse files

TIAF API: tune and BI app

Sequence diagram of the use case:
https://screenshot.googleplex.com/5fqc8jN36DN8Mxh.png

Bug: 211886434
Test: atest android.media.tv.interactive.cts.TvInteractiveAppServiceTest
Change-Id: I3cab3bae45f61859cecfd7f191e3c8c465d57c78
parent 1ef34605
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26763,6 +26763,7 @@ package android.media.tv {
    method public void notifyTimeShiftStatusChanged(int);
    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 notifyVideoAvailable();
    method public void notifyVideoUnavailable(int);
    method public void onAppPrivateCommand(@NonNull String, android.os.Bundle);
@@ -26975,7 +26976,10 @@ package android.media.tv.interactive {
  public abstract static class TvInteractiveAppService.Session implements android.view.KeyEvent.Callback {
    ctor public TvInteractiveAppService.Session(@NonNull android.content.Context);
    method public void layoutSurface(int, int, int, int);
    method public final void notifyBiInteractiveAppCreated(@NonNull android.net.Uri, @Nullable String);
    method public void notifySessionStateChanged(int, int);
    method public void onCreateBiInteractiveApp(@NonNull android.net.Uri, @Nullable android.os.Bundle);
    method public void onDestroyBiInteractiveApp(@NonNull String);
    method public boolean onKeyDown(int, @NonNull android.view.KeyEvent);
    method public boolean onKeyLongPress(int, @NonNull android.view.KeyEvent);
    method public boolean onKeyMultiple(int, int, @NonNull android.view.KeyEvent);
@@ -26984,6 +26988,7 @@ package android.media.tv.interactive {
    method public void onStartInteractiveApp();
    method public void onStopInteractiveApp();
    method public void onSurfaceChanged(int, int, int);
    method public void onTuned(@NonNull android.net.Uri);
  }
  public class TvInteractiveAppView extends android.view.ViewGroup {
@@ -26991,6 +26996,8 @@ package android.media.tv.interactive {
    ctor public TvInteractiveAppView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
    ctor public TvInteractiveAppView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int);
    method public void clearCallback();
    method public void createBiInteractiveApp(@NonNull android.net.Uri, @Nullable android.os.Bundle);
    method public void destroyBiInteractiveApp(@NonNull String);
    method public void prepareInteractiveApp(@NonNull String, int);
    method public void setCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppView.TvInteractiveAppCallback);
    method public int setTvView(@Nullable android.media.tv.TvView);
@@ -27000,6 +27007,7 @@ package android.media.tv.interactive {
  public abstract static class TvInteractiveAppView.TvInteractiveAppCallback {
    ctor public TvInteractiveAppView.TvInteractiveAppCallback();
    method public void onBiInteractiveAppCreated(@NonNull String, @NonNull android.net.Uri, @Nullable String);
    method public void onStateChanged(@NonNull String, int, int);
  }
+5 −1
Original line number Diff line number Diff line
@@ -592,7 +592,11 @@ public abstract class TvInputService extends Service {
            });
        }

        /** @hide */
        /**
         * Informs the application that this session has been tuned to the given channel.
         *
         * @param channelUri The URI of the tuned channel.
         */
        public void notifyTuned(@NonNull Uri channelUri) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
+13 −7
Original line number Diff line number Diff line
@@ -360,8 +360,11 @@ public abstract class TvInteractiveAppService extends Service {
        /**
         * Creates broadcast-independent(BI) interactive application.
         *
         * <p>The implementation should call {@link #notifyBiInteractiveAppCreated(Uri, String)},
         * no matter if it's created successfully or not.
         *
         * @see #notifyBiInteractiveAppCreated(Uri, String)
         * @see #onDestroyBiInteractiveApp(String)
         * @hide
         */
        public void onCreateBiInteractiveApp(@NonNull Uri biIAppUri, @Nullable Bundle params) {
        }
@@ -371,10 +374,9 @@ public abstract class TvInteractiveAppService extends Service {
         * Destroys broadcast-independent(BI) interactive application.
         *
         * @param biIAppId the BI interactive app ID from
         *        {@link #createBiInteractiveApp(Uri, Bundle)}
         *                 {@link #onCreateBiInteractiveApp(Uri, Bundle)}}
         *
         * @see #onCreateBiInteractiveApp(Uri, Bundle)
         * @hide
         */
        public void onDestroyBiInteractiveApp(@NonNull String biIAppId) {
        }
@@ -483,7 +485,8 @@ public abstract class TvInteractiveAppService extends Service {

        /**
         * Called when the corresponding TV input tuned to a channel.
         * @hide
         *
         * @param channelUri The tuned channel URI.
         */
        public void onTuned(@NonNull Uri channelUri) {
        }
@@ -1047,11 +1050,14 @@ public abstract class TvInteractiveAppService extends Service {

        /**
         * Notifies the broadcast-independent(BI) interactive application has been created.
         *
         * @param biIAppId BI interactive app ID, which can be used to destroy the BI interactive
         *                 app.
         * @hide
         *                 app. {@code null} if it's not created successfully.
         *
         * @see #onCreateBiInteractiveApp(Uri, Bundle)
         */
        public final void notifyBiInteractiveAppCreated(Uri biIAppUri, String biIAppId) {
        public final void notifyBiInteractiveAppCreated(
                @NonNull Uri biIAppUri, @Nullable String biIAppId) {
            executeOrPostRunnableOnMainThread(new Runnable() {
                @MainThread
                @Override
+9 −6
Original line number Diff line number Diff line
@@ -522,8 +522,10 @@ public class TvInteractiveAppView extends ViewGroup {
    /**
     * Creates broadcast-independent(BI) interactive application.
     *
     * @see #destroyBiInteractiveApp(String)
     * @hide
     * <p>{@link TvInteractiveAppCallback#onBiInteractiveAppCreated(String, Uri, String)} will be
     * called for the result.
     *
     * @see TvInteractiveAppCallback#onBiInteractiveAppCreated(String, Uri, String)
     */
    public void createBiInteractiveApp(@NonNull Uri biIAppUri, @Nullable Bundle params) {
        if (DEBUG) {
@@ -540,7 +542,6 @@ public class TvInteractiveAppView extends ViewGroup {
     * @param biIAppId the BI interactive app ID from {@link #createBiInteractiveApp(Uri, Bundle)}
     *
     * @see #createBiInteractiveApp(Uri, Bundle)
     * @hide
     */
    public void destroyBiInteractiveApp(@NonNull String biIAppId) {
        if (DEBUG) {
@@ -639,10 +640,12 @@ public class TvInteractiveAppView extends ViewGroup {
         *
         * @param iAppServiceId The ID of the TV interactive app service bound to this view.
         * @param biIAppUri URI associated this BI interactive app. This is the same URI in
         *                  {@link Session#createBiInteractiveApp(Uri, Bundle)}
         *                  {@link #createBiInteractiveApp(Uri, Bundle)}
         * @param biIAppId BI interactive app ID, which can be used to destroy the BI interactive
         *                 app.
         * @hide
         *                 app. {@code null} if it's not created successfully.
         *
         * @see #createBiInteractiveApp(Uri, Bundle)
         * @see #destroyBiInteractiveApp(String)
         */
        public void onBiInteractiveAppCreated(@NonNull String iAppServiceId, @NonNull Uri biIAppUri,
                @Nullable String biIAppId) {