TvInteractiveAppService.Session

public static abstract class TvInteractiveAppService.Session
extends Object implements KeyEvent.Callback

java.lang.Object
   ↳ android.media.tv.interactive.TvInteractiveAppService.Session


Base class for derived classes to implement to provide a TV interactive app session.

A session is associated with a TvInteractiveAppView instance and handles corresponding communications. It also handles the communications with TvInputService.Session if connected.

Summary

Public constructors

Session(Context context)

Creates a new Session.

Public methods

boolean isMediaViewEnabled()

Returns true if media view is enabled, false otherwise.

void layoutSurface(int left, int top, int right, int bottom)

Assigns a size and position to the surface passed in onSetSurface(Surface).

void notifyAdBufferReady(AdBuffer buffer)

Notifies when the advertisement buffer is filled and ready to be read.

final void notifyBiInteractiveAppCreated(Uri biIAppUri, String biIAppId)

Notifies the broadcast-independent(BI) interactive application has been created.

void notifySessionStateChanged(int state, int err)

Notifies when the session state is changed.

final void notifyTeletextAppStateChanged(int state)

Notifies when the digital teletext app state is changed.

void onAdBufferConsumed(AdBuffer buffer)

Called when an advertisement buffer is consumed.

void onAdResponse(AdResponse response)

Called when an advertisement response is received.

void onAvailableSpeeds(float[] speeds)

Receives available playback speeds.

void onBroadcastInfoResponse(BroadcastInfoResponse response)

Called when a broadcast info response is received.

void onContentAllowed()

Called when content is allowed.

void onContentBlocked(TvContentRating rating)

Called when content is blocked.

void onCreateBiInteractiveAppRequest(Uri biIAppUri, Bundle params)

Creates broadcast-independent(BI) interactive application.

View onCreateMediaView()

Called when the application requests to create an media view.

void onCurrentChannelLcn(int lcn)

Receives logical channel number (LCN) of current channel.

void onCurrentChannelUri(Uri channelUri)

Receives current channel URI.

void onCurrentTvInputId(String inputId)

Receives current TV input ID.

void onCurrentVideoBounds(Rect bounds)

Receives current video bounds.

void onDestroyBiInteractiveAppRequest(String biIAppId)

Destroys broadcast-independent(BI) interactive application.

void onError(String errMsg, Bundle params)

Called when the application sends information of an error.

boolean onGenericMotionEvent(MotionEvent event)

Implement this method to handle generic motion events on the current session.

boolean onKeyDown(int keyCode, KeyEvent event)

Called when a key down event has occurred.

boolean onKeyLongPress(int keyCode, KeyEvent event)

Called when a long press has occurred.

boolean onKeyMultiple(int keyCode, int count, KeyEvent event)

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.

boolean onKeyUp(int keyCode, KeyEvent event)

Called when a key up event has occurred.

void onMediaViewSizeChanged(int width, int height)

Called when the size of the media view is changed by the application.

void onRecordingConnectionFailed(String recordingId, String inputId)

This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input.

void onRecordingDisconnected(String recordingId, String inputId)

This is called when the connection to the current recording session is lost.

void onRecordingError(String recordingId, int err)

This is called when an issue has occurred.

void onRecordingScheduled(String recordingId, String requestId)

This is called when the recording has been scheduled.

void onRecordingStarted(String recordingId, String requestId)

This is called when a recording has been started.

void onRecordingStopped(String recordingId)

This is called when the recording has been stopped.

void onRecordingTuned(String recordingId, Uri channelUri)

This is called when the recording session has been tuned to the given channel and is ready to start recording.

abstract void onRelease()

Releases TvInteractiveAppService session.

void onResetInteractiveApp()

Resets TvInteractiveAppService session.

abstract boolean onSetSurface(Surface surface)

Called when the application sets the surface.

void onSetTeletextAppEnabled(boolean enable)

To toggle Digital Teletext Application if there is one in AIT app list.

void onSignalStrength(int strength)

Called when signal strength is changed.

void onSigningResult(String signingId, byte[] result)

Receives signing result.

void onStartInteractiveApp()

Starts TvInteractiveAppService session.

void onStopInteractiveApp()

Stops TvInteractiveAppService session.

void onStreamVolume(float volume)

Receives current stream volume.

void onSurfaceChanged(int format, int width, int height)

Called after any structural changes (format or size) have been made to the surface passed in onSetSurface(Surface).

void onTimeShiftCurrentPositionChanged(String inputId, long timeMs)

Called when time shift current position is changed.

void onTimeShiftMode(int mode)

Receives current time shift mode.

void onTimeShiftPlaybackParams(PlaybackParams params)

Called when the time shift PlaybackParams is set or changed.

void onTimeShiftStartPositionChanged(String inputId, long timeMs)

Called when time shift start position is changed.

void onTimeShiftStatusChanged(String inputId, int status)

Called when time shift status is changed.

boolean onTouchEvent(MotionEvent event)

Implement this method to handle touch screen motion events on the current session.

void onTrackInfoList(List<TvTrackInfo> tracks)

Receives track list.

void onTrackSelected(int type, String trackId)

Called when the corresponding TV input selected to a track.

boolean onTrackballEvent(MotionEvent event)

Implement this method to handle trackball events on the current session.

void onTracksChanged(List<TvTrackInfo> tracks)

Called when the tracks are changed.

void onTuned(Uri channelUri)

Called when the corresponding TV input tuned to a channel.

void onTvMessage(int type, Bundle data)

Called when a TV message is received

void onTvRecordingInfo(TvRecordingInfo recordingInfo)

Receives the requested TvRecordingInfo.

void onTvRecordingInfoList(List<TvRecordingInfo> recordingInfoList)

Receives requested recording info list.

void onVideoAvailable()

Called when video is available.

void onVideoUnavailable(int reason)

Called when video is unavailable.

void removeBroadcastInfo(int requestId)

Remove broadcast information request from the related TV input.

void requestAd(AdRequest request)

Sends an advertisement request to be processed by the related TV input.

void requestAvailableSpeeds()

Requests available speeds for time shift.

void requestBroadcastInfo(BroadcastInfoRequest request)

Requests broadcast related information from the related TV input.

void requestCurrentChannelLcn()

Requests the logic channel number (LCN) of the current channel.

void requestCurrentChannelUri()

Requests the URI of the current channel.

void requestCurrentTvInputId()

Requests current TV input ID.

void requestCurrentVideoBounds()

Requests the bounds of the current video.

void requestScheduleRecording(String requestId, String inputId, Uri channelUri, Uri programUri, Bundle params)

Requests scheduling of a recording.

void requestScheduleRecording(String requestId, String inputId, Uri channelUri, long startTime, long duration, int repeatDays, Bundle params)

Requests scheduling of a recording.

void requestSigning(String signingId, String algorithm, String alias, byte[] data)

Requests signing of the given data.

void requestStartRecording(String requestId, Uri programUri)

Requests starting of recording

This is used to request the active TvRecordingClient to call TvRecordingClient.startRecording(Uri) with the provided programUri.

void requestStopRecording(String recordingId)

Requests the recording associated with the recordingId to stop.

void requestStreamVolume()

Requests stream volume.

void requestTimeShiftMode()

Requests time shift mode.

void requestTrackInfoList()

Requests the list of TvTrackInfo.

void requestTvRecordingInfo(String recordingId)

Gets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.

void requestTvRecordingInfoList(int type)

Gets a list of TvRecordingInfo for the specified recording type.

void sendPlaybackCommandRequest(String cmdType, Bundle parameters)

Sends a specific playback command to be processed by the related TV input.

void sendTimeShiftCommandRequest(String cmdType, Bundle parameters)

Sends a specific time shift command to be processed by the related TV input.

void setMediaViewEnabled(boolean enable)

Enables or disables the media view.

void setTvRecordingInfo(String recordingId, TvRecordingInfo recordingInfo)

Sets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.

void setVideoBounds(Rect rect)

Sets broadcast video bounds.

Inherited methods

Public constructors

Session

Added in API level 33
public Session (Context context)

Creates a new Session.

Parameters
context Context: The context of the application This value cannot be null.

Public methods

isMediaViewEnabled

Added in API level 33
public boolean isMediaViewEnabled ()

Returns true if media view is enabled, false otherwise.

Returns
boolean

layoutSurface

Added in API level 33
public void layoutSurface (int left, 
                int top, 
                int right, 
                int bottom)

Assigns a size and position to the surface passed in onSetSurface(Surface). The position is relative to the overlay view that sits on top of this surface.
If you override this method you must call through to the superclass implementation.

Parameters
left int: Left position in pixels, relative to the overlay view.

top int: Top position in pixels, relative to the overlay view.

right int: Right position in pixels, relative to the overlay view.

bottom int: Bottom position in pixels, relative to the overlay view.

notifyAdBufferReady

Added in API level 34
public void notifyAdBufferReady (AdBuffer buffer)

Notifies when the advertisement buffer is filled and ready to be read.
If you override this method you must call through to the superclass implementation.

Parameters
buffer AdBuffer: The AdBuffer to be received This value cannot be null.

notifyBiInteractiveAppCreated

Added in API level 33
public final void notifyBiInteractiveAppCreated (Uri biIAppUri, 
                String biIAppId)

Notifies the broadcast-independent(BI) interactive application has been created.
If you override this method you must call through to the superclass implementation.

Parameters
biIAppUri Uri: This value cannot be null.

biIAppId String: BI interactive app ID, which can be used to destroy the BI interactive app. null if it's not created successfully.

notifySessionStateChanged

Added in API level 33
public void notifySessionStateChanged (int state, 
                int err)

Notifies when the session state is changed.
If you override this method you must call through to the superclass implementation.

Parameters
state int: the current session state. Value is TvInteractiveAppManager.INTERACTIVE_APP_STATE_STOPPED, TvInteractiveAppManager.INTERACTIVE_APP_STATE_RUNNING, or TvInteractiveAppManager.INTERACTIVE_APP_STATE_ERROR

err int: the error code for error state. TvInteractiveAppManager#ERROR_NONE is used when the state is not TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR. Value is TvInteractiveAppManager.ERROR_NONE, TvInteractiveAppManager.ERROR_UNKNOWN, TvInteractiveAppManager.ERROR_NOT_SUPPORTED, TvInteractiveAppManager.ERROR_WEAK_SIGNAL, TvInteractiveAppManager.ERROR_RESOURCE_UNAVAILABLE, TvInteractiveAppManager.ERROR_BLOCKED, TvInteractiveAppManager.ERROR_ENCRYPTED, or TvInteractiveAppManager.ERROR_UNKNOWN_CHANNEL

notifyTeletextAppStateChanged

Added in API level 33
public final void notifyTeletextAppStateChanged (int state)

Notifies when the digital teletext app state is changed.
If you override this method you must call through to the superclass implementation.

Parameters
state int: the current state. Value is TvInteractiveAppManager.TELETEXT_APP_STATE_SHOW, TvInteractiveAppManager.TELETEXT_APP_STATE_HIDE, or TvInteractiveAppManager.TELETEXT_APP_STATE_ERROR

onAdBufferConsumed

Added in API level 34
public void onAdBufferConsumed (AdBuffer buffer)

Called when an advertisement buffer is consumed.

Parameters
buffer AdBuffer: The AdBuffer that was consumed. This value cannot be null.

onAdResponse

Added in API level 33
public void onAdResponse (AdResponse response)

Called when an advertisement response is received.

Parameters
response AdResponse: This value cannot be null.

onAvailableSpeeds

Added in API level 34
public void onAvailableSpeeds (float[] speeds)

Receives available playback speeds.

Parameters
speeds float: An ordered array of playback speeds, expressed as values relative to the normal playback speed (1.0), at which the current content can be played as a time-shifted broadcast. This is an empty array if the supported playback speeds are unknown or the video/broadcast is not in time shift mode. If currently in time shift mode, this array will normally include at least the values 1.0 (normal speed) and 0.0 (paused). This value cannot be null.

onBroadcastInfoResponse

Added in API level 33
public void onBroadcastInfoResponse (BroadcastInfoResponse response)

Called when a broadcast info response is received.

Parameters
response BroadcastInfoResponse: This value cannot be null.

onContentAllowed

Added in API level 33
public void onContentAllowed ()

Called when content is allowed.

onContentBlocked

Added in API level 33
public void onContentBlocked (TvContentRating rating)

Called when content is blocked.

Parameters
rating TvContentRating: This value cannot be null.

onCreateBiInteractiveAppRequest

Added in API level 33
public void onCreateBiInteractiveAppRequest (Uri biIAppUri, 
                Bundle params)

Creates broadcast-independent(BI) interactive application.

The implementation should call notifyBiInteractiveAppCreated(android.net.Uri, java.lang.String), no matter if it's created successfully or not.

Parameters
biIAppUri Uri: This value cannot be null.

params Bundle: This value may be null.

onCreateMediaView

Added in API level 33
public View onCreateMediaView ()

Called when the application requests to create an media view. Each session implementation can override this method and return its own view.

Returns
View a view attached to the media window This value may be null.

onCurrentChannelLcn

Added in API level 33
public void onCurrentChannelLcn (int lcn)

Receives logical channel number (LCN) of current channel.

Parameters
lcn int

onCurrentChannelUri

Added in API level 33
public void onCurrentChannelUri (Uri channelUri)

Receives current channel URI.

Parameters
channelUri Uri: This value may be null.

onCurrentTvInputId

Added in API level 33
public void onCurrentTvInputId (String inputId)

Receives current TV input ID.

Parameters
inputId String: This value may be null.

onCurrentVideoBounds

Added in API level 34
public void onCurrentVideoBounds (Rect bounds)

Receives current video bounds.

Parameters
bounds Rect: the rectangle area for rendering the current video. This value cannot be null.

onDestroyBiInteractiveAppRequest

Added in API level 33
public void onDestroyBiInteractiveAppRequest (String biIAppId)

Destroys broadcast-independent(BI) interactive application.

Parameters
biIAppId String: the BI interactive app ID from onCreateBiInteractiveAppRequest(android.net.Uri, android.os.Bundle) This value cannot be null.

onError

Added in API level 33
public void onError (String errMsg, 
                Bundle params)

Called when the application sends information of an error.

Parameters
errMsg String: the message of the error. This value cannot be null.

params Bundle: additional parameters of the error. For example, the signingId of TvInteractiveAppView.TvInteractiveAppCallback.onRequestSigning(java.lang.String, java.lang.String, java.lang.String, java.lang.String, byte[]) can be included to identify the related signing request, and the method name "onRequestSigning" can also be added to the params. This value cannot be null.

onGenericMotionEvent

Added in API level 33
public boolean onGenericMotionEvent (MotionEvent event)

Implement this method to handle generic motion events on the current session.

Parameters
event MotionEvent: The motion event being received. This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyDown

Added in API level 33
public boolean onKeyDown (int keyCode, 
                KeyEvent event)

Called when a key down event has occurred. If you return true, you can first call KeyEvent.startTracking() to have the framework track the event through its onKeyUp(int, android.view.KeyEvent) and also call your onKeyLongPress(int, android.view.KeyEvent) if it occurs.

Parameters
keyCode int: The value in event.getKeyCode().

event KeyEvent: This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyLongPress

Added in API level 33
public boolean onKeyLongPress (int keyCode, 
                KeyEvent event)

Called when a long press has occurred. If you return true, the final key up will have KeyEvent#FLAG_CANCELED and KeyEvent#FLAG_CANCELED_LONG_PRESS set. Note that in order to receive this callback, someone in the event change must return true from onKeyDown(int, KeyEvent) and call KeyEvent#startTracking() on the event.

Parameters
keyCode int: The value in event.getKeyCode().

event KeyEvent: This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyMultiple

Added in API level 33
public boolean onKeyMultiple (int keyCode, 
                int count, 
                KeyEvent event)

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.

Parameters
keyCode int: The value in event.getKeyCode().

count int: Number of pairs as returned by event.getRepeatCount().

event KeyEvent: This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 33
public boolean onKeyUp (int keyCode, 
                KeyEvent event)

Called when a key up event has occurred.

Parameters
keyCode int: The value in event.getKeyCode().

event KeyEvent: This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onMediaViewSizeChanged

Added in API level 33
public void onMediaViewSizeChanged (int width, 
                int height)

Called when the size of the media view is changed by the application.

This is always called at least once when the session is created regardless of whether the media view is enabled or not. The media view container size is the same as the containing TvInteractiveAppView. Note that the size of the underlying surface can be different if the surface was changed by calling layoutSurface(int, int, int, int).

Parameters
width int: The width of the media view, in pixels. This units of this value are pixels.

height int: The height of the media view, in pixels. This units of this value are pixels.

onRecordingConnectionFailed

Added in API level 34
public void onRecordingConnectionFailed (String recordingId, 
                String inputId)

This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input.

Parameters
recordingId String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

inputId String: The ID of the TV input bound to the current TvRecordingClient. This value cannot be null.

onRecordingDisconnected

Added in API level 34
public void onRecordingDisconnected (String recordingId, 
                String inputId)

This is called when the connection to the current recording session is lost.

Parameters
recordingId String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

inputId String: The ID of the TV input bound to the current TvRecordingClient. This value cannot be null.

onRecordingError

Added in API level 34
public void onRecordingError (String recordingId, 
                int err)

This is called when an issue has occurred. It may be called at any time after the current recording session is created until it is released.

Parameters
recordingId String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

err int: The error code. Should be one of the following. Value is TvInputManager.RECORDING_ERROR_UNKNOWN, TvInputManager.RECORDING_ERROR_INSUFFICIENT_SPACE, or TvInputManager.RECORDING_ERROR_RESOURCE_BUSY

onRecordingScheduled

Added in API level 34
public void onRecordingScheduled (String recordingId, 
                String requestId)

This is called when the recording has been scheduled.

Parameters
recordingId String: The ID assigned to this recording by the app. It can be used to send recording related requests such as requestStopRecording(java.lang.String). This value cannot be null.

requestId String: The ID of the request when requestScheduleRecording(String, String, Uri, Uri, Bundle) is called. null if the recording is not triggered by a request. This ID should be created by the TvInteractiveAppService and can be any string.

onRecordingStarted

Added in API level 34
public void onRecordingStarted (String recordingId, 
                String requestId)

This is called when a recording has been started.

When a scheduled recording is started, this is also called, and the request ID in this case is null.

Parameters
recordingId String: The ID of the recording started. The TV app should provide and maintain this ID to identify the recording in the future. This value cannot be null.

requestId String: The ID of the request when requestStartRecording(java.lang.String, android.net.Uri) is called. null if the recording is not triggered by a requestStartRecording(java.lang.String, android.net.Uri) request. This ID should be created by the TvInteractiveAppService and can be any string.

onRecordingStopped

Added in API level 34
public void onRecordingStopped (String recordingId)

This is called when the recording has been stopped.

Parameters
recordingId String: The ID of the recording stopped. This ID is created and maintained by the TV app when the recording was started. This value cannot be null.

onRecordingTuned

Added in API level 34
public void onRecordingTuned (String recordingId, 
                Uri channelUri)

This is called when the recording session has been tuned to the given channel and is ready to start recording.

Parameters
recordingId String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

channelUri Uri: The URI of the tuned channel. This value cannot be null.

onRelease

Added in API level 33
public abstract void onRelease ()

Releases TvInteractiveAppService session.

onResetInteractiveApp

Added in API level 33
public void onResetInteractiveApp ()

Resets TvInteractiveAppService session.

onSetSurface

Added in API level 33
public abstract boolean onSetSurface (Surface surface)

Called when the application sets the surface.

The TV Interactive App service should render interactive app UI onto the given surface. When called with null, the Interactive App service should immediately free any references to the currently set surface and stop using it.

Parameters
surface Surface: The surface to be used for interactive app UI rendering. Can be null.

Returns
boolean true if the surface was set successfully, false otherwise.

onSetTeletextAppEnabled

Added in API level 33
public void onSetTeletextAppEnabled (boolean enable)

To toggle Digital Teletext Application if there is one in AIT app list.

Parameters
enable boolean: true to enable teletext app; false otherwise.

onSignalStrength

Added in API level 33
public void onSignalStrength (int strength)

Called when signal strength is changed.

Parameters
strength int: Value is TvInputManager.SIGNAL_STRENGTH_LOST, TvInputManager.SIGNAL_STRENGTH_WEAK, or TvInputManager.SIGNAL_STRENGTH_STRONG

onSigningResult

Added in API level 33
public void onSigningResult (String signingId, 
                byte[] result)

Receives signing result.

Parameters
signingId String: the ID to identify the request. It's the same as the corresponding ID in Session#requestSigning(String, String, String, byte[]) This value cannot be null.

result byte: the signed result. This value cannot be null.

onStartInteractiveApp

Added in API level 33
public void onStartInteractiveApp ()

Starts TvInteractiveAppService session.

onStopInteractiveApp

Added in API level 33
public void onStopInteractiveApp ()

Stops TvInteractiveAppService session.

onStreamVolume

Added in API level 33
public void onStreamVolume (float volume)

Receives current stream volume.

Parameters
volume float: a volume value between 0.0f and 1.0f, inclusive.

onSurfaceChanged

Added in API level 33
public void onSurfaceChanged (int format, 
                int width, 
                int height)

Called after any structural changes (format or size) have been made to the surface passed in onSetSurface(Surface). This method is always called at least once, after onSetSurface(Surface) is called with non-null surface.

Parameters
format int: The new PixelFormat of the surface. Value is PixelFormat.RGBA_8888, PixelFormat.RGBX_8888, PixelFormat.RGBA_F16, PixelFormat.RGBA_1010102, PixelFormat.RGB_888, PixelFormat.RGB_565, or android.graphics.PixelFormat.R_8

width int: The new width of the surface.

height int: The new height of the surface.

onTimeShiftCurrentPositionChanged

Added in API level 34
public void onTimeShiftCurrentPositionChanged (String inputId, 
                long timeMs)

Called when time shift current position is changed.

Parameters
inputId String: The ID of the input for which the time shift current position has changed. This value cannot be null.

timeMs long: The current position for time shifting, in milliseconds since the epoch.

onTimeShiftMode

Added in API level 34
public void onTimeShiftMode (int mode)

Receives current time shift mode.

Parameters
mode int: The current time shift mode. The value is one of the following: TvInputManager#TIME_SHIFT_MODE_OFF, TvInputManager#TIME_SHIFT_MODE_LOCAL, TvInputManager#TIME_SHIFT_MODE_NETWORK, TvInputManager#TIME_SHIFT_MODE_AUTO. Value is TvInputManager.TIME_SHIFT_MODE_OFF, TvInputManager.TIME_SHIFT_MODE_LOCAL, TvInputManager.TIME_SHIFT_MODE_NETWORK, or TvInputManager.TIME_SHIFT_MODE_AUTO

onTimeShiftPlaybackParams

Added in API level 34
public void onTimeShiftPlaybackParams (PlaybackParams params)

Called when the time shift PlaybackParams is set or changed.

Parameters
params PlaybackParams: The new PlaybackParams that was set or changed. This value cannot be null.

onTimeShiftStartPositionChanged

Added in API level 34
public void onTimeShiftStartPositionChanged (String inputId, 
                long timeMs)

Called when time shift start position is changed.

Parameters
inputId String: The ID of the input for which the time shift start position has changed. This value cannot be null.

timeMs long: The start position for time shifting, in milliseconds since the epoch.

onTimeShiftStatusChanged

Added in API level 34
public void onTimeShiftStatusChanged (String inputId, 
                int status)

Called when time shift status is changed.

Parameters
inputId String: The ID of the input for which the time shift status has changed. This value cannot be null.

status int: The status of which the input has changed to. Should be one of the following. Value is TvInputManager.TIME_SHIFT_STATUS_UNKNOWN, TvInputManager.TIME_SHIFT_STATUS_UNSUPPORTED, TvInputManager.TIME_SHIFT_STATUS_UNAVAILABLE, or TvInputManager.TIME_SHIFT_STATUS_AVAILABLE

onTouchEvent

Added in API level 33
public boolean onTouchEvent (MotionEvent event)

Implement this method to handle touch screen motion events on the current session.

Parameters
event MotionEvent: The motion event being received. This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onTrackInfoList

Added in API level 33
public void onTrackInfoList (List<TvTrackInfo> tracks)

Receives track list.

Parameters
tracks List: This value cannot be null.

onTrackSelected

Added in API level 33
public void onTrackSelected (int type, 
                String trackId)

Called when the corresponding TV input selected to a track.

Parameters
type int: Value is TvTrackInfo.TYPE_AUDIO, TvTrackInfo.TYPE_VIDEO, or TvTrackInfo.TYPE_SUBTITLE

trackId String: This value cannot be null.

onTrackballEvent

Added in API level 33
public boolean onTrackballEvent (MotionEvent event)

Implement this method to handle trackball events on the current session.

Parameters
event MotionEvent: The motion event being received. This value cannot be null.

Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onTracksChanged

Added in API level 33
public void onTracksChanged (List<TvTrackInfo> tracks)

Called when the tracks are changed.

Parameters
tracks List: This value cannot be null.

onTuned

Added in API level 33
public void onTuned (Uri channelUri)

Called when the corresponding TV input tuned to a channel.

Parameters
channelUri Uri: The tuned channel URI. This value cannot be null.

onTvMessage

Added in API level 34
public void onTvMessage (int type, 
                Bundle data)

Called when a TV message is received

Parameters
type int: The type of message received, such as TvInputManager#TV_MESSAGE_TYPE_WATERMARK Value is TvInputManager.TV_MESSAGE_TYPE_WATERMARK, TvInputManager.TV_MESSAGE_TYPE_CLOSED_CAPTION, or TvInputManager.TV_MESSAGE_TYPE_OTHER

data Bundle: The raw data of the message. The bundle keys are: TvInputManager#TV_MESSAGE_KEY_STREAM_ID, TvInputManager#TV_MESSAGE_KEY_GROUP_ID, TvInputManager#TV_MESSAGE_KEY_SUBTYPE, TvInputManager#TV_MESSAGE_KEY_RAW_DATA. See TvInputManager#TV_MESSAGE_KEY_SUBTYPE for more information on how to parse this data. This value cannot be null.

onTvRecordingInfo

Added in API level 34
public void onTvRecordingInfo (TvRecordingInfo recordingInfo)

Receives the requested TvRecordingInfo.

Parameters
recordingInfo TvRecordingInfo: The requested recording info. null if no recording found.

onTvRecordingInfoList

Added in API level 34
public void onTvRecordingInfoList (List<TvRecordingInfo> recordingInfoList)

Receives requested recording info list.

Parameters
recordingInfoList List: The list of recording info requested. Returns an empty list if no matching recording info found. This value cannot be null.

onVideoAvailable

Added in API level 33
public void onVideoAvailable ()

Called when video is available.

onVideoUnavailable

Added in API level 33
public void onVideoUnavailable (int reason)

Called when video is unavailable.

Parameters
reason int: Value is TvInputManager.VIDEO_UNAVAILABLE_REASON_UNKNOWN, TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING, TvInputManager.VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL, TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING, TvInputManager.VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY, TvInputManager.VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED, TvInputManager.VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED, android.media.tv.TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_NO_LICENSE, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT, TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING, or TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN

removeBroadcastInfo

Added in API level 33
public void removeBroadcastInfo (int requestId)

Remove broadcast information request from the related TV input.
If you override this method you must call through to the superclass implementation.

Parameters
requestId int: the ID of the request

requestAd

Added in API level 33
public void requestAd (AdRequest request)

Sends an advertisement request to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.

Parameters
request AdRequest: The advertisement request This value cannot be null.

requestAvailableSpeeds

Added in API level 34
public void requestAvailableSpeeds ()

Requests available speeds for time shift.
If you override this method you must call through to the superclass implementation.

requestBroadcastInfo

Added in API level 33
public void requestBroadcastInfo (BroadcastInfoRequest request)

Requests broadcast related information from the related TV input.
If you override this method you must call through to the superclass implementation.

Parameters
request BroadcastInfoRequest: the request for broadcast info This value cannot be null.

requestCurrentChannelLcn

Added in API level 33
public void requestCurrentChannelLcn ()

Requests the logic channel number (LCN) of the current channel.
If you override this method you must call through to the superclass implementation.

requestCurrentChannelUri

Added in API level 33
public void requestCurrentChannelUri ()

Requests the URI of the current channel.
If you override this method you must call through to the superclass implementation.

requestCurrentTvInputId

Added in API level 33
public void requestCurrentTvInputId ()

Requests current TV input ID.
If you override this method you must call through to the superclass implementation.

See also:

requestCurrentVideoBounds

Added in API level 34
public void requestCurrentVideoBounds ()

Requests the bounds of the current video.
If you override this method you must call through to the superclass implementation.

requestScheduleRecording

Added in API level 34
public void requestScheduleRecording (String requestId, 
                String inputId, 
                Uri channelUri, 
                Uri programUri, 
                Bundle params)

Requests scheduling of a recording.
If you override this method you must call through to the superclass implementation.

Parameters
requestId String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingScheduled(java.lang.String, java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null.

inputId String: The ID of the TV input for the given channel. This value cannot be null.

channelUri Uri: The URI of a channel to be recorded. This value cannot be null.

programUri Uri: The URI of the TV program to be recorded. This value cannot be null.

params Bundle: Domain-specific data for this tune request. Keys must be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be null.

requestScheduleRecording

Added in API level 34
public void requestScheduleRecording (String requestId, 
                String inputId, 
                Uri channelUri, 
                long startTime, 
                long duration, 
                int repeatDays, 
                Bundle params)

Requests scheduling of a recording.
If you override this method you must call through to the superclass implementation.

Parameters
requestId String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingScheduled(java.lang.String, java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null.

inputId String: The ID of the TV input for the given channel. This value cannot be null.

channelUri Uri: The URI of a channel to be recorded. This value cannot be null.

startTime long: The start time of the recording in milliseconds since epoch.

duration long: The duration of the recording in milliseconds.

repeatDays int: The repeated days. 0 if not repeated.

params Bundle: Domain-specific data for this tune request. Keys must be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be null.

requestSigning

Added in API level 33
public void requestSigning (String signingId, 
                String algorithm, 
                String alias, 
                byte[] data)

Requests signing of the given data.

This is used when the corresponding server of the broadcast-independent interactive app requires signing during handshaking, and the interactive app service doesn't have the built-in private key. The private key is provided by the content providers and pre-built in the related app, such as TV app.
If you override this method you must call through to the superclass implementation.

Parameters
signingId String: the ID to identify the request. When a result is received, this ID can be used to correlate the result with the request. This value cannot be null.

algorithm String: the standard name of the signature algorithm requested, such as MD5withRSA, SHA256withDSA, etc. The name is from standards like FIPS PUB 186-4 and PKCS #1. This value cannot be null.

alias String: the alias of the corresponding KeyStore. This value cannot be null.

data byte: the original bytes to be signed. This value cannot be null.

requestStartRecording

Added in API level 34
public void requestStartRecording (String requestId, 
                Uri programUri)

Requests starting of recording

This is used to request the active TvRecordingClient to call TvRecordingClient.startRecording(Uri) with the provided programUri. A non-null programUri implies the started recording should be of that specific program, whereas null programUri does not impose such a requirement and the recording can span across multiple TV programs.
If you override this method you must call through to the superclass implementation.

Parameters
requestId String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingStarted(java.lang.String, java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null.

programUri Uri: The URI for the TV program to record, built by TvContract#buildProgramUri(long). Can be null.

requestStopRecording

Added in API level 34
public void requestStopRecording (String recordingId)

Requests the recording associated with the recordingId to stop.

This is used to request the associated TvRecordingClient to call TvRecordingClient.stopRecording().
If you override this method you must call through to the superclass implementation.

Parameters
recordingId String: The ID of the recording to stop. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

requestStreamVolume

Added in API level 33
public void requestStreamVolume ()

Requests stream volume.
If you override this method you must call through to the superclass implementation.

requestTimeShiftMode

Added in API level 34
public void requestTimeShiftMode ()

Requests time shift mode.
If you override this method you must call through to the superclass implementation.

requestTrackInfoList

Added in API level 33
public void requestTrackInfoList ()

Requests the list of TvTrackInfo.
If you override this method you must call through to the superclass implementation.

requestTvRecordingInfo

Added in API level 34
public void requestTvRecordingInfo (String recordingId)

Gets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.

Parameters
recordingId String: The ID of the recording to set the info for. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

requestTvRecordingInfoList

Added in API level 34
public void requestTvRecordingInfoList (int type)

Gets a list of TvRecordingInfo for the specified recording type.
If you override this method you must call through to the superclass implementation.

Parameters
type int: The type of recording to retrieve. Value is TvRecordingInfo.RECORDING_SCHEDULED, TvRecordingInfo.RECORDING_IN_PROGRESS, or TvRecordingInfo.RECORDING_ALL

sendPlaybackCommandRequest

Added in API level 33
public void sendPlaybackCommandRequest (String cmdType, 
                Bundle parameters)

Sends a specific playback command to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.

Parameters
cmdType String: type of the specific command Value is TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_TUNE, TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_TUNE_NEXT, TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_TUNE_PREV, TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_STOP, TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME, TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_SELECT_TRACK, or android.media.tv.interactive.TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_FREEZE This value cannot be null.

parameters Bundle: parameters of the specific command This value may be null.

sendTimeShiftCommandRequest

Added in API level 34
public void sendTimeShiftCommandRequest (String cmdType, 
                Bundle parameters)

Sends a specific time shift command to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.

Parameters
cmdType String: type of the specific command Value is TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_PLAY, TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_PAUSE, TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_RESUME, TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_SEEK_TO, TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_SET_PLAYBACK_PARAMS, or TvInteractiveAppService.TIME_SHIFT_COMMAND_TYPE_SET_MODE This value cannot be null.

parameters Bundle: parameters of the specific command This value may be null.

setMediaViewEnabled

Added in API level 33
public void setMediaViewEnabled (boolean enable)

Enables or disables the media view.

By default, the media view is disabled. Must be called explicitly after the session is created to enable the media view.

The TV Interactive App service can disable its media view when needed.
If you override this method you must call through to the superclass implementation.

Parameters
enable boolean: true if you want to enable the media view. false otherwise.

setTvRecordingInfo

Added in API level 34
public void setTvRecordingInfo (String recordingId, 
                TvRecordingInfo recordingInfo)

Sets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.

Parameters
recordingId String: The ID of the recording to set the info for. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null.

recordingInfo TvRecordingInfo: The TvRecordingInfo to set to the recording. This value cannot be null.

setVideoBounds

Added in API level 33
public void setVideoBounds (Rect rect)

Sets broadcast video bounds.
If you override this method you must call through to the superclass implementation.

Parameters
rect Rect: This value cannot be null.