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

Commit b375805f authored by Jae Seo's avatar Jae Seo
Browse files

TIF: Add a method to get TvInputInfo for a given TV input

This is going to be needed by applications to get information about the
inputs that are just added thus not included in the previously retrieved
input list.

Bug: 16166859, Bug: 15838097
Change-Id: Icecd03fcea208a0c4d41caab1eec64e574f40877
parent 56d77b9c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16608,6 +16608,7 @@ package android.media.tv {
  public final class TvInputManager {
    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 registerListener(android.media.tv.TvInputManager.TvInputListener, android.os.Handler);
    method public void unregisterListener(android.media.tv.TvInputManager.TvInputListener);
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.view.Surface;
 */
interface ITvInputManager {
    List<TvInputInfo> getTvInputList(int userId);
    TvInputInfo getTvInputInfo(in String inputId, int userId);

    void registerCallback(in ITvInputManagerCallback callback, int userId);
    void unregisterCallback(in ITvInputManagerCallback callback, int userId);
+14 −0
Original line number Diff line number Diff line
@@ -477,6 +477,20 @@ public final class TvInputManager {
        }
    }

    /**
     * Returns the {@link TvInputInfo} for a given TV input.
     *
     * @param inputId The ID of the TV input.
     * @return the {@link TvInputInfo} for a given TV input. {@code null} if not found.
     */
    public TvInputInfo getTvInputInfo(String inputId) {
        try {
            return mService.getTvInputInfo(inputId, mUserId);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Returns the state of a given TV input. It retuns one of the following:
     * <ul>
+16 −0
Original line number Diff line number Diff line
@@ -753,6 +753,22 @@ public final class TvInputManagerService extends SystemService {
            }
        }

        @Override
        public TvInputInfo getTvInputInfo(String inputId, int userId) {
            final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
                    Binder.getCallingUid(), userId, "getTvInputInfo");
            final long identity = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    UserState userState = getUserStateLocked(resolvedUserId);
                    TvInputState state = userState.inputMap.get(inputId);
                    return state == null ? null : state.mInfo;
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
        public void registerCallback(final ITvInputManagerCallback callback, int userId) {
            final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),