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

Commit dabf01fb authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "TIAF API review: add onError" into tm-dev

parents 5f73823c 832d0eb7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26205,6 +26205,7 @@ package android.media.tv.interactive {
    method public void onCurrentChannelUri(@Nullable android.net.Uri);
    method public void onCurrentTvInputId(@Nullable String);
    method public void onDestroyBiInteractiveAppRequest(@NonNull String);
    method public void onError(@NonNull String, @NonNull android.os.Bundle);
    method public boolean onGenericMotionEvent(@NonNull android.view.MotionEvent);
    method public boolean onKeyDown(int, @NonNull android.view.KeyEvent);
    method public boolean onKeyLongPress(int, @NonNull android.view.KeyEvent);
@@ -26266,6 +26267,7 @@ package android.media.tv.interactive {
    method public void destroyBiInteractiveApp(@NonNull String);
    method public boolean dispatchUnhandledInputEvent(@NonNull android.view.InputEvent);
    method @Nullable public android.media.tv.interactive.TvInteractiveAppView.OnUnhandledInputEventListener getOnUnhandledInputEventListener();
    method public void notifyError(@NonNull String, @NonNull android.os.Bundle);
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void onLayout(boolean, int, int, int, int);
@@ -26292,6 +26294,7 @@ package android.media.tv.interactive {
    field public static final String BI_INTERACTIVE_APP_KEY_HTTP_ADDITIONAL_HEADERS = "http_additional_headers";
    field public static final String BI_INTERACTIVE_APP_KEY_HTTP_USER_AGENT = "http_user_agent";
    field public static final String BI_INTERACTIVE_APP_KEY_PRIVATE_KEY = "private_key";
    field public static final String ERROR_KEY_METHOD_NAME = "method_name";
  }
  public static interface TvInteractiveAppView.OnUnhandledInputEventListener {
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ interface ITvInteractiveAppManager {
    void sendCurrentTvInputId(in IBinder sessionToken, in String inputId, int userId);
    void sendSigningResult(in IBinder sessionToken, in String signingId, in byte[] result,
            int userId);
    void notifyError(in IBinder sessionToken, in String errMsg, in Bundle params, int userId);
    void createSession(in ITvInteractiveAppClient client, in String iAppServiceId, int type,
            int seq, int userId);
    void releaseSession(in IBinder sessionToken, int userId);
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ oneway interface ITvInteractiveAppSession {
    void sendTrackInfoList(in List<TvTrackInfo> tracks);
    void sendCurrentTvInputId(in String inputId);
    void sendSigningResult(in String signingId, in byte[] result);
    void notifyError(in String errMsg, in Bundle params);
    void release();
    void notifyTuned(in Uri channelUri);
    void notifyTrackSelected(int type, in String trackId);
+12 −0
Original line number Diff line number Diff line
@@ -1047,6 +1047,18 @@ public final class TvInteractiveAppManager {
            }
        }

        void notifyError(@NonNull String errMsg, @NonNull Bundle params) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.notifyError(mToken, errMsg, params, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

        /**
         * Sets the {@link android.view.Surface} for this session.
         *
+24 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.media.tv.TvInputInfo;
import android.media.tv.TvInputManager;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvView;
import android.media.tv.interactive.TvInteractiveAppView.TvInteractiveAppCallback;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -465,6 +466,20 @@ public abstract class TvInteractiveAppService extends Service {
        public void onSigningResult(@NonNull String signingId, @NonNull byte[] result) {
        }

        /**
         * Called when the application sends information of an error.
         *
         * @param errMsg the message of the error.
         * @param params additional parameters of the error. For example, the signingId of {@link
         *     TvInteractiveAppCallback#onRequestSigning(String, String, String, String, byte[])}
         *     can be included to identify the related signing request, and the method name
         *     "onRequestSigning" can also be added to the params.
         *
         * @see TvInteractiveAppView#ERROR_KEY_METHOD_NAME
         */
        public void onError(@NonNull String errMsg, @NonNull Bundle params) {
        }

        /**
         * Called when the application sets the surface.
         *
@@ -1004,6 +1019,10 @@ public abstract class TvInteractiveAppService extends Service {
            onSigningResult(signingId, result);
        }

        void notifyError(String errMsg, Bundle params) {
            onError(errMsg, params);
        }

        void release() {
            onRelease();
            if (mSurface != null) {
@@ -1476,6 +1495,11 @@ public abstract class TvInteractiveAppService extends Service {
            mSessionImpl.sendSigningResult(signingId, result);
        }

        @Override
        public void notifyError(@NonNull String errMsg, @NonNull Bundle params) {
            mSessionImpl.notifyError(errMsg, params);
        }

        @Override
        public void release() {
            mSessionImpl.scheduleMediaViewCleanup();
Loading