From 1edb35fb296ebfaabe765a1839765f8a43336def Mon Sep 17 00:00:00 2001 From: Clay Murphy Date: Wed, 15 Oct 2014 14:25:59 -0700 Subject: Docs: Port TV docs to source.android.com Bug: 16572516 Change-Id: Ic33e472f1d22c6538f3feea99c070de03898590b --- src/devices/devices_toc.cs | 11 + src/devices/tv/HDMI-CEC.jd | 312 +++++++++++++ src/devices/tv/images/Built-in_Tuner_TV_Input.png | Bin 0 -> 44789 bytes src/devices/tv/images/HDMI_Control_Service.png | Bin 0 -> 55283 bytes .../tv/images/HDMI_Control_Service_Flow.png | Bin 0 -> 127214 bytes src/devices/tv/images/TIF_HDMI_TV_Input.png | Bin 0 -> 45322 bytes src/devices/tv/images/TIF_MHEG5_app.png | Bin 0 -> 88809 bytes src/devices/tv/images/TIF_Overview.png | Bin 0 -> 103861 bytes src/devices/tv/images/TIF_PIP-PAP.png | Bin 0 -> 101077 bytes src/devices/tv/images/TIF_TV_Provider.png | Bin 0 -> 64871 bytes src/devices/tv/images/TV_App_CEC_integration.png | Bin 0 -> 66300 bytes src/devices/tv/images/TV_Input_DVR.png | Bin 0 -> 68531 bytes src/devices/tv/images/Third-party_Input_HDMI.png | Bin 0 -> 65955 bytes src/devices/tv/index.jd | 481 +++++++++++++++++++++ 14 files changed, 804 insertions(+) create mode 100644 src/devices/tv/HDMI-CEC.jd create mode 100644 src/devices/tv/images/Built-in_Tuner_TV_Input.png create mode 100644 src/devices/tv/images/HDMI_Control_Service.png create mode 100644 src/devices/tv/images/HDMI_Control_Service_Flow.png create mode 100644 src/devices/tv/images/TIF_HDMI_TV_Input.png create mode 100644 src/devices/tv/images/TIF_MHEG5_app.png create mode 100644 src/devices/tv/images/TIF_Overview.png create mode 100644 src/devices/tv/images/TIF_PIP-PAP.png create mode 100644 src/devices/tv/images/TIF_TV_Provider.png create mode 100644 src/devices/tv/images/TV_App_CEC_integration.png create mode 100644 src/devices/tv/images/TV_Input_DVR.png create mode 100644 src/devices/tv/images/Third-party_Input_HDMI.png create mode 100644 src/devices/tv/index.jd diff --git a/src/devices/devices_toc.cs b/src/devices/devices_toc.cs index 0e2c3b77..93da9f4f 100644 --- a/src/devices/devices_toc.cs +++ b/src/devices/devices_toc.cs @@ -226,6 +226,17 @@ + + diff --git a/src/devices/tv/HDMI-CEC.jd b/src/devices/tv/HDMI-CEC.jd new file mode 100644 index 00000000..9c23ba52 --- /dev/null +++ b/src/devices/tv/HDMI-CEC.jd @@ -0,0 +1,312 @@ +page.title=HDMI-CEC Control Service +@jd:body + + +
+
+

In this document

+
    +
+
+
+ +

Introduction

+ +

The High-Definition Multimedia Interface Consumer Electronics Control (HDMI-CEC) standard allows mulitmedia consumer products to communicate and +exchange information with each other. HDMI-CEC supports many features, like +Remote Control Passthrough and System Audio Control, but one of the most +popular is One Touch Play. One Touch Play lets a media source device turn on +the TV and switch its input port automatically, so you don’t have to search for +the TV remote to switch from your Chromecast to Blu-ray player.

+ +

Most manufacturers have adopted HDMI-CEC so their devices work with other +companies’ devices. But because each manufacturer implements the HDMI-CEC +standard in different ways, devices don’t always understand each other and +supported features vary between devices. Because of this variance, consumers +can’t safely assume that two products that claim CEC support are completely +compatible.

+ +

Solution

+ + +

With the introduction of the Android TV Input Framework (TIF), HDMI-CEC brings +together all connected devices and minimizes compatibility issues. Android has +created a system service called HdmiControlService to alleviate these pain points.

+ +

By offering HdmiControlService as a part of the Android ecosystem, Android hopes to provide:

+ + + +

Overall design

+ + +

HdmiControlService is connected with the rest of the system like TV Input Framework (TIF), Audio service, and Power service to implement the various features the standard +specifies.

+ +

See the following diagram for a depiction of the switch from a custom CEC +controller to an implementation of the simpler HDMI-CEC hardware abstraction +layer (HAL).

+ +Diagram that shows how HDMI-CEC was implemented before and after Android 5.0 + +

Figure 1. HDMI Control Service replacement

+ +

Implementation

+ + +

See the following diagram for a detailed view of the HDMI control service.

+ +Image that shows how HDMI Control service details + +

Figure 2. HDMI Control Service details

+ +

Here are the key ingredients to a proper Android HDMI-CEC implementation:

+ + + +

+

Note: Device manufacturers should add the following line into PRODUCT_COPY_FILES in device.mk

+ +
+PRODUCT_COPY_FILES += \
+frameworks/native/data/etc/android.hardware.hdmi.cec.xml:system/etc/permissions/android.hardware.hdmi.cec.xml
+
+ + +

Depending on whether your device is a HDMI sink device or a HDMI source device, +device manufactureres need to set ro.hdmi.device_type in device.mk for HdmiControlService to work correctly.

+ +

For HDMI source devices, like Over the Top (OTT) boxes, set:

+ +
+PRODUCT_PROPERTY_OVERRIDES += ro.hdmi.device_type=4
+
+ +

For HDMI sink devices, like panel TVs, set:

+ +
+PRODUCT_PROPERTY_OVERRIDES += ro.hdmi.device_type=0
+

+ + + + +

Android supports type TV/Display(0) and playback device(4), which can issue the One Touch Play command to display. The other types (tuner +and recorder) are currently not supported.

+ +

HDMI-CEC HAL definition

+ + +

In order to have the service in action, the HDMI-CEC HAL needs to be +implemented to the definition provided by Android. It abstracts differences in +the hardware level and exposes the primitive operations (allocate/read/write, +etc.) to the upper layer through API.

+ +

The API calls that device manufacturers must support are:

+ +

TX/RX/Events

+ + +

Info

+ + +

Logical Address

+ + +

Status

+ + +

Here is an excerpt of the HDMI-CEC HAL definition regarding APIs:

+ +
+#ifndef ANDROID_INCLUDE_HARDWARE_HDMI_CEC_H
+#define ANDROID_INCLUDE_HARDWARE_HDMI_CEC_H
+
+...
+
+/*
+ * HDMI-CEC HAL interface definition.
+ */
+typedef struct hdmi_cec_device {
+    /**
+     * Common methods of the HDMI-CEC device.  This *must* be the first member of
+     * hdmi_cec_device as users of this structure will cast a hw_device_t to hdmi_cec_device
+     * pointer in contexts where it's known the hw_device_t references a hdmi_cec_device.
+     */
+    struct hw_device_t common;
+
+    /*
+     * (*add_logical_address)() passes the logical address that will be used
+     * in this system.
+     *
+     * HAL may use it to configure the hardware so that the CEC commands addressed
+     * the given logical address can be filtered in. This method can be called
+     * as many times as necessary in order to support multiple logical devices.
+     * addr should be in the range of valid logical addresses for the call
+     * to succeed.
+     *
+     * Returns 0 on success or -errno on error.
+     */
+    int (*add_logical_address)(const struct hdmi_cec_device* dev, cec_logical_address_t addr);
+
+    /*
+     * (*clear_logical_address)() tells HAL to reset all the logical addresses.
+     *
+     * It is used when the system doesn't need to process CEC command any more,
+     * hence to tell HAL to stop receiving commands from the CEC bus, and change
+     * the state back to the beginning.
+     */
+    void (*clear_logical_address)(const struct hdmi_cec_device* dev);
+
+    /*
+     * (*get_physical_address)() returns the CEC physical address. The
+     * address is written to addr.
+     *
+     * The physical address depends on the topology of the network formed
+     * by connected HDMI devices. It is therefore likely to change if the cable
+     * is plugged off and on again. It is advised to call get_physical_address
+     * to get the updated address when hot plug event takes place.
+     *
+     * Returns 0 on success or -errno on error.
+     */
+    int (*get_physical_address)(const struct hdmi_cec_device* dev, uint16_t* addr);
+
+    /*
+     * (*send_message)() transmits HDMI-CEC message to other HDMI device.
+     *
+     * The method should be designed to return in a certain amount of time not
+     * hanging forever, which can happen if CEC signal line is pulled low for
+     * some reason. HAL implementation should take the situation into account
+     * so as not to wait forever for the message to get sent out.
+     *
+     * It should try retransmission at least once as specified in the standard.
+     *
+     * Returns error code. See HDMI_RESULT_SUCCESS, HDMI_RESULT_NACK, and
+     * HDMI_RESULT_BUSY.
+     */
+    int (*send_message)(const struct hdmi_cec_device* dev, const cec_message_t*);
+
+    /*
+     * (*register_event_callback)() registers a callback that HDMI-CEC HAL
+     * can later use for incoming CEC messages or internal HDMI events.
+     * When calling from C++, use the argument arg to pass the calling object.
+     * It will be passed back when the callback is invoked so that the context
+     * can be retrieved.
+     */
+    void (*register_event_callback)(const struct hdmi_cec_device* dev,
+            event_callback_t callback, void* arg);
+
+    /*
+     * (*get_version)() returns the CEC version supported by underlying hardware.
+     */
+    void (*get_version)(const struct hdmi_cec_device* dev, int* version);
+
+    /*
+     * (*get_vendor_id)() returns the identifier of the vendor. It is
+     * the 24-bit unique company ID obtained from the IEEE Registration
+     * Authority Committee (RAC).
+     */
+    void (*get_vendor_id)(const struct hdmi_cec_device* dev, uint32_t* vendor_id);
+
+    /*
+     * (*get_port_info)() returns the hdmi port information of underlying hardware.
+     * info is the list of HDMI port information, and 'total' is the number of
+     * HDMI ports in the system.
+     */
+    void (*get_port_info)(const struct hdmi_cec_device* dev,
+            struct hdmi_port_info* list[], int* total);
+
+    /*
+     * (*set_option)() passes flags controlling the way HDMI-CEC service works down
+     * to HAL implementation. Those flags will be used in case the feature needs
+     * update in HAL itself, firmware or microcontroller.
+     */
+    void (*set_option)(const struct hdmi_cec_device* dev, int flag, int value);
+
+    /*
+     * (*set_audio_return_channel)() configures ARC circuit in the hardware logic
+     * to start or stop the feature. Flag can be either 1 to start the feature
+     * or 0 to stop it.
+     *
+     * Returns 0 on success or -errno on error.
+     */
+    void (*set_audio_return_channel)(const struct hdmi_cec_device* dev, int flag);
+
+    /*
+     * (*is_connected)() returns the connection status of the specified port.
+     * Returns HDMI_CONNECTED if a device is connected, otherwise HDMI_NOT_CONNECTED.
+     * The HAL should watch for +5V power signal to determine the status.
+     */
+    int (*is_connected)(const struct hdmi_cec_device* dev, int port);
+
+    /* Reserved for future use to maximum 16 functions. Must be NULL. */
+    void* reserved[16 - 11];
+} hdmi_cec_device_t;
+
+#endif /* ANDROID_INCLUDE_HARDWARE_HDMI_CEC_H */
+
+ + +

The API lets the service make use of the hardware resource to send/receive +HDMI-CEC commands, configure necessary settings, and (optionally) communicate +with the microprocessor in the underlying platform that will take over the CEC +control while the Android system is in standby mode.

+ +

Testing

+ + +

Device manufacturers must test the APIs of the HDMI-CEC HAL with their own +tools to make sure they provide expected functionality.

diff --git a/src/devices/tv/images/Built-in_Tuner_TV_Input.png b/src/devices/tv/images/Built-in_Tuner_TV_Input.png new file mode 100644 index 00000000..bff7fea9 Binary files /dev/null and b/src/devices/tv/images/Built-in_Tuner_TV_Input.png differ diff --git a/src/devices/tv/images/HDMI_Control_Service.png b/src/devices/tv/images/HDMI_Control_Service.png new file mode 100644 index 00000000..cc8e43d5 Binary files /dev/null and b/src/devices/tv/images/HDMI_Control_Service.png differ diff --git a/src/devices/tv/images/HDMI_Control_Service_Flow.png b/src/devices/tv/images/HDMI_Control_Service_Flow.png new file mode 100644 index 00000000..84fe4a6a Binary files /dev/null and b/src/devices/tv/images/HDMI_Control_Service_Flow.png differ diff --git a/src/devices/tv/images/TIF_HDMI_TV_Input.png b/src/devices/tv/images/TIF_HDMI_TV_Input.png new file mode 100644 index 00000000..5274588c Binary files /dev/null and b/src/devices/tv/images/TIF_HDMI_TV_Input.png differ diff --git a/src/devices/tv/images/TIF_MHEG5_app.png b/src/devices/tv/images/TIF_MHEG5_app.png new file mode 100644 index 00000000..f977ea44 Binary files /dev/null and b/src/devices/tv/images/TIF_MHEG5_app.png differ diff --git a/src/devices/tv/images/TIF_Overview.png b/src/devices/tv/images/TIF_Overview.png new file mode 100644 index 00000000..5041c170 Binary files /dev/null and b/src/devices/tv/images/TIF_Overview.png differ diff --git a/src/devices/tv/images/TIF_PIP-PAP.png b/src/devices/tv/images/TIF_PIP-PAP.png new file mode 100644 index 00000000..ea3a3a72 Binary files /dev/null and b/src/devices/tv/images/TIF_PIP-PAP.png differ diff --git a/src/devices/tv/images/TIF_TV_Provider.png b/src/devices/tv/images/TIF_TV_Provider.png new file mode 100644 index 00000000..d058d82b Binary files /dev/null and b/src/devices/tv/images/TIF_TV_Provider.png differ diff --git a/src/devices/tv/images/TV_App_CEC_integration.png b/src/devices/tv/images/TV_App_CEC_integration.png new file mode 100644 index 00000000..da2908cd Binary files /dev/null and b/src/devices/tv/images/TV_App_CEC_integration.png differ diff --git a/src/devices/tv/images/TV_Input_DVR.png b/src/devices/tv/images/TV_Input_DVR.png new file mode 100644 index 00000000..3a652db1 Binary files /dev/null and b/src/devices/tv/images/TV_Input_DVR.png differ diff --git a/src/devices/tv/images/Third-party_Input_HDMI.png b/src/devices/tv/images/Third-party_Input_HDMI.png new file mode 100644 index 00000000..684613a9 Binary files /dev/null and b/src/devices/tv/images/Third-party_Input_HDMI.png differ diff --git a/src/devices/tv/index.jd b/src/devices/tv/index.jd new file mode 100644 index 00000000..72e03fa8 --- /dev/null +++ b/src/devices/tv/index.jd @@ -0,0 +1,481 @@ +page.title=TV Input Framework +@jd:body + + +
+
+

In this document

+
    +
+
+
+ +

Introduction

+ +

The Android TV Input Framework (TIF) simplifies the delivery of live content to +Android TV. The Android TIF provides a standard API for manufacturers to use to +create input modules for controlling Android TV. It also enables live TV search +and recommendations via metadata published by the TV Input. The framework does +not seek to implement TV standards or regional requirements.

+ +

The Android TIF makes it easier for partners to meet regional digital TV +broadcast standards without re-implementation. This document may also inform +third-party app developers who would like to create custom TV Inputs.

+ +

Components

+ +

The Android TV Input Framework implementation includes a TV Input Manager and +an example TV App that works with a special remote control to access built-in +and IP tuner channels. The TV App communicates with TV Input modules supplied +by the device manufacturer or other parties through the TV Input Manager.

+ +

The TV Input Framework consists of:

+ + + +

These components are covered in detail below. See the following diagram for a +detailed view of the Android TV Input Framework architecture.

+ +Overview of the Android TIF architecture +

Figure 1. Android TV Input Framework (TIF) architecture

+ +

Flow

+ +

Here is how the architecture is exercised:

+ +
    +
  1. The user sees and interacts with the TV App, a system app that can’t be +replaced by a third-party app. The Android Open Source Project (AOSP) provides +a reference TV App that manufacturers can extend to suit their needs. +
  2. The TV App displays the AV content from the TV Input. +
  3. The TV App cannot talk directly with the TV Inputs. The TV Input Manager +identifies the state of TV Inputs for the TV App. See TV Input Manager below for more details about these limitations. +
+ +

Permissions

+ + + +

TV Provider

+ +

The TV Provider database stores the channels and programs from TV Inputs. The +TV Provider also publishes and manages the associated permissions so that TV +Inputs can see only their own records. For instance, a specific TV Input can +see only the channels and programs it has supplied and is prohibited from +accessing any other TV Inputs’ channels and programs.

+ +

The TV Provider maps "broadcast genre" to "canonical genre" internally. TV +Inputs are responsible for populating "broadcast genre" with the value in the +underlying broadcast standard, and the "canonical genre" field will +automatically be populated with the correct associated genre from android.provider.TvContract.Genres. For example, with broadcast standard ATSC A/65 and program with genre 0x25 +(meaning “Sports”), the TV Input will populate the “broadcast genre” with the +String “Sports” and TV Provider will populate the “canonical genre” field with +the mapped value android.provider.TvContract.Genres.SPORTS.

+ +

See the diagram below for a detailed view of the TV Provider.

+ +Android TV Provider +

Figure 2. Android TV Provider

+ +

Only apps in the privileged system partition can read the entire TV Provider +database.

+ +

Passthrough TV inputs do not store channels and programs.

+ +

In addition to the standard fields for channels and programs, the TV Provider +database also offers a BLOB type field, COLUMN_INTERNAL_PROVIDER_DATA, in each table that TV Inputs may use to store arbitrary data. That BLOB data +can include custom information, such as frequency of the associated tuner, and +may be provided in a protocol buffer or another form. A Searchable field is +available to make certain channels unavailable in search (such as to meet +country-specific requirements for content protection).

+ +

Database field examples

+ +

The TV Provider supports structured data in channel (android.provider.TvContract.Channels) and program (android.provider.TvContract.Programs) tables. These tables are populated and accessed by TV Inputs and system apps +like the TV App. These tables have four types of fields:

+ + + +

For a more exhaustive list of the fields, see android/frameworks/base/media/java/android/media/tv/TvContract.java

+ +

Permissions and access control

+ +

All fields are visible to anyone with access to the corresponding row. No +fields are directly accessible to users; they see only what the TV App, System +apps, or TV Inputs surface.

+ + + +

TV Input Manager

+ +

The TV Input Manager provides a central system API to the overall Android TV +Input Framework. It arbitrates interaction between apps and TV Inputs and +provides parental control functionality. TV Input Manager sessions must be +created one-to-one with TV Inputs. The TV Input Manager allows access to +installed TV Inputs so apps may:

+ + + +

For sessions, a TV Input may be tuned by the TV App only to URIs it has added +to the TV Provider database, except for passthrough TV Inputs which can be +tuned to using TvContract.buildChannelUriForPassthroughInput(). A TV Input may also have its volume set. TV Inputs provided and signed by the +device manufacturer (signature apps) or other apps installed in the system +partition will have access to the entire TV Provider database. This access can +be used to construct apps to browse and search across all available TV channels +and programs.

+ +

An app may create and register a TvInputCallback with the android.media.tv.TvInputManager to be called back on a TV Input’s state change or on the addition or removal +of a TV Input. For example, a TV App can react when a TV Input is disconnected +by displaying it as disconnected and preventing its selection.

+ +

The TV Input Manager abstracts communication between the TV App and TV Inputs. +The standard interface of TV Input Manager and TV Input allows multiple +partners to create their own TV Apps while helping all third-party TV Inputs +work on all TV Apps, thus creating an ecosystem.

+ +

TV Inputs

+ +

TV Inputs are Android apps in the sense they have an AndroidManifest.xml and +are installed (via Play, pre-installed, or sideloaded). Android TV supports +pre-installed system apps, apps signed by the device manufacturer and +third-party TV Inputs.

+ +

Some inputs, like the HDMI input or built-in tuner input, can be provided only +by the manufacturer as they speak directly with the underlying hardware. +Others, such as IPTV, place-shifting, and external STB, can be supplied by +third parties as APKs on Google Play Store. Once downloaded and installed, the +new input can be selected within the TV App.

+ +

Passthrough input example

+ +Android TV System Input +

Figure 3. Android TV System Input

+ +

In this example, the TV Input provided by the device manufacturer is trusted +and has full access to the TV Provider. As a passthrough TV Input, it does not +register any channels or programs with the TV Provider. To obtain the URI used +to reference the passthrough input, use the android.media.tv.TvContract utility method buildChannelUriForPassthroughInput(String inputId). The TV App communicates with the TV Input Manager to reach the HDMI TV +Input.

+ +

Built-in tuner example

+ +Android TV Built-in Tuner Input +

Figure 4. Android TV Built-in Tuner Input

+ +

In this example, the Built-in Tuner TV Input provided by the device +manufacturer is trusted and has full access to the TV Provider.

+ +

Third-party input example

+ +Android TV third-party input +

Figure 5. Android TV third-party input

+ +

In this example, the external STB TV Input is provided by a third party. Since +that TV Input can’t directly access the HDMI video feed coming in, it must go +through the TV Input Manager and use the HDMI TV Input provided by the device +manufacture.

+ +

Through the TV Input Manager, the external STB TV Input can speak with the HDMI +TV Input and ask it to show the video on HDMI1. So the STB TV Input can control +the TV while the manufacturer-provided HDMI TV Input renders the video.

+ +

Picture in picture (PIP) example

+ +Android TV KeyEvents +

Figure 6. Android TV KeyEvents

+ +

The diagram above shows how buttons on a remote control are passed to a +specific TV Input for picture in picture (PIP) display. Those button presses +are interpreted by the hardware driver supplied by the device manufacturer, +converting hardware scancodes to Android keycodes and passing them to the +standard Android input pipeline InputReader and InputDispatcher functions as KeyEvents. These in turn trigger events on the TV App if it is in focus.

+ +

Only system TV Inputs are eligible to receive InputEvents, and only if they have the RECEIVE_INPUT_EVENT system permission. The TV Input is responsible to determine which InputEvents +to consume and should allow the TV App to handle the keys it does not need to +consume.

+ +

The TV App is responsible for knowing which system TV Input is active, meaning +selected by the user, and to disambiguate incoming KeyEvents and route them to the correct TV Input Manager session, calling dispatchInputEvent() to pass on the event to the associated TV Input.

+ +

MHEG-5 input example

+ +

The following diagram shows a more detailed view of how KeyEvents are routed through the Android TIF.

+ +Android TV Red button example +

Figure 7. Android TV Red button example

+ +

It depicts the flow of a Red button app, common in Europe for letting users +access interactive apps on their televisions. An app can be delivered over this +transport stream. When the button is clicked, it lets users interact with these +broadcast apps. For example, you might use these broadcast apps to access +related web pages or sports scores.

+ +

See the Broadcast app section to learn how broadcast apps interact with the TV App.

+ +

In this example:

+ +
    +
  1. The TV App is in focus and receives all keys. +
  2. KeyEvents (e.g. the Red button) is passed to the active TV Input as InputEvents. +
  3. The system TV Input integrates with MHEG-5 stack and has the RECEIVE_INPUT_EVENT system permission. +
  4. On receiving activation keycode (e.g. Red button), the TV Input activates +broadcast app. +
  5. TV input consumes KeyEvents as InputEvents and the broadcast app is the focus and handles InputEvents until dismissed. +
+ +

Note: Third-party TV inputs never receive keys.

+ +

TV Input HAL

+ +

The TV Input HAL aids development of TV Inputs to access TV-specific hardware. +As with other Android HALs, the TV Input HAL (tv_input) is +available in the AOSP source tree and the vendor develops its implementation.

+ +

TV App

+ +

The Android TV Input Framework includes a reference implementation to help +manufacturers create their own TV Apps more quickly. Third-party developers +cannot develop TV Apps as the APIs require system or signature permission.

+ +

Partners are strongly encouraged to take the reference as a base implementation +and extend it to add additional functionality. By building upon the reference +implementation, bug fixes and improvements added to the reference will be more +easily included in the partner’s variant. By extending the TV App in a +structured way, it is easier to pick up new features and bug fixes made to the +reference. Ideally, those extensions are submitted to the Android ecosystem so +others may benefit from and be compatible with them.

+ +

The TV App provides channel and program search results (via com.android.tv.search.TvProviderSearch) and passes keys, tune, and volume calls to TV Inputs through the TV Input +Manager. Manufacturers must implement the TV App to ensure search functions +work for their users. Otherwise, users will struggle to navigate the resulting +Android TV.

+ +

The example Android TV App lets manufacturers see how the TIF works and should +expedite their own development by demonstrating a simple TV-watching +experience.

+ +

As with the TIF in general, the TV App does not seek to implement device +manufacturer or country-specific features. Instead, it handles these tasks by +default:

+ +

Setup and configuration

+ + + +

Viewing

+ + +

Parental Control

+ +

Parental control lets a user block undesired channels and programs, but bypass +the block by entering a PIN code.

+ +

Responsibility for parental control functionality is shared amongst the TV App, +TV Input Manager service, TV Provider, and TV Input.

+ +

TV Provider

+ +

Each channel row has a COLUMN_LOCKED field that is used to lock specific channels from viewing without entering a +PIN code. The program field COLUMN_CONTENT_RATING is intended for display and is not used to enforce parental control.

+ +

TV Input Manager

+ +

The TV Input Manager stores every blocked TvContentRating and responds to isRatingBlocked() to advise if content with the given rating should be blocked.

+ +

TV Input

+ +

The TV Input checks if the current content should be blocked by calling isRatingBlocked() on the TV Input Manager when the rating of the displayed content has changed +(on program or channel change), or parental control settings have changed (on ACTION_BLOCKED_RATINGS_CHANGED and ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED). If the content should be blocked, the TV Input disables the audio and video +and notifies the TV app that the current content is blocked by calling notifyContentBlocked(TvContentRating).

+ +

TV App

+ +

The TV App shows parental control settings to users and a PIN code UI when it +is notified by a TV Input that the current content is blocked or when the user +attempts to view a blocked channel.

+ +

The TV App does not directly store the parental control settings. When the user +changes the parental control settings, every blocked TvContentRating is stored by the TV Input Manager, and blocked channels are stored by the TV +Provider.

+ +

HDMI-CEC

+ +

HDMI-CEC allows one device to control another, thereby enabling a single remote +to control multiple appliances in a home theater. It is used by Android TV to +speed setup and allow distant control over various TV Inputs via the central TV +App. For instance, it may switch inputs, power up or down devices, and more.

+ +

The Android TIF implements HDMI-CEC as the HDMI Control Service so that +partners merely need to develop low-level drivers that interact with the +lightweight Android TV HAL, skipping more complex business logic. In providing +a standard implementation, Android seeks to mitigate compatibility issues by +reducing fragmented implementations and selective feature support. The HDMI +Control Service uses the existing Android services, including input and power.

+ +

This means existing HDMI-CEC implementations will need to be redesigned to +interoperate with the Android TIF. We recommend the hardware platform contain a +microprocessor to receive CEC power on and other commands.

+ +CEC integration on Android TV +

Figure 8. CEC integration on Android TV

+ +
    +
  1. The CEC bus receives a command from the currently active source to switch to a +different source. +
  2. The driver passes the command to the HDMI-CEC HAL. +
  3. The HAL notifies all ActiveSourceChangeListeners. +
  4. THe HDMI Control Service is notified of source change via ActiveSourceChangeListener. +
  5. The TV Input Manager service generates an intent for the TV App to switch the +source. +
  6. The TV App then creates a TV Input Manager Session for the TV Input being +switched to and calls setMain on that session. +
  7. The TV Input Manager Session passes this information on to the HDMI TV Input. +
  8. The HDMI TV input requests to set sideband surface. +
  9. The TV Input Manager Service generates a corresponding routing control command +back to HDMI Control Service when the surface is set. +
+ +

TV integration guidelines

+ +

Broadcast app

+ +

Because each country has broadcast-specific requirements (MHEG, Teletext, +HbbTV, and more), manufacturers are expected to supply their own solutions for +the broadcast app, for example:

+ + + +

In the Android L release, Android TV expects partners to use systems +integrators or the Android solutions for regional TV stacks, pass the surface +to TV software stacks, or pass the necessary key code to interact with legacy +stacks.

+ +

Here’s how the broadcast app and TV App interact:

+ +
    +
  1. The TV App is in focus, receiving all keys. +
  2. The TV App passes keys (e.g. Red button) to the TV Input device. +
  3. The TV Input device internally integrates with legacy TV stack. +
  4. On receiving an activation keycode (e.g. Red button), the TV Input device +activates broadcast apps. +
  5. A broadcast app takes focus in the TV App and handles user actions. +
+ +

For voice search/recommendation, the broadcast app may support In-app search +for voice search.

+ +

DVR

+ +

Android TV supports digital video recording (DVR) with partner development. The +DVR function works like so:

+ +
    +
  1. DVR recording function / Live Buffer can be implemented by any TV Input. +
  2. TV App passes on key inputs to TV Input (including recording/pause/fast +forward/ rewind keys). +
  3. When playing the recorded content, the TV Input handles it with trick play +overlay. +
  4. DVR app enables users to browse and manage recorded program. +
+ +

For voice search/recommendation:

+ + + +

See the following diagram for a view into a possible DVR implementation in +Android TV.

+ +Digital video recording in Android TV +

Figure 9. Digital video recording in Android TV

-- cgit v1.2.3