public abstract static class TvInputService.HardwareSession extends TvInputService.Session
This class is for an input which provides channels for the external set-top box to the
application. Once a TV input returns an implementation of this class on
TvInputService.onCreateSession(String)
, the framework will create a separate session for
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 TvInputService.Session.onTune(android.net.Uri)
is
requested by the application.
Note that this class is not for inputs for internal hardware like built-in tuner and HDMI 1.
TvInputService.onCreateSession(String)
Constructor and Description |
---|
HardwareSession(Context context)
Creates a new HardwareSession.
|
Modifier and Type | Method and Description |
---|---|
abstract String |
getHardwareInputId()
Returns the hardware TV input ID the external device is connected to.
|
void |
onHardwareVideoAvailable()
Called when the underlying hardware TV input session calls
TvInputService.Session.notifyVideoAvailable() . |
void |
onHardwareVideoUnavailable(int reason)
Called when the underlying hardware TV input session calls
TvInputService.Session.notifyVideoUnavailable(int) . |
boolean |
onSetSurface(Surface surface)
This method will not be called in
TvInputService.HardwareSession . |
layoutSurface, notifyChannelRetuned, notifyContentAllowed, notifyContentBlocked, notifySessionEvent, notifyTimeShiftStatusChanged, notifyTracksChanged, notifyTrackSelected, notifyVideoAvailable, notifyVideoUnavailable, onAppPrivateCommand, onCreateOverlayView, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyUp, onOverlayViewSizeChanged, onRelease, onSelectTrack, onSetCaptionEnabled, onSetMain, onSetStreamVolume, onSurfaceChanged, onTimeShiftGetCurrentPosition, onTimeShiftGetStartPosition, onTimeShiftPause, onTimeShiftPlay, onTimeShiftResume, onTimeShiftSeekTo, onTimeShiftSetPlaybackParams, onTouchEvent, onTrackballEvent, onTune, onTune, onUnblockContent, setOverlayViewEnabled
public HardwareSession(Context context)
context
- The context of the applicationpublic abstract String getHardwareInputId()
TV input is expected to provide android.R.attr#setupActivity
so that
the application can launch it before using this TV input. The setup activity may let
the user select the hardware TV input to which the external device is connected. The ID
of the selected one should be stored in the TV input so that it can be returned here.
public final boolean onSetSurface(Surface surface)
TvInputService.HardwareSession
. Framework will
forward the application's surface to the hardware TV input.onSetSurface
in class TvInputService.Session
surface
- The surface to be used for video rendering. Can be null
.true
if the surface was set successfully, false
otherwise.public void onHardwareVideoAvailable()
TvInputService.Session.notifyVideoAvailable()
.public void onHardwareVideoUnavailable(int reason)
TvInputService.Session.notifyVideoUnavailable(int)
.reason
- The reason that the hardware TV input stopped the playback: