Skip to content

Migrate TV home screen channels and programs snippets - #1213

Open
barbaralaw wants to merge 2 commits into
android:mainfrom
StellarElements:barbaralaw/tv-home-screen-snippets
Open

barbaralaw wants to merge 2 commits into
android:mainfrom
StellarElements:barbaralaw/tv-home-screen-snippets

Conversation

@barbaralaw

@barbaralaw barbaralaw commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Code snippets are for:

This adds the androidx.tvprovider:tvprovider dependency (1.1.0) to the :tv module. The page owners approved adding it.

res/xml/previewinputservice.xml is migrated because the Preview videos page prints it, and the page sets its file name. The PreviewVideoInputService entry in the module's manifest (with its meta-data pointing to that file) is there so the service compiles and is registered. The page's own manifest block stays on the page.

Lint flags every tvprovider program builder setter (setTitle, setType, and so on) as RestrictedApi, because the setters are inherited from a base class the library restricts. The functions that wrap those snippets carry @SuppressLint("RestrictedApi") outside the region tags, as the android/tv-samples apps do. The docs team approved this.

List of modifications:

  • Recommendations-channel page (android_tv_channel_logo): The block that showed the two storeChannelLogo method signatures, which aren't valid Kotlin, now shows the real ChannelLogoUtils.storeChannelLogo calls with the same arguments.
  • Recommendations-channel page (android_tv_channel_query): In the query block, cursor != null and cursor.moveToNext() didn't compile and is now cursor != null && cursor.moveToNext().
  • Recommendations-channel page (android_tv_channel_builder, android_tv_channel_insert, android_tv_channel_update, android_tv_program_builder, android_tv_program_insert, android_tv_program_update, android_tv_program_delete, android_tv_channel_query): Comments end with a full stop, and the formatter changed the indentation and line breaks of the builder chains, the insert and update calls, and the query block.
  • Preview-videos page (android_tv_preview_program_video_uri): new ComponentName(context, PreviewVideoInputService.class) is Java syntax and is now ComponentName(context, PreviewVideoInputService::class.java).
  • Preview-videos page (android_tv_preview_video_input_service): In PreviewVideoInputService, the undefined mPlayer is now mediaPlayer? (the property the class declares), and catch (IOException e) is now catch (e: IOException).
  • Preview-videos page (android_tv_preview_video_input_service): The service's import lines show as commented-out imports at the same position; the real imports are at the top of the file.
  • Preview-videos page (android_tv_preview_input_service_metadata): The XML snippet doesn't show the <?xml version="1.0" encoding="utf-8"?> line, because it must be the first line of the file and can't sit inside a region tag. The line is still in the file.
  • Preview-videos page (android_tv_preview_program_video_uri, android_tv_preview_program_video_uri_string, android_tv_preview_video_input_service): Comments end with a full stop, and the formatter fixed the indentation of the URI builder chains and the service.
  • Video-programs page (android_tv_video_program_builder): The comment ends with a full stop, and the formatter changed the indentation of the builder chain.
  • Watch-next-add-programs page (android_tv_watch_next_program_insert): The formatter changed the indentation of the builder chain and the line breaks of the insert call.

Snippets not migrated:

  • Recommendations-channel page: the WRITE_EPG_DATA permission and the two <receiver> blocks (manifest), the Gradle dependency (build file), and the adb command (CLI).
  • Recommendations-channel page: the android.support.media.tv import block, because the page's prose names the support library.
  • Recommendations-channel page: the ACTION_REQUEST_CHANNEL_BROWSABLE block, because startActivityForResult is deprecated and has no one-to-one replacement.
  • Preview-videos page: the <service> declaration (manifest).
  • The pages' Java versions of these snippets are removed from the pages in the companion CL, as agreed with the page owners.

Companion CL: cl/1004906645 (https://critique.corp.google.com/cl/1004906645)

@barbaralaw
barbaralaw marked this pull request as ready for review October 27, 2026 14:50
@barbaralaw
barbaralaw requested a review from a team as a code owner October 27, 2026 14:50
@snippet-bot

snippet-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 20 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant