Skip to content

feat(unoapp): add Android TV / Auto / Wear OS opt-ins - #2072

Merged
agneszitte merged 4 commits into
mainfrom
dev/mazi/androidtv
Jul 22, 2026
Merged

agneszitte merged 4 commits into
mainfrom
dev/mazi/androidtv

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds three new opt-in checkboxes to the unoapp template — Android TV, Android Auto, and Wear OS — that surface in the Studio wizard whenever the Android platform is selected. Selecting any of them stamps the corresponding manifest entries, intent filters, resources, and <UnoFeatures> flags so the generated project requires no manual Android setup to target these form factors.

These opt-ins produce a single APK that targets phones plus the chosen form factor(s). The conventional Wear-only / TV-only / Auto-only standalone APK pattern remains a manual setup; documented in the corresponding feature pages of unoplatform/uno.

Related to unoplatform/uno-private#1126.
Related to unoplatform/uno-private#1327.
Related to unoplatform/uno-private#1328.

Spec

Full design documented at specs/002-android-form-factors/spec.md.

What's in this PR

Template parameters

Symbol Type Default Visibility
includeAndroidTV bool parameter false Wizard checkbox shown when platforms includes android
includeAndroidAuto bool parameter false Wizard checkbox shown when platforms includes android
includeAndroidWear bool parameter false Wizard checkbox shown when platforms includes android

Three matching computed mirror booleans (useAndroidTV, useAndroidAuto, useAndroidWear) gate the conditional resource includes.

What gets stamped

File Change
AndroidManifest.xml <uses-feature> for android.software.leanback + android.hardware.touchscreen (TV); <uses-feature> for android.hardware.type.watch (Wear); <meta-data android:name="com.google.android.gms.car.application"> inside <application> (Auto). All required="false" so the same APK installs on phones too.
MainActivity.Android.cs Conditional [IntentFilter] with CategoryLeanbackLauncher (TV).
Main.Android.cs Conditional [assembly: UsesFeature] attributes (TV) + conditional Banner = "@drawable/banner" on the [ApplicationAttribute].
MyExtensionsApp.1.csproj Conditional <UnoFeatures> entries (AndroidTV, AndroidAuto, AndroidWear) so Uno.Sdk resolves the right AndroidX packages.
Resources/drawable-xhdpi/banner.png 320×180 placeholder banner (TV).
Resources/values/Styles.AndroidTV.xml Transparent colorControlHighlight override (TV).
Resources/xml/automotive_app_desc.xml <automotiveApp><uses name="media" /></automotiveApp> (Auto).

Wizard wiring

TemplateWizard.json gets a new Android form factors MultiSelect block under the existing Platforms screen, plus icon metadata for the three new symbols (referencing assets that ship in unoplatform/uno.studio). The three flags are also added to ExportableSymbols so they round-trip through the dotnet new command preview.

Merge order (across repos)

⚠️ This PR depends on unoplatform/uno shipping first. The generated project's <UnoFeatures>AndroidTV</UnoFeatures> (etc.) entries only resolve to AndroidX packages once a new Uno.Sdk is published.

  1. unoplatform/uno (PR #23157) — SDK plumbing + docs ← must merge + ship first
  2. unoplatform/uno.templates ← this PR (template stamping for new projects)
  3. unoplatform/uno.studio (PR #1030) — wizard SVG icons for the new options ← closes the linked uno-private QA issues

Test plan

QA test plans (manual emulator validation per form factor) are tracked at unoplatform/uno-private#1126 (TV), unoplatform/uno-private#1327 (Auto), and unoplatform/uno-private#1328 (Wear).

  • dotnet pack src/Uno.Templates/Uno.Templates.csproj produces a valid template package.
  • dotnet new install <packed nupkg> succeeds.
  • dotnet new unoapp -o TVApp -platforms android --include-android-tv true generates a project with:
    • the leanback uses-feature in AndroidManifest.xml
    • the [IntentFilter] with CategoryLeanbackLauncher in MainActivity.Android.cs
    • the assembly [UsesFeature] attrs and Banner = "@drawable/banner" in Main.Android.cs
    • a banner.png under drawable-xhdpi/ and Styles.AndroidTV.xml under values/
    • AndroidTV; in <UnoFeatures>
  • Repeat with --include-android-auto true (verifies automotive_app_desc.xml + manifest meta-data + AndroidAuto; UnoFeature).
  • Repeat with --include-android-wear true (verifies the watch uses-feature + AndroidWear; UnoFeature).
  • Picking only Android with none of the three flags produces a project identical to today's output (no banner, no leanback intent filter, etc.).
  • Picking Android together with iOS + Wasm + Desktop and ticking Android TV still includes only the TV-specific assets in the Android head.
  • dotnet build TVApp/TVApp -f net10.0-android succeeds end-to-end (requires the new Uno.Sdk from PR #23157).

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Android TV / Android Auto / Wear OS opt-in flags to the unoapp template and wires them into both dotnet new and the Uno Studio wizard, stamping the necessary Android manifest/code/resources and <UnoFeatures> entries.

Changes:

  • Introduces three new template parameters (includeAndroidTV, includeAndroidAuto, includeAndroidWear) plus computed gating symbols and resource excludes.
  • Stamps Android TV/Auto/Wear-specific manifest entries, TV intent filter + banner/uses-feature attributes, and Auto/Wear resources.
  • Updates the Studio wizard configuration and adds a design spec documenting the behavior.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/Resources/xml/automotive_app_desc.xml Adds Automotive app description resource for Android Auto opt-in.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/Resources/values/Styles.AndroidTV.xml Adds TV-specific style override to disable native highlight.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/Resources/drawable-xhdpi/banner.png Adds placeholder Android TV banner drawable.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/MainActivity.Android.cs Adds conditional Leanback launcher intent filter for Android TV.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/Main.Android.cs Adds conditional UsesFeature attributes + banner on ApplicationAttribute for TV.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/Platforms/Android/AndroidManifest.xml Adds conditional uses-feature entries and Auto meta-data stamping.
src/Uno.Templates/content/unoapp/MyExtensionsApp.1/MyExtensionsApp.1.csproj Adds conditional <UnoFeatures> entries for TV/Auto/Wear.
src/Uno.Templates/content/unoapp/.template.config/template.json Declares new parameters/computed symbols and excludes gated resources.
src/Uno.Templates/content/unoapp/.template.config/TemplateWizard.json Adds wizard MultiSelect section + metadata + exportable symbols for new options.
specs/002-android-form-factors/spec.md Documents the opt-in design and stamped outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MartinZikmund and others added 3 commits July 22, 2026 14:20
Adds three template parameters (includeAndroidTV, includeAndroidAuto,
includeAndroidWear) that surface as wizard checkboxes in a new "Android
form factors" sub-section under Platforms. Each opt-in stamps the
required AndroidManifest entries, intent filters, resources, and
<UnoFeatures> flags so users do not need any manual Android setup to
target these form factors from a fresh project.

The opt-ins produce a single APK that targets phones plus the chosen
form factor(s); a standalone Wear-only / TV-only / Auto-only project is
out of scope and documented in the corresponding feature pages of the
unoplatform/uno repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…or conditionals

- Move the transparent colorControlHighlight item into AppTheme in Styles.xml
  (conditionally stamped) so the override actually applies via
  postSplashScreenTheme; remove the unreferenced Styles.AndroidTV.xml
- Gate the UnoFeatures entries on the computed useAndroidTV/Auto/Wear symbols
  so CLI generation without the Android platform cannot stamp stray tokens
- Declare the leanback/touchscreen uses-feature entries only in
  AndroidManifest.xml, removing the duplicate assembly-level [UsesFeature]
  attributes and the unused Android.Content.PM using
- Update the spec to match (and fix the dotnet new CLI flag syntax)

Co-Authored-By: Claude Fable 5 <[email protected]>
@ajpinedam
ajpinedam force-pushed the dev/mazi/androidtv branch from 61587e2 to 9879fea Compare July 22, 2026 18:20
@ajpinedam

Copy link
Copy Markdown
Contributor

rebased and force-pushed looking to fix the CI errors.

Reorder the groups in src/Uno.Sdk/packages.json to match the exact group
order of uno core (unoplatform/uno src/Uno.Sdk/packages.json) so that
release-time diffs between the two manifests stay minimal and reviewable.
Only ordering changes: WinAppSdkBuildToolsWinApp moves up after
WinAppSdkBuildTools, and the AndroidX Leanback/CarApp/Wear/WearTiles
form-factor groups move into the AndroidX block ahead of Navigation/
Collection. No versions or package memberships change.

Also remove the duplicate "Uno.WinUI.Svg" entry in the Core group (it had
crept back in via an older bundled SDK snapshot).

Mirror the same ordering in the generated ReadMe (src/Uno.Sdk/ReadMe.md):
its embedded packages.json block now matches the manifest, and the MSBuild
property table reorders the Android form-factor rows to match. The
Uno.Sdk.Updater ReadMe template is reordered the same way so future
regenerations stay consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@mergify

mergify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

5 participants