Coalesce passing focus accents to reduce background rendering

This commit is contained in:
Elijah Kuntz 2026-10-19 10:45:42 -07:00
parent 25ea43bea7
commit 22a2130563
11 changed files with 199 additions and 14 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. **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.
Focus uses a 6.5% scale increase, a 160 ms transition, and an app-colored cached soft shadow. Background crossfades last 280 ms. App accent changes wait for a 160 ms pause in color selection, coalescing passing selections during rapid navigation while tile focus feedback stays immediate. Reduced motion applies colors immediately. **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.
@ -153,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.
The `.AccentSchedulingInstrumentation` runner verifies focus-color coalescing, the final selected color, pause cancellation, resume recovery, and immediate reduced-motion updates in both rendering modes.
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.

View file

@ -6,8 +6,8 @@ android {
applicationId 'tv.luma.launcher'
minSdk 26
targetSdk 34
versionCode 11
versionName '1.1.8'
versionCode 12
versionName '1.1.9'
}
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }
}

View file

@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="11" android:versionName="1.1.8">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="12" android:versionName="1.1.9">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="34" />
<uses-feature android:name="android.software.leanback" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

View file

@ -31,6 +31,13 @@ final class SceneView extends View {
private float dim = .24f;
private ValueAnimator animator, colorAnimator;
private boolean useTintMask;
private boolean accentPending;
// Let the 160 ms focus lift finish; passing selections need no full-screen transition.
private final Runnable accentUpdate =
() -> {
accentPending = false;
applyAccent(targetAccent, true);
};
SceneView(Context c) {
super(c);
@ -95,7 +102,10 @@ final class SceneView extends View {
void setMotion(boolean enabled) {
motion = enabled;
if (!enabled) stopAnimations();
if (!enabled) {
stopAnimations();
if (dirty) requestRender();
}
}
void configure(String s, float darkness) {
@ -106,14 +116,21 @@ final class SceneView extends View {
}
void accent(int color, boolean animate) {
if (targetAccent == color) return;
targetAccent = color;
removeCallbacks(accentUpdate);
accentPending = animate && motion && active && frame != null;
if (accentPending) postDelayed(accentUpdate, 160);
else applyAccent(color, animate);
}
private void applyAccent(int color, boolean animate) {
if (!useTintMask) {
if (accent == color) return;
accent = targetAccent = color;
accent = color;
requestRender();
return;
}
if (targetAccent == color) return;
targetAccent = color;
if (colorAnimator != null) colorAnimator.cancel();
if (!animate || !motion || frame == null) {
accent = color;
@ -340,8 +357,11 @@ final class SceneView extends View {
}
void stopAnimations() {
removeCallbacks(accentUpdate);
accentPending = false;
stopImageAnimation();
if (colorAnimator != null) colorAnimator.cancel();
if (!useTintMask && accent != targetAccent) dirty = true;
accent = targetAccent;
invalidate();
}

View file

@ -1 +1 @@
Improves app-tile rendering and reduces the shared focus-shadow texture to one quarter of its previous size. Adds an optional Memory saver setting for background colors. All devices use the same rendering default, with no model-specific pathways. Keeps cinematic artwork, focus effects, and smooth scrolling. Tested on the onn box and integrated TV.
Reduces unnecessary cinematic background work while moving quickly through apps. App focus feedback stays immediate; the background follows the final selected color after a short pause. Preserves smooth scrolling, artwork, and wake recovery. Tested on both the integrated TV and onn, with the same behavior across devices.

View file

@ -48,7 +48,7 @@ No launcher application was disabled or uninstalled. Screensaver selection at th
Build validation uses aapt2, javac, D8, zipalign, and apksigner signature verification. There are no third-party runtime libraries.
Final APK (1.1.8): 2,753,622 bytes. SHA-256: `9f4fecf5162c897e9614b9fe4b3af37989bd10d3959d9278f1314e4e0630b80b`.
Final APK (1.1.9): 2,753,622 bytes. SHA-256: `bf03db00b66fd1aa2eaf6ed6c6b65da222a32725e9549133e37890a758fd27df`.
## Updater regression — October 18, 2026
@ -137,3 +137,28 @@ Wake regression passed on both devices in both rendering modes: cold launch, int
The final signed 1.1.8 APK was installed on both devices and retains the previous certificate. Final screenshots show the original five-column spacious layout, mountain background, rounded banners, and app-colored focused shadow. Temporary diagnostic packages were uninstalled. The onn Home helper was re-bound after instrumentation using its original enabled-service list, retaining Button Mapper; Home from Android settings and repeated Back returned/stayed in Luma. The TV's Home override remains off with its original empty service list. Projectivy remains installed and enabled.
With Android settings foreground, the onn UI and Home helper each consumed zero CPU ticks over five seconds. The TV initially consumed five CPU ticks over five seconds after installation; a later five-second sample after settling consumed zero. These short samples show idle behavior after pending work completes, rather than establishing overnight endurance. Both devices were returned to Luma after verification.
## Projectivy review and focus-color coalescing — October 19, 2026
Reviewed the official [Projectivy repository](https://github.com/spocky/miproja1), its [4.70 release notes](https://github.com/spocky/miproja1/releases/tag/4.70), [4.72 release notes](https://github.com/spocky/miproja1/releases/tag/4.72), and public wallpaper-provider documentation. The main repository exposes configuration files, releases, and an issue tracker, rather than the launcher's core rendering implementation. There is no public renderer source there to inspect or port. Findings here come from the documented release behavior and Luma's own source/measurements, not assumptions about Projectivy's internals.
Applicable lessons from those notes include bounded image caches and content counts, image downsampling, limiting expensive wallpaper/color work, and stopping listeners when backgrounded. The published 50 MB image-cache cap does not establish an in-memory budget; it was not copied into Luma's RAM limits. Luma already bounds images/caches, samples wallpaper, debounces Plex artwork, and cancels background work. This review motivated testing fewer unnecessary accent transitions during rapid focus changes. It does not establish that Projectivy uses this particular implementation.
Version 1.1.9 retains immediate app-tile focus scale/glow/labels, but coalesces app accent changes until 160 ms without another different color. It then uses the existing 280 ms background transition. Reduced motion and initial rendering apply immediately. A single reusable callback retains only the latest color, is removed on pause/screensaver/stop, and restores the selected color when resumed. Both devices use the same code and behavior. Bitmap resolution, image quality, and the spacious layout are unchanged.
Fresh same-device 1.1.8 versus candidate comparisons used the native-input 42-key NavigationInstrumentation workload described above, with no shell input process per key. The test ran normal navigation (350 ms between keys), then rapid navigation (80 ms between keys), on each device's existing grid:
| Device / pace | 1.1.8 median / p90 | 1.1.9 median / p90 | Missed deadlines, baseline → optimized |
| --- | ---: | ---: | ---: |
| onn, normal | 10.02 / 13.29 ms | 9.90 / 12.92 ms | 5/800 → 10/737 |
| onn, rapid | 11.02 / 13.61 ms | 10.76 / 14.02 ms | 1/255 → 1/252 |
| TV, normal | 16.52 / 24.34 ms | 12.53 / 24.30 ms | 18/853 → 18/799 |
| TV, rapid | 24.37 / 25.07 ms | 20.64 / 21.56 ms | 25/214 → 21/229 |
On the TV, rapid-navigation median/p90 duration improved about 15%/14%; GPU p90 fell from 20.62 to 17.29 ms. On the onn, frame durations remained roughly level and the normal-navigation missed-deadline count increased in this short sample. This is a reduction in unnecessary background work and an improvement on the TV, not a consistent frame-time improvement on every device. TV rapid frames still exceed a 16.7 ms budget. All captures had zero dropped FrameMetrics callbacks. These samples are not an endurance test or a hardware ranking; raw results are under ignored `output/performance/round3/`.
The new scheduling regression passed on both devices in both rendering modes. Three colors 60 ms apart produced exactly one final full-color composition (or reused the existing Memory-saver textures), retained the final selected color, canceled pending work on pause, restored on resume, and applied reduced-motion changes immediately. The complete wake regression also passed on both devices in both modes: interrupted loads, partial-grid recovery, memory trimming, image reuse, nonblank bounded scenes, release on stop, screensaver dismissal, five stop/start cycles, and runtime renderer switching. Diagnostic preference changes were restored.
The final signed 1.1.9 build was installed on both devices. Screenshots confirm the wallpaper, app banners, focus appearance, and original layout. After settling with Android settings foreground, both launcher UIs and the onn Home helper consumed zero CPU ticks over five seconds. Home/Back returned/stayed in Luma on the onn; the TV retained its original disabled Home override. The onn's original accessibility list was restored after instrumentation, including Button Mapper. Both diagnostic APKs and the round's temporary on-device reports/scripts were removed; Projectivy remains installed and enabled on both devices. Both devices were returned to Luma.

Binary file not shown.

Binary file not shown.

View file

@ -1,11 +1,11 @@
{
"schema": 1,
"packageName": "tv.luma.launcher",
"versionCode": 11,
"versionName": "1.1.8",
"versionCode": 12,
"versionName": "1.1.9",
"minSdk": 26,
"apk": "Luma.apk",
"size": 2753622,
"sha256": "9f4fecf5162c897e9614b9fe4b3af37989bd10d3959d9278f1314e4e0630b80b",
"notes": "Improves app-tile rendering and reduces the shared focus-shadow texture to one quarter of its previous size. Adds an optional Memory saver setting for background colors. All devices use the same rendering default, with no model-specific pathways. Keeps cinematic artwork, focus effects, and smooth scrolling. Tested on the onn box and integrated TV."
"sha256": "bf03db00b66fd1aa2eaf6ed6c6b65da222a32725e9549133e37890a758fd27df",
"notes": "Reduces unnecessary cinematic background work while moving quickly through apps. App focus feedback stays immediate; the background follows the final selected color after a short pause. Preserves smooth scrolling, artwork, and wake recovery. Tested on both the integrated TV and onn, with the same behavior across devices."
}

View file

@ -0,0 +1,137 @@
package tv.luma.launcher.tests;
import android.animation.ValueAnimator;
import android.app.*;
import android.content.*;
import android.graphics.Color;
import android.os.Bundle;
import java.lang.reflect.*;
/** Passing focus colors must not start image jobs or escape a paused scene. */
public final class AccentSchedulingInstrumentation extends Instrumentation {
private Object scene;
private Object get(String name) throws Exception {
Field f = scene.getClass().getDeclaredField(name);
f.setAccessible(true);
return f.get(scene);
}
private void call(String name, Class<?>[] types, Object... args) {
runOnMainSync(
() -> {
try {
Method m = scene.getClass().getDeclaredMethod(name, types);
m.setAccessible(true);
m.invoke(scene, args);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
private void color(int color, boolean animate) {
call("accent", new Class<?>[] {int.class, boolean.class}, color, animate);
}
private void settled() throws Exception {
long until = android.os.SystemClock.uptimeMillis() + 4000;
boolean[] ready = {false};
while (android.os.SystemClock.uptimeMillis() < until) {
runOnMainSync(
() -> {
try {
ValueAnimator a = (ValueAnimator) get("animator"),
c = (ValueAnimator) get("colorAnimator");
ready[0] =
get("frame") != null
&& !(boolean) get("dirty")
&& !(boolean) get("accentPending")
&& (a == null || !a.isRunning())
&& (c == null || !c.isRunning());
} catch (Exception e) {
throw new RuntimeException(e);
}
});
if (ready[0]) return;
Thread.sleep(20);
}
throw new AssertionError("scene did not settle");
}
@Override
public void onCreate(Bundle args) {
super.onCreate(args);
start();
}
@Override
public void onStart() {
Bundle result = new Bundle();
StringBuilder report = new StringBuilder();
try {
Activity activity =
startActivitySync(
new Intent(Intent.ACTION_MAIN)
.setComponent(
new ComponentName("tv.luma.launcher", "tv.luma.launcher.MainActivity"))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
Thread.sleep(3000);
Field f = activity.getClass().getDeclaredField("scene");
f.setAccessible(true);
scene = f.get(activity);
for (boolean memory : new boolean[] {false, true}) {
call("setMemorySaver", new Class<?>[] {boolean.class}, memory);
call("setMotion", new Class<?>[] {boolean.class}, false);
color(Color.WHITE, false);
settled();
Object frame = get("frame"), mask = get("mask");
int generation = (int) get("generation");
call("setMotion", new Class<?>[] {boolean.class}, true);
for (int color : new int[] {Color.RED, Color.CYAN, Color.GREEN}) {
color(color, true);
Thread.sleep(60);
if (get("frame") != frame || (int) get("generation") != generation)
throw new AssertionError("passing selection composed a background");
}
settled();
if ((int) get("accent") != Color.GREEN || (int) get("targetAccent") != Color.GREEN)
throw new AssertionError("latest selected color was lost");
if (memory && (get("frame") != frame || get("mask") != mask))
throw new AssertionError("memory saver rebuilt textures for an accent");
if (!memory && (get("frame") == frame || (int) get("generation") != generation + 1))
throw new AssertionError("expected exactly one final background composition");
report
.append("PASS: coalesced passing colors, retained final color; memorySaver=")
.append(memory)
.append('\n');
color(Color.MAGENTA, true);
call("pause", new Class<?>[0]);
generation = (int) get("generation");
Thread.sleep(350);
if ((boolean) get("accentPending") || (int) get("generation") != generation)
throw new AssertionError("delayed accent escaped pause");
call("resume", new Class<?>[0]);
settled();
if ((int) get("accent") != Color.MAGENTA)
throw new AssertionError("resume lost pending color");
call("setMotion", new Class<?>[] {boolean.class}, false);
color(Color.BLUE, true);
if ((boolean) get("accentPending") || (int) get("accent") != Color.BLUE)
throw new AssertionError("reduced motion deferred the color");
settled();
report
.append(
"PASS: pause cancels pending work, resume restores, reduced motion immediate;"
+ " memorySaver=")
.append(memory)
.append('\n');
}
result.putString("stream", report.toString());
finish(Activity.RESULT_OK, result);
} catch (Throwable error) {
result.putString("stream", report + "FAIL: " + error + "\n");
finish(Activity.RESULT_CANCELED, result);
}
}
}

View file

@ -7,4 +7,5 @@
<instrumentation android:name=".RenderingInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".NavigationInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".TileRenderingInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".AccentSchedulingInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
</manifest>