java.lang.Object | |
↳ | android.media.tv.TvInputService.Session |
Known Direct Subclasses |
Base class for derived classes to implement to provide a TV input session.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new Session.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notifies the channel of the session is retuned by TV input.
| |||||||||||
Informs the application that the user is allowed to watch the current program content.
| |||||||||||
Informs the application that the current program content is blocked by parent controls.
| |||||||||||
Sends the type and ID of a selected track.
| |||||||||||
Sends the list of all audio/video/subtitle tracks.
| |||||||||||
Informs the application that the video is now available for watching.
| |||||||||||
Informs the application that the video became unavailable for some reason.
| |||||||||||
Called when an application requests to create an overlay view.
| |||||||||||
Implement this method to handle generic motion events on the current input session.
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyDown() : always returns false (doesn't handle the event).
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyLongPress() : always returns false (doesn't handle the event).
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyMultiple() : always returns false (doesn't handle the event).
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyUp() : always returns false (doesn't handle the event).
| |||||||||||
Called when the session is released.
| |||||||||||
Select a given track.
| |||||||||||
Enables or disables the caption.
| |||||||||||
Sets the relative stream volume of the current TV input session to handle the change of
audio focus by setting.
| |||||||||||
Sets the
Surface for the current input session on which the TV input renders
video.
| |||||||||||
Called after any structural changes (format or size) have been made to the
Surface passed by onSetSurface(Surface) .
| |||||||||||
Implement this method to handle touch screen motion events on the current input session.
| |||||||||||
Implement this method to handle trackball events on the current input session.
| |||||||||||
Tunes to a given channel.
| |||||||||||
Requests to unblock the content according to the given rating.
| |||||||||||
Enables or disables the overlay view.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.view.KeyEvent.Callback
|
Creates a new Session.
context | The context of the application |
---|
Notifies the channel of the session is retuned by TV input.
channelUri | The URI of a channel. |
---|
Informs the application that the user is allowed to watch the current program content.
Each TV input service is required to query the system whether the user is allowed to
watch the current program before showing it to the user if the parental controls is
enabled (i.e. TvInputManager.isParentalControlsEnabled()
returns true
). Whether the TV input
service should block the content or not is determined by invoking
TvInputManager.isRatingBlocked(TvContentRating)
with the content rating for the current program. Then the TvInputManager
makes a
judgment based on the user blocked ratings stored in the secure settings and returns the
result. If the rating in question turns out to be allowed by the user, the TV input
service must call this method to notify the application that is permitted to show the
content.
Each TV input service also needs to continuously listen to any changes made to the
parental controls settings by registering a broadcast receiver to receive
ACTION_BLOCKED_RATINGS_CHANGED
and
ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED
and immediately
reevaluate the current program with the new parental controls settings.
Informs the application that the current program content is blocked by parent controls.
Each TV input service is required to query the system whether the user is allowed to
watch the current program before showing it to the user if the parental controls is
enabled (i.e. TvInputManager.isParentalControlsEnabled()
returns true
). Whether the TV input
service should block the content or not is determined by invoking
TvInputManager.isRatingBlocked(TvContentRating)
with the content rating for the current program. Then the TvInputManager
makes a
judgment based on the user blocked ratings stored in the secure settings and returns the
result. If the rating in question turns out to be blocked, the TV input service must
immediately block the content and call this method with the content rating of the current
program to prompt the PIN verification screen.
Each TV input service also needs to continuously listen to any changes made to the
parental controls settings by registering a broadcast receiver to receive
ACTION_BLOCKED_RATINGS_CHANGED
and
ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED
and immediately
reevaluate the current program with the new parental controls settings.
rating | The content rating for the current TV program. |
---|
Sends the type and ID of a selected track. This is used to inform the application that a
specific track is selected. The TV input service must call this method as soon as a track
is selected either by default or in response to a call to onSelectTrack(int, String)
. The
selected track ID for a given type is maintained in the framework until the next call to
this method even after the entire track list is updated (but is reset when the session is
tuned to a new channel), so care must be taken not to result in an obsolete track ID.
type | The type of the selected track. The type can be
TYPE_AUDIO , TYPE_VIDEO or
TYPE_SUBTITLE . |
---|---|
trackId | The ID of the selected track. |
Sends the list of all audio/video/subtitle tracks. The is used by the framework to
maintain the track information for a given session, which in turn is used by
getTracks(int)
for the application to retrieve metadata for a given track type.
The TV input service must call this method as soon as the track information becomes
available or is updated. Note that in a case where a part of the information for a
certain track is updated, it is not necessary to create a new TvTrackInfo
object
with a different track ID.
tracks | A list which includes track information. |
---|
IllegalArgumentException | if tracks contains redundant tracks.
|
---|
Informs the application that the video is now available for watching. This is primarily used to signal the application to unblock the screen. The TV input service must call this method as soon as the content rendered onto its surface gets ready for viewing.
Informs the application that the video became unavailable for some reason. This is primarily used to signal the application to block the screen not to show any intermittent video artifacts.
reason | The reason why the video became unavailable: |
---|
Called when an application requests to create an overlay view. Each session implementation can override this method and return its own view.
Implement this method to handle generic motion events on the current input session.
event | The motion event being received. |
---|
true
. If you want to allow the event to
be handled by the next receiver, return false
.Default implementation of KeyEvent.Callback.onKeyDown()
: always returns false (doesn't handle the event).
Override this to intercept key down events before they are processed by the application. If you return true, the application will not process the event itself. If you return false, the normal application processing will occur as if the TV input had not seen the event at all.
keyCode | The value in event.getKeyCode(). |
---|---|
event | Description of the key event. |
true
. If you want to allow the event to
be handled by the next receiver, return false
.
Default implementation of
KeyEvent.Callback.onKeyLongPress()
: always returns false (doesn't handle the event).
Override this to intercept key long press events before they are processed by the application. If you return true, the application will not process the event itself. If you return false, the normal application processing will occur as if the TV input had not seen the event at all.
keyCode | The value in event.getKeyCode(). |
---|---|
event | Description of the key event. |
true
. If you want to allow the event to
be handled by the next receiver, return false
.
Default implementation of
KeyEvent.Callback.onKeyMultiple()
: always returns false (doesn't handle the event).
Override this to intercept special key multiple events before they are processed by the application. If you return true, the application will not itself process the event. If you return false, the normal application processing will occur as if the TV input had not seen the event at all.
keyCode | The value in event.getKeyCode(). |
---|---|
count | The number of times the action was made. |
event | Description of the key event. |
true
. If you want to allow the event to
be handled by the next receiver, return false
.
Default implementation of KeyEvent.Callback.onKeyUp()
: always returns false (doesn't handle the event).
Override this to intercept key up events before they are processed by the application. If you return true, the application will not itself process the event. If you return false, the normal application processing will occur as if the TV input had not seen the event at all.
keyCode | The value in event.getKeyCode(). |
---|---|
event | Description of the key event. |
true
. If you want to allow the event to
be handled by the next receiver, return false
.
Select a given track.
If this is done successfully, the implementation should call notifyTrackSelected(int, String)
to help applications maintain the selcted track lists.
type | The type of the track to select. The type can be
TYPE_AUDIO , TYPE_VIDEO or
TYPE_SUBTITLE . |
---|---|
trackId | The ID of the track to select. null means to unselect the current
track for a given type. |
Enables or disables the caption.
The locale for the user's preferred captioning language can be obtained by calling
CaptioningManager.getLocale()
.
enabled | true to enable, false to disable. |
---|
Sets the relative stream volume of the current TV input session to handle the change of audio focus by setting.
volume | Volume scale from 0.0 to 1.0. |
---|
Called after any structural changes (format or size) have been made to the
Surface
passed by onSetSurface(Surface)
. This method is always called
at least once, after onSetSurface(Surface)
with non-null Surface
is called.
Implement this method to handle touch screen motion events on the current input session.
event | The motion event being received. |
---|
true
. If you want to allow the event to
be handled by the next receiver, return false
.Implement this method to handle trackball events on the current input session.
event | The motion event being received. |
---|
true
. If you want to allow the event to
be handled by the next receiver, return false
.Tunes to a given channel. When the video is available, notifyVideoAvailable()
should be called. Also, notifyVideoUnavailable(int)
should be called when the
TV input cannot continue playing the given channel.
channelUri | The URI of the channel. |
---|
true
the tuning was successful, false
otherwise.
Requests to unblock the content according to the given rating.
The implementation should unblock the content. TV input service has responsibility to decide when/how the unblock expires while it can keep previously unblocked ratings in order not to ask a user to unblock whenever a content rating is changed. Therefore an unblocked rating can be valid for a channel, a program, or certain amount of time depending on the implementation.
unblockedRating | An unblocked content rating |
---|
Enables or disables the overlay view. By default, the overlay view is disabled. Must be called explicitly after the session is created to enable the overlay view.
enable | true if you want to enable the overlay view. false
otherwise.
|
---|