Reuse Home tiles and Plex artwork to reduce allocation
This commit is contained in:
parent
5f035d909a
commit
ac0a892c5f
14 changed files with 741 additions and 40 deletions
|
|
@ -180,3 +180,42 @@ The platform interfaces are documented in [TvInputManager](https://developer.and
|
|||
|
||||
|
||||
Final 1.1.10 package/version checks passed on both devices, with the input button visible only on the TV. After settling with Android settings foreground, both UIs and the onn Home helper consumed zero CPU ticks over five seconds. The diagnostic APKs and temporary on-device files were removed. The onn's original Home/accessibility service list was restored after instrumentation; Home returned from Android settings, and Back stayed in Luma. The TV's existing Home override remains off. Projectivy remains installed/enabled on both devices, and both devices were returned to Luma. Raw local checks are in ignored `output/performance/input-switching/`.
|
||||
|
||||
## Warm Home returns and Plex artwork reuse — October 19, 2026
|
||||
|
||||
Version 1.1.11 keeps two reductions in unnecessary work, with the same defaults and rendering implementation on both devices:
|
||||
|
||||
- Reuse the app grid when its ordered packages, labels, launch components, APK source paths, column count, and tile widths are unchanged. Rediscover installed apps and rebind listeners to the new models. Layout changes rebuild the grid; icon completions check the current binding generation. A paused focus animation is normalized before reuse.
|
||||
- Reuse an already displayed Plex image and composed scene for the same artwork path, including Plex/Plezy selections sharing that artwork. Keep the previous image while a different one loads; a failed replacement retains that image. Coalesce identical pending requests, cancel obsolete delayed callbacks, reject stale completions, and retry the focused artwork after resume. Changing the Plex connection or selecting another app clears the previous source appropriately.
|
||||
|
||||
Images and image caches are still released on stop. Retained views already existed while backgrounded before this change; this avoids replacing them on return rather than retaining additional bitmap memory. Image resolution, layout, animation timing, and the optional Memory saver default are unchanged. There are no device/model/manufacturer/IP branches.
|
||||
|
||||
`WarmReturnInstrumentation` invokes eight complete pause/stop/start/resume cycles, waiting for all app icons and the scene to be present. The first two cycles are excluded from the medians below. Allocation is the target process's ART Java allocated-byte counter during resume-to-image-ready, including concurrent target-process work. This is a controlled lifecycle workload, not physical app-switch latency, peak RAM, or a GPU allocation measurement.
|
||||
|
||||
| Device | 1.1.10 Java bytes per return | 1.1.11 Java bytes per return | Reduction | Image-ready median, before → after |
|
||||
| --- | ---: | ---: | ---: | ---: |
|
||||
| onn, 21 app tiles | 344,776 | 197,320 | 42.8% | 182 → 181 ms |
|
||||
| Integrated TV, 14 app tiles | 295,816 | 197,512 | 33.2% | 167 → 165 ms |
|
||||
|
||||
All tiles were reused in every candidate cycle. Image-ready times are effectively unchanged; the demonstrated benefit is less Java allocation and view construction. A prior candidate run gave 184 ms on the onn and 165 ms on the TV, consistent with that interpretation.
|
||||
|
||||
Four repeated selections of the same featured Plex app produced eight extra scene compositions on 1.1.10 on each device. The candidate produces zero, retaining both the same artwork bitmap and the same finished background frame. `PlexArtworkInstrumentation` uses an authenticated loopback-only HTTP fixture running inside the test process, with the bundled wallpaper as fixture artwork. It requires no home Plex server or network connection. Original encrypted credential preferences and the media-row setting are restored in finally; no real credential values are printed. Earlier host-forwarded fixture attempts were interrupted by the TV's intermittent ADB connection, so the final fixture runs on-device.
|
||||
|
||||
`GridReuseInstrumentation` verifies label changes retain views, rebound focus callbacks retain selection, interrupted focus lifts finish at the correct scale, and hiding/reordering/changing columns produces the correct grid. Layout preferences are restored after testing. The complete wake suite passes with default rendering and Memory saver on both devices, including partial/interrupted loads, pause-only image reuse, memory trimming, screensaver dismissal, five stop/start cycles, runtime renderer switching, and removal of TV-input listeners while paused.
|
||||
|
||||
An exact-pixel background damage experiment was rejected: the bounding rectangle of changed RGB pixels still covered 93.1–97.6% of the screen across tested accent pairs, while scanning the bounded 960 × 540 image cost roughly 12–14 ms after warmup. No clipping or image-quality approximation was added to the launcher. The already rejected custom GPU shader from the earlier round remains absent.
|
||||
|
||||
The final signed-build comparison reinstalls 1.1.10, runs the native 42-key normal/rapid navigation workload, installs 1.1.11, and repeats it. The device runs the script locally so ADB connection interruptions do not interrupt the measurements:
|
||||
|
||||
| Device / pace | 1.1.10 median / p90 | 1.1.11 median / p90 | Missed deadlines, before → after |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| onn, normal | 10.44 / 13.35 ms | 10.25 / 13.61 ms | 14/740 → 10/741 |
|
||||
| onn, rapid | 11.01 / 14.84 ms | 11.36 / 15.00 ms | 1/256 → 1/255 |
|
||||
| TV, normal | 23.87 / 24.72 ms | 23.85 / 24.72 ms | 35/803 → 32/807 |
|
||||
| TV, rapid | 24.06 / 24.78 ms | 24.05 / 24.83 ms | 27/217 → 27/219 |
|
||||
|
||||
These show essentially unchanged navigation frame times rather than a consistent frame-rate gain. Earlier candidate samples fluctuated: TV rapid p90 was 24.82 ms in one run and 40.91 ms in another; the final consecutive baseline/release comparison returned to about 24.8 ms. onn candidate rapid p90 ranged from 14.37 to 15.22 ms versus the initial baseline's 14.49 ms. All captures had zero dropped FrameMetrics callbacks. FrameMetrics totals include graphics-pipeline waits; these samples neither establish a hardware ceiling nor compare identical installed-app grids across devices. The changes are retained for the demonstrated reduction in allocations and redundant scene composition, without claiming to solve the TV's remaining graphics-pipeline timing.
|
||||
|
||||
The final 1.1.11 APK retains the existing signing certificate and was installed on both devices. The self-contained Plex fixture passes on both, including latest-request selection, failed-image retention, cancellation on pause, automatic focused-artwork retry on resume, rejection of obsolete selections, and image release/restoration across stop/start. Raw local reports are under ignored `output/performance/round4/`.
|
||||
|
||||
Final screenshots confirm wallpaper, app artwork, focus styling, and the original spacious layout on both devices. UI hierarchy checks show the input button on the TV only. With Android settings foreground after settling, each launcher process consumed zero CPU ticks over five seconds. Back from Luma stayed in Luma on both. Projectivy remains installed and enabled. The enabled accessibility lists match the start of this round: Button Mapper only on the onn, and null on the TV. Both system Home resolvers point to Google TV; the onn's Luma Home override was already off at this round's initial capture and remains off. This round preserves that configuration rather than enabling a helper that was absent initially. Both devices were returned to Luma. Temporary diagnostics, reverse ports, and this round's on-device APKs/scripts/reports were removed after validation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue