Apple TV (tvOS) and Google TV (Android TV) support#5261
Conversation
Phase 1 — shared form-factor API + @media: - CN.isTV() / Display.isTV() / CodenameOneImplementation.isTV() (mirrors isWatch()) - iOS isTV() via new isRunningOnTV() native (TARGET_OS_TV) + {tv,ios,appletv} overrides - Android isTV() (television/leanback feature + UI-mode) + {tv,android,android-tv} overrides - Resources.loadTheme selects device-tv / device-watch @media variants at runtime (also completes @media for the existing watch port, which never wired it) - CSSDeviceFormFactorMediaQueryTest (runs green) + dev-guide css.asciidoc Phase 2 — Google TV / Android TV: - AndroidGradleBuilder: LEANBACK_LAUNCHER category, android.software.leanback + touchscreen-optional uses-feature, generated 320x180 tv_banner; gated on android.tv - build-hint schema (android.tv / android.tv.banner); README + TVPlatforms dev guide Phase 3 — Apple TV (tvOS): - TvNativeBuilder: adds a separate appletvos Xcode target (family 3, Metal, GL-only sources excluded), modeled on the Mac Catalyst slice; wired into IPhoneBuilder + CN1BuildMojo (codename1.tvMain) + build-hint schema. Verified end-to-end locally: generates the <Main>TV target against the tvOS 26 SDK. - Native tvOS slice (#if !TARGET_OS_TV) in progress: MessageUI + several UIKit conformance guards done; remaining guards tracked in TVOS_PORT.md. Phase 4 — tvOS screenshot tests: - scripts/run-tv-ui-tests.sh + a non-blocking build-ios-tv CI job (continue-on-error until the native slice compiles and goldens are seeded, as the watch port was); scripts/ios/screenshots-tv goldens dir; sample auto-enables via codename1.tvMain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Developer Guide build artifacts are available for download from this workflow run:
Developer Guide quality checks: |
|
Compared 11 screenshots: 11 matched. |
|
Compared 122 screenshots: 122 matched. |
|
Compared 129 screenshots: 129 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
|
Compared 126 screenshots: 126 matched. Benchmark ResultsDetailed Performance Metrics
|
Cloudflare Preview
|
|
Compared 128 screenshots: 128 matched. |
|
Compared 128 screenshots: 128 matched. |
|
Compared 129 screenshots: 129 matched. Benchmark Results
Detailed Performance Metrics
|
|
Compared 210 screenshots: 210 matched. |
|
Compared 129 screenshots: 129 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Brings the HelloCodenameOneTV target much closer to compiling against the tvOS 26 simulator SDK (verified locally). Guarded/handled: - IOSNative.m: broadened the watch guards to also cover tvOS for the native features tvOS lacks (CLLocation region monitoring, MPMoviePlayer, UIPasteboard, orientation, status bar, telephony) — 144 errors -> 0. (Compile-first measure; re-enabling tvOS-capable features like UITextField/audio is a follow-up, see TVOS_PORT.md.) - CodenameOne_GLAppDelegate.m: guard UNNotificationResponse / UNTextInputNotificationResponse and the legacy openURL delegate (tvOS-absent); hold currentNotificationResponse as id. - NetworkConnectionImpl.m: guard setNetworkActivityIndicatorVisible (tvOS-removed). - UIWebViewEventDelegate.[hm]: drop the legacy UIWebView browser peer on tvOS. - DrawStringTextureCache.m: use sizeWithAttributes: on tvOS (sizeWithFont: removed). - CodenameOne_GLViewController.m: tvOS trusts view bounds for orientation (like Mac Catalyst). - sample LocalNotificationNativeImpl.m: no-op the delivered-notification calls on tvOS. TVOS_PORT.md documents the remaining CodenameOne_GLViewController.m surgical guards (~63 sites incl. the UIPopoverController->id change) and the exact local build recipe (arm64, preserve the CN1_USE_METAL define, -ferror-limit=0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- CodenameOne_GLViewController.m now COMPILES for tvOS: ~63 surgical #if !TARGET_OS_TV guards (device orientation, status bar, UIToolbar keyboard input-accessory, on-screen keyboard notifications, UIHoverGestureRecognizer, the UIImagePicker/UIDatePicker/UIPickerView/UIActionSheet/UIDocumentInteraction delegate methods), legacy sizeWithFont:/drawAtPoint:withFont: -> the modern sizeWithAttributes:/withAttributes: API, and UIPopoverController -> id. - IOSNative.m: reverted the earlier blanket watch-guard broadening (it was wrong: tvOS supports most of what watchOS lacks - CIFilter, vImage, UIView capture, audio, UNUserNotificationCenter). Correct model is tvOS≈iOS, guarding only the genuinely tvOS-absent APIs. Remaining IOSNative.m surgical work is ~6 localized features (UIWebView, MPMoviePlayer*, UIPasteboard, orientation, UIDocumentInteractionController, scrollsToTop) + LAContext + push actions, documented in TVOS_PORT.md. Both files are structurally valid (balanced #if/#endif) and compile unchanged for iOS. Verified against the tvOS 26 simulator SDK locally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Regression fixes (my tvOS changes broke the existing iOS/Mac builds): - UIPopoverController -> id was applied unconditionally, breaking iOS/Mac where popoverController.delegate needs the real type. Now conditional: id only on tvOS (where UIPopoverController is unavailable), UIPopoverController* elsewhere (IOSNative.m + CodenameOne_GLViewController.m). - sizeWithFont:/drawAtPoint:withFont: were modernized to the attributed-string API on ALL platforms, changing existing iOS rendering. Restored: iOS keeps the original sizeWithFont:/withFont:; only the tvOS slice (where they were removed) uses sizeWithAttributes:/withAttributes:. iOS target verified building clean against the iphonesimulator SDK; tvOS GLViewController.m still compiles; the iOS API paths are byte-for-byte unchanged. Developer-guide prose gate: - TVPlatforms.asciidoc: 320x180 -> 320×180 (Vale proselint typography). - Add "Leanback" (Android's android.software.leanback / LEANBACK_LAUNCHER proper noun) to languagetool-accept.txt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s target compiles + links Guards UIWebView, MPMoviePlayer/AVKit video peer, UIPasteboard, pickers/ date-picker/action-sheet/activity/print controllers, device orientation, MessageUI, LocalAuthentication biometrics, CLLocationManager tvOS-absent properties, and the UNNotification action/category registration with #if !TARGET_OS_TV (broadening existing watch guards where present). The iOS #else path is byte-identical (verified: iphonesimulator BUILD SUCCEEDED); appletvsimulator now BUILD SUCCEEDED with 0 errors and links. Plain local notifications via UNUserNotificationCenter stay enabled on tvOS; only the action/category/attachment/sound extras are guarded out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>






























































































































Adds TV form-factor support across the framework, builders and CI. Modeled on the merged Apple Watch port (#5252), but tvOS is handled like the Mac Catalyst slice (Metal + most iOS APIs, just no OpenGL ES) rather than the watch's Core-Graphics backend.
Phase 1 — shared form-factor API +
@media(complete, verified)CN.isTV()/Display.isTV()/CodenameOneImplementation.isTV()(mirrorsisWatch()).isTV()via a newisRunningOnTV()native backed byTARGET_OS_TV;{tv,ios,appletv}platform overrides.isTV()(television/leanback feature +UiModeManagerfallback);{tv,android,android-tv}overrides.Resources.loadThemenow selectsdevice-tv/device-watch@mediavariants at runtime — this also completes@mediafor the existing watch port, which never wired it.CSSDeviceFormFactorMediaQueryTest(passes against the real compiler) +css.asciidocdocs.Phase 2 — Google TV / Android TV (complete, verified)
AndroidGradleBuilder(both the maven-plugin and BuildDaemon copies):LEANBACK_LAUNCHERcategory,android.software.leanback+ touchscreen-optionaluses-feature, and a generated 320×180tv_banner, gated on a newandroid.tvhint.android.tv/android.tv.banner); README + newTVPlatforms.asciidocdev-guide section.Phase 3 — Apple TV (tvOS)
TvNativeBuilderadds a separateappletvosXcode target (TARGETED_DEVICE_FAMILY=3, Metal, OpenGL-only.mfiles excluded), reusing the sharedUIApplicationMainentry — modeled onMacNativeBuilder. Wired intoIPhoneBuilder+CN1BuildMojo(codename1.tvMain) + build-hint schema.<Main>TVtarget generates and the build reaches compilation.#if !TARGET_OS_TVslice in progress: MessageUI + several UIKit-conformance guards landed; the remaining guards (notifications, WebKit, status-bar/orientation, pickers) are tracked inPorts/iOSPort/nativeSources/TVOS_PORT.md.Phase 4 — tvOS screenshot tests
scripts/run-tv-ui-tests.sh(tvOS-simulator clone ofrun-watch-ui-tests.sh) + a non-blockingbuild-ios-tvCI job (continue-on-erroruntil the native slice compiles and thescripts/ios/screenshots-tvgolden set is seeded — the same bootstrap the watch port used). Sample auto-enables the target viacodename1.tvMain.Status / follow-up
Phases 1–2 are complete and verified. The tvOS builder + test infrastructure are complete and verified to generate a valid tvOS target; the tvOS native source slice needs further
!TARGET_OS_TVguarding (documented inTVOS_PORT.md) beforebuild-ios-tvgoes blocking and seeds goldens. CorrespondingTvNativeBuilderchanges were also made in the BuildDaemon repo (cloud builds).🤖 Generated with Claude Code