diff options
| -rw-r--r-- | api/current.txt | 4 | ||||
| -rw-r--r-- | api/removed.txt | 8 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/system-removed.txt | 8 | ||||
| -rw-r--r-- | api/test-current.txt | 4 | ||||
| -rw-r--r-- | api/test-removed.txt | 8 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputService.java | 15 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvView.java | 51 | ||||
| -rw-r--r-- | services/core/java/com/android/server/tv/TvInputManagerService.java | 1 |
9 files changed, 72 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt index 6bda86b80f04..37fd524ef77d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23021,6 +23021,7 @@ package android.media.tv { method public boolean onTouchEvent(android.view.MotionEvent); method public boolean onTrackballEvent(android.view.MotionEvent); method public abstract boolean onTune(android.net.Uri); + method public boolean onTune(android.net.Uri, android.os.Bundle); method public void onUnblockContent(android.media.tv.TvContentRating); method public void setOverlayViewEnabled(boolean); } @@ -23094,12 +23095,15 @@ package android.media.tv { method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener); method public void setStreamVolume(float); method public void setTimeShiftPositionCallback(android.media.tv.TvView.TimeShiftPositionCallback); + method public void setZOrderMediaOverlay(boolean); + method public void setZOrderOnTop(boolean); method public void timeShiftPause(); method public void timeShiftPlay(java.lang.String, android.net.Uri); method public void timeShiftResume(); method public void timeShiftSeekTo(long); method public void timeShiftSetPlaybackParams(android.media.PlaybackParams); method public void tune(java.lang.String, android.net.Uri); + method public void tune(java.lang.String, android.net.Uri, android.os.Bundle); } public static abstract interface TvView.OnUnhandledInputEventListener { diff --git a/api/removed.txt b/api/removed.txt index 115224ce49a6..6ad54d26fb99 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -43,6 +43,14 @@ package android.media { } +package android.media.tv { + + public class TvView extends android.view.ViewGroup { + method public void requestUnblockContent(android.media.tv.TvContentRating); + } + +} + package android.net { public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory { diff --git a/api/system-current.txt b/api/system-current.txt index a73d734d9017..23c6578eac7e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -24870,7 +24870,6 @@ package android.media.tv { method public java.util.List<android.media.tv.TvTrackInfo> getTracks(int); method protected void onLayout(boolean, int, int, int, int); method public boolean onUnhandledInputEvent(android.view.InputEvent); - method public deprecated void requestUnblockContent(android.media.tv.TvContentRating); method public void reset(); method public void selectTrack(int, java.lang.String); method public void sendAppPrivateCommand(java.lang.String, android.os.Bundle); diff --git a/api/system-removed.txt b/api/system-removed.txt index 9ebc484e6dd7..79f72975a194 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -41,6 +41,14 @@ package android.media { } +package android.media.tv { + + public class TvView extends android.view.ViewGroup { + method public void requestUnblockContent(android.media.tv.TvContentRating); + } + +} + package android.net { public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory { diff --git a/api/test-current.txt b/api/test-current.txt index 6693c7a85f38..bd90736c504d 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -23032,6 +23032,7 @@ package android.media.tv { method public boolean onTouchEvent(android.view.MotionEvent); method public boolean onTrackballEvent(android.view.MotionEvent); method public abstract boolean onTune(android.net.Uri); + method public boolean onTune(android.net.Uri, android.os.Bundle); method public void onUnblockContent(android.media.tv.TvContentRating); method public void setOverlayViewEnabled(boolean); } @@ -23105,12 +23106,15 @@ package android.media.tv { method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener); method public void setStreamVolume(float); method public void setTimeShiftPositionCallback(android.media.tv.TvView.TimeShiftPositionCallback); + method public void setZOrderMediaOverlay(boolean); + method public void setZOrderOnTop(boolean); method public void timeShiftPause(); method public void timeShiftPlay(java.lang.String, android.net.Uri); method public void timeShiftResume(); method public void timeShiftSeekTo(long); method public void timeShiftSetPlaybackParams(android.media.PlaybackParams); method public void tune(java.lang.String, android.net.Uri); + method public void tune(java.lang.String, android.net.Uri, android.os.Bundle); } public static abstract interface TvView.OnUnhandledInputEventListener { diff --git a/api/test-removed.txt b/api/test-removed.txt index 115224ce49a6..6ad54d26fb99 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -43,6 +43,14 @@ package android.media { } +package android.media.tv { + + public class TvView extends android.view.ViewGroup { + method public void requestUnblockContent(android.media.tv.TvContentRating); + } + +} + package android.net { public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory { diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index 8fb58b5ce068..bc20c1790de2 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -491,7 +491,7 @@ public abstract class TvInputService extends Service { * until this method is called. * * <p>The TV input service must call this method as soon as the content rendered onto its - * surface is ready for viewing. This method must be called each time {@link #onTune(Uri)} + * surface is ready for viewing. This method must be called each time {@link #onTune} * is called. * * @see #notifyVideoUnavailable @@ -837,14 +837,15 @@ public abstract class TvInputService extends Service { public abstract boolean onTune(Uri channelUri); /** - * Calls {@link #onTune(Uri)}. Override this method in order to handle {@code params}. + * Calls {@link #onTune(Uri)}. Override this method in order to handle domain-specific + * features that are only known between certain TV inputs and their clients. * * @param channelUri The URI of the channel. - * @param params The extra parameters from other applications. + * @param params Domain-specific data for this tune request. Keys <em>must</em> be a scoped + * name, i.e. prefixed with a package name you own, so that different developers + * will not create conflicting keys. * @return {@code true} if the tuning was successful, {@code false} otherwise. - * @hide */ - @SystemApi public boolean onTune(Uri channelUri, Bundle params) { return onTune(channelUri); } @@ -1209,7 +1210,7 @@ public abstract class TvInputService extends Service { } /** - * Calls {@link #onTune}. + * Calls {@link #onTune(Uri, Bundle)}. */ void tune(Uri channelUri, Bundle params) { mCurrentPositionMs = TvInputManager.TIME_SHIFT_INVALID_TIME; @@ -1836,7 +1837,7 @@ public abstract class TvInputService extends Service { * a hardware TV Input (e.g. HDMI 1) and forward the application's surface to the session so * that the user can see the screen of the hardware TV Input when she tunes to a channel from * this TV input. The implementation of this class is expected to change the channel of the - * external set-top box via a proprietary protocol when {@link HardwareSession#onTune(Uri)} is + * external set-top box via a proprietary protocol when {@link HardwareSession#onTune} is * requested by the application. * * <p>Note that this class is not for inputs for internal hardware like built-in tuner and HDMI diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index 5c4b52883391..96230769762c 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -18,6 +18,7 @@ package android.media.tv; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.content.Context; import android.graphics.Canvas; @@ -56,7 +57,7 @@ import java.util.Queue; * TV inputs available on the system can be obtained by calling * {@link TvInputManager#getTvInputList() TvInputManager.getTvInputList()}.) * - * <p>Once the application supplies the URI for a specific TV channel to {@link #tune(String, Uri)} + * <p>Once the application supplies the URI for a specific TV channel to {@link #tune} * method, it takes care of underlying service binding (and unbinding if the current TvView is * already bound to a service) and automatically allocates/deallocates resources needed. In addition * to a few essential methods to control how the contents are presented, it also provides a way to @@ -206,13 +207,18 @@ public class TvView extends ViewGroup { } /** - * Sets the Z order of a window owning the surface of this TvView above the normal TvView - * but below an application. + * Controls whether the TvView's surface is placed on top of another regular surface view in the + * window (but still behind the window itself). + * This is typically used to place overlays on top of an underlying TvView. * - * @see SurfaceView#setZOrderMediaOverlay - * @hide + * <p>Note that this must be set before the TvView's containing window is attached to the + * window manager. + * + * <p>Calling this overrides any previous call to {@link #setZOrderOnTop}. + * + * @param isMediaOverlay {@code true} to be on top of another regular surface, {@code false} + * otherwise. */ - @SystemApi public void setZOrderMediaOverlay(boolean isMediaOverlay) { if (isMediaOverlay) { mWindowZOrder = ZORDER_MEDIA_OVERLAY; @@ -230,12 +236,18 @@ public class TvView extends ViewGroup { } /** - * Sets the Z order of a window owning the surface of this TvView on top of an application. + * Controls whether the TvView's surface is placed on top of its window. Normally it is placed + * behind the window, to allow it to (for the most part) appear to composite with the views in + * the hierarchy. By setting this, you cause it to be placed above the window. This means that + * none of the contents of the window this TvView is in will be visible on top of its surface. * - * @see SurfaceView#setZOrderOnTop - * @hide + * <p>Note that this must be set before the TvView's containing window is attached to the window + * manager. + * + * <p>Calling this overrides any previous call to {@link #setZOrderMediaOverlay}. + * + * @param onTop {@code true} to be on top of its window, {@code false} otherwise. */ - @SystemApi public void setZOrderOnTop(boolean onTop) { if (onTop) { mWindowZOrder = ZORDER_ON_TOP; @@ -280,14 +292,15 @@ public class TvView extends ViewGroup { } /** - * Tunes to a given channel. + * Tunes to a given channel. This can be used to provide domain-specific features that are only + * known between certain TvView applications and their TV inputs. * * @param inputId The ID of TV input for the given channel. * @param channelUri The URI of a channel. - * @param params Extra parameters. - * @hide + * @param params Domain-specific data for this tune request. Keys <em>must</em> be a scoped + * name, i.e. prefixed with a package name you own, so that different developers will + * not create conflicting keys. */ - @SystemApi public void tune(String inputId, Uri channelUri, Bundle params) { if (DEBUG) Log.d(TAG, "tune(" + channelUri + ")"); if (TextUtils.isEmpty(inputId)) { @@ -360,11 +373,8 @@ public class TvView extends ViewGroup { * * @param unblockedRating A TvContentRating to unblock. * @see TvInputService.Session#notifyContentBlocked(TvContentRating) - * @hide - * @deprecated Use {@link #unblockContent} instead. + * @removed */ - @Deprecated - @SystemApi public void requestUnblockContent(TvContentRating unblockedRating) { unblockContent(unblockedRating); } @@ -379,6 +389,7 @@ public class TvView extends ViewGroup { * @hide */ @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PARENTAL_CONTROLS) public void unblockContent(TvContentRating unblockedRating) { if (mSession != null) { mSession.unblockContent(unblockedRating); @@ -539,7 +550,7 @@ public class TvView extends ViewGroup { } /** - * Calls {@link TvInputService.Session#appPrivateCommand(String, Bundle)} for the current + * Calls {@link TvInputService.Session#onAppPrivateCommand(String, Bundle)} for the current * session. * * @param action The name of the private command to send. This <em>must</em> be a scoped name, @@ -893,7 +904,7 @@ public class TvView extends ViewGroup { /** * This is invoked when the channel of this TvView is changed by the underlying TV input - * without any {@link TvView#tune(String, Uri)} request. + * without any {@link TvView#tune} request. * * @param inputId The ID of the TV input bound to this view. * @param channelUri The URI of a channel. diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java index 49aaa4aa1047..30442bcba48f 100644 --- a/services/core/java/com/android/server/tv/TvInputManagerService.java +++ b/services/core/java/com/android/server/tv/TvInputManagerService.java @@ -1292,6 +1292,7 @@ public final class TvInputManagerService extends SystemService { @Override public void unblockContent( IBinder sessionToken, String unblockedRating, int userId) { + ensureParentalControlsPermission(); final int callingUid = Binder.getCallingUid(); final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid, userId, "unblockContent"); |