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

Commit 1553a528 authored by Jae Seo's avatar Jae Seo
Browse files

API Review: android.media.tv

TvView:
- Instead of ERROR_INPUT_DISCONNECTED, a separate callback
  onDisconnected; change onError to onConnectionFailed.

Bug: 17114406
Change-Id: I9457ac81c883610f96954494bf75a4e78e53383f
parent 75d6bc1a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -17108,8 +17108,6 @@ package android.media.tv {
    method public void setStreamVolume(float);
    method public void setTvInputListener(android.media.tv.TvView.TvInputListener);
    method public void tune(java.lang.String, android.net.Uri);
    field public static final int ERROR_INPUT_DISCONNECTED = 1; // 0x1
    field public static final int ERROR_INPUT_NOT_CONNECTED = 0; // 0x0
  }
  public static abstract interface TvView.OnUnhandledInputEventListener {
@@ -17119,9 +17117,10 @@ package android.media.tv {
  public static abstract class TvView.TvInputListener {
    ctor public TvView.TvInputListener();
    method public void onChannelRetuned(java.lang.String, android.net.Uri);
    method public void onConnectionFailed(java.lang.String);
    method public void onContentAllowed(java.lang.String);
    method public void onContentBlocked(java.lang.String, android.media.tv.TvContentRating);
    method public void onError(java.lang.String, int);
    method public void onDisconnected(java.lang.String);
    method public void onTrackSelected(java.lang.String, int, java.lang.String);
    method public void onTracksChanged(java.lang.String, java.util.List<android.media.tv.TvTrackInfo>);
    method public void onVideoAvailable(java.lang.String);
+13 −19
Original line number Diff line number Diff line
@@ -59,19 +59,6 @@ public class TvView extends ViewGroup {
    // STOPSHIP: Turn debugging off.
    private static final boolean DEBUG = true;

    /**
     * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the connection to
     * the requested TV input was not established thus the view is unable to handle the further
     * operations.
     */
    public static final int ERROR_INPUT_NOT_CONNECTED = 0;

    /**
     * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the underlying TV
     * input has been disconnected.
     */
    public static final int ERROR_INPUT_DISCONNECTED = 1;

    private static final int VIDEO_SIZE_VALUE_UNKNOWN = 0;

    private static final int ZORDER_MEDIA = 0;
@@ -686,13 +673,20 @@ public class TvView extends ViewGroup {
    public abstract static class TvInputListener {

        /**
         * This is invoked when an error occurred while handling requested operation.
         * This is invoked when an error occurred while establishing a connection to the underlying
         * TV input.
         *
         * @param inputId The ID of the TV input bound to this view.
         */
        public void onConnectionFailed(String inputId) {
        }

        /**
         * This is invoked when the existing connection to the underlying TV input is lost.
         *
         * @param inputId The ID of the TV input bound to this view.
         * @param errorCode The error code. For the details of error code, please see
         *         {@link TvView}.
         */
        public void onError(String inputId, int errorCode) {
        public void onDisconnected(String inputId) {
        }

        /**
@@ -857,7 +851,7 @@ public class TvView extends ViewGroup {
                }
            } else {
                if (mListener != null) {
                    mListener.onError(mInputId, ERROR_INPUT_NOT_CONNECTED);
                    mListener.onConnectionFailed(mInputId);
                }
            }
        }
@@ -870,7 +864,7 @@ public class TvView extends ViewGroup {
            mSessionCallback = null;
            mSession = null;
            if (mListener != null) {
                mListener.onError(mInputId, ERROR_INPUT_DISCONNECTED);
                mListener.onDisconnected(mInputId);
            }
        }