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

Commit 8ed7a545 authored by Henry Fang's avatar Henry Fang Committed by Automerger Merge Worker
Browse files

Merge "Add methods to get vendor extension interfaces" am: 1d6f1c9d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1826093

Change-Id: Ib2719a51470c4044beaaed0937a85051cb958496
parents 26af7dd3 1d6f1c9d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5841,9 +5841,11 @@ package android.media.tv {
    method @Nullable @RequiresPermission(android.Manifest.permission.TV_INPUT_HARDWARE) public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, @NonNull android.media.tv.TvInputInfo, @Nullable String, int, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.TvInputManager.HardwareCallback);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PARENTAL_CONTROLS) public void addBlockedRating(@NonNull android.media.tv.TvContentRating);
    method @RequiresPermission(android.Manifest.permission.CAPTURE_TV_INPUT) public boolean captureFrame(String, android.view.Surface, android.media.tv.TvStreamConfig);
    method @NonNull public java.util.List<java.lang.String> getAvailableExtensionInterfaceNames(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.CAPTURE_TV_INPUT) public java.util.List<android.media.tv.TvStreamConfig> getAvailableTvStreamConfigList(String);
    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_TUNED_INFO) public java.util.List<android.media.tv.TunedInfo> getCurrentTunedInfos();
    method @NonNull @RequiresPermission("android.permission.DVB_DEVICE") public java.util.List<android.media.tv.DvbDeviceInfo> getDvbDeviceList();
    method @Nullable public android.os.IBinder getExtensionInterface(@NonNull String, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.TV_INPUT_HARDWARE) public java.util.List<android.media.tv.TvInputHardwareInfo> getHardwareList();
    method @RequiresPermission(android.Manifest.permission.READ_CONTENT_RATING_SYSTEMS) public java.util.List<android.media.tv.TvContentRatingSystemInfo> getTvContentRatingSystemList();
    method @RequiresPermission(android.Manifest.permission.CAPTURE_TV_INPUT) public boolean isSingleSessionActive();
@@ -5874,6 +5876,9 @@ package android.media.tv {
  public abstract class TvInputService extends android.app.Service {
    method @Nullable public android.os.IBinder createExtension();
    method @NonNull public java.util.List<java.lang.String> getAvailableExtensionInterfaceNames();
    method @Nullable public android.os.IBinder getExtensionInterface(@NonNull String);
    method @Nullable public String getExtensionInterfacePermission(@NonNull String);
    method @Nullable public android.media.tv.TvInputInfo onHardwareAdded(android.media.tv.TvInputHardwareInfo);
    method @Nullable public String onHardwareRemoved(android.media.tv.TvInputHardwareInfo);
    method @Nullable public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo);
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ interface ITvInputManager {
    TvInputInfo getTvInputInfo(in String inputId, int userId);
    void updateTvInputInfo(in TvInputInfo inputInfo, int userId);
    int getTvInputState(in String inputId, int userId);
    List<String> getAvailableExtensionInterfaceNames(in String inputId, int userId);
    IBinder getExtensionInterface(in String inputId, in String name, int userId);

    List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId);

+13 −10
Original line number Diff line number Diff line
@@ -26,18 +26,21 @@ import android.view.InputChannel;
 * Top-level interface to a TV input component (implemented in a Service).
 * @hide
 */
oneway interface ITvInputService {
    void registerCallback(in ITvInputServiceCallback callback);
    void unregisterCallback(in ITvInputServiceCallback callback);
    void createSession(in InputChannel channel, in ITvInputSessionCallback callback,
interface ITvInputService {
    oneway void registerCallback(in ITvInputServiceCallback callback);
    oneway void unregisterCallback(in ITvInputServiceCallback callback);
    oneway void createSession(in InputChannel channel, in ITvInputSessionCallback callback,
            in String inputId, in String sessionId);
    void createRecordingSession(in ITvInputSessionCallback callback, in String inputId,
    oneway void createRecordingSession(in ITvInputSessionCallback callback, in String inputId,
            in String sessionId);
    List<String> getAvailableExtensionInterfaceNames();
    IBinder getExtensionInterface(in String name);
    String getExtensionInterfacePermission(in String name);

    // For hardware TvInputService
    void notifyHardwareAdded(in TvInputHardwareInfo hardwareInfo);
    void notifyHardwareRemoved(in TvInputHardwareInfo hardwareInfo);
    void notifyHdmiDeviceAdded(in HdmiDeviceInfo deviceInfo);
    void notifyHdmiDeviceRemoved(in HdmiDeviceInfo deviceInfo);
    void notifyHdmiDeviceUpdated(in HdmiDeviceInfo deviceInfo);
    oneway void notifyHardwareAdded(in TvInputHardwareInfo hardwareInfo);
    oneway void notifyHardwareRemoved(in TvInputHardwareInfo hardwareInfo);
    oneway void notifyHdmiDeviceAdded(in HdmiDeviceInfo deviceInfo);
    oneway void notifyHdmiDeviceRemoved(in HdmiDeviceInfo deviceInfo);
    oneway void notifyHdmiDeviceUpdated(in HdmiDeviceInfo deviceInfo);
}
+51 −0
Original line number Diff line number Diff line
@@ -1389,6 +1389,57 @@ public final class TvInputManager {
        }
    }

    /**
     * Returns available extension interfaces of a given hardware TV input. This can be used to
     * provide domain-specific features that are only known between certain hardware TV inputs
     * and their clients.
     *
     * @param inputId The ID of the TV input.
     * @return a non-null list of extension interface names available to the caller. An empty
     *         list indicates the given TV input is not found, or the given TV input is not a
     *         hardware TV input, or the given TV input doesn't support any extension
     *         interfaces, or the caller doesn't hold the required permission for the extension
     *         interfaces supported by the given TV input.
     * @see #getExtensionInterface
     * @hide
     */
    @SystemApi
    @NonNull
    public List<String> getAvailableExtensionInterfaceNames(@NonNull String inputId) {
        Preconditions.checkNotNull(inputId);
        try {
            return mService.getAvailableExtensionInterfaceNames(inputId, mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Returns an extension interface of a given hardware TV input. This can be used to provide
     * domain-specific features that are only known between certain hardware TV inputs and
     * their clients.
     *
     * @param inputId The ID of the TV input.
     * @param name The extension interface name.
     * @return an {@link IBinder} for the given extension interface, {@code null} if the given TV
     *         input is not found, or if the given TV input is not a hardware TV input, or if the
     *         given TV input doesn't support the given extension interface, or if the caller
     *         doesn't hold the required permission for the given extension interface.
     * @see #getAvailableExtensionInterfaceNames
     * @hide
     */
    @SystemApi
    @Nullable
    public IBinder getExtensionInterface(@NonNull String inputId, @NonNull String name) {
        Preconditions.checkNotNull(inputId);
        Preconditions.checkNotNull(name);
        try {
            return mService.getExtensionInterface(inputId, name, mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Registers a {@link TvInputCallback}.
     *
+76 −0
Original line number Diff line number Diff line
@@ -200,6 +200,21 @@ public abstract class TvInputService extends Service {
                        .sendToTarget();
            }

            @Override
            public List<String>  getAvailableExtensionInterfaceNames() {
                return TvInputService.this.getAvailableExtensionInterfaceNames();
            }

            @Override
            public IBinder getExtensionInterface(String name) {
                return TvInputService.this.getExtensionInterface(name);
            }

            @Override
            public String getExtensionInterfacePermission(String name) {
                return TvInputService.this.getExtensionInterfacePermission(name);
            }

            @Override
            public void notifyHardwareAdded(TvInputHardwareInfo hardwareInfo) {
                mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HARDWARE_INPUT,
@@ -252,6 +267,67 @@ public abstract class TvInputService extends Service {
        return null;
    }

    /**
     * Returns available extension interfaces. This can be used to provide domain-specific
     * features that are only known between certain hardware TV inputs and their clients.
     *
     * <p>Note that this service-level extension interface mechanism is only for hardware
     * TV inputs that are bound even when sessions are not created.
     *
     * @return a non-null list of available extension interface names. An empty list
     *         indicates the TV input doesn't support any extension interfaces.
     * @see #getExtensionInterface
     * @see #getExtensionInterfacePermission
     * @hide
     */
    @NonNull
    @SystemApi
    public List<String> getAvailableExtensionInterfaceNames() {
        return new ArrayList<>();
    }

    /**
     * Returns an extension interface. This can be used to provide domain-specific features
     * that are only known between certain hardware TV inputs and their clients.
     *
     * <p>Note that this service-level extension interface mechanism is only for hardware
     * TV inputs that are bound even when sessions are not created.
     *
     * @param name The extension interface name.
     * @return an {@link IBinder} for the given extension interface, {@code null} if the TV input
     *         doesn't support the given extension interface.
     * @see #getAvailableExtensionInterfaceNames
     * @see #getExtensionInterfacePermission
     * @hide
     */
    @Nullable
    @SystemApi
    public IBinder getExtensionInterface(@NonNull String name) {
        return null;
    }

    /**
     * Returns a permission for the given extension interface. This can be used to provide
     * domain-specific features that are only known between certain hardware TV inputs and their
     * clients.
     *
     * <p>Note that this service-level extension interface mechanism is only for hardware
     * TV inputs that are bound even when sessions are not created.
     *
     * @param name The extension interface name.
     * @return a name of the permission being checked for the given extension interface,
     *         {@code null} if there is no required permission, or if the TV input doesn't
     *         support the given extension interface.
     * @see #getAvailableExtensionInterfaceNames
     * @see #getExtensionInterface
     * @hide
     */
    @Nullable
    @SystemApi
    public String getExtensionInterfacePermission(@NonNull String name) {
        return null;
    }

    /**
     * Returns a concrete implementation of {@link Session}.
     *
Loading