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

Commit 61acf46d authored by Wonsik Kim's avatar Wonsik Kim Committed by Android (Google) Code Review
Browse files

Merge "TIF: revise API names" into lmp-dev

parents eb2727bb 9bf671f8
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -16786,8 +16786,8 @@ package android.media.tv {
    method public int getInputState(java.lang.String);
    method public android.media.tv.TvInputInfo getTvInputInfo(java.lang.String);
    method public java.util.List<android.media.tv.TvInputInfo> getTvInputList();
    method public void registerCallback(android.media.tv.TvInputManager.TvInputCallback, android.os.Handler);
    method public void unregisterCallback(android.media.tv.TvInputManager.TvInputCallback);
    method public void registerListener(android.media.tv.TvInputManager.TvInputListener, android.os.Handler);
    method public void unregisterListener(android.media.tv.TvInputManager.TvInputListener);
    field public static final int INPUT_STATE_CONNECTED = 0; // 0x0
    field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
    field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
@@ -16797,8 +16797,8 @@ package android.media.tv {
    field public static final int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL = 2; // 0x2
  }
  public static abstract class TvInputManager.TvInputCallback {
    ctor public TvInputManager.TvInputCallback();
  public static abstract class TvInputManager.TvInputListener {
    ctor public TvInputManager.TvInputListener();
    method public void onInputAdded(java.lang.String);
    method public void onInputRemoved(java.lang.String);
    method public void onInputStateChanged(java.lang.String, int);
@@ -16836,7 +16836,6 @@ 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);
@@ -16844,6 +16843,7 @@ package android.media.tv {
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public abstract void onRelease();
    method public void onRequestUnblockContent(android.media.tv.TvContentRating);
    method public boolean onSelectTrack(android.media.tv.TvTrackInfo);
    method public abstract void onSetCaptionEnabled(boolean);
    method public abstract void onSetStreamVolume(float);
@@ -16857,14 +16857,14 @@ package android.media.tv {
  }
  public final class TvParentalControlManager {
    method public void addParentalControlCallback(android.media.tv.TvParentalControlManager.ParentalControlCallback, android.os.Handler);
    method public void addParentalControlListener(android.media.tv.TvParentalControlManager.ParentalControlListener, android.os.Handler);
    method public final boolean isEnabled();
    method public final boolean isRatingBlocked(android.media.tv.TvContentRating);
    method public void removeParentalControlCallback(android.media.tv.TvParentalControlManager.ParentalControlCallback);
    method public void removeParentalControlListener(android.media.tv.TvParentalControlManager.ParentalControlListener);
  }
  public static abstract class TvParentalControlManager.ParentalControlCallback {
    ctor public TvParentalControlManager.ParentalControlCallback();
  public static abstract class TvParentalControlManager.ParentalControlListener {
    ctor public TvParentalControlManager.ParentalControlListener();
    method public void onBlockedRatingsChanged();
    method public void onEnabledChanged(boolean);
  }
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ 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);
    void requestUnblockContent(in IBinder sessionToken, in String unblockedRating, int userId);

    // For TV input hardware binding
    List<TvInputHardwareInfo> getHardwareList();
+1 −1
Original line number Diff line number Diff line
@@ -42,5 +42,5 @@ oneway interface ITvInputSession {
    void relayoutOverlayView(in Rect frame);
    void removeOverlayView();

    void unblockContent(in String unblockedRating);
    void requestUnblockContent(in String unblockedRating);
}
+6 −5
Original line number Diff line number Diff line
@@ -51,7 +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 static final int DO_REQUEST_UNBLOCK_CONTENT = 12;

    private final HandlerCaller mCaller;

@@ -133,8 +133,8 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.removeOverlayView(true);
                return;
            }
            case DO_UNBLOCK_CONTENT: {
                mTvInputSessionImpl.unblockContent((String) msg.obj);
            case DO_REQUEST_UNBLOCK_CONTENT: {
                mTvInputSessionImpl.requestUnblockContent((String) msg.obj);
                return;
            }
            default: {
@@ -202,8 +202,9 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    }

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

    private final class TvInputEventReceiver extends InputEventReceiver {
+33 −33
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public final class TvInputManager {
     * The TV input is connected.
     * <p>
     * State for {@link #getInputState} and {@link
     * TvInputManager.TvInputCallback#onInputStateChanged}.
     * TvInputManager.TvInputListener#onInputStateChanged}.
     * </p>
     */
    public static final int INPUT_STATE_CONNECTED = 0;
@@ -82,7 +82,7 @@ public final class TvInputManager {
     * fully ready.
     * <p>
     * State for {@link #getInputState} and {@link
     * TvInputManager.TvInputCallback#onInputStateChanged}.
     * TvInputManager.TvInputListener#onInputStateChanged}.
     * </p>
     */
    public static final int INPUT_STATE_CONNECTED_STANDBY = 1;
@@ -90,7 +90,7 @@ public final class TvInputManager {
     * The TV input is disconnected.
     * <p>
     * State for {@link #getInputState} and {@link
     * TvInputManager.TvInputCallback#onInputStateChanged}.
     * TvInputManager.TvInputListener#onInputStateChanged}.
     * </p>
     */
    public static final int INPUT_STATE_DISCONNECTED = 2;
@@ -100,8 +100,8 @@ public final class TvInputManager {
    private final Object mLock = new Object();

    // @GuardedBy(mLock)
    private final List<TvInputCallbackRecord> mTvInputCallbackRecordsList =
            new LinkedList<TvInputCallbackRecord>();
    private final List<TvInputListenerRecord> mTvInputListenerRecordsList =
            new LinkedList<TvInputListenerRecord>();

    // A mapping from TV input ID to the state of corresponding input.
    // @GuardedBy(mLock)
@@ -315,7 +315,7 @@ public final class TvInputManager {
    /**
     * Interface used to monitor status of the TV input.
     */
    public abstract static class TvInputCallback {
    public abstract static class TvInputListener {
        /**
         * This is called when the state of a given TV input is changed.
         *
@@ -347,24 +347,24 @@ public final class TvInputManager {
        }
    }

    private static final class TvInputCallbackRecord {
        private final TvInputCallback mCallback;
    private static final class TvInputListenerRecord {
        private final TvInputListener mListener;
        private final Handler mHandler;

        public TvInputCallbackRecord(TvInputCallback callback, Handler handler) {
            mCallback = callback;
        public TvInputListenerRecord(TvInputListener listener, Handler handler) {
            mListener = listener;
            mHandler = handler;
        }

        public TvInputCallback getCallback() {
            return mCallback;
        public TvInputListener getListener() {
            return mListener;
        }

        public void postInputStateChanged(final String inputId, final int state) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mCallback.onInputStateChanged(inputId, state);
                    mListener.onInputStateChanged(inputId, state);
                }
            });
        }
@@ -373,7 +373,7 @@ public final class TvInputManager {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mCallback.onInputAdded(inputId);
                    mListener.onInputAdded(inputId);
                }
            });
        }
@@ -382,7 +382,7 @@ public final class TvInputManager {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mCallback.onInputRemoved(inputId);
                    mListener.onInputRemoved(inputId);
                }
            });
        }
@@ -516,7 +516,7 @@ public final class TvInputManager {
            public void onInputStateChanged(String inputId, int state) {
                synchronized (mLock) {
                    mStateMap.put(inputId, state);
                    for (TvInputCallbackRecord record : mTvInputCallbackRecordsList) {
                    for (TvInputListenerRecord record : mTvInputListenerRecordsList) {
                        record.postInputStateChanged(inputId, state);
                    }
                }
@@ -526,7 +526,7 @@ public final class TvInputManager {
            public void onInputAdded(String inputId) {
                synchronized (mLock) {
                    mStateMap.put(inputId, INPUT_STATE_CONNECTED);
                    for (TvInputCallbackRecord record : mTvInputCallbackRecordsList) {
                    for (TvInputListenerRecord record : mTvInputListenerRecordsList) {
                        record.postInputAdded(inputId);
                    }
                }
@@ -536,7 +536,7 @@ public final class TvInputManager {
            public void onInputRemoved(String inputId) {
                synchronized (mLock) {
                    mStateMap.remove(inputId);
                    for (TvInputCallbackRecord record : mTvInputCallbackRecordsList) {
                    for (TvInputListenerRecord record : mTvInputListenerRecordsList) {
                        record.postInputRemoved(inputId);
                    }
                }
@@ -602,39 +602,39 @@ public final class TvInputManager {
    }

    /**
     * Registers a {@link TvInputCallback}.
     * Registers a {@link TvInputListener}.
     *
     * @param callback A callback used to monitor status of the TV inputs.
     * @param listener A listener used to monitor status of the TV inputs.
     * @param handler A {@link Handler} that the status change will be delivered to.
     * @throws IllegalArgumentException if any of the arguments is {@code null}.
     */
    public void registerCallback(TvInputCallback callback, Handler handler) {
        if (callback == null) {
    public void registerListener(TvInputListener listener, Handler handler) {
        if (listener == null) {
            throw new IllegalArgumentException("callback cannot be null");
        }
        if (handler == null) {
            throw new IllegalArgumentException("handler cannot be null");
        }
        synchronized (mLock) {
            mTvInputCallbackRecordsList.add(new TvInputCallbackRecord(callback, handler));
            mTvInputListenerRecordsList.add(new TvInputListenerRecord(listener, handler));
        }
    }

    /**
     * Unregisters the existing {@link TvInputCallback}.
     * Unregisters the existing {@link TvInputListener}.
     *
     * @param callback The existing callback to remove.
     * @param listener The existing listener to remove.
     * @throws IllegalArgumentException if any of the arguments is {@code null}.
     */
    public void unregisterCallback(final TvInputCallback callback) {
        if (callback == null) {
    public void unregisterListener(final TvInputListener listener) {
        if (listener == null) {
            throw new IllegalArgumentException("callback cannot be null");
        }
        synchronized (mLock) {
            for (Iterator<TvInputCallbackRecord> it = mTvInputCallbackRecordsList.iterator();
            for (Iterator<TvInputListenerRecord> it = mTvInputListenerRecordsList.iterator();
                    it.hasNext(); ) {
                TvInputCallbackRecord record = it.next();
                if (record.getCallback() == callback) {
                TvInputListenerRecord record = it.next();
                if (record.getListener() == listener) {
                    it.remove();
                    break;
                }
@@ -963,15 +963,15 @@ public final class TvInputManager {
        }

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