Optimize portable tile rendering and add optional memory saver

This commit is contained in:
Elijah Kuntz 2026-10-19 10:36:30 -07:00
parent 5bb15fa69e
commit 25ea43bea7
18 changed files with 918 additions and 63 deletions

View file

@ -40,7 +40,7 @@ To return to the previous routing, turn off Luma's Home override, then open Proj
**App labels** offers Always, Focused only (default), and Never. Accessibility app names remain available in all modes. Other settings include 5/6/7 columns, background dimming, automatic or fixed accent colors, reduced motion, clock visibility, and 90-second scene rotation. Alpine uses the bundled original wallpaper; Aurora and Midnight are inexpensive procedural gradients.
Focus uses a 6.5% scale increase, a 160 ms transition, and an app-colored cached soft shadow. Background crossfades last 280 ms. The launcher has no continuously rendered blur or background video. Optional screensaver video runs only while the screensaver is visible.
Focus uses a 6.5% scale increase, a 160 ms transition, and an app-colored cached soft shadow. Background crossfades last 280 ms. **Memory saver** in Appearance is off by default on every device. Enabling it reuses the background while app accent colors change, reducing image allocation and uploads; animation speed can vary with the graphics driver. It can be switched off at any time. The launcher has no continuously rendered blur or background video. Optional screensaver video runs only while the screensaver is visible.
The app grid uses one 260 ms scroll animation for remote focus movement. **App section text** can hide the heading, installed count, and customization hint; it is hidden by default without changing the original spacing.
@ -98,9 +98,10 @@ Android scheduling and installation behavior follow the [JobInfo API](https://de
- Platform Java/Android views and Canvas; no WebView, Compose runtime, playback engine, or third-party runtime dependencies.
- Single sampled RGB565 wallpaper (960 × 540 for the bundled 1920 × 1080 image). Cinematic gradients, dimming, and artwork are composed off the UI thread into an opaque texture capped at 960 × 540; navigation crossfades the finished textures instead of re-running several full-screen shaders every frame.
- App artwork is rasterized to 288 × 162. Icon cache is capped at 3 MiB; visible tiles also hold their displayed images.
- App artwork is rasterized to 288 × 162 over an opaque background. Rounded tiles use a cached bitmap shader instead of per-frame path clipping and redundant background blending. Icon cache is capped at 3 MiB; visible tiles also hold their displayed images.
- Plex image cache is capped at 3 MiB. Hero images are sampled to at most roughly 1280 × 720; rows and network response sizes are bounded.
- At most the current and previous composed backgrounds are displayed during a short crossfade. The compositor has one worker and one pending request; obsolete results are discarded. Its worker times out after two idle seconds. A focus debounce avoids loading Plex artwork for every passing selection. Only the focused tile draws an app-colored soft shadow. All tiles share a single 192 × 122 texture (about 92 KiB); no live elevation-shadow geometry is animated.
- At most the current and previous composed backgrounds are displayed during a short crossfade. The compositor has one worker and one pending request; obsolete results are discarded. Its worker times out after two idle seconds. A focus debounce avoids loading Plex artwork for every passing selection. Only the focused tile draws an app-colored soft shadow. All tiles share a single 192 × 122 alpha-only texture (about 23 KiB); no live elevation-shadow geometry is animated.
- The same rendering default applies to all devices, with no device-model, manufacturer, or IP-based renderer selection. Optional Memory saver adds a bounded alpha-only accent mask (at most 320 × 180), avoids composing a new full-color background for each accent change, and preserves artwork crossfades. It is an explicit user tradeoff, not an automatic hardware classification.
- No boot receiver, alarms, or PowerManager wake locks. Update checks use one brief JobScheduler job, normally daily. The optional Home override is an event-driven accessibility service in a separate process; turning it off removes that bound service. The optional DreamService runs only when Android explicitly binds it as a system screensaver.
- Clock updates once per minute; optional scene rotation runs only while Luma is visible.
- On pause, networking and scene animations are canceled. On stop, queued work, image references, and caches are cleared. Worker threads time out after ten idle seconds.
@ -152,6 +153,8 @@ bash scripts/build-wake-tests.sh
Successful output ends with `INSTRUMENTATION_CODE: -1` and PASS lines for all cases. The runner controls activity lifecycle callbacks and should be run with no other device tests in progress.
Android force-stops the target package during instrumentation and can mark its accessibility helper as stopped/crashed. After testing, check **Settings → Default launcher** and toggle **Luma Home button** off/on in Android Accessibility if needed, then reopen Luma. This is test-runner cleanup, not an action needed during normal TV wake.
Additional runners in the same test APK check real GPU pixels (`.TileRenderingInstrumentation`, `.RenderingInstrumentation`) and normal/rapid D-pad navigation without spawning an input process per key (`.NavigationInstrumentation`). Pass `-e memorySaver true` to the wake or navigation runner to exercise the optional mode; the runner restores its preference afterward.
The same test APK also includes `tv.luma.launcher.tests/.PerformanceInstrumentation` for the background/shadow A/B benchmark. It changes only runtime view state and writes a temporary `performance.txt` in Luma's external-files directory. Reopen Luma afterward and remove the diagnostic APK.
See [docs/ASSETS.md](docs/ASSETS.md) for the wallpaper generation prompt and asset provenance. Android TV intent handling follows [Android's TV app guidance](https://developer.android.com/training/tv/get-started/create); Plex integration follows the [official Plex Media Server API documentation](https://developer.plex.tv/pms/).