Clay Murphy | 1edb35f | 2014-10-15 14:25:59 -0700 | [diff] [blame^] | 1 | page.title=TV Input Framework |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2013 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2>In this document</h2> |
| 22 | <ol id="auto-toc"> |
| 23 | </ol> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
| 27 | <h2 id=introduction>Introduction</h2> |
| 28 | |
| 29 | <p>The Android TV Input Framework (TIF) simplifies the delivery of live content to |
| 30 | Android TV. The Android TIF provides a standard API for manufacturers to use to |
| 31 | create input modules for controlling Android TV. It also enables live TV search |
| 32 | and recommendations via metadata published by the TV Input. The framework does |
| 33 | not seek to implement TV standards or regional requirements.</p> |
| 34 | |
| 35 | <p>The Android TIF makes it easier for partners to meet regional digital TV |
| 36 | broadcast standards without re-implementation. This document may also inform |
| 37 | third-party app developers who would like to create custom TV Inputs.</p> |
| 38 | |
| 39 | <h2 id=components>Components</h2> |
| 40 | |
| 41 | <p>The Android TV Input Framework implementation includes a TV Input Manager and |
| 42 | an example TV App that works with a special remote control to access built-in |
| 43 | and IP tuner channels. The TV App communicates with TV Input modules supplied |
| 44 | by the device manufacturer or other parties through the TV Input Manager.</p> |
| 45 | |
| 46 | <p>The TV Input Framework consists of:</p> |
| 47 | |
| 48 | <ul> |
| 49 | <li>TV Provider (<code>com.android.providers.tv.TvProvider</code>): a database of channels, programs, and associated permissions |
| 50 | <li>TV App (<code>com.android.tv.TvActivity</code>): the app that handles user interaction |
| 51 | <li>TV Input Manager (<code>android.media.tv.TvInputManager</code>): allows the TV Inputs to communicate with the TV App |
| 52 | <li>TV Input: an app representing physical or virtual tuners and input ports |
| 53 | <li>TV Input HAL (<code>tv_input</code> module): a hardware definition that allows system TV Inputs to access |
| 54 | TV-specific hardware when implemented |
| 55 | <li>Parental Control: the technology to allow blocking of channels and programs |
| 56 | <li>HDMI-CEC: the technology to allow remote control of various devices over HDMI |
| 57 | </ul> |
| 58 | |
| 59 | <p>These components are covered in detail below. See the following diagram for a |
| 60 | detailed view of the Android TV Input Framework architecture.</p> |
| 61 | |
| 62 | <img src="images/TIF_Overview.png" alt="Overview of the Android TIF architecture"> |
| 63 | <p class="img-caption"><strong>Figure 1.</strong> Android TV Input Framework (TIF) architecture</p> |
| 64 | |
| 65 | <h2 id=flow>Flow</h2> |
| 66 | |
| 67 | <p>Here is how the architecture is exercised:</p> |
| 68 | |
| 69 | <ol> |
| 70 | <li>The user sees and interacts with the TV App, a system app that can’t be |
| 71 | replaced by a third-party app. The Android Open Source Project (AOSP) provides |
| 72 | a reference TV App that manufacturers can extend to suit their needs. |
| 73 | <li>The TV App displays the AV content from the TV Input. |
| 74 | <li>The TV App cannot talk directly with the TV Inputs. The TV Input Manager |
| 75 | identifies the state of TV Inputs for the TV App. See <em>TV Input Manager</em> below for more details about these limitations. |
| 76 | </ol> |
| 77 | |
| 78 | <h2 id=permissions>Permissions</h2> |
| 79 | |
| 80 | <ul> |
| 81 | <li>Only <code><a href="http://developer.android.com/guide/topics/manifest/permission-element.html#plevel">signatureOrSystem</a> T</code>V Inputs and TV App have full access to the TV Provider database and are able |
| 82 | to receive KeyEvents. |
| 83 | <li>Only system TV Inputs can access the TV Input HAL through the TV Input Manager |
| 84 | service. TV Inputs are accessed one-to-one via TV Input Manager sessions. |
| 85 | <li>Third-party TV Inputs have package-locked access to the TV Provider database |
| 86 | and can READ/WRITE only to matching package rows. |
| 87 | <li>Third-party TV inputs can either display their own content or content from a |
| 88 | device manufacturer’s passthrough TV inputs, like HDMI1. They can’t display |
| 89 | content from non-passthrough TV inputs, like a built-in or IPTV tuner. |
| 90 | <li><code>TV_INPUT_HARDWARE</code> permission for a hardware TV Input app, signals the TV Input Manager Service |
| 91 | to notify the TV Input service on boot to call the TV Input Manager Service and |
| 92 | add its TV Inputs. This permission allows a hardware TV Input app to support |
| 93 | multiple TV Inputs per TV Input service, as well as being able to dynamically |
| 94 | add and remove its supported TV Inputs. |
| 95 | </ul> |
| 96 | |
| 97 | <h2 id=tv_provider>TV Provider</h2> |
| 98 | |
| 99 | <p>The TV Provider database stores the channels and programs from TV Inputs. The |
| 100 | TV Provider also publishes and manages the associated permissions so that TV |
| 101 | Inputs can see only their own records. For instance, a specific TV Input can |
| 102 | see only the channels and programs it has supplied and is prohibited from |
| 103 | accessing any other TV Inputs’ channels and programs. </p> |
| 104 | |
| 105 | <p>The TV Provider maps "broadcast genre" to "canonical genre" internally. TV |
| 106 | Inputs are responsible for populating "broadcast genre" with the value in the |
| 107 | underlying broadcast standard, and the "canonical genre" field will |
| 108 | automatically be populated with the correct associated genre from <code>android.provider.TvContract.Genres</code>. For example, with broadcast standard ATSC A/65 and program with genre 0x25 |
| 109 | (meaning “Sports”), the TV Input will populate the “broadcast genre” with the |
| 110 | String “Sports” and TV Provider will populate the “canonical genre” field with |
| 111 | the mapped value <code>android.provider.TvContract.Genres.SPORTS</code>.</p> |
| 112 | |
| 113 | <p>See the diagram below for a detailed view of the TV Provider. </p> |
| 114 | |
| 115 | <img src="images/TIF_TV_Provider.png" alt="Android TV Provider"> |
| 116 | <p class="img-caption"><strong>Figure 2.</strong> Android TV Provider</p> |
| 117 | |
| 118 | <p><em>Only apps in the privileged system partition can read the entire TV Provider |
| 119 | database. </em></p> |
| 120 | |
| 121 | <p>Passthrough TV inputs do not store channels and programs. </p> |
| 122 | |
| 123 | <p>In addition to the standard fields for channels and programs, the TV Provider |
| 124 | database also offers a BLOB type field, <code>COLUMN_INTERNAL_PROVIDER_DATA</code>, in each table that TV Inputs may use to store arbitrary data. That BLOB data |
| 125 | can include custom information, such as frequency of the associated tuner, and |
| 126 | may be provided in a protocol buffer or another form. A Searchable field is |
| 127 | available to make certain channels unavailable in search (such as to meet |
| 128 | country-specific requirements for content protection).</p> |
| 129 | |
| 130 | <h3 id=tv_provider_database_field_examples>Database field examples</h3> |
| 131 | |
| 132 | <p>The TV Provider supports structured data in channel (<code>android.provider.TvContract.Channels</code>) and program (<code>android.provider.TvContract.Programs</code>) tables. These tables are populated and accessed by TV Inputs and system apps |
| 133 | like the TV App. These tables have four types of fields:</p> |
| 134 | |
| 135 | <ul> |
| 136 | <li><strong>Display: </strong>Display fields contain information that apps may want to make visible to the |
| 137 | user, like a channel’s name (<code>COLUMN_DISPLAY_NAME</code>) or number (<code>COLUMN_DISPLAY_NUMBER</code>), or the title of the program being viewed. |
| 138 | <li><strong>Metadata:</strong> There are three fields for identifying content, according to relevant |
| 139 | standards, like a channel’s transport stream ID (<code>COLUMN_TRANSPORT_STREAM_ID</code>), original network ID (<code>COLUMN_ORIGINAL_NETWORK_ID</code>) and service id (<code>COLUMN_SERVICE_ID</code>). |
| 140 | <li><strong>Internal data</strong>: Fields that are for the custom use of TV Inputs.<br> |
| 141 | Some fields, like <code>COLUMN_INTERNAL_PROVIDER_DATA</code>, are customizable BLOB fields where a TV Input can store arbitrary metadata |
| 142 | about their channel or program. |
| 143 | <li><strong>Flag: </strong>Flag fields represent whether a channel should be restricted from search, |
| 144 | browse, or viewing. This can be set only at the channel level. All programs |
| 145 | defer to the setting on the channel. |
| 146 | <ul> |
| 147 | <li><code>COLUMN_SEARCHABLE</code>: Restricting search from some channels may be a requirement in certain |
| 148 | regions. <code>COLUMN_SEARCHABLE = 0</code> means the channel should not be exposed in search results. |
| 149 | <li><code>COLUMN_BROWSABLE</code>: Visible to system applications only. Restricting channel from being browsed |
| 150 | by applications. <code>COLUMN_BROWSABLE = 0</code> means the channel should not be included in the channel list. |
| 151 | <li><code>COLUMN_LOCKED</code>: Visible to system applications only. Restricting channel from being viewed by |
| 152 | invalid accounts without entering PIN code. <code>COLUMN_LOCKED = 1</code> means the channel should be protected by parental control. |
| 153 | </ul> |
| 154 | </ul> |
| 155 | |
| 156 | <p>For a more exhaustive list of the fields, see <code>android/frameworks/base/media/java/android/media/tv/TvContract.java</code></p> |
| 157 | |
| 158 | <h3 id=permissions_and_access_control>Permissions and access control</h3> |
| 159 | |
| 160 | <p>All fields are visible to anyone with access to the corresponding row. No |
| 161 | fields are directly accessible to users; they see only what the TV App, System |
| 162 | apps, or TV Inputs surface.</p> |
| 163 | |
| 164 | <ul> |
| 165 | <li>Each row has <code>PACKAGE_NAME</code>, the package (app) that owns that row, checked on Query, Insert, Update via |
| 166 | TvProvider.java. |
| 167 | A TV Input may access only the information it wrote and is |
| 168 | cordoned off from the information provided by other TV Inputs. |
| 169 | <li>READ, WRITE permissions via AndroidManifest.xml (requires user consent) to |
| 170 | determine available channels. |
| 171 | <li>Only <code>signatureOrSystem</code> apps can acquire <code>ACCESS_ALL_EPG_DATA</code> permission to access the entire database. |
| 172 | </ul> |
| 173 | |
| 174 | <h2 id=tv_input_manager>TV Input Manager</h2> |
| 175 | |
| 176 | <p>The TV Input Manager provides a central system API to the overall Android TV |
| 177 | Input Framework. It arbitrates interaction between apps and TV Inputs and |
| 178 | provides parental control functionality. TV Input Manager sessions must be |
| 179 | created one-to-one with TV Inputs. The TV Input Manager allows access to |
| 180 | installed TV Inputs so apps may:</p> |
| 181 | |
| 182 | <ul> |
| 183 | <li>List TV inputs and check their status |
| 184 | <li>Create sessions and manage listeners |
| 185 | </ul> |
| 186 | |
| 187 | <p>For sessions, a TV Input may be tuned by the TV App only to URIs it has added |
| 188 | to the TV Provider database, except for passthrough TV Inputs which can be |
| 189 | tuned to using <code>TvContract.buildChannelUriForPassthroughInput()</code>. A TV Input may also have its volume set. TV Inputs provided and signed by the |
| 190 | device manufacturer (signature apps) or other apps installed in the system |
| 191 | partition will have access to the entire TV Provider database. This access can |
| 192 | be used to construct apps to browse and search across all available TV channels |
| 193 | and programs.</p> |
| 194 | |
| 195 | <p>An app may create and register a <code>TvInputCallback</code> with the <code>android.media.tv.TvInputManager</code> to be called back on a TV Input’s state change or on the addition or removal |
| 196 | of a TV Input. For example, a TV App can react when a TV Input is disconnected |
| 197 | by displaying it as disconnected and preventing its selection.</p> |
| 198 | |
| 199 | <p>The TV Input Manager abstracts communication between the TV App and TV Inputs. |
| 200 | The standard interface of TV Input Manager and TV Input allows multiple |
| 201 | partners to create their own TV Apps while helping all third-party TV Inputs |
| 202 | work on all TV Apps, thus creating an ecosystem. </p> |
| 203 | |
| 204 | <h2 id=tv_inputs>TV Inputs</h2> |
| 205 | |
| 206 | <p>TV Inputs are Android apps in the sense they have an AndroidManifest.xml and |
| 207 | are installed (via Play, pre-installed, or sideloaded). Android TV supports |
| 208 | pre-installed system apps, apps signed by the device manufacturer and |
| 209 | third-party TV Inputs. </p> |
| 210 | |
| 211 | <p>Some inputs, like the HDMI input or built-in tuner input, can be provided only |
| 212 | by the manufacturer as they speak directly with the underlying hardware. |
| 213 | Others, such as IPTV, place-shifting, and external STB, can be supplied by |
| 214 | third parties as APKs on Google Play Store. Once downloaded and installed, the |
| 215 | new input can be selected within the TV App.</p> |
| 216 | |
| 217 | <h3 id=passthrough_input_example>Passthrough input example</h3> |
| 218 | |
| 219 | <img src="images/TIF_HDMI_TV_Input.png" alt="Android TV System Input"> |
| 220 | <p class="img-caption"><strong>Figure 3.</strong> Android TV System Input</p> |
| 221 | |
| 222 | <p>In this example, the TV Input provided by the device manufacturer is trusted |
| 223 | and has full access to the TV Provider. As a passthrough TV Input, it does not |
| 224 | register any channels or programs with the TV Provider. To obtain the URI used |
| 225 | to reference the passthrough input, use the <code>android.media.tv.TvContract</code> utility method <code>buildChannelUriForPassthroughInput(String inputId)</code>. The TV App communicates with the TV Input Manager to reach the HDMI TV |
| 226 | Input. </p> |
| 227 | |
| 228 | <h3 id=built-in_tuner_example>Built-in tuner example</h3> |
| 229 | |
| 230 | <img src="images/Built-in_Tuner_TV_Input.png" alt="Android TV Built-in Tuner Input"> |
| 231 | <p class="img-caption"><strong>Figure 4.</strong> Android TV Built-in Tuner Input</p> |
| 232 | |
| 233 | <p>In this example, the Built-in Tuner TV Input provided by the device |
| 234 | manufacturer is trusted and has full access to the TV Provider. </p> |
| 235 | |
| 236 | <h3 id=third-party_input_example>Third-party input example</h3> |
| 237 | |
| 238 | <img src="images/Third-party_Input_HDMI.png" alt="Android TV third-party input"> |
| 239 | <p class="img-caption"><strong>Figure 5.</strong> Android TV third-party input</p> |
| 240 | |
| 241 | <p>In this example, the external STB TV Input is provided by a third party. Since |
| 242 | that TV Input can’t directly access the HDMI video feed coming in, it must go |
| 243 | through the TV Input Manager and use the HDMI TV Input provided by the device |
| 244 | manufacture.</p> |
| 245 | |
| 246 | <p>Through the TV Input Manager, the external STB TV Input can speak with the HDMI |
| 247 | TV Input and ask it to show the video on HDMI1. So the STB TV Input can control |
| 248 | the TV while the manufacturer-provided HDMI TV Input renders the video.</p> |
| 249 | |
| 250 | <h3 id=picture_in_picture_pip_example>Picture in picture (PIP) example </h3> |
| 251 | |
| 252 | <img src="images/TIF_PIP-PAP.png" alt="Android TV KeyEvents"> |
| 253 | <p class="img-caption"><strong>Figure 6.</strong> Android TV KeyEvents</p> |
| 254 | |
| 255 | <p>The diagram above shows how buttons on a remote control are passed to a |
| 256 | specific TV Input for picture in picture (PIP) display. Those button presses |
| 257 | are interpreted by the hardware driver supplied by the device manufacturer, |
| 258 | converting hardware scancodes to Android keycodes and passing them to the |
| 259 | standard Android <a href="http://source.android.com/devices/tech/input/overview.html">input pipeline</a> <code>InputReader</code> and <code>InputDispatcher</code> functions as <a href="http://developer.android.com/reference/android/view/KeyEvent.html">KeyEvents</a>. These in turn trigger events on the TV App if it is in focus. </p> |
| 260 | |
| 261 | <p>Only system TV Inputs are eligible to receive <code>InputEvents</code>, and only if they have the <code>RECEIVE_INPUT_EVENT</code> system permission. The TV Input is responsible to determine which InputEvents |
| 262 | to consume and should allow the TV App to handle the keys it does not need to |
| 263 | consume.</p> |
| 264 | |
| 265 | <p>The TV App is responsible for knowing which system TV Input is active, meaning |
| 266 | selected by the user, and to disambiguate incoming <code>KeyEvents</code> and route them to the correct TV Input Manager session, calling <code>dispatchInputEvent()</code> to pass on the event to the associated TV Input. </p> |
| 267 | |
| 268 | <h3 id=mheg-5_input_example>MHEG-5 input example</h3> |
| 269 | |
| 270 | <p>The following diagram shows a more detailed view of how <code>KeyEvents</code> are routed through the Android TIF.</p> |
| 271 | |
| 272 | <img src="images/TIF_MHEG5_app.png" alt="Android TV Red button example"> |
| 273 | <p class="img-caption"><strong>Figure 7.</strong> Android TV Red button example</p> |
| 274 | |
| 275 | <p>It depicts the flow of a Red button app, common in Europe for letting users |
| 276 | access interactive apps on their televisions. An app can be delivered over this |
| 277 | transport stream. When the button is clicked, it lets users interact with these |
| 278 | broadcast apps. For example, you might use these broadcast apps to access |
| 279 | related web pages or sports scores.</p> |
| 280 | |
| 281 | <p>See the <em>Broadcast app</em> section to learn how broadcast apps interact with the TV App.</p> |
| 282 | |
| 283 | <p>In this example:</p> |
| 284 | |
| 285 | <ol> |
| 286 | <li>The TV App is in focus and receives all keys. |
| 287 | <li><code>KeyEvents</code> (e.g. the Red button) is passed to the active TV Input as <code>InputEvents.</code> |
| 288 | <li>The system TV Input integrates with MHEG-5 stack and has the <code>RECEIVE_INPUT_EVENT</code> system permission. |
| 289 | <li>On receiving activation keycode (e.g. Red button), the TV Input activates |
| 290 | broadcast app. |
| 291 | <li>TV input consumes <code>KeyEvents</code> as <code>InputEvents</code> and the broadcast app is the focus and handles <code>InputEvents</code> until dismissed. |
| 292 | </ol> |
| 293 | |
| 294 | <p class="note"><strong>Note</strong>: Third-party TV inputs never receive keys. </p> |
| 295 | |
| 296 | <h2 id=tv_input_hal>TV Input HAL</h2> |
| 297 | |
| 298 | <p>The TV Input HAL aids development of TV Inputs to access TV-specific hardware. |
| 299 | As with other Android HALs, the TV Input HAL (<code>tv_input</code>) is |
| 300 | available in the AOSP source tree and the vendor develops its implementation.</p> |
| 301 | |
| 302 | <h2 id=tv_app>TV App</h2> |
| 303 | |
| 304 | <p>The Android TV Input Framework includes a reference implementation to help |
| 305 | manufacturers create their own TV Apps more quickly. Third-party developers |
| 306 | cannot develop TV Apps as the APIs require system or signature permission.</p> |
| 307 | |
| 308 | <p>Partners are strongly encouraged to take the reference as a base implementation |
| 309 | and extend it to add additional functionality. By building upon the reference |
| 310 | implementation, bug fixes and improvements added to the reference will be more |
| 311 | easily included in the partner’s variant. By extending the TV App in a |
| 312 | structured way, it is easier to pick up new features and bug fixes made to the |
| 313 | reference. Ideally, those extensions are submitted to the Android ecosystem so |
| 314 | others may benefit from and be compatible with them.</p> |
| 315 | |
| 316 | <p>The TV App provides channel and program search results (via <code>com.android.tv.search.TvProviderSearch</code>) and passes keys, tune, and volume calls to TV Inputs through the TV Input |
| 317 | Manager. Manufacturers must implement the TV App to ensure search functions |
| 318 | work for their users. Otherwise, users will struggle to navigate the resulting |
| 319 | Android TV.</p> |
| 320 | |
| 321 | <p>The example Android TV App lets manufacturers see how the TIF works and should |
| 322 | expedite their own development by demonstrating a simple TV-watching |
| 323 | experience. </p> |
| 324 | |
| 325 | <p>As with the TIF in general, the TV App does not seek to implement device |
| 326 | manufacturer or country-specific features. Instead, it handles these tasks by |
| 327 | default:</p> |
| 328 | |
| 329 | <h3 id=setup_and_configuration>Setup and configuration</h3> |
| 330 | |
| 331 | <ul> |
| 332 | <li>Auto-detect TV Inputs |
| 333 | <li>Let TV Inputs initiate channel setup |
| 334 | <li>Control parental settings |
| 335 | <li>Alter TV settings |
| 336 | <ul> |
| 337 | <li>Edit channel |
| 338 | </ul> |
| 339 | </ul> |
| 340 | |
| 341 | <h3 id=viewing>Viewing</h3> |
| 342 | <ul> |
| 343 | <li>Access and navigate all TV channels |
| 344 | <li>Access TV program information bar |
| 345 | <li>Multiple audio and subtitle track support |
| 346 | <li>Parental control PIN challenge |
| 347 | <li>Allow TV Input UI overlay for: |
| 348 | <ul> |
| 349 | <li>TV standard (HbbTV, etc.) |
| 350 | </ul> |
| 351 | </ul> |
| 352 | |
| 353 | <h2 id=parental_control>Parental Control</h2> |
| 354 | |
| 355 | <p>Parental control lets a user block undesired channels and programs, but bypass |
| 356 | the block by entering a PIN code.</p> |
| 357 | |
| 358 | <p>Responsibility for parental control functionality is shared amongst the TV App, |
| 359 | TV Input Manager service, TV Provider, and TV Input. </p> |
| 360 | |
| 361 | <h3 id=tv_provider>TV Provider</h3> |
| 362 | |
| 363 | <p>Each channel row has a <code>COLUMN_LOCKED</code> field that is used to lock specific channels from viewing without entering a |
| 364 | PIN code. The program field <code>COLUMN_CONTENT_RATING</code> is intended for display and is not used to enforce parental control.</p> |
| 365 | |
| 366 | <h3 id=tv_input_manager>TV Input Manager</h3> |
| 367 | |
| 368 | <p>The TV Input Manager stores every blocked <code>TvContentRating</code> and responds to <code>isRatingBlocked()</code> to advise if content with the given rating should be blocked.</p> |
| 369 | |
| 370 | <h3 id=tv_input>TV Input</h3> |
| 371 | |
| 372 | <p>The TV Input checks if the current content should be blocked by calling <code>isRatingBlocked()</code> on the TV Input Manager when the rating of the displayed content has changed |
| 373 | (on program or channel change), or parental control settings have changed (on <code>ACTION_BLOCKED_RATINGS_CHANGED</code> and <code>ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED</code>). If the content should be blocked, the TV Input disables the audio and video |
| 374 | and notifies the TV app that the current content is blocked by calling <code>notifyContentBlocked(TvContentRating)</code>.</p> |
| 375 | |
| 376 | <h3 id=tv_app>TV App</h3> |
| 377 | |
| 378 | <p>The TV App shows parental control settings to users and a PIN code UI when it |
| 379 | is notified by a TV Input that the current content is blocked or when the user |
| 380 | attempts to view a blocked channel.</p> |
| 381 | |
| 382 | <p>The TV App does not directly store the parental control settings. When the user |
| 383 | changes the parental control settings, every blocked <code>TvContentRating</code> is stored by the TV Input Manager, and blocked channels are stored by the TV |
| 384 | Provider.</p> |
| 385 | |
| 386 | <h2 id=hdmi-cec>HDMI-CEC</h2> |
| 387 | |
| 388 | <p>HDMI-CEC allows one device to control another, thereby enabling a single remote |
| 389 | to control multiple appliances in a home theater. It is used by Android TV to |
| 390 | speed setup and allow distant control over various TV Inputs via the central TV |
| 391 | App. For instance, it may switch inputs, power up or down devices, and more.</p> |
| 392 | |
| 393 | <p>The Android TIF implements HDMI-CEC as the HDMI Control Service so that |
| 394 | partners merely need to develop low-level drivers that interact with the |
| 395 | lightweight Android TV HAL, skipping more complex business logic. In providing |
| 396 | a standard implementation, Android seeks to mitigate compatibility issues by |
| 397 | reducing fragmented implementations and selective feature support. The HDMI |
| 398 | Control Service uses the existing Android services, including input and power.</p> |
| 399 | |
| 400 | <p>This means existing HDMI-CEC implementations will need to be redesigned to |
| 401 | interoperate with the Android TIF. We recommend the hardware platform contain a |
| 402 | microprocessor to receive CEC power on and other commands.</p> |
| 403 | |
| 404 | <img src="images/TV_App_CEC_integration.png" alt="CEC integration on Android TV"> |
| 405 | <p class="img-caption"><strong>Figure 8.</strong> CEC integration on Android TV</p> |
| 406 | |
| 407 | <ol> |
| 408 | <li> The CEC bus receives a command from the currently active source to switch to a |
| 409 | different source. |
| 410 | <li> The driver passes the command to the HDMI-CEC HAL. |
| 411 | <li> The HAL notifies all <code>ActiveSourceChangeListeners</code>. |
| 412 | <li> THe HDMI Control Service is notified of source change via <code>ActiveSourceChangeListener</code>. |
| 413 | <li> The TV Input Manager service generates an intent for the TV App to switch the |
| 414 | source. |
| 415 | <li> The TV App then creates a TV Input Manager Session for the TV Input being |
| 416 | switched to and calls <code>setMain</code> on that session. |
| 417 | <li> The TV Input Manager Session passes this information on to the HDMI TV Input. |
| 418 | <li> The HDMI TV input requests to set sideband surface. |
| 419 | <li> The TV Input Manager Service generates a corresponding routing control command |
| 420 | back to HDMI Control Service when the surface is set. |
| 421 | </ol> |
| 422 | |
| 423 | <h2 id=tv_integration_guidelines>TV integration guidelines</h2> |
| 424 | |
| 425 | <h3 id=broadcast_app>Broadcast app</h3> |
| 426 | |
| 427 | <p>Because each country has broadcast-specific requirements (MHEG, Teletext, |
| 428 | HbbTV, and more), manufacturers are expected to supply their own solutions for |
| 429 | the broadcast app, for example:</p> |
| 430 | |
| 431 | <ul> |
| 432 | <li> MHEG: native stack |
| 433 | <li> Teletext: native stack |
| 434 | <li> HbbTV: webkit modification by Opera browser |
| 435 | </ul> |
| 436 | |
| 437 | <p>In the Android L release, Android TV expects partners to use systems |
| 438 | integrators or the Android solutions for regional TV stacks, pass the surface |
| 439 | to TV software stacks, or pass the necessary key code to interact with legacy |
| 440 | stacks.</p> |
| 441 | |
| 442 | <p>Here’s how the broadcast app and TV App interact:</p> |
| 443 | |
| 444 | <ol> |
| 445 | <li>The TV App is in focus, receiving all keys. |
| 446 | <li>The TV App passes keys (e.g. Red button) to the TV Input device. |
| 447 | <li>The TV Input device internally integrates with legacy TV stack. |
| 448 | <li>On receiving an activation keycode (e.g. Red button), the TV Input device |
| 449 | activates broadcast apps. |
| 450 | <li>A broadcast app takes focus in the TV App and handles user actions. |
| 451 | </ol> |
| 452 | |
| 453 | <p>For voice search/recommendation, the broadcast app may support In-app search |
| 454 | for voice search.</p> |
| 455 | |
| 456 | <h3 id=dvr>DVR</h3> |
| 457 | |
| 458 | <p>Android TV supports digital video recording (DVR) with partner development. The |
| 459 | DVR function works like so:</p> |
| 460 | |
| 461 | <ol> |
| 462 | <li> DVR recording function / Live Buffer can be implemented by any TV Input. |
| 463 | <li> TV App passes on key inputs to TV Input (including recording/pause/fast |
| 464 | forward/ rewind keys). |
| 465 | <li> When playing the recorded content, the TV Input handles it with trick play |
| 466 | overlay. |
| 467 | <li> DVR app enables users to browse and manage recorded program. |
| 468 | </ol> |
| 469 | |
| 470 | <p>For voice search/recommendation:</p> |
| 471 | |
| 472 | <ul> |
| 473 | <li>DVR app supports In-app search for Voice search. |
| 474 | <li>DVR app can propose recommendation using notifications. |
| 475 | </ul> |
| 476 | |
| 477 | <p>See the following diagram for a view into a possible DVR implementation in |
| 478 | Android TV.</p> |
| 479 | |
| 480 | <img src="images/TV_Input_DVR.png" alt="Digital video recording in Android TV"> |
| 481 | <p class="img-caption"><strong>Figure 9.</strong> Digital video recording in Android TV</p> |