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

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

Merge "TIF: Add unblock content" into lmp-dev

parents 427f7429 903d6b72
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16675,6 +16675,7 @@ package android.media.tv {
    method public void dispatchTrackInfoChanged(java.util.List<android.media.tv.TvTrackInfo>);
    method public void dispatchVideoAvailable();
    method public void dispatchVideoUnavailable(int);
    method public abstract void onContentUnblocked(android.media.tv.TvContentRating);
    method public android.view.View onCreateOverlayView();
    method public boolean onGenericMotionEvent(android.view.MotionEvent);
    method public boolean onKeyDown(int, android.view.KeyEvent);
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ interface ITvInputManager {
    void relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId);
    void removeOverlayView(in IBinder sessionToken, int userId);

    void unblockContent(in IBinder sessionToken, in String unblockedRating, int userId);

    // For TV input hardware binding
    List<TvInputHardwareInfo> getHardwareList();
    /*
+2 −0
Original line number Diff line number Diff line
@@ -41,4 +41,6 @@ oneway interface ITvInputSession {
    void createOverlayView(in IBinder windowToken, in Rect frame);
    void relayoutOverlayView(in Rect frame);
    void removeOverlayView();

    void unblockContent(in String unblockedRating);
}
+10 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    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 static final int DO_UNBLOCK_CONTENT = 12;

    private final HandlerCaller mCaller;

@@ -132,6 +133,10 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.removeOverlayView(true);
                return;
            }
            case DO_UNBLOCK_CONTENT: {
                mTvInputSessionImpl.unblockContent((String) msg.obj);
                return;
            }
            default: {
                Log.w(TAG, "Unhandled message code: " + msg.what);
                return;
@@ -196,6 +201,11 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_REMOVE_OVERLAY_VIEW));
    }

    @Override
    public void unblockContent(String unblockedRating) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_UNBLOCK_CONTENT, unblockedRating));
    }

    private final class TvInputEventReceiver extends InputEventReceiver {
        public TvInputEventReceiver(InputChannel inputChannel, Looper looper) {
            super(inputChannel, looper);
+15 −0
Original line number Diff line number Diff line
@@ -931,6 +931,21 @@ public final class TvInputManager {
            }
        }

        /**
         * Unblock content blocked by parental controls.
         */
        void unblockContent(TvContentRating unblockedRating) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.unblockContent(mToken, unblockedRating.flattenToString(), mUserId);
            } catch (RemoteException e) {
                throw new RuntimeException(e);
            }
        }

        /**
         * Dispatches an input event to this session.
         *
Loading