# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# TvInputService.Session

`public static abstract class TvInputService.Session`
`extends Object` `implements KeyEvent.Callback`

java.lang.Object
↳ | android.media.tv.TvInputService.Session

Known direct subclasses TvInputService.HardwareSession
TvInputService.HardwareSession | Base class for a TV input session which represents an external device connected to a hardware TV input.

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

## Summary

### Public constructors
`Session(Context context)` Creates a new Session.

### Public methods
`void` | `layoutSurface(int left, int top, int right, int bottom)` Assigns a size and position to the surface passed in `onSetSurface(Surface)`.
`void` | `notifyChannelRetuned(Uri channelUri)` Informs the application that the current channel is re-tuned for some reason and the session now displays the content from a new channel.
`void` | `notifyContentAllowed()` Informs the application that the user is allowed to watch the current program content.
`void` | `notifyContentBlocked(TvContentRating rating)` Informs the application that the current program content is blocked by parent controls.
`void` | `notifyTimeShiftStatusChanged(int status)` Informs the application that the time shift status is changed.
`void` | `notifyTrackSelected(int type, String trackId)` Sends the type and ID of a selected track.
`void` | `notifyTracksChanged(List<TvTrackInfo> tracks)` Sends the list of all audio/video/subtitle tracks.
`void` | `notifyVideoAvailable()` Informs the application that the video is now available for watching.
`void` | `notifyVideoUnavailable(int reason)` Informs the application that the video became unavailable for some reason.
`void` | `onAppPrivateCommand(String action, Bundle data)` Processes a private command sent from the application to the TV input.
`View` | `onCreateOverlayView()` Called when the application requests to create an overlay view.
`boolean` | `onGenericMotionEvent(MotionEvent event)` Implement this method to handle generic motion events on the current input session.
`boolean` | `onKeyDown(int keyCode, KeyEvent event)` Default implementation of `KeyEvent.Callback.onKeyDown()`: always returns false (doesn't handle the event).
`boolean` | `onKeyLongPress(int keyCode, KeyEvent event)` Default implementation of `KeyEvent.Callback.onKeyLongPress()`: always returns false (doesn't handle the event).
`boolean` | `onKeyMultiple(int keyCode, int count, KeyEvent event)` Default implementation of `KeyEvent.Callback.onKeyMultiple()`: always returns false (doesn't handle the event).
`boolean` | `onKeyUp(int keyCode, KeyEvent event)` Default implementation of `KeyEvent.Callback.onKeyUp()`: always returns false (doesn't handle the event).
`void` | `onOverlayViewSizeChanged(int width, int height)` Called when the size of the overlay view is changed by the application.
`abstract void` | `onRelease()` Called when the session is released.
`boolean` | `onSelectTrack(int type, String trackId)` Selects a given track.
`abstract void` | `onSetCaptionEnabled(boolean enabled)` Enables or disables the caption.
`abstract void` | `onSetStreamVolume(float volume)` Sets the relative stream volume of the current TV input session.
`abstract boolean` | `onSetSurface(Surface surface)` Called when the application sets the surface.
`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)`.
`long` | `onTimeShiftGetCurrentPosition()` Returns the current position for time shifting, in milliseconds since the epoch.
`long` | `onTimeShiftGetStartPosition()` Returns the start position for time shifting, in milliseconds since the epoch.
`void` | `onTimeShiftPause()` Called when the application requests to pause playback.
`void` | `onTimeShiftPlay(Uri recordedProgramUri)` Called when the application requests to play a given recorded TV program.
`void` | `onTimeShiftResume()` Called when the application requests to resume playback.
`void` | `onTimeShiftSeekTo(long timeMs)` Called when the application requests to seek to a specified time position.
`void` | `onTimeShiftSetPlaybackParams(PlaybackParams params)` Called when the application sets playback parameters containing the speed and audio mode.
`boolean` | `onTouchEvent(MotionEvent event)` Implement this method to handle touch screen motion events on the current input session.
`boolean` | `onTrackballEvent(MotionEvent event)` Implement this method to handle trackball events on the current input session.
`boolean` | `onTune(Uri channelUri, Bundle params)` Tunes to a given channel.
`abstract boolean` | `onTune(Uri channelUri)` Tunes to a given channel.
`void` | `onUnblockContent(TvContentRating unblockedRating)` Requests to unblock the content according to the given rating.
`void` | `setOverlayViewEnabled(boolean enable)` Enables or disables the overlay view.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.view.KeyEvent.Callback`
`abstract boolean` | `onKeyDown(int keyCode, KeyEvent event)` Called when a key down event has occurred.
`abstract boolean` | `onKeyLongPress(int keyCode, KeyEvent event)` Called when a long press has occurred.
`abstract 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.
`abstract boolean` | `onKeyUp(int keyCode, KeyEvent event)` Called when a key up event has occurred.

## Public constructors

### Session

    public Session (Context context)

Creates a new Session.

Parameters
`context` | `Context`: The context of the application

## Public methods

### layoutSurface

    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.

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.

See also:

- `onOverlayViewSizeChanged(int, int)`

### notifyChannelRetuned

    public void notifyChannelRetuned (Uri channelUri)

Informs the application that the current channel is re-tuned for some reason and the session now displays the content from a new channel. This is used to handle special cases such as when the current channel becomes unavailable, it is necessary to send the user to a certain channel or the user changes channel in some other way (e.g. by using a dedicated remote).

Parameters
`channelUri` | `Uri`: The URI of the new channel.

### notifyContentAllowed

    public void notifyContentAllowed ()

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 `TvInputManager#ACTION_BLOCKED_RATINGS_CHANGED` and `TvInputManager#ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED` and immediately reevaluate the current program with the new parental controls settings.

See also:

- `notifyContentBlocked(TvContentRating)`
- `TvInputManager`

### notifyContentBlocked

    public void notifyContentBlocked (TvContentRating rating)

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 or `TvContentRating#UNRATED` in case the rating information is missing. 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 `TvInputManager#ACTION_BLOCKED_RATINGS_CHANGED` and `TvInputManager#ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED` and immediately reevaluate the current program with the new parental controls settings.

Parameters
`rating` | `TvContentRating`: The content rating for the current TV program. Can be `TvContentRating#UNRATED`. This value cannot be `null`.

See also:

- `notifyContentAllowed()`
- `TvInputManager`

### notifyTimeShiftStatusChanged

    public void notifyTimeShiftStatusChanged (int status)

Informs the application that the time shift status is changed.

Prior to calling this method, the application assumes the status `TvInputManager#TIME_SHIFT_STATUS_UNKNOWN`. Right after the session is created, it is important to invoke the method with the status `TvInputManager#TIME_SHIFT_STATUS_AVAILABLE` if the implementation does support time shifting, or `TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED` otherwise. Failure to notifying the current status change immediately might result in an undesirable behavior in the application such as hiding the play controls.

If the status `TvInputManager#TIME_SHIFT_STATUS_AVAILABLE` is reported, the application assumes it can pause/resume playback, seek to a specified time position and set playback rate and audio mode. The implementation should override `onTimeShiftPause()`, `onTimeShiftResume()`, `onTimeShiftSeekTo(long)`, `onTimeShiftGetStartPosition()`, `onTimeShiftGetCurrentPosition()` and `onTimeShiftSetPlaybackParams(PlaybackParams)`.

Parameters
`status` | `int`: The current time shift status. Should be one of the followings. `TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED` `TvInputManager#TIME_SHIFT_STATUS_UNAVAILABLE` `TvInputManager#TIME_SHIFT_STATUS_AVAILABLE` Value is `TvInputManager.TIME_SHIFT_STATUS_UNKNOWN`, `TvInputManager.TIME_SHIFT_STATUS_UNSUPPORTED`, `TvInputManager.TIME_SHIFT_STATUS_UNAVAILABLE`, or `TvInputManager.TIME_SHIFT_STATUS_AVAILABLE`

### notifyTrackSelected

    public void notifyTrackSelected (int type,
                    String trackId)

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.

Parameters
`type` | `int`: The type of the selected track. The type can be `TvTrackInfo#TYPE_AUDIO`, `TvTrackInfo#TYPE_VIDEO` or `TvTrackInfo#TYPE_SUBTITLE`.
`trackId` | `String`: The ID of the selected track.

See also:

- `onSelectTrack(int, String)`

### notifyTracksChanged

    public void notifyTracksChanged (List<TvTrackInfo> tracks)

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 `TvView#getTracks` 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.

Parameters
`tracks` | `List`: A list which includes track information.

### notifyVideoAvailable

    public void notifyVideoAvailable ()

Informs the application that the video is now available for watching. Video is blocked until this method is called.

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 `onTune(Uri)` is called.

See also:

- `notifyVideoUnavailable(int)`

### notifyVideoUnavailable

    public void notifyVideoUnavailable (int reason)

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.

Parameters
`reason` | `int`: The reason why the video became unavailable: `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` 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_INSUFFICIENT_RESOURCE`, `TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION`, `TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED`, `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`

See also:

- `notifyVideoAvailable()`

### onAppPrivateCommand

    public void onAppPrivateCommand (String action,
                    Bundle data)

Processes a private command sent from the application to the TV input. This can be used to provide domain-specific features that are only known between certain TV inputs and their clients.

Parameters
`action` | `String`: Name of the command to be performed. This must be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting commands. This value cannot be `null`.
`data` | `Bundle`: Any data to include with the command.

### onCreateOverlayView

    public View onCreateOverlayView ()

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

Returns
`View` | a view attached to the overlay window

### onGenericMotionEvent

    public boolean onGenericMotionEvent (MotionEvent event)

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

Parameters
`event` | `MotionEvent`: The motion event being received.

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`.

See also:

- `View.onGenericMotionEvent(MotionEvent)`

### onKeyDown

    public boolean onKeyDown (int keyCode,
                    KeyEvent event)

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.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: Description of the key event.

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

    public boolean onKeyLongPress (int keyCode,
                    KeyEvent event)

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.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: Description of the key event.

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

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

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.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`count` | `int`: The number of times the action was made.
`event` | `KeyEvent`: Description of the key event.

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

    public boolean onKeyUp (int keyCode,
                    KeyEvent event)

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.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: Description of the key event.

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`.

### onOverlayViewSizeChanged

    public void onOverlayViewSizeChanged (int width,
                    int height)

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

This is always called at least once when the session is created regardless of whether the overlay view is enabled or not. The overlay view size is the same as the containing `TvView`. 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 overlay view.
`height` | `int`: The height of the overlay view.

### onRelease

    public abstract void onRelease ()

Called when the session is released.

### onSelectTrack

    public boolean onSelectTrack (int type,
                    String trackId)

Selects a given track.

If this is done successfully, the implementation should call `notifyTrackSelected(int, String)` to help applications maintain the up-to-date list of the selected tracks.

Parameters
`type` | `int`: The type of the track to select. The type can be `TvTrackInfo#TYPE_AUDIO`, `TvTrackInfo#TYPE_VIDEO` or `TvTrackInfo#TYPE_SUBTITLE`.
`trackId` | `String`: The ID of the track to select. `null` means to unselect the current track for a given type. This value may be `null`.

Returns
`boolean` | `true` if the track selection was successful, `false` otherwise.

See also:

- `notifyTrackSelected(int, String)`

### onSetCaptionEnabled

    public abstract void onSetCaptionEnabled (boolean enabled)

Enables or disables the caption.

The locale for the user's preferred captioning language can be obtained by calling `CaptioningManager.getLocale()`.

Parameters
`enabled` | `boolean`: `true` to enable, `false` to disable.

See also:

- `CaptioningManager`

### onSetStreamVolume

    public abstract void onSetStreamVolume (float volume)

Sets the relative stream volume of the current TV input session.

The implementation should honor this request in order to handle audio focus changes or mute the current session when multiple sessions, possibly from different inputs are active. If the method has not yet been called, the implementation should assume the default value of `1.0f`.

Parameters
`volume` | `float`: A volume value between `0.0f` to `1.0f`. Value is between 0.0 and 1.0 inclusive

### onSetSurface

    public abstract boolean onSetSurface (Surface surface)

Called when the application sets the surface.

The TV input service should render video onto the given surface. When called with `null`, the input service should immediately free any references to the currently set surface and stop using it.

Parameters
`surface` | `Surface`: The surface to be used for video rendering. Can be `null`. This value may be `null`.

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

### onSurfaceChanged

    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.
`width` | `int`: The new width of the surface.
`height` | `int`: The new height of the surface.

### onTimeShiftGetCurrentPosition

    public long onTimeShiftGetCurrentPosition ()

Returns the current position for time shifting, in milliseconds since the epoch. Returns `TvInputManager#TIME_SHIFT_INVALID_TIME` if the position is unknown at the moment.

The current position for time shifting is the same as the current position of playback. It should be equal to or greater than the start position reported by `onTimeShiftGetStartPosition()`. When playback is completed, the current position should stay where the playback ends, in other words, the returned value of this mehtod should be equal to the start position plus the duration of the program.

Returns
`long` |

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftResume()`
- `onTimeShiftPause()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetStartPosition()`

### onTimeShiftGetStartPosition

    public long onTimeShiftGetStartPosition ()

Returns the start position for time shifting, in milliseconds since the epoch. Returns `TvInputManager#TIME_SHIFT_INVALID_TIME` if the position is unknown at the moment.

The start position for time shifting indicates the earliest possible time the user can seek to. Initially this is equivalent to the time when the implementation starts recording. Later it may be adjusted because there is insufficient space or the duration of recording is limited by the implementation. The application does not allow the user to seek to a position earlier than the start position.

For playback of a recorded program initiated by `onTimeShiftPlay(android.net.Uri)`, the start position should be 0 and does not change.

Returns
`long` |

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftResume()`
- `onTimeShiftPause()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetCurrentPosition()`

### onTimeShiftPause

    public void onTimeShiftPause ()

Called when the application requests to pause playback.

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftResume()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetStartPosition()`
- `onTimeShiftGetCurrentPosition()`

### onTimeShiftPlay

    public void onTimeShiftPlay (Uri recordedProgramUri)

Called when the application requests to play a given recorded TV program.

Parameters
`recordedProgramUri` | `Uri`: The URI of a recorded TV program.

See also:

- `onTimeShiftResume()`
- `onTimeShiftPause()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetStartPosition()`
- `onTimeShiftGetCurrentPosition()`

### onTimeShiftResume

    public void onTimeShiftResume ()

Called when the application requests to resume playback.

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftPause()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetStartPosition()`
- `onTimeShiftGetCurrentPosition()`

### onTimeShiftSeekTo

    public void onTimeShiftSeekTo (long timeMs)

Called when the application requests to seek to a specified time position. Normally, the position is given within range between the start and the current time, inclusively. The implementation is expected to seek to the nearest time position if the given position is not in the range.

Parameters
`timeMs` | `long`: The time position to seek to, in milliseconds since the epoch.

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftResume()`
- `onTimeShiftPause()`
- `onTimeShiftSetPlaybackParams(PlaybackParams)`
- `onTimeShiftGetStartPosition()`
- `onTimeShiftGetCurrentPosition()`

### onTimeShiftSetPlaybackParams

    public void onTimeShiftSetPlaybackParams (PlaybackParams params)

Called when the application sets playback parameters containing the speed and audio mode.

Once the playback parameters are set, the implementation should honor the current settings until the next tune request. Pause/resume/seek request does not reset the parameters previously set.

Parameters
`params` | `PlaybackParams`: The playback params.

See also:

- `onTimeShiftPlay(Uri)`
- `onTimeShiftResume()`
- `onTimeShiftPause()`
- `onTimeShiftSeekTo(long)`
- `onTimeShiftGetStartPosition()`
- `onTimeShiftGetCurrentPosition()`

### onTouchEvent

    public boolean onTouchEvent (MotionEvent event)

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

Parameters
`event` | `MotionEvent`: The motion event being received.

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`.

See also:

- `View.onTouchEvent(MotionEvent)`

### onTrackballEvent

    public boolean onTrackballEvent (MotionEvent event)

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

Parameters
`event` | `MotionEvent`: The motion event being received.

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`.

See also:

- `View.onTrackballEvent(MotionEvent)`

### onTune

    public boolean onTune (Uri channelUri,
                    Bundle params)

Tunes to a given channel. Override this method in order to handle domain-specific features that are only known between certain TV inputs and their clients.

The default implementation calls `onTune(android.net.Uri)`.

Parameters
`channelUri` | `Uri`: The URI of the channel.
`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.

Returns
`boolean` | `true` if the tuning was successful, `false` otherwise.

### onTune

    public abstract boolean onTune (Uri channelUri)

Tunes to a given channel.

No video will be displayed until `notifyVideoAvailable()` is called. Also, `notifyVideoUnavailable(int)` should be called when the TV input cannot continue playing the given channel.

Parameters
`channelUri` | `Uri`: The URI of the channel.

Returns
`boolean` | `true` if the tuning was successful, `false` otherwise.

### onUnblockContent

    public void onUnblockContent (TvContentRating unblockedRating)

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.

Parameters
`unblockedRating` | `TvContentRating`: An unblocked content rating

### setOverlayViewEnabled

    public void setOverlayViewEnabled (boolean enable)

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.

The TV input service can disable its overlay view when the size of the overlay view is insufficient to display the whole information, such as when used in Picture-in-picture. Override `onOverlayViewSizeChanged(int, int)` to get the size of the overlay view, which then can be used to determine whether to enable/disable the overlay view.

Parameters
`enable` | `boolean`: `true` if you want to enable the overlay view. `false` otherwise.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*