Skip to content

Add Android TV support and launcher banner - #10268

Open
AmakerGame wants to merge 1 commit into
topjohnwu:masterfrom
AmakerGame:master
Open

AmakerGame wants to merge 1 commit into
topjohnwu:masterfrom
AmakerGame:master

Conversation

@AmakerGame

@AmakerGame AmakerGame commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make the app installable and usable on Android TV: add a launcher
banner and the leanback launcher entry, and fix several places where
D-pad / remote use was broken or crashed.

Changes

Launcher & manifest

  • Add LEANBACK_LAUNCHER intent filter to MainActivity, so the app
    shows up on the Android TV home screen.
  • Declare android.hardware.touchscreen and android.software.leanback
    as required="false". The app stays installable on phones/tablets.
  • Add a 320x180dp TV banner (ic_banner.png, mdpi to xxhdpi) and set
    it as android:banner on the application and MainActivity.

TV detection

  • Add Info.isTv (UI mode TV, FEATURE_LEANBACK, or no touchscreen).

Focus handling

  • On TV, request focus on the current tab's nav item at startup, so the
    first D-pad press isn't swallowed.
  • Restore focus to the Home nav item after Back returns from another
    tab. Previously the focused content left composition and focus was
    lost.
  • Use one FocusRequester per nav item (reusing the existing Modules
    and Superuser ones).

File picker crash

  • Many TV images ship without a document picker, so
    ActivityResultContracts.GetContent threw ActivityNotFoundException.
    Add launchSafely() and use it in ModuleScreen and InstallDialog.
    It shows the existing app_not_found toast and resets
    pendingSubmitAfterPick instead of crashing or waiting forever.

Overscan

  • Add Modifier.tvSafeArea() (48dp x 27dp, ~5%), applied in
    MainActivity. No-op on non-TV devices.

Notes

  • No new strings; the existing app_not_found is reused.
  • Module installation on TVs without a document picker is still
    limited to what the system offers (e.g. a third-party file manager).
  • Not compiled or tested on a device. I could only check brace/XML
    validity. Please build with ./build.py app and try on an Android TV
    device or emulator, with a remote and with a phone for regression.

Add Leanback launcher support and TV banners, detect TV devices, keep content within the safe area, restore D-pad focus, and handle missing document pickers without crashing.

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