From 0632d8ae71418bea092f9f2c7e62118213e7cc78 Mon Sep 17 00:00:00 2001 From: Dongwon Kang Date: Fri, 18 Mar 2016 07:42:04 -0700 Subject: [PATCH] TIF: Address comments on hardware manager related system APIs Bug: 25726241 Change-Id: I0a3e7e8cf494d897fc04528ba719faa4150b9207 --- api/removed.txt | 4 ++ api/system-current.txt | 2 +- api/system-removed.txt | 4 ++ api/test-removed.txt | 4 ++ .../java/android/media/tv/TvInputManager.java | 48 ++++++++++++++++--- 5 files changed, 55 insertions(+), 7 deletions(-) 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 99a4ad3c448a6..9410fc5579f17 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -24682,7 +24682,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 c72a7a027e901..a4bff25d77d58 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -824,11 +824,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); } @@ -1470,18 +1480,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() { @@ -1503,6 +1536,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