Cache soft focus shadows and compare TV rendering performance
This commit is contained in:
parent
1f69422354
commit
5bb15fa69e
11 changed files with 85 additions and 17 deletions
|
|
@ -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 native 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. 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.
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ Android scheduling and installation behavior follow the [JobInfo API](https://de
|
|||
- 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.
|
||||
- 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 casts an app-colored shadow, with no duplicate parent shadow.
|
||||
- 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.
|
||||
- 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.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ android {
|
|||
applicationId 'tv.luma.launcher'
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 9
|
||||
versionName '1.1.6'
|
||||
versionCode 10
|
||||
versionName '1.1.7'
|
||||
}
|
||||
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="9" android:versionName="1.1.6">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="10" android:versionName="1.1.7">
|
||||
<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" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package tv.luma.launcher;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.view.*;
|
||||
|
|
@ -12,6 +13,12 @@ final class AppTile extends LinearLayout {
|
|||
private final TextView label;
|
||||
private boolean motion = true;
|
||||
private String labelMode = "always";
|
||||
// One small shared texture replaces live elevation-shadow geometry on every focus frame.
|
||||
private static Bitmap shadowMask;
|
||||
private final Paint shadowPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
|
||||
private final RectF shadowBounds = new RectF();
|
||||
private float shadowAmount;
|
||||
private ValueAnimator shadowAnimation;
|
||||
|
||||
interface Focus {
|
||||
void changed(boolean hasFocus);
|
||||
|
|
@ -25,6 +32,15 @@ final class AppTile extends LinearLayout {
|
|||
setClickable(true);
|
||||
setClipChildren(false);
|
||||
setClipToPadding(false);
|
||||
setWillNotDraw(false);
|
||||
if (shadowMask == null) {
|
||||
shadowMask = Bitmap.createBitmap(192, 122, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(shadowMask);
|
||||
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
p.setColor(Color.WHITE);
|
||||
p.setShadowLayer(8, 0, 4, Color.WHITE);
|
||||
canvas.drawRoundRect(new RectF(16, 16, 176, 106), 12, 12, p);
|
||||
}
|
||||
setContentDescription(name);
|
||||
setPadding(Ui.dp(c, 5), Ui.dp(c, 7), Ui.dp(c, 5), Ui.dp(c, 7));
|
||||
art = new ArtView(c, name);
|
||||
|
|
@ -48,8 +64,20 @@ final class AppTile extends LinearLayout {
|
|||
label.setTextColor(f ? Ui.WHITE : Ui.MUTED);
|
||||
updateLabel();
|
||||
art.focus = f;
|
||||
// Only the focused tile needs a shadow; avoid overlapping parent/child shadows.
|
||||
art.animate().translationZ(Ui.dp(c, f ? 6 : 0)).setDuration(motion ? 160 : 0).start();
|
||||
if (shadowAnimation != null) shadowAnimation.cancel();
|
||||
if (motion) {
|
||||
shadowAnimation = ValueAnimator.ofFloat(shadowAmount, f ? 1 : 0);
|
||||
shadowAnimation.setDuration(160);
|
||||
shadowAnimation.addUpdateListener(
|
||||
a -> {
|
||||
shadowAmount = (float) a.getAnimatedValue();
|
||||
invalidate();
|
||||
});
|
||||
shadowAnimation.start();
|
||||
} else {
|
||||
shadowAmount = f ? 1 : 0;
|
||||
invalidate();
|
||||
}
|
||||
art.invalidate();
|
||||
if (focus != null) focus.changed(f);
|
||||
});
|
||||
|
|
@ -78,15 +106,28 @@ final class AppTile extends LinearLayout {
|
|||
}
|
||||
|
||||
void setAccent(int color) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28) {
|
||||
art.setOutlineAmbientShadowColor(color);
|
||||
art.setOutlineSpotShadowColor(color);
|
||||
}
|
||||
shadowPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (shadowAmount <= 0 || art.getWidth() == 0) return;
|
||||
float inset = Ui.dp(getContext(), 2);
|
||||
float scale = (art.getWidth() - 2 * inset) / 160f;
|
||||
float left = art.getLeft() + inset - 16 * scale;
|
||||
float top = art.getTop() + inset - 16 * scale;
|
||||
shadowBounds.set(left, top, left + 192 * scale, top + 122 * scale);
|
||||
shadowPaint.setAlpha(Math.round(150 * shadowAmount));
|
||||
canvas.drawBitmap(shadowMask, null, shadowBounds, shadowPaint);
|
||||
}
|
||||
|
||||
void stopAnimations() {
|
||||
animate().cancel();
|
||||
art.animate().cancel();
|
||||
if (shadowAnimation != null) shadowAnimation.cancel();
|
||||
shadowAmount = hasFocus() ? 1 : 0;
|
||||
}
|
||||
|
||||
void bitmap(Bitmap b) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Improves navigation performance on integrated Android TVs by precomposing cinematic backgrounds off the main thread. Reduces redundant tile shadows while keeping focus animations, dynamic colors, and the existing spacious layout. Image work and caches are released when leaving Home.
|
||||
Further improves focus animation performance with a small shared soft-shadow texture. Keeps the cinematic background, app-colored glow, focus enlargement, and smooth scrolling. Includes the integrated-TV background rendering optimization.
|
||||
|
|
|
|||
|
|
@ -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.6): 2,753,622 bytes. SHA-256: `59527fde9ca270d76864406dadbdad219905fbfdf75e853b536ca09e51811cdd`.
|
||||
Final APK (1.1.7): 2,753,622 bytes. SHA-256: `b15cd4abad3cb55eab29916fdd61b4702e665d163d3225779b04b7dee302ee23`.
|
||||
|
||||
## Updater regression — October 18, 2026
|
||||
|
||||
|
|
@ -96,3 +96,15 @@ The original D-pad workload was then repeated against the final installed APK: *
|
|||
Foreground PSS was 43,742 KiB (42.7 MiB), and background PSS was 35,803 KiB (35.0 MiB). The launcher consumed zero CPU ticks over five seconds while Android settings was foreground. Source/composite caches are cleared when stopped; actual heap reclamation remains Android's responsibility. These short samples do not establish overnight endurance.
|
||||
|
||||
The TV's Home override was already off (no enabled accessibility services) and was retained. A physical Home-key injection returns to Google Home on this TV; opening Luma directly and repeated Back stays in Luma. No default-launcher, picture, power, resolution, or accessibility settings were changed. The optimized APK was installed only on the authorized TV at `.200`; the onn was not operated during this investigation. Version 1.1.6 is published in the existing Git update feed for the other devices.
|
||||
|
||||
## Further focus optimization and onn comparison — October 19, 2026
|
||||
|
||||
The onn was still running 1.1.5. After waking it and allowing its images to settle, the same 42-key D-pad workload reported 603 frames, 34 missed deadlines (5.64%), median 20 ms, 90th percentile 23 ms, and 95th percentile 24 ms. Thus the integrated TV's 1.1.6 results were already comparable to the working onn installation, with a lower median and missed-deadline rate. This compares the devices' actual installed versions and app grids; it is not a same-version hardware ranking. The onn's package, preferences, and Home override were not changed; its original standby state was restored after measurement.
|
||||
|
||||
On the TV, the 1.1.6 diagnostic showed that the remaining native focused-tile shadow increased tail latency. Version 1.1.7 replaces it with one shared 192 × 122 ARGB soft-shadow texture (93,696 bytes), tinted for each app and faded over the existing 160 ms focus transition. The existing 6.5% focus scale, glow, background colors, and scrolling remain enabled. This avoids animating live elevation-shadow geometry and does not require reducing image resolution further or removing animations.
|
||||
|
||||
The same TV-local focus benchmark with the new shadow enabled produced **640 frames, median 13.48 ms, 90th percentile 14.31 ms, and zero frames over 16.7 ms**. Version 1.1.6's corresponding sample was 639 frames, median 12.99 ms, 90th percentile 17.00 ms, and 64 frames over 16.7 ms. The gain is consistency/tail latency rather than a faster median. Disabling the cached shadow for diagnosis barely changed the result (median 13.33 ms, 90th percentile 14.10 ms), indicating its remaining rendering cost is small.
|
||||
|
||||
The enhanced wake regression passed with the cached-shadow build, including checking that its animation stops on leaving Home, nonblank bounded backgrounds, interrupted-load recovery, screensaver dismissal, and five stop/start cycles. An initial attempt began while the TV was asleep; later ADB disconnects interrupted streamed test reports. Running the diagnostic locally with saved output while the TV was awake completed successfully. The temporary diagnostic APK is removed after verification.
|
||||
|
||||
The broader 42-key D-pad sequence on 1.1.7 recorded 861 frames, 16 missed deadlines (1.86%), median 14 ms, 90th percentile 25 ms, and 95th percentile 25 ms. This is roughly level with the 1.1.6 sample (1.41%, 13/24/26 ms); the cached shadow's isolated-focus consistency gain did not produce a measurable improvement to the whole navigation workload in these samples. It is not presented as a new overall performance leap. Screenshots confirm the soft app-colored shadow, scale/outline, wallpaper, and spacing remain visible. The remaining navigation time is primarily GPU/compositing work; main-thread draw/traversal was already sub-millisecond in the sampled 1.1.6 trace. The onn comparison remains 1.1.5, rather than claiming a same-version hardware comparison.
|
||||
|
|
|
|||
BIN
output/Luma.apk
BIN
output/Luma.apk
Binary file not shown.
Binary file not shown.
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"schema": 1,
|
||||
"packageName": "tv.luma.launcher",
|
||||
"versionCode": 9,
|
||||
"versionName": "1.1.6",
|
||||
"versionCode": 10,
|
||||
"versionName": "1.1.7",
|
||||
"minSdk": 26,
|
||||
"apk": "Luma.apk",
|
||||
"size": 2753622,
|
||||
"sha256": "59527fde9ca270d76864406dadbdad219905fbfdf75e853b536ca09e51811cdd",
|
||||
"notes": "Improves navigation performance on integrated Android TVs by precomposing cinematic backgrounds off the main thread. Reduces redundant tile shadows while keeping focus animations, dynamic colors, and the existing spacious layout. Image work and caches are released when leaving Home."
|
||||
"sha256": "b15cd4abad3cb55eab29916fdd61b4702e665d163d3225779b04b7dee302ee23",
|
||||
"notes": "Further improves focus animation performance with a small shared soft-shadow texture. Keeps the cinematic background, app-colored glow, focus enlargement, and smooth scrolling. Includes the integrated-TV background rendering optimization."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,15 @@ public final class PerformanceInstrumentation extends Instrumentation {
|
|||
for (View item : items) {
|
||||
try {
|
||||
((View) field(item, "art")).setOutlineProvider(null);
|
||||
try {
|
||||
((android.graphics.Paint) field(item, "shadowPaint"))
|
||||
.setColorFilter(
|
||||
new android.graphics.PorterDuffColorFilter(
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
android.graphics.PorterDuff.Mode.SRC_IN));
|
||||
} catch (NoSuchFieldException legacyNativeShadow) {
|
||||
// Older builds only have Android's elevation shadow.
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,12 @@ public final class WakeRegressionInstrumentation extends Instrumentation {
|
|||
callActivityOnPause(activity);
|
||||
callActivityOnStop(activity);
|
||||
try {
|
||||
for (Object tile : ((Map<?, ?>) field(activity, "tiles")).values()) {
|
||||
android.animation.ValueAnimator shadow =
|
||||
(android.animation.ValueAnimator) field(tile, "shadowAnimation");
|
||||
if (shadow != null && shadow.isRunning())
|
||||
throw new AssertionError("focus shadow still animating after stop");
|
||||
}
|
||||
Object scene = field(activity, "scene");
|
||||
for (String name : new String[] {"wallpaper", "mediaArt", "frame", "previousFrame"})
|
||||
if (field(scene, name) != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue