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

Commit c66ca126 authored by Youngsang Cho's avatar Youngsang Cho Committed by Android (Google) Code Review
Browse files

Merge "TIF: Add a notification for surface change from TvView to TvInputService" into lmp-dev

parents b375805f e821d711
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16652,6 +16652,7 @@ package android.media.tv {
    method public abstract void onSetCaptionEnabled(boolean);
    method public abstract void onSetStreamVolume(float);
    method public abstract boolean onSetSurface(android.view.Surface);
    method public void onSurfaceChanged(int, int, int);
    method public boolean onTouchEvent(android.view.MotionEvent);
    method public boolean onTrackballEvent(android.view.MotionEvent);
    method public abstract boolean onTune(android.net.Uri);
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ interface ITvInputManager {
    void releaseSession(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);
    void setVolume(in IBinder sessionToken, float volume, int userId);
    void tune(in IBinder sessionToken, in Uri channelUri, int userId);
    void setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId);
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ oneway interface ITvInputSession {
    void release();

    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
    // is to introduce some new concepts that will solve a number of problems in audio policy today.
    void setVolume(float volume);
+21 −8
Original line number Diff line number Diff line
@@ -42,14 +42,15 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand

    private static final int DO_RELEASE = 1;
    private static final int DO_SET_SURFACE = 2;
    private static final int DO_SET_VOLUME = 3;
    private static final int DO_TUNE = 4;
    private static final int DO_SET_CAPTION_ENABLED = 5;
    private static final int DO_SELECT_TRACK = 6;
    private static final int DO_UNSELECT_TRACK = 7;
    private static final int DO_CREATE_OVERLAY_VIEW = 8;
    private static final int DO_RELAYOUT_OVERLAY_VIEW = 9;
    private static final int DO_REMOVE_OVERLAY_VIEW = 10;
    private static final int DO_DISPATCH_SURFACE_CHANGED = 3;
    private static final int DO_SET_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_CREATE_OVERLAY_VIEW = 9;
    private static final int DO_RELAYOUT_OVERLAY_VIEW = 10;
    private static final int DO_REMOVE_OVERLAY_VIEW = 11;

    private final HandlerCaller mCaller;

@@ -91,6 +92,12 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.setSurface((Surface) msg.obj);
                return;
            }
            case DO_DISPATCH_SURFACE_CHANGED: {
                SomeArgs args = (SomeArgs) msg.obj;
                mTvInputSessionImpl.dispatchSurfaceChanged(args.argi1, args.argi2, args.argi3);
                args.recycle();
                return;
            }
            case DO_SET_VOLUME: {
                mTvInputSessionImpl.setVolume((Float) msg.obj);
                return;
@@ -142,6 +149,12 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_SURFACE, surface));
    }

    @Override
    public void dispatchSurfaceChanged(int format, int width, int height) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageIIII(DO_DISPATCH_SURFACE_CHANGED,
                format, width, height, 0));
    }

    @Override
    public final void setVolume(float volume) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_VOLUME, volume));
+21 −0
Original line number Diff line number Diff line
@@ -668,6 +668,27 @@ public final class TvInputManager {
            }
        }

        /**
         * Notifies of any structural changes (format or size) of the {@link Surface}
         * passed by {@link #setSurface}.
         *
         * @param format The new PixelFormat of the {@link Surface}.
         * @param width The new width of the {@link Surface}.
         * @param height The new height of the {@link Surface}.
         * @hide
         */
        public void dispatchSurfaceChanged(int format, int width, int height) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.dispatchSurfaceChanged(mToken, format, width, height, mUserId);
            } catch (RemoteException e) {
                throw new RuntimeException(e);
            }
        }

        /**
         * Sets the relative stream volume of this session to handle a change of audio focus.
         *
Loading