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

Commit 3e5576c5 authored by Ji-Hwan Lee's avatar Ji-Hwan Lee Committed by Android Git Automerger
Browse files

am 22185ce0: TIF: Support HDMI-CEC active source management

* commit '22185ce066e7ad658b31affbc01ebac4b8bd5f80':
  TIF: Support HDMI-CEC active source management
parents 62f2d437 4c52697d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ interface ITvInputManager {
    void createSession(in ITvInputClient client, in String inputId, int seq, int userId);
    void releaseSession(in IBinder sessionToken, int userId);

    void setMainSession(in IBinder sessionToken, int userId);
    void setSurface(in IBinder sessionToken, in Surface surface, int userId);
    void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height,
            int userId);
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.Surface;
oneway interface ITvInputSession {
    void release();

    void setMainSession(boolean isMainSession);
    void setSurface(in Surface surface);
    void dispatchSurfaceChanged(int format, int width, int height);
    // TODO: Remove this once it becomes irrelevant for applications to handle audio focus. The plan
+22 −12
Original line number Diff line number Diff line
@@ -42,18 +42,19 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    private static final String TAG = "TvInputSessionWrapper";

    private static final int DO_RELEASE = 1;
    private static final int DO_SET_SURFACE = 2;
    private static final int DO_DISPATCH_SURFACE_CHANGED = 3;
    private static final int DO_SET_STREAM_VOLUME = 4;
    private static final int DO_TUNE = 5;
    private static final int DO_SET_CAPTION_ENABLED = 6;
    private static final int DO_SELECT_TRACK = 7;
    private static final int DO_UNSELECT_TRACK = 8;
    private static final int DO_APP_PRIVATE_COMMAND = 9;
    private static final int DO_CREATE_OVERLAY_VIEW = 10;
    private static final int DO_RELAYOUT_OVERLAY_VIEW = 11;
    private static final int DO_REMOVE_OVERLAY_VIEW = 12;
    private static final int DO_REQUEST_UNBLOCK_CONTENT = 13;
    private static final int DO_SET_MAIN_SESSION = 2;
    private static final int DO_SET_SURFACE = 3;
    private static final int DO_DISPATCH_SURFACE_CHANGED = 4;
    private static final int DO_SET_STREAM_VOLUME = 5;
    private static final int DO_TUNE = 6;
    private static final int DO_SET_CAPTION_ENABLED = 7;
    private static final int DO_SELECT_TRACK = 8;
    private static final int DO_UNSELECT_TRACK = 9;
    private static final int DO_APP_PRIVATE_COMMAND = 10;
    private static final int DO_CREATE_OVERLAY_VIEW = 11;
    private static final int DO_RELAYOUT_OVERLAY_VIEW = 12;
    private static final int DO_REMOVE_OVERLAY_VIEW = 13;
    private static final int DO_REQUEST_UNBLOCK_CONTENT = 14;

    private final HandlerCaller mCaller;

@@ -91,6 +92,10 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                }
                return;
            }
            case DO_SET_MAIN_SESSION: {
                mTvInputSessionImpl.setMainSession((Boolean) msg.obj);
                return;
            }
            case DO_SET_SURFACE: {
                mTvInputSessionImpl.setSurface((Surface) msg.obj);
                return;
@@ -157,6 +162,11 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_RELEASE));
    }

    @Override
    public void setMainSession(boolean isMain) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_MAIN_SESSION, isMain));
    }

    @Override
    public void setSurface(Surface surface) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_SURFACE, surface));
+16 −0
Original line number Diff line number Diff line
@@ -773,6 +773,22 @@ public final class TvInputManager {
            releaseInternal();
        }

        /**
         * Set this as main session. See {@link TvView#setMainTvView} for about meaning of "main".
         * @hide
         */
        public void setMainSession() {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.setMainSession(mToken, mUserId);
            } catch (RemoteException e) {
                throw new RuntimeException(e);
            }
        }

        /**
         * Sets the {@link android.view.Surface} for this session.
         *
+33 −0
Original line number Diff line number Diff line
@@ -473,6 +473,32 @@ public abstract class TvInputService extends Service {
         */
        public abstract void onRelease();

        /**
         * Set the current session as the "main" session. See {@link TvView#setMainTvView} for the
         * meaning of "main".
         * <p>
         * This is primarily for HDMI-CEC active source management. TV input service that manages
         * HDMI-CEC logical device should make sure not only to select the corresponding HDMI
         * logical device as source device on {@code onSetMainSession(true)}, but also to select
         * internal device on {@code onSetMainSession(false)}. Also, if surface is set to non-main
         * session, it needs to select internal device after temporarily selecting corresponding
         * HDMI logical device for set up.
         * </p><p>
         * It is guaranteed that {@code onSetMainSession(true)} for new session is called first,
         * and {@code onSetMainSession(false)} for old session is called afterwards. This allows
         * {@code onSetMainSession(false)} to be no-op when TV input service knows that the next
         * main session corresponds to another HDMI logical device. Practically, this implies that
         * one TV input service should handle all HDMI port and HDMI-CEC logical devices for smooth
         * active source transition.
         * </p>
         *
         * @param isMainSession If true, session is main.
         * @hide
         */
        @SystemApi
        public void onSetMainSession(boolean isMainSession) {
        }

        /**
         * Sets the {@link Surface} for the current input session on which the TV input renders
         * video.
@@ -726,6 +752,13 @@ public abstract class TvInputService extends Service {
            removeOverlayView(true);
        }

        /**
         * Calls {@link #onSetMain}.
         */
        void setMainSession(boolean isMainSession) {
            onSetMainSession(isMainSession);
        }

        /**
         * Calls {@link #onSetSurface}.
         */
Loading