TvInputManager


public final class TvInputManager
extends Object

java.lang.Object
   ↳ android.media.tv.TvInputManager


Central system API to the overall TV input framework (TIF) architecture, which arbitrates interaction between applications and the selected TV inputs.

There are three primary parties involved in the TV input framework (TIF) architecture:

  • The TV input manager as expressed by this class is the central point of the system that manages interaction between all other parts. It is expressed as the client-side API here which exists in each application context and communicates with a global system service that manages the interaction across all processes.
  • A TV input implemented by TvInputService represents an input source of TV, which can be a pass-through input such as HDMI, or a tuner input which provides broadcast TV programs. The system binds to the TV input per application\u2019s request. on implementing TV inputs.
  • Applications talk to the TV input manager to list TV inputs and check their status. Once an application find the input to use, it uses TvView or TvRecordingClient for further interaction such as watching and recording broadcast TV programs.

Summary

Nested classes

class TvInputManager.TvInputCallback

Callback used to monitor status of the TV inputs. 

Constants

String ACTION_BLOCKED_RATINGS_CHANGED

Broadcast intent action when the user blocked content ratings change.

String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED

Broadcast intent action when the parental controls enabled state changes.

String ACTION_QUERY_CONTENT_RATING_SYSTEMS

Broadcast intent action used to query available content rating systems.

String ACTION_SETUP_INPUTS

Activity action to set up channel sources i.e. TV inputs of type TvInputInfo.TYPE_TUNER.

String ACTION_VIEW_RECORDING_SCHEDULES

Activity action to display the recording schedules.

int BROADCAST_INFO_STREAM_EVENT

int BROADCAST_INFO_TYPE_COMMAND

int BROADCAST_INFO_TYPE_DSMCC

int BROADCAST_INFO_TYPE_PES

int BROADCAST_INFO_TYPE_SECTION

int BROADCAST_INFO_TYPE_TABLE

int BROADCAST_INFO_TYPE_TIMELINE

int BROADCAST_INFO_TYPE_TS

int INPUT_STATE_CONNECTED

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is connected.

int INPUT_STATE_CONNECTED_STANDBY

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is connected but in standby mode.

int INPUT_STATE_DISCONNECTED

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is disconnected.

String META_DATA_CONTENT_RATING_SYSTEMS

Content rating systems metadata associated with ACTION_QUERY_CONTENT_RATING_SYSTEMS.

int RECORDING_ERROR_INSUFFICIENT_SPACE

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): Recording cannot proceed due to insufficient storage space.

int RECORDING_ERROR_RESOURCE_BUSY

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): Recording cannot proceed because a required recording resource was not able to be allocated.

int RECORDING_ERROR_UNKNOWN

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): The requested operation cannot be completed due to a problem that does not fit under any other error codes, or the error code for the problem is defined on the higher version than application's android:targetSdkVersion.

String SESSION_DATA_KEY_AD_BUFFER

An object of AdBuffer.

String SESSION_DATA_KEY_AD_RESPONSE

An object of AdResponse.

String SESSION_DATA_KEY_BROADCAST_INFO_RESPONSE

An object of BroadcastInfoResponse.

String SESSION_DATA_KEY_CHANNEL_URI

The URI of a channel.

String SESSION_DATA_KEY_TRACKS

A list which includes track information.

String SESSION_DATA_KEY_TRACK_ID

The ID of the track.

String SESSION_DATA_KEY_TRACK_TYPE

The type of the track.

String SESSION_DATA_KEY_TV_MESSAGE_TYPE

The type of TV message.

String SESSION_DATA_KEY_VIDEO_UNAVAILABLE_REASON

The reason why the video became unavailable.

String SESSION_DATA_TYPE_AD_BUFFER_CONSUMED

Notifies the advertisement buffer is consumed.

String SESSION_DATA_TYPE_AD_RESPONSE

Notifies response for advertisement.

String SESSION_DATA_TYPE_BROADCAST_INFO_RESPONSE

Notifies response for broadcast info.

String SESSION_DATA_TYPE_TRACKS_CHANGED

Sends the list of all audio/video/subtitle tracks.

String SESSION_DATA_TYPE_TRACK_SELECTED

Sends the type and ID of a selected track.

String SESSION_DATA_TYPE_TUNED

Informs the application that the session has been tuned to the given channel.

String SESSION_DATA_TYPE_TV_MESSAGE

Sends the TV message.

String SESSION_DATA_TYPE_VIDEO_AVAILABLE

Informs the application that the video is now available for watching.

String SESSION_DATA_TYPE_VIDEO_UNAVAILABLE

Informs the application that the video became unavailable for some reason.

int SIGNAL_STRENGTH_LOST

Signal lost.

int SIGNAL_STRENGTH_STRONG

Strong signal.

int SIGNAL_STRENGTH_WEAK

Weak signal.

long TIME_SHIFT_INVALID_TIME

Value returned by TvInputService.Session.onTimeShiftGetCurrentPosition() and TvInputService.Session.onTimeShiftGetStartPosition() when time shifting has not yet started.

int TIME_SHIFT_MODE_AUTO

Time shift mode: auto.

int TIME_SHIFT_MODE_LOCAL

Time shift mode: local.

int TIME_SHIFT_MODE_NETWORK

Time shift mode: network.

int TIME_SHIFT_MODE_OFF

Time shift mode: off.

int TIME_SHIFT_STATUS_AVAILABLE

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Time shifting is currently available.

int TIME_SHIFT_STATUS_UNAVAILABLE

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Time shifting is currently unavailable but might work again later.

int TIME_SHIFT_STATUS_UNKNOWN

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Unknown status.

int TIME_SHIFT_STATUS_UNSUPPORTED

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): The current TV input does not support time shifting.

long TV_MESSAGE_GROUP_ID_NONE

This value for TV_MESSAGE_KEY_GROUP_ID denotes that the message doesn't belong to any group.

String TV_MESSAGE_KEY_GROUP_ID

This constant is used as a Bundle key for TV messages.

String TV_MESSAGE_KEY_RAW_DATA

This constant is used as a Bundle key for TV messages.

String TV_MESSAGE_KEY_STREAM_ID

This constant is used as a Bundle key for TV messages.

String TV_MESSAGE_KEY_SUBTYPE

This constant is used as a Bundle key for TV messages.

String TV_MESSAGE_SUBTYPE_CC_608E

This is a subtype for TV messages that can be potentially found as a value at TV_MESSAGE_KEY_SUBTYPE.

String TV_MESSAGE_SUBTYPE_WATERMARKING_A335

This is a subtype for TV messages that can be potentially found as a value at TV_MESSAGE_KEY_SUBTYPE.

int TV_MESSAGE_TYPE_CLOSED_CAPTION

Indicates that this TV message contains Closed Captioning data

int TV_MESSAGE_TYPE_OTHER

Indicates that this TV message contains other data

int TV_MESSAGE_TYPE_WATERMARK

Indicates that this TV message contains watermarking data

int VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the current TV program is audio-only.

int VIDEO_UNAVAILABLE_REASON_BUFFERING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the corresponding TV input has stopped playback temporarily to buffer more data.

int VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because of a geographical blackout.

int VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is invalid.

int VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is muted.

int VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the output protection level enabled on the device is not sufficient to meet the requirements in the license policy.

int VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because Using a license in whhich the keys have expired.

int VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the device need be activated.

int VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the device need be paired.

int VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is missed.

int VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the PVR record is not allowed by the license policy.

int VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because CAS system is rebooting.

int VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because of unknown CAS error.

int VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the resource is not enough to meet requirement.

int VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the source is not physically connected, for example the HDMI cable is not connected.

int VIDEO_UNAVAILABLE_REASON_STOPPED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because it has been stopped by TvView.stopPlayback(int).

int VIDEO_UNAVAILABLE_REASON_TUNING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the corresponding TV input is in the middle of tuning to a new channel.

int VIDEO_UNAVAILABLE_REASON_UNKNOWN

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable due to an unspecified error.

int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable due to weak TV signal.

Public methods

List<TvContentRating> getBlockedRatings()

Returns the list of blocked content ratings.

int getInputState(String inputId)

Returns the state of a given TV input.

TvInputInfo getTvInputInfo(String inputId)

Returns the TvInputInfo for a given TV input.

List<TvInputInfo> getTvInputList()

Returns the complete list of TV inputs on the system.

boolean isParentalControlsEnabled()

Returns the user's parental controls enabled state.

boolean isRatingBlocked(TvContentRating rating)

Checks whether a given TV content rating is blocked by the user.

void registerCallback(TvInputManager.TvInputCallback callback, Handler handler)

Registers a TvInputCallback.

void unregisterCallback(TvInputManager.TvInputCallback callback)

Unregisters the existing TvInputCallback.

void updateTvInputInfo(TvInputInfo inputInfo)

Updates the TvInputInfo for an existing TV input.

Inherited methods

Constants

ACTION_BLOCKED_RATINGS_CHANGED

Added in API level 21
public static final String ACTION_BLOCKED_RATINGS_CHANGED

Broadcast intent action when the user blocked content ratings change. For use with the isRatingBlocked(TvContentRating).

Constant Value: "android.media.tv.action.BLOCKED_RATINGS_CHANGED"

ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED

Added in API level 21
public static final String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED

Broadcast intent action when the parental controls enabled state changes. For use with the isParentalControlsEnabled().

Constant Value: "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED"

ACTION_QUERY_CONTENT_RATING_SYSTEMS

Added in API level 21
public static final String ACTION_QUERY_CONTENT_RATING_SYSTEMS

Broadcast intent action used to query available content rating systems.

The TV input manager service locates available content rating systems by querying broadcast receivers that are registered for this action. An application can offer additional content rating systems to the user by declaring a suitable broadcast receiver in its manifest.

Here is an example broadcast receiver declaration that an application might include in its AndroidManifest.xml to advertise custom content rating systems. The meta-data specifies a resource that contains a description of each content rating system that is provided by the application.

 <receiver android:name=".TvInputReceiver">
     <intent-filter>
         <action android:name=
                 "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS" />
     </intent-filter>
     <meta-data
             android:name="android.media.tv.metadata.CONTENT_RATING_SYSTEMS"
             android:resource="@xml/tv_content_rating_systems" />
 </receiver>

In the above example, the @xml/tv_content_rating_systems resource refers to an XML resource whose root element is <rating-system-definitions> that contains zero or more <rating-system-definition> elements. Each <rating-system-definition> element specifies the ratings, sub-ratings and rating orders of a particular content rating system.

See also:

Constant Value: "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS"

ACTION_SETUP_INPUTS

Added in API level 24
public static final String ACTION_SETUP_INPUTS

Activity action to set up channel sources i.e. TV inputs of type TvInputInfo.TYPE_TUNER. When invoked, the system will display an appropriate UI for the user to initiate the individual setup flow provided by R.attr.setupActivity of each TV input service.

Constant Value: "android.media.tv.action.SETUP_INPUTS"

ACTION_VIEW_RECORDING_SCHEDULES

Added in API level 26
public static final String ACTION_VIEW_RECORDING_SCHEDULES

Activity action to display the recording schedules. When invoked, the system will display an appropriate UI to browse the schedules.

Constant Value: "android.media.tv.action.VIEW_RECORDING_SCHEDULES"

BROADCAST_INFO_STREAM_EVENT

Added in API level 33
public static final int BROADCAST_INFO_STREAM_EVENT

Constant Value: 5 (0x00000005)

BROADCAST_INFO_TYPE_COMMAND

Added in API level 33
public static final int BROADCAST_INFO_TYPE_COMMAND

Constant Value: 7 (0x00000007)

BROADCAST_INFO_TYPE_DSMCC

Added in API level 33
public static final int BROADCAST_INFO_TYPE_DSMCC

Constant Value: 6 (0x00000006)

BROADCAST_INFO_TYPE_PES

Added in API level 33
public static final int BROADCAST_INFO_TYPE_PES

Constant Value: 4 (0x00000004)

BROADCAST_INFO_TYPE_SECTION

Added in API level 33
public static final int BROADCAST_INFO_TYPE_SECTION

Constant Value: 3 (0x00000003)

BROADCAST_INFO_TYPE_TABLE

Added in API level 33
public static final int BROADCAST_INFO_TYPE_TABLE

Constant Value: 2 (0x00000002)

BROADCAST_INFO_TYPE_TIMELINE

Added in API level 33
public static final int BROADCAST_INFO_TYPE_TIMELINE

Constant Value: 8 (0x00000008)

BROADCAST_INFO_TYPE_TS

Added in API level 33
public static final int BROADCAST_INFO_TYPE_TS

Constant Value: 1 (0x00000001)

INPUT_STATE_CONNECTED

Added in API level 21
public static final int INPUT_STATE_CONNECTED

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is connected.

This state indicates that a source device is connected to the input port and is in the normal operation mode. It is mostly relevant to hardware inputs such as HDMI input. Non-hardware inputs are considered connected all the time.

Constant Value: 0 (0x00000000)

INPUT_STATE_CONNECTED_STANDBY

Added in API level 21
public static final int INPUT_STATE_CONNECTED_STANDBY

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is connected but in standby mode.

This state indicates that a source device is connected to the input port but is in standby or low power mode. It is mostly relevant to hardware inputs such as HDMI input and Component inputs.

Constant Value: 1 (0x00000001)

INPUT_STATE_DISCONNECTED

Added in API level 21
public static final int INPUT_STATE_DISCONNECTED

State for getInputState(java.lang.String) and TvInputCallback.onInputStateChanged(String, int): The input source is disconnected.

This state indicates that a source device is disconnected from the input port. It is mostly relevant to hardware inputs such as HDMI input.

Constant Value: 2 (0x00000002)

META_DATA_CONTENT_RATING_SYSTEMS

Added in API level 21
public static final String META_DATA_CONTENT_RATING_SYSTEMS

Content rating systems metadata associated with ACTION_QUERY_CONTENT_RATING_SYSTEMS.

Specifies the resource ID of an XML resource that describes the content rating systems that are provided by the application.

Constant Value: "android.media.tv.metadata.CONTENT_RATING_SYSTEMS"

RECORDING_ERROR_INSUFFICIENT_SPACE

Added in API level 24
public static final int RECORDING_ERROR_INSUFFICIENT_SPACE

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): Recording cannot proceed due to insufficient storage space.

Constant Value: 1 (0x00000001)

RECORDING_ERROR_RESOURCE_BUSY

Added in API level 24
public static final int RECORDING_ERROR_RESOURCE_BUSY

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): Recording cannot proceed because a required recording resource was not able to be allocated.

Constant Value: 2 (0x00000002)

RECORDING_ERROR_UNKNOWN

Added in API level 24
public static final int RECORDING_ERROR_UNKNOWN

Error for TvInputService.RecordingSession.notifyError(int) and TvRecordingClient.RecordingCallback.onError(int): The requested operation cannot be completed due to a problem that does not fit under any other error codes, or the error code for the problem is defined on the higher version than application's android:targetSdkVersion.

Constant Value: 0 (0x00000000)

SESSION_DATA_KEY_AD_BUFFER

public static final String SESSION_DATA_KEY_AD_BUFFER

An object of AdBuffer.

Type: android.media.tv.AdBuffer

Constant Value: "ad_buffer"

SESSION_DATA_KEY_AD_RESPONSE

public static final String SESSION_DATA_KEY_AD_RESPONSE

An object of AdResponse.

Type: android.media.tv.AdResponse

Constant Value: "ad_response"

SESSION_DATA_KEY_BROADCAST_INFO_RESPONSE

public static final String SESSION_DATA_KEY_BROADCAST_INFO_RESPONSE

An object of BroadcastInfoResponse.

Type: android.media.tv.BroadcastInfoResponse

Constant Value: "broadcast_info_response"

SESSION_DATA_KEY_CHANNEL_URI

public static final String SESSION_DATA_KEY_CHANNEL_URI

The URI of a channel.

Type: android.net.Uri

Constant Value: "channel_uri"

SESSION_DATA_KEY_TRACKS

public static final String SESSION_DATA_KEY_TRACKS

A list which includes track information.

Type: java.util.List<android.media.tv.TvTrackInfo>

Constant Value: "tracks"

SESSION_DATA_KEY_TRACK_ID

public static final String SESSION_DATA_KEY_TRACK_ID

The ID of the track.

Type: String

Constant Value: "track_id"

SESSION_DATA_KEY_TRACK_TYPE

public static final String SESSION_DATA_KEY_TRACK_TYPE

The type of the track.

One of TvTrackInfo.TYPE_AUDIO, TvTrackInfo.TYPE_VIDEO, TvTrackInfo.TYPE_SUBTITLE.

Type: Integer

Constant Value: "track_type"

SESSION_DATA_KEY_TV_MESSAGE_TYPE

public static final String SESSION_DATA_KEY_TV_MESSAGE_TYPE

The type of TV message.

It can be one of ERROR(/TV_MESSAGE_TYPE_WATERMARK), ERROR(/TV_MESSAGE_TYPE_CLOSED_CAPTION), ERROR(/TV_MESSAGE_TYPE_OTHER)

Type: Integer

Constant Value: "tv_message_type"

SESSION_DATA_KEY_VIDEO_UNAVAILABLE_REASON

public static final String SESSION_DATA_KEY_VIDEO_UNAVAILABLE_REASON

The reason why the video became unavailable.

The value can be ERROR(/VIDEO_UNAVAILABLE_REASON_BUFFERING), ERROR(/VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY), etc.

Type: Integer

Constant Value: "video_unavailable_reason"

SESSION_DATA_TYPE_AD_BUFFER_CONSUMED

public static final String SESSION_DATA_TYPE_AD_BUFFER_CONSUMED

Notifies the advertisement buffer is consumed.

Constant Value: "ad_buffer_consumed"

SESSION_DATA_TYPE_AD_RESPONSE

public static final String SESSION_DATA_TYPE_AD_RESPONSE

Notifies response for advertisement.

Constant Value: "ad_response"

SESSION_DATA_TYPE_BROADCAST_INFO_RESPONSE

public static final String SESSION_DATA_TYPE_BROADCAST_INFO_RESPONSE

Notifies response for broadcast info.

Constant Value: "broadcast_info_response"

SESSION_DATA_TYPE_TRACKS_CHANGED

public static final String SESSION_DATA_TYPE_TRACKS_CHANGED

Sends the list of all audio/video/subtitle tracks.

Constant Value: "tracks_changed"

SESSION_DATA_TYPE_TRACK_SELECTED

public static final String SESSION_DATA_TYPE_TRACK_SELECTED

Sends the type and ID of a selected track. This is used to inform the application that a specific track is selected.

Constant Value: "track_selected"

SESSION_DATA_TYPE_TUNED

public static final String SESSION_DATA_TYPE_TUNED

Informs the application that the session has been tuned to the given channel.

Constant Value: "tuned"

SESSION_DATA_TYPE_TV_MESSAGE

public static final String SESSION_DATA_TYPE_TV_MESSAGE

Sends the TV message.

Constant Value: "tv_message"

SESSION_DATA_TYPE_VIDEO_AVAILABLE

public static final String SESSION_DATA_TYPE_VIDEO_AVAILABLE

Informs the application that the video is now available for watching.

Constant Value: "video_available"

SESSION_DATA_TYPE_VIDEO_UNAVAILABLE

public static final String SESSION_DATA_TYPE_VIDEO_UNAVAILABLE

Informs the application that the video became unavailable for some reason.

Constant Value: "video_unavailable"

SIGNAL_STRENGTH_LOST

Added in API level 33
public static final int SIGNAL_STRENGTH_LOST

Signal lost.

Constant Value: 1 (0x00000001)

SIGNAL_STRENGTH_STRONG

Added in API level 33
public static final int SIGNAL_STRENGTH_STRONG

Strong signal.

Constant Value: 3 (0x00000003)

SIGNAL_STRENGTH_WEAK

Added in API level 33
public static final int SIGNAL_STRENGTH_WEAK

Weak signal.

Constant Value: 2 (0x00000002)

TIME_SHIFT_INVALID_TIME

Added in API level 23
public static final long TIME_SHIFT_INVALID_TIME

Value returned by TvInputService.Session.onTimeShiftGetCurrentPosition() and TvInputService.Session.onTimeShiftGetStartPosition() when time shifting has not yet started.

Constant Value: -9223372036854775808 (0x8000000000000000)

TIME_SHIFT_MODE_AUTO

Added in API level 34
public static final int TIME_SHIFT_MODE_AUTO

Time shift mode: auto.

Time shift mode is handled automatically.

Constant Value: 4 (0x00000004)

TIME_SHIFT_MODE_LOCAL

Added in API level 34
public static final int TIME_SHIFT_MODE_LOCAL

Time shift mode: local.

Time shift is handle locally, using on-device data. E.g. playing a local file.

Constant Value: 2 (0x00000002)

TIME_SHIFT_MODE_NETWORK

Added in API level 34
public static final int TIME_SHIFT_MODE_NETWORK

Time shift mode: network.

Time shift is handle remotely via network. E.g. online streaming.

Constant Value: 3 (0x00000003)

TIME_SHIFT_MODE_OFF

Added in API level 34
public static final int TIME_SHIFT_MODE_OFF

Time shift mode: off.

Time shift is disabled.

Constant Value: 1 (0x00000001)

TIME_SHIFT_STATUS_AVAILABLE

Added in API level 23
public static final int TIME_SHIFT_STATUS_AVAILABLE

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Time shifting is currently available. In this status, the application assumes it can pause/resume playback, seek to a specified time position and set playback rate and audio mode.

Constant Value: 3 (0x00000003)

TIME_SHIFT_STATUS_UNAVAILABLE

Added in API level 23
public static final int TIME_SHIFT_STATUS_UNAVAILABLE

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Time shifting is currently unavailable but might work again later.

Constant Value: 2 (0x00000002)

TIME_SHIFT_STATUS_UNKNOWN

Added in API level 23
public static final int TIME_SHIFT_STATUS_UNKNOWN

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): Unknown status. Also the status prior to calling notifyTimeShiftStatusChanged.

Constant Value: 0 (0x00000000)

TIME_SHIFT_STATUS_UNSUPPORTED

Added in API level 23
public static final int TIME_SHIFT_STATUS_UNSUPPORTED

Status for TvInputService.Session.notifyTimeShiftStatusChanged(int) and TvView.TvInputCallback.onTimeShiftStatusChanged(String, int): The current TV input does not support time shifting.

Constant Value: 1 (0x00000001)

TV_MESSAGE_GROUP_ID_NONE

Added in API level 34
public static final long TV_MESSAGE_GROUP_ID_NONE

This value for TV_MESSAGE_KEY_GROUP_ID denotes that the message doesn't belong to any group.

Constant Value: -1 (0xffffffffffffffff)

TV_MESSAGE_KEY_GROUP_ID

Added in API level 34
public static final String TV_MESSAGE_KEY_GROUP_ID

This constant is used as a Bundle key for TV messages. This is used to optionally identify messages that belong together, such as headers and bodies of the same event. For messages that do not have a group, this value should be TV_MESSAGE_GROUP_ID_NONE.

As -1 is a reserved value, -1 should not be used as a valid groupId.

Type: long

Constant Value: "android.media.tv.TvInputManager.group_id"

TV_MESSAGE_KEY_RAW_DATA

Added in API level 34
public static final String TV_MESSAGE_KEY_RAW_DATA

This constant is used as a Bundle key for TV messages. The value of the key stores the raw data contained in this TV message. The format of this data is determined by the format defined by the subtype, found using the key at TV_MESSAGE_KEY_SUBTYPE. See TV_MESSAGE_KEY_SUBTYPE for more information on how to parse this data.

Type: byte[]

Constant Value: "android.media.tv.TvInputManager.raw_data"

TV_MESSAGE_KEY_STREAM_ID

Added in API level 34
public static final String TV_MESSAGE_KEY_STREAM_ID

This constant is used as a Bundle key for TV messages. The value of the key identifies the stream on the TV input source for which the watermark event is relevant to.

Type: String

Constant Value: "android.media.tv.TvInputManager.stream_id"

TV_MESSAGE_KEY_SUBTYPE

Added in API level 34
public static final String TV_MESSAGE_KEY_SUBTYPE

This constant is used as a Bundle key for TV messages. The value of the key identifies the subtype of the data, such as the format of the CC data. The format found at this key can then be used to identify how to parse the data at TV_MESSAGE_KEY_RAW_DATA.

To parse the raw data based on the subtype, please refer to the official documentation of the concerning subtype. For example, for the subtype TV_MESSAGE_SUBTYPE_WATERMARKING_A335, the document for A/335 from the ATSC standard details how this data is formatted. Similarly, the subtype TV_MESSAGE_SUBTYPE_CC_608E is documented in the ANSI/CTA standard for 608-E. These subtypes are examples of common formats for their respective uses and other subtypes may exist.

Type: String

Constant Value: "android.media.tv.TvInputManager.subtype"

TV_MESSAGE_SUBTYPE_CC_608E

Added in API level 34
public static final String TV_MESSAGE_SUBTYPE_CC_608E

This is a subtype for TV messages that can be potentially found as a value at TV_MESSAGE_KEY_SUBTYPE. It identifies the subtype of the message as the CC format CTA 608-E.

Constant Value: "CTA 608-E"

TV_MESSAGE_SUBTYPE_WATERMARKING_A335

Added in API level 34
public static final String TV_MESSAGE_SUBTYPE_WATERMARKING_A335

This is a subtype for TV messages that can be potentially found as a value at TV_MESSAGE_KEY_SUBTYPE. It identifies the subtype of the message as the watermarking format ATSC A/335.

Constant Value: "ATSC A/335"

TV_MESSAGE_TYPE_CLOSED_CAPTION

Added in API level 34
public static final int TV_MESSAGE_TYPE_CLOSED_CAPTION

Indicates that this TV message contains Closed Captioning data

Constant Value: 2 (0x00000002)

TV_MESSAGE_TYPE_OTHER

Added in API level 34
public static final int TV_MESSAGE_TYPE_OTHER

Indicates that this TV message contains other data

Constant Value: 1000 (0x000003e8)

TV_MESSAGE_TYPE_WATERMARK

Added in API level 34
public static final int TV_MESSAGE_TYPE_WATERMARK

Indicates that this TV message contains watermarking data

Constant Value: 1 (0x00000001)

VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY

Added in API level 23
public static final int VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the current TV program is audio-only.

Constant Value: 4 (0x00000004)

VIDEO_UNAVAILABLE_REASON_BUFFERING

Added in API level 21
public static final int VIDEO_UNAVAILABLE_REASON_BUFFERING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the corresponding TV input has stopped playback temporarily to buffer more data.

Constant Value: 3 (0x00000003)

VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because of a geographical blackout.

Constant Value: 16 (0x00000010)

VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is invalid.

Constant Value: 15 (0x0000000f)

VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is muted.

Constant Value: 14 (0x0000000e)

VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the output protection level enabled on the device is not sufficient to meet the requirements in the license policy.

Constant Value: 7 (0x00000007)

VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because Using a license in whhich the keys have expired.

Constant Value: 10 (0x0000000a)

VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the device need be activated.

Constant Value: 11 (0x0000000b)

VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the device need be paired.

Constant Value: 12 (0x0000000c)

VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because smart card is missed.

Constant Value: 13 (0x0000000d)

VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the PVR record is not allowed by the license policy.

Constant Value: 8 (0x00000008)

VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because CAS system is rebooting.

Constant Value: 17 (0x00000011)

VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because of unknown CAS error.

Constant Value: 18 (0x00000012)

VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the resource is not enough to meet requirement.

Constant Value: 6 (0x00000006)

VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED

Added in API level 30
public static final int VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the source is not physically connected, for example the HDMI cable is not connected.

Constant Value: 5 (0x00000005)

VIDEO_UNAVAILABLE_REASON_STOPPED

public static final int VIDEO_UNAVAILABLE_REASON_STOPPED

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because it has been stopped by TvView.stopPlayback(int).

Constant Value: 19 (0x00000013)

VIDEO_UNAVAILABLE_REASON_TUNING

Added in API level 21
public static final int VIDEO_UNAVAILABLE_REASON_TUNING

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable because the corresponding TV input is in the middle of tuning to a new channel.

Constant Value: 1 (0x00000001)

VIDEO_UNAVAILABLE_REASON_UNKNOWN

Added in API level 21
public static final int VIDEO_UNAVAILABLE_REASON_UNKNOWN

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable due to an unspecified error.

Constant Value: 0 (0x00000000)

VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL

Added in API level 21
public static final int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL

Reason for TvInputService.Session.notifyVideoUnavailable(int) and TvView.TvInputCallback.onVideoUnavailable(String, int): Video is unavailable due to weak TV signal.

Constant Value: 2 (0x00000002)

Public methods

getBlockedRatings

Added in API level 28
public List<TvContentRating> getBlockedRatings ()

Returns the list of blocked content ratings.

Returns
List<TvContentRating> the list of content ratings blocked by the user.

getInputState

Added in API level 21
public int getInputState (String inputId)

Returns the state of a given TV input.

The state is one of the following:

Parameters
inputId String: The ID of the TV input. This value cannot be null.

Returns
int Value is INPUT_STATE_CONNECTED, INPUT_STATE_CONNECTED_STANDBY, or INPUT_STATE_DISCONNECTED

Throws
IllegalArgumentException if the argument is null.

getTvInputInfo

Added in API level 21
public TvInputInfo getTvInputInfo (String inputId)

Returns the TvInputInfo for a given TV input.

Parameters
inputId String: The ID of the TV input. This value cannot be null.

Returns
TvInputInfo the TvInputInfo for a given TV input. null if not found.

getTvInputList

Added in API level 21
public List<TvInputInfo> getTvInputList ()

Returns the complete list of TV inputs on the system.

Returns
List<TvInputInfo> List of TvInputInfo for each TV input that describes its meta information.

isParentalControlsEnabled

Added in API level 21
public boolean isParentalControlsEnabled ()

Returns the user's parental controls enabled state.

Returns
boolean true if the user enabled the parental controls, false otherwise.

isRatingBlocked

Added in API level 21
public boolean isRatingBlocked (TvContentRating rating)

Checks whether a given TV content rating is blocked by the user.

Parameters
rating TvContentRating: The TV content rating to check. Can be TvContentRating.UNRATED. This value cannot be null.

Returns
boolean true if the given TV content rating is blocked, false otherwise.

registerCallback

Added in API level 21
public void registerCallback (TvInputManager.TvInputCallback callback, 
                Handler handler)

Registers a TvInputCallback.

Parameters
callback TvInputManager.TvInputCallback: A callback used to monitor status of the TV inputs. This value cannot be null.

handler Handler: A Handler that the status change will be delivered to. This value cannot be null.

unregisterCallback

Added in API level 21
public void unregisterCallback (TvInputManager.TvInputCallback callback)

Unregisters the existing TvInputCallback.

Parameters
callback TvInputManager.TvInputCallback: The existing callback to remove. This value cannot be null.

updateTvInputInfo

Added in API level 24
public void updateTvInputInfo (TvInputInfo inputInfo)

Updates the TvInputInfo for an existing TV input. A TV input service implementation may call this method to pass the application and system an up-to-date TvInputInfo object that describes itself.

The system automatically creates a TvInputInfo object for each TV input, based on the information collected from the AndroidManifest.xml, thus it is not necessary to call this method unless such information has changed dynamically. Use TvInputInfo.Builder to build a new TvInputInfo object.

Attempting to change information about a TV input that the calling package does not own does nothing.

Parameters
inputInfo TvInputInfo: The TvInputInfo object that contains new information. This value cannot be null.

Throws
IllegalArgumentException if the argument is null.