From ee564881d99eeca24e1ef4b59ca6dab4d30a90d9 Mon Sep 17 00:00:00 2001 From: Dongwon Kang Date: Fri, 15 Apr 2016 17:44:37 -0700 Subject: [PATCH] TIF: Address API review comments - Remove TIS.updateTvInputInfo and unhide TIM.updateTvInputInfo - Add more doc on RECORDING_ERROR_UNKNOWN Bug: 28146354 Change-Id: I581ef17b60e0933f5c07df3f398d15b890b2e29d --- api/current.txt | 2 +- api/system-current.txt | 2 +- api/test-current.txt | 2 +- core/res/res/values/attrs.xml | 4 +-- .../java/android/media/tv/TvInputManager.java | 19 +++++++++++--- .../java/android/media/tv/TvInputService.java | 25 ------------------- 6 files changed, 20 insertions(+), 34 deletions(-) diff --git a/api/current.txt b/api/current.txt index 5df8750fcb7c4..558a627492ac0 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23021,6 +23021,7 @@ package android.media.tv { method public boolean isRatingBlocked(android.media.tv.TvContentRating); method public void registerCallback(android.media.tv.TvInputManager.TvInputCallback, android.os.Handler); method public void unregisterCallback(android.media.tv.TvInputManager.TvInputCallback); + method public void updateTvInputInfo(android.media.tv.TvInputInfo); field public static final java.lang.String ACTION_BLOCKED_RATINGS_CHANGED = "android.media.tv.action.BLOCKED_RATINGS_CHANGED"; field public static final java.lang.String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED = "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED"; field public static final java.lang.String ACTION_QUERY_CONTENT_RATING_SYSTEMS = "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS"; @@ -23058,7 +23059,6 @@ package android.media.tv { method public final android.os.IBinder onBind(android.content.Intent); method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String); method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String); - method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; } diff --git a/api/system-current.txt b/api/system-current.txt index acb699d26a050..1dbbdf30a3535 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -24707,6 +24707,7 @@ package android.media.tv { method public void removeBlockedRating(android.media.tv.TvContentRating); method public void setParentalControlsEnabled(boolean); method public void unregisterCallback(android.media.tv.TvInputManager.TvInputCallback); + method public void updateTvInputInfo(android.media.tv.TvInputInfo); field public static final java.lang.String ACTION_BLOCKED_RATINGS_CHANGED = "android.media.tv.action.BLOCKED_RATINGS_CHANGED"; field public static final java.lang.String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED = "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED"; field public static final java.lang.String ACTION_QUERY_CONTENT_RATING_SYSTEMS = "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS"; @@ -24761,7 +24762,6 @@ package android.media.tv { method public java.lang.String onHardwareRemoved(android.media.tv.TvInputHardwareInfo); method public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo); method public java.lang.String onHdmiDeviceRemoved(android.hardware.hdmi.HdmiDeviceInfo); - method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; } diff --git a/api/test-current.txt b/api/test-current.txt index e4b11bd2d4b5e..a4d63eab02f7c 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -23089,6 +23089,7 @@ package android.media.tv { method public boolean isRatingBlocked(android.media.tv.TvContentRating); method public void registerCallback(android.media.tv.TvInputManager.TvInputCallback, android.os.Handler); method public void unregisterCallback(android.media.tv.TvInputManager.TvInputCallback); + method public void updateTvInputInfo(android.media.tv.TvInputInfo); field public static final java.lang.String ACTION_BLOCKED_RATINGS_CHANGED = "android.media.tv.action.BLOCKED_RATINGS_CHANGED"; field public static final java.lang.String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED = "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED"; field public static final java.lang.String ACTION_QUERY_CONTENT_RATING_SYSTEMS = "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS"; @@ -23126,7 +23127,6 @@ package android.media.tv { method public final android.os.IBinder onBind(android.content.Intent); method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String); method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String); - method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 85e0b88bd9375..a3e6019569710 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -8083,11 +8083,11 @@ i + {@link android.media.tv.TvInputManager#updateTvInputInfo(android.media.tv.TvInputInfo)}. --> + {@link android.media.tv.TvInputManager#updateTvInputInfo(android.media.tv.TvInputInfo)}. --> diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index bfd938e4bfbdd..5c9d2b230abcd 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -191,7 +191,9 @@ public final class TvInputManager { /** * Error for {@link TvInputService.RecordingSession#notifyError(int)} and * {@link TvRecordingClient.RecordingCallback#onError(int)}: The requested operation cannot be - * completed due to a problem that does not fit under any other error codes. + * completed due to a problem that does not fit under any other error codes, or the error code + * for the problem is defined on the higher version than application's + * android:targetSdkVersion. */ public static final int RECORDING_ERROR_UNKNOWN = 0; @@ -1181,14 +1183,23 @@ public final class TvInputManager { } /** - * Updates information about an existing TV input. + * Updates the TvInputInfo for an existing TV input. A TV input service + * implementation may call this method to pass the application and system an up-to-date + * TvInputInfo object that describes itself. * - *

This is called internally only by {@link TvInputService}. + *

The system automatically creates a TvInputInfo object for each TV input, + * based on the information collected from the AndroidManifest.xml, thus it is not + * necessary to call this method unless such information has changed dynamically. + * Use {@link TvInputInfo.Builder} to build a new TvInputInfo object. + * + *

Attempting to change information about a TV input that the calling package does not own + * does nothing. * * @param inputInfo The TvInputInfo object that contains new information. * @throws IllegalArgumentException if the argument is {@code null}. + * @see TvInputCallback#onTvInputInfoUpdated(TvInputInfo) */ - void updateTvInputInfo(@NonNull TvInputInfo inputInfo) { + public void updateTvInputInfo(@NonNull TvInputInfo inputInfo) { Preconditions.checkNotNull(inputInfo); try { mService.updateTvInputInfo(inputInfo, mUserId); diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index 21211d74b2462..7ae8da091adb2 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -256,31 +256,6 @@ public abstract class TvInputService extends Service { return null; } - /** - * Updates the TvInputInfo for an existing TV input. A TV input service - * implementation may call this method to pass the application and system an up-to-date - * TvInputInfo object that describes itself. - * - *

The system automatically creates a TvInputInfo object for each TV input, - * based on the information collected from the AndroidManifest.xml, thus it is not - * necessary to call this method unless such information has changed dynamically. - * Use {@link TvInputInfo.Builder} to build a new TvInputInfo object. - * - *

Attempting to change information about a TV input that the calling package does not own - * does nothing. - * - * @param context The application context. - * @param inputInfo The TvInputInfo object that contains new information. - * @see TvInputManager.TvInputCallback#onTvInputInfoUpdated(TvInputInfo) - */ - public static final void updateTvInputInfo(Context context, TvInputInfo inputInfo) { - TvInputManager manager = (TvInputManager) context.getSystemService( - Context.TV_INPUT_SERVICE); - if (manager != null) { - manager.updateTvInputInfo(inputInfo); - } - } - private boolean isPassthroughInput(String inputId) { if (mTvInputManager == null) { mTvInputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE);