Android APIs
public final class

TvInputManager

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

Class Overview

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

Summary

Nested Classes
class TvInputManager.TvInputCallback Callback used to monitor status of the TV input. 
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.
int INPUT_STATE_CONNECTED The TV input is connected.
int INPUT_STATE_CONNECTED_STANDBY The TV input is connected but in standby mode.
int INPUT_STATE_DISCONNECTED The TV input is disconnected.
String META_DATA_CONTENT_RATING_SYSTEMS Content rating systems metadata associated with ACTION_QUERY_CONTENT_RATING_SYSTEMS.
int VIDEO_UNAVAILABLE_REASON_BUFFERING Video is not available because the TV input stopped the playback temporarily to buffer more data.
int VIDEO_UNAVAILABLE_REASON_TUNING Video is not available because the TV input is in the middle of tuning to a new channel.
int VIDEO_UNAVAILABLE_REASON_UNKNOWN A generic reason.
int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL Video is not available due to the weak TV signal.
Public Methods
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)
void unregisterCallback(TvInputManager.TvInputCallback callback)
Unregisters the existing TvInputManager.TvInputCallback.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_BLOCKED_RATINGS_CHANGED

Added in API level 21

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"

public static final String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED

Added in API level 21

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"

public static final String ACTION_QUERY_CONTENT_RATING_SYSTEMS

Added in API level 21

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"

public static final int INPUT_STATE_CONNECTED

Added in API level 21

The TV input is connected.

State for getInputState(String) and onInputStateChanged(String, int).

Constant Value: 0 (0x00000000)

public static final int INPUT_STATE_CONNECTED_STANDBY

Added in API level 21

The TV input is connected but in standby mode. It would take a while until it becomes fully ready.

State for getInputState(String) and onInputStateChanged(String, int).

Constant Value: 1 (0x00000001)

public static final int INPUT_STATE_DISCONNECTED

Added in API level 21

The TV input is disconnected.

State for getInputState(String) and onInputStateChanged(String, int).

Constant Value: 2 (0x00000002)

public static final String META_DATA_CONTENT_RATING_SYSTEMS

Added in API level 21

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"

public static final int VIDEO_UNAVAILABLE_REASON_BUFFERING

Added in API level 21

Video is not available because the TV input stopped the playback temporarily to buffer more data.

Constant Value: 3 (0x00000003)

public static final int VIDEO_UNAVAILABLE_REASON_TUNING

Added in API level 21

Video is not available because the TV input is in the middle of tuning to a new channel.

Constant Value: 1 (0x00000001)

public static final int VIDEO_UNAVAILABLE_REASON_UNKNOWN

Added in API level 21

A generic reason. Video is not available due to an unspecified error.

Constant Value: 0 (0x00000000)

public static final int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL

Added in API level 21

Video is not available due to the weak TV signal.

Constant Value: 2 (0x00000002)

Public Methods

public int getInputState (String inputId)

Added in API level 21

Returns the state of a given TV input. It returns one of the following:

Parameters
inputId The id of the TV input.
Throws
IllegalArgumentException if the argument is null or if there is no TvInputInfo corresponding to inputId.

public TvInputInfo getTvInputInfo (String inputId)

Added in API level 21

Returns the TvInputInfo for a given TV input.

Parameters
inputId The ID of the TV input.
Returns
  • the TvInputInfo for a given TV input. null if not found.

public List<TvInputInfo> getTvInputList ()

Added in API level 21

Returns the complete list of TV inputs on the system.

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

public boolean isParentalControlsEnabled ()

Added in API level 21

Returns the user's parental controls enabled state.

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

public boolean isRatingBlocked (TvContentRating rating)

Added in API level 21

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

Parameters
rating The TV content rating to check.
Returns
  • true if the given TV content rating is blocked, false otherwise.

public void registerCallback (TvInputManager.TvInputCallback callback, Handler handler)

Added in API level 21
Parameters
callback A callback used to monitor status of the TV inputs.
handler A Handler that the status change will be delivered to.
Throws
IllegalArgumentException if any of the arguments is null.

public void unregisterCallback (TvInputManager.TvInputCallback callback)

Added in API level 21

Unregisters the existing TvInputManager.TvInputCallback.

Parameters
callback The existing callback to remove.
Throws
IllegalArgumentException if any of the arguments is null.