diff --git a/api/removed.txt b/api/removed.txt index 86085c8ded67d..3f16bca3eff1c 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -94,6 +94,10 @@ package android.media { package android.media.tv { + public final class TvInputManager { + method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo); + } + public class TvView extends android.view.ViewGroup { method public void requestUnblockContent(android.media.tv.TvContentRating); } diff --git a/api/system-current.txt b/api/system-current.txt index 489d0bbf49096..d4f566fa94842 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -24638,7 +24638,7 @@ package android.media.tv { } public final class TvInputManager { - method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo); + method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputInfo, android.media.tv.TvInputManager.HardwareCallback); method public void addBlockedRating(android.media.tv.TvContentRating); method public boolean captureFrame(java.lang.String, android.view.Surface, android.media.tv.TvStreamConfig); method public java.util.List getAvailableTvStreamConfigList(java.lang.String); diff --git a/api/system-removed.txt b/api/system-removed.txt index bc1762722c18d..03cf8b0902a4d 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -92,6 +92,10 @@ package android.media { package android.media.tv { + public final class TvInputManager { + method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo); + } + public class TvView extends android.view.ViewGroup { method public void requestUnblockContent(android.media.tv.TvContentRating); } diff --git a/api/test-removed.txt b/api/test-removed.txt index 86085c8ded67d..3f16bca3eff1c 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -94,6 +94,10 @@ package android.media { package android.media.tv { + public final class TvInputManager { + method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo); + } + public class TvView extends android.view.ViewGroup { method public void requestUnblockContent(android.media.tv.TvContentRating); } diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 94e89de64a9ef..04ea683b505f5 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -843,11 +843,21 @@ public final class TvInputManager { /** * Interface used to receive events from Hardware objects. + * * @hide */ @SystemApi public abstract static class HardwareCallback { + /** + * This is called when {@link Hardware} is no longer available for the client. + */ public abstract void onReleased(); + + /** + * This is called when the underlying {@link TvStreamConfig} has been changed. + * + * @param configs A list of new {@link TvStreamConfig}s. + */ public abstract void onStreamConfigChanged(TvStreamConfig[] configs); } @@ -1489,18 +1499,41 @@ public final class TvInputManager { } /** - * Returns acquired TvInputManager.Hardware object for given deviceId. + * Acquires {@link Hardware} object for the given device ID. * - * If there are other Hardware object acquired for the same deviceId, calling this method will - * preempt the previously acquired object and report {@link HardwareCallback#onReleased} to the - * old object. + *

A subsequent call to this method on the same {@code deviceId} will release the currently + * acquired Hardware. + * + * @param deviceId The device ID to acquire Hardware for. + * @param callback A callback to receive updates on Hardware. + * @param info The TV input which will use the acquired Hardware. + * @return Hardware on success, {@code null} otherwise. + * + * @removed + */ + @RequiresPermission(android.Manifest.permission.TV_INPUT_HARDWARE) + public Hardware acquireTvInputHardware(int deviceId, final HardwareCallback callback, + TvInputInfo info) { + return acquireTvInputHardware(deviceId, info, callback); + } + + /** + * Acquires {@link Hardware} object for the given device ID. + * + *

A subsequent call to this method on the same {@code deviceId} will release the currently + * acquired Hardware. + * + * @param deviceId The device ID to acquire Hardware for. + * @param callback A callback to receive updates on Hardware. + * @param info The TV input which will use the acquired Hardware. + * @return Hardware on success, {@code null} otherwise. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.TV_INPUT_HARDWARE) - public Hardware acquireTvInputHardware(int deviceId, final HardwareCallback callback, - TvInputInfo info) { + public Hardware acquireTvInputHardware(int deviceId, TvInputInfo info, + final HardwareCallback callback) { try { return new Hardware( mService.acquireTvInputHardware(deviceId, new ITvInputHardwareCallback.Stub() { @@ -1522,6 +1555,9 @@ public final class TvInputManager { /** * Releases previously acquired hardware object. * + * @param deviceId The device ID this Hardware was acquired for + * @param hardware Hardware to release. + * * @hide */ @SystemApi