Remove obsolete launcher integration and reduce navigation jank

This commit is contained in:
Elijah Kuntz 2026-10-19 14:48:08 -07:00
parent ac0a892c5f
commit 2739b278cd
21 changed files with 394 additions and 129 deletions

View file

@ -8,7 +8,7 @@ Follow Android and Android TV best practices. Keep Luma portable across current
- Use documented platform APIs, API-level availability checks, measured capabilities, and resource limits when behavior needs to adapt. Provide a safe portable fallback. Make performance/quality tradeoffs explicit user settings when capability checks cannot reliably predict performance.
- Use the same defaults across devices unless a documented capability requires otherwise. Verify optimizations on both available test devices; record comparable workloads and distinguish measurements from assumptions. Never assume that an optimization on one GPU improves another.
- Keep deployment addresses, repository endpoints, and environment-specific values configurable or in deployment/test configuration. Do not embed a particular household's device addresses in production logic.
- Preserve existing launcher fallbacks, user preferences, and accessibility configuration during development and testing. Restore temporary test changes.
- Preserve installed launchers unless the user explicitly authorizes their removal. Preserve user preferences and accessibility configuration during development and testing. Restore temporary test changes.
## Keys and security

View file

@ -1,12 +1,12 @@
# Luma for Android TV
A native, remote-first Android TV launcher designed for limited-memory streamers and integrated TVs. It is installed alongside Projectivy as `tv.luma.launcher`; Projectivy remains available as a fallback.
A native, remote-first Android TV launcher designed for limited-memory streamers and integrated TVs. Its package name is `tv.luma.launcher`.
Version **1.1.11** reuses unchanged app tiles when returning Home and avoids reloading already displayed Plex artwork. Every resume restores missing images, including when Android briefly pauses the launcher without stopping it. Leaving the launcher releases image memory. Updates can be installed directly from the TV; physical-input controls appear on compatible TVs.
Version **1.1.12** removes obsolete alternate-launcher integration, avoids redundant screen-on window updates during navigation, and waits for focus to settle before transitioning app background colors. Every resume restores missing images, including when Android briefly pauses the launcher without stopping it. Leaving the launcher releases image memory. Updates can be installed directly from the TV; physical-input controls appear on compatible TVs.
## Use it
Press **Home**, or open **Luma** from Projectivy's app list. Set `LUMA_ADB_DEVICE` to your connected ADB device address to open it from a computer:
Press **Home** after configuring Home routing, or open **Luma** from Android's app list. Set `LUMA_ADB_DEVICE` to your connected ADB device address to open it from a computer:
```sh
.tools/platform-tools/adb -s "$LUMA_ADB_DEVICE" shell am start -n tv.luma.launcher/.MainActivity
@ -20,13 +20,11 @@ Press **Home**, or open **Luma** from Projectivy's app list. Set `LUMA_ADB_DEVIC
## Default launcher and Home routing
**Settings → Default launcher** provides Android's Home app chooser, a Home button override toggle, and a direct Projectivy fallback. Enabling the override opens Android Accessibility settings; enable **Luma Home button** there. Turning it off in Luma disables only Luma's accessibility service.
**Settings → Default launcher** provides Android's Home app chooser and a Home button override toggle. Use the native chooser where supported. On devices that keep routing Home to Google TV, enable **Luma Home button** in Android Accessibility settings. Turning the override off in Luma disables only Luma's own service.
On this onn. device, Android records Luma as the Home role holder but still resolves Home to Google's launcher. Luma's accessibility workaround redirects that stock Home window and handles Home key events where Android delivers them. It runs in a separate small `:home` process so the launcher UI and its artwork can still be reclaimed while another app runs. It requests window-state events only from Google Home and Projectivy, without permission to retrieve window content. It has no polling loop or network work.
The event-driven helper handles Home keys where Android delivers them and redirects Google's stock Home window. It runs in a separate small `:home` process so artwork memory can be reclaimed when another app opens. It cannot retrieve window content and has no polling loop or network work. Android's stock launcher remains installed.
Projectivy's **Settings → General → Override current launcher** is switched off to avoid competing Home handlers. Projectivy's application and accessibility service, and Button Mapper's accessibility service, remain enabled. The Projectivy app tile and **Open Projectivy** deliberately allow the fallback to remain open until the next Home press. Back stays on Luma.
To return to the previous routing, turn off Luma's Home override, then open Projectivy and re-enable **Override current launcher**. No launcher needs to be disabled or uninstalled. The native chooser uses Android's [Home role API](https://developer.android.com/reference/android/app/role/RoleManager); the workaround uses the documented [AccessibilityService callbacks](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService).
The native chooser uses Android's [Home role API](https://developer.android.com/reference/android/app/role/RoleManager); the override uses documented [AccessibilityService callbacks](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService).
## TV inputs
@ -46,7 +44,7 @@ Luma opens an available standard TV channel viewer, with Android's native `TvVie
**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. 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.
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 250 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.
@ -130,7 +128,7 @@ For a fresh macOS checkout, run `scripts/bootstrap.sh`, review/accept the SDK li
The local build creates and reuses `.tools/luma-development.keystore`. Preserve that file to install future updates over the existing APK. It is ignored by source control. This is a development signing identity for your sideloaded build; configure your own signing identity before distributing it.
To remove only Luma, run `adb uninstall tv.luma.launcher`; Projectivy remains installed. No command in the build/install scripts disables another launcher or changes the default Home app.
To remove Luma, run `adb uninstall tv.luma.launcher`. No command in the build/install scripts disables another launcher or changes the default Home app.
## Device checks

View file

@ -6,8 +6,8 @@ android {
applicationId 'tv.luma.launcher'
minSdk 26
targetSdk 34
versionCode 14
versionName '1.1.11'
versionCode 15
versionName '1.1.12'
}
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="14" android:versionName="1.1.11">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="15" android:versionName="1.1.12">
<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

@ -6,28 +6,11 @@ import android.content.Intent;
/** Private, explicit cross-process controls; only Luma's own UID can call this receiver. */
public final class HomeControlReceiver extends BroadcastReceiver {
static final String FALLBACK = "tv.luma.launcher.ALLOW_PROJECTIVY";
static final String DISABLE = "tv.luma.launcher.DISABLE_HOME_OVERRIDE";
static void setFallback(Context context, boolean allow) {
if (isFallback(context) == allow) return;
context
.getSharedPreferences("home-routing", Context.MODE_PRIVATE)
.edit()
.putBoolean("fallback", allow)
.apply();
}
static boolean isFallback(Context context) {
return context
.getSharedPreferences("home-routing", Context.MODE_PRIVATE)
.getBoolean("fallback", false);
}
@Override
public void onReceive(Context context, Intent intent) {
if (FALLBACK.equals(intent.getAction())) setFallback(context, true);
else if (DISABLE.equals(intent.getAction()) && LumaHomeService.active != null) {
if (DISABLE.equals(intent.getAction()) && LumaHomeService.active != null) {
LumaHomeService.active.disableSelf();
}
}

View file

@ -18,7 +18,6 @@ public final class LumaHomeService extends AccessibilityService {
public boolean onKeyEvent(KeyEvent event) {
if (event.getKeyCode() != KeyEvent.KEYCODE_HOME) return false;
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
HomeControlReceiver.setFallback(this, false);
openLuma();
}
return true;
@ -32,11 +31,6 @@ public final class LumaHomeService extends AccessibilityService {
// Class names only: no view hierarchy, text, screenshots, or content inspection.
if (pkg.equals("com.google.android.apps.tv.launcherx")
&& cls.equals("com.google.android.apps.tv.launcherx.home.HomeActivity")) {
HomeControlReceiver.setFallback(this, false);
openLuma();
} else if (pkg.equals("com.spocky.projengmenu")
&& cls.equals("com.spocky.projengmenu.ui.home.MainActivity")
&& !HomeControlReceiver.isFallback(this)) {
openLuma();
}
}

View file

@ -389,7 +389,7 @@ public final class MainActivity extends Activity {
currentDialog = null;
saverDownloading = false;
}
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setKeepScreenOn(false);
handler.removeCallbacks(idleSaver);
stopSaver(false);
scene.pause();
@ -690,10 +690,6 @@ public final class MainActivity extends Activity {
}
private void launch(AppRepository.App a) {
if (a.component.getPackageName().equals("com.spocky.projengmenu")) {
fallback();
return;
}
try {
Intent i =
new Intent(Intent.ACTION_MAIN)
@ -706,34 +702,6 @@ public final class MainActivity extends Activity {
}
}
private void fallback() {
// Wait for the private router process to allow this explicit fallback launch.
sendOrderedBroadcast(
new Intent(this, HomeControlReceiver.class).setAction(HomeControlReceiver.FALLBACK),
null,
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
openProjectivy();
}
},
handler,
Activity.RESULT_OK,
null,
null);
}
private void openProjectivy() {
try {
Intent i = getPackageManager().getLeanbackLaunchIntentForPackage("com.spocky.projengmenu");
if (i == null) i = getPackageManager().getLaunchIntentForPackage("com.spocky.projengmenu");
if (i != null) startActivity(i);
else toast("Projectivy is not available");
} catch (Exception e) {
toast("Unable to open Projectivy");
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@ -861,7 +829,10 @@ public final class MainActivity extends Activity {
: "A new Luma version is available",
this::updatesSettings);
action(
p, "Default launcher", "Home button routing and fallback", this::defaultLauncherSettings);
p,
"Default launcher",
"Home button routing and system defaults",
this::defaultLauncherSettings);
action(
p,
"Plex media rows",
@ -881,14 +852,6 @@ public final class MainActivity extends Activity {
toast("Settings unavailable");
}
});
action(
p,
"Open Projectivy",
"Your existing launcher is always available",
() -> {
dismiss();
fallback();
});
action(
p,
"About Luma",
@ -1199,8 +1162,7 @@ public final class MainActivity extends Activity {
"System Home: "
+ (nativeHome ? "Luma" : "Managed by this TV")
+ "\nHome button override: "
+ (enabled ? "On" : "Off")
+ "\nProjectivy stays installed and available as your fallback.");
+ (enabled ? "On" : "Off"));
action(
p,
"Choose default Home app",
@ -1253,8 +1215,7 @@ public final class MainActivity extends Activity {
panel(
"Enable Home routing",
"In Android Accessibility, enable Luma Home button.\n\n"
+ "In Projectivy settings → General, turn off Override current launcher to"
+ " avoid competing Home handlers. Projectivy itself stays available.");
+ "This routes the Home button to Luma.");
action(
help,
"Open Accessibility settings",
@ -1273,14 +1234,6 @@ public final class MainActivity extends Activity {
action(help, "Back", null, this::defaultLauncherSettings);
}
});
action(
p,
"Open Projectivy",
"Use your fallback without turning Luma off",
() -> {
dismiss();
fallback();
});
action(p, "Back", null, this::showSettings);
}
@ -1492,7 +1445,7 @@ public final class MainActivity extends Activity {
"No ads or analytics. Wallpaper, app artwork, and Plex requests stop when another app"
+ " opens. Image caches are bounded and cleared when Luma leaves the screen.\n\n"
+ "Menu opens settings. Hold OK on an app to customize it. Back stays on Luma. Open"
+ " Projectivy from Settings or its app tile.\n\n"
+ " Android settings from Luma settings.\n\n"
+ "Manage Home routing and scheduled update checks in Settings.",
13,
Ui.MUTED);
@ -1995,12 +1948,19 @@ public final class MainActivity extends Activity {
return super.dispatchTouchEvent(event);
}
private void setKeepScreenOn(boolean enabled) {
int flag = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
boolean current = (getWindow().getAttributes().flags & flag) != 0;
if (current == enabled) return;
if (enabled) getWindow().addFlags(flag);
else getWindow().clearFlags(flag);
}
private void resetSaverTimer() {
handler.removeCallbacks(idleSaver);
int minutes = prefs.getInt("saverTimeout", 10);
if (foreground && (minutes > 0 || saver != null))
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
else getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if (foreground && (minutes > 0 || saver != null)) setKeepScreenOn(true);
else setKeepScreenOn(false);
if (foreground && saver == null && currentDialog == null && minutes > 0)
handler.postDelayed(idleSaver, minutes * 60000L);
}
@ -2013,7 +1973,7 @@ public final class MainActivity extends Activity {
scene.pause();
scroll.stopAnimation();
saver = new SaverView(this);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setKeepScreenOn(true);
root.addView(saver, new FrameLayout.LayoutParams(-1, -1));
saver.requestFocus();
}
@ -2023,7 +1983,7 @@ public final class MainActivity extends Activity {
saver.stop();
root.removeView(saver);
saver = null;
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setKeepScreenOn(false);
if (resume && foreground) {
scene.resume();
AppTile tile = tiles.get(selected);

View file

@ -32,7 +32,7 @@ final class SceneView extends View {
private ValueAnimator animator, colorAnimator;
private boolean useTintMask;
private boolean accentPending;
// Let the 160 ms focus lift finish; passing selections need no full-screen transition.
// Keep full-screen color work out of continuous D-pad navigation; tile focus stays immediate.
private final Runnable accentUpdate =
() -> {
accentPending = false;
@ -120,7 +120,7 @@ final class SceneView extends View {
targetAccent = color;
removeCallbacks(accentUpdate);
accentPending = animate && motion && active && frame != null;
if (accentPending) postDelayed(accentUpdate, 160);
if (accentPending) postDelayed(accentUpdate, 250);
else applyAccent(color, animate);
}
@ -132,6 +132,8 @@ final class SceneView extends View {
return;
}
if (colorAnimator != null) colorAnimator.cancel();
// Coalesced navigation may return to the color that is already displayed.
if (accent == color) return;
if (!animate || !motion || frame == null) {
accent = color;
invalidate();

View file

@ -1,4 +1,4 @@
<resources>
<string name="home_override_name">Luma Home button</string>
<string name="home_override_description">Opens Luma when you press Home or the stock launcher appears. Does not read screen content. Projectivy remains available from Luma settings. Turn off other launcher Home overrides to avoid conflicts.</string>
<string name="home_override_description">Opens Luma when you press Home or the stock launcher appears. Does not read screen content. Turn off other launcher Home overrides to avoid conflicts.</string>
</resources>

View file

@ -1,6 +1,6 @@
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeWindowStateChanged"
android:packageNames="com.google.android.apps.tv.launcherx,com.spocky.projengmenu"
android:packageNames="com.google.android.apps.tv.launcherx"
android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="80"
android:accessibilityFlags="flagRequestFilterKeyEvents"

View file

@ -1 +1 @@
Reduces allocation when returning Home by reusing unchanged app tiles. Reuses Plex artwork that is already displayed and avoids redundant background rebuilds. Keeps the previous artwork while a replacement loads, cancels obsolete requests, and restores interrupted artwork loads after resume. Layout, image quality, and device-independent rendering defaults are unchanged.
Removes obsolete alternate-launcher shortcuts and routing integration. Avoids redundant window relayouts when remote input resets the screensaver timer. Background app-color transitions wait for a 250 ms pause in navigation and skip animations to an already displayed color. Tile focus stays immediate, with the same image quality and smooth final crossfade. No device-specific rendering paths.

View file

@ -12,7 +12,7 @@ Validated on the user’s onn. 4K Plus Streaming device over ADB, October 17, 20
- Scenic photo preview, single-button wake, and real one-minute idle activation passed. Idle timeout was restored to ten minutes, photo duration to thirty seconds, and mode to Scenic.
- NPS bird video downloaded to private device storage (about 40 MB), played locally in a loop, and stopped on leaving Luma. The local file remains available in Nature video mode; no ongoing stream/download is active.
- Home routing: Android reports Luma as HOME role holder but the OEM resolver still chooses Google Home. The enabled Luma accessibility service routes Home to Luma. Repeated Home presses, return from Android settings and SmartTube, and screensaver dismissal were checked.
- Projectivy fallback stays open when explicitly selected through its app tile or Settings. Back stays on Luma; from lower rows it returns to the first row. Home returns to Luma. Projectivy remains installed and enabled; only its competing “Override current launcher” preference is off. Its accessibility service and Button Mapper’s service are retained.
- The previous launcher fallback stays open when explicitly selected through its app tile or Settings. Back stays on Luma; from lower rows it returns to the first row. Home returns to Luma. The previous launcher remains installed and enabled; only its competing “Override current launcher” preference is off. Its accessibility service and Button Mapper’s service are retained.
- Luma’s override Off control removes only its own accessibility service. Re-enabling through Android’s actual Accessibility settings was verified. The service is system-bound in a separate `tv.luma.launcher:home` process. No view-content retrieval capability is requested.
## Wake regression — October 18, 2026
@ -62,7 +62,7 @@ A forced scheduled check against the real public HTTPS repository found a newer
Testing exposed a device-specific consequence of legacy APK/file installation: Android restricted settings reset the accessibility service list. The final flow uses a PackageInstaller session for a publisher-verified self-update (`PACKAGE_SOURCE_OTHER`), always requiring user confirmation. It does not claim to be an app store or request silent installation. Unlike a general APK file installer, Luma accepts only its own package signed by the installed key.
The final real upgrade, **1.1.4 → 1.1.5**, was downloaded from production Git and approved with the TV remote. The complete enabled-accessibility-service list matched before and after, including Luma Home, Projectivy, and Button Mapper. Restricted-settings authorization remained allowed, and the TV returned directly to Luma. No ADB install or accessibility repair was used for that final upgrade. Prior temporary configuration changes from failed installation-method tests were restored.
The final real upgrade, **1.1.4 → 1.1.5**, was downloaded from production Git and approved with the TV remote. The complete enabled-accessibility-service list matched before and after, including Luma Home, the previous launcher, and Button Mapper. Restricted-settings authorization remained allowed, and the TV returned directly to Luma. No ADB install or accessibility repair was used for that final upgrade. Prior temporary configuration changes from failed installation-method tests were restored.
The source classification follows Android's [PackageInstaller source definitions](https://developer.android.com/reference/android/content/pm/PackageInstaller#PACKAGE_SOURCE_OTHER); the platform's [file-source restriction implementation](https://android.googlesource.com/platform/frameworks/base/+/143db55921dd%5E%21/) explains the behavior encountered during the earlier file-install tests.
@ -134,16 +134,14 @@ GPU PixelCopy checks passed on both devices for wide opaque banners, portrait ce
Wake regression passed on both devices in both rendering modes: cold launch, interrupted loading/pause/resume, memory trim, existing-tile reuse, partial-grid recovery, bounded nonblank backgrounds, texture/queue release on stop, screensaver dismissal, and five stop/start cycles. Memory-saver checks also verified loading the saved preference and switching back and forth at runtime. Temporary preference changes were restored by the test runners. The first tile-comparison test had an uninitialized reference bitmap in the diagnostic overlay; fixing that test setup allowed the comparisons to pass without changing production rendering.
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.
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. The previous launcher 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
## 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.
An earlier review of another launcher's public release notes motivated testing fewer unnecessary accent transitions. The available material did not expose that launcher's rendering source, so no implementation was copied or inferred. Luma's changes were validated against its own code and device measurements.
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.
@ -161,7 +159,7 @@ On the TV, rapid-navigation median/p90 duration improved about 15%/14%; GPU p90
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.
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; the previous launcher remains installed and enabled on both devices. Both devices were returned to Luma.
## Capability-based TV input button — October 19, 2026
@ -179,7 +177,7 @@ The enhanced wake regression passed on both devices, including interrupted-load
The platform interfaces are documented in [TvInputManager](https://developer.android.com/reference/android/media/tv/TvInputManager), [TvInputInfo](https://developer.android.com/reference/android/media/tv/TvInputInfo), and [TvView](https://developer.android.com/reference/android/media/tv/TvView).
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/`.
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. The previous launcher 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
@ -218,4 +216,47 @@ These show essentially unchanged navigation frame times rather than a consistent
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.
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. The previous launcher 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.
## Launcher integration removal and current-jank investigation — October 19, 2026
At the user's request, the previous alternate launcher was uninstalled from both devices. Luma's dedicated shortcuts, special launch handling, explicit fallback broadcast/preferences, accessibility package subscription/redirect, and explanatory UI strings for that integration were removed. Home-key handling, Google Home redirection, Android settings access, and the user-controlled override remain. No other installed launcher or accessibility service was removed. Earlier validation entries above describe historical configurations, not a requirement to keep another launcher installed.
The supplied benchmark reports use Android's current `Janky frames` counter from gfxinfo. That differs from the legacy counter and from FrameMetrics total-duration thresholds used in prior development notes. The reported TCL gap was reproduced after uninstalling the other launcher; removal alone did not fix it. A neighboring-tile comparison also differed in workload: the onn's Plex/Plezy pair shares an accent, while the TV's Plex/Spotify pair changes it. A second comparison therefore used Plex/Spotify on both devices, the same Alpine theme and dim level, real alternating D-pad keys at a scheduled 200 ms cadence, and no Plex network/media rows.
`JankInstrumentation` resets gfxinfo immediately before each 60-key sequence and reads its current jank counter after settling. It temporarily changes only the test order, media-row setting and accent, restoring those keys in finally. Memory-saver isolations change the scene at runtime without changing the saved preference. Each trial executes once on-device and saves its report locally; retrieval does not replay navigation. The first two apps are asserted in matched tests. Tile contents elsewhere still differ. The test does not measure input-to-photon latency.
Three-trial baseline medians after the uninstall were 0.76% current jank on the onn's original neighboring tiles and 8.50% on the TV's original neighbors. With the same Plex/Spotify pair, medians were 0.14% and 8.36%. The workload difference matters, but does not explain away the TV gap. Removing the focus shadow left TV median jank at 8.25%, so the shadow was retained. Hiding the entire background gave a 0% median on both; that diagnostic loses the intended visual design and was not shipped. A fixed accent gave TV samples of 1.67%, 7.83%, and 0%, so it is not a consistently faster mode claim.
Perfetto captures included FrameTimeline, main/RenderThread slices, scheduling, and graphics events. In the retained old-delay trace window, mean RenderThread dequeueBuffer duration was 7.36 ms on the TV versus 3.36 ms on the onn. Mean DrawFrames duration was 13.42 versus 8.30 ms. Mean main-thread doFrame was 6.23 versus 1.85 ms, but included 4.75 versus 0.89 ms waiting in postAndWait; recording View drawing itself averaged roughly 0.25–0.30 ms. These are wall durations including waits, not CPU execution times.
The TV's retained FrameTimeline sample contained 573 buffer-stuffing/late-present frames finishing on time and one app-deadline-missed frame. Its retained SurfaceFlinger frames finished on time. The onn also had buffer stuffing with on-time app completion. Those states are not the same as gfxinfo's current-jank percentage: [Perfetto describes buffer stuffing as queued frames that can remain smooth while adding latency](https://perfetto.dev/docs/data-sources/frametimeline). This evidence points toward buffering/render-pipeline waits, rather than proving excessive Java UI work or a hard GPU-compute ceiling. Neither device exposed GPU render-stage slices in these captures, so the GPU/driver/display contribution cannot be completely separated. The initial 32 MiB ring traces retain only part of the input window; TV process-name metadata was incomplete and its target PID was verified against the corresponding gfxinfo report. A larger 64 MiB configuration with periodic process stats is included in `tests/device/jank-trace.pbtxt` for reproduction.
The retained software change extends the accent quiet period from 160 to 250 ms. It avoids starting full-screen transitions for passing selections at a 200 ms cadence, while preserving immediate 160 ms tile focus and the existing 280 ms final background crossfade. The explicit tradeoff is 90 ms more delay before an animated app-color change begins after focus settles. Initial rendering, reduced motion, image resolution, blur/composition quality, and all device-independent defaults are unchanged. Slower navigation can still trigger expensive background transitions; this does not establish universally stutter-free rendering.
Testing also exposed a redundant Memory-saver animation: coalescing a move away and back could animate a color to itself. The final build cancels an obsolete color animation and returns immediately if the displayed color already matches. The scheduling regression now uses 200 ms passing selections and verifies that returning to the displayed color starts neither composition nor a color animator, in both rendering modes.
The trace also exposed repeated window relayouts at remote input: the old timer reset reapplied FLAG_KEEP_SCREEN_ON even when unchanged. The final code checks the actual window flag before changing it. This removes redundant window-attribute dispatch from the per-key path and preserves real flag changes for timeout settings, screensaver entry/exit, and pause/resume. `WindowFlagsInstrumentation` wraps the Window callback and verifies twenty interactions produce zero attribute-change callbacks; switching the timer Off/On produces one change each, and pause/resume releases/restores the flag. It restores the original timer preference and callback.
A same-version diagnostic control APK containing the integration removal but the old 160 ms renderer was used to capture the control trace and three Memory-saver-On trials without downgrading an installed package. It was not published. The Memory-saver-Off baseline medians use the original 1.1.11 renderer. The final release was installed over all temporary controls. Profiling captures are separate from the untraced median trials.
Final untraced matched-pair results (three-trial medians, current gfxinfo jank):
| Device / Memory saver | Old rendering current jank → 1.1.12 | Reported duration p90, old → new |
| --- | ---: | ---: |
| onn / Off | 0.14% → 0.30% | 11 → 10 ms |
| onn / On | 0.14% → 0.76% | 13 → 12 ms |
| TV / Off | 8.36% → 0.00% | 24 → 9 ms |
| TV / On | 6.94% → 0.00% | 23 → 12 ms |
TV Off trials were 0.15%, 0%, and 0%; On trials were 0%, 0%, and 0%. onn Off trials were 0.45%, 0.30%, and 0.30%; On trials were 1.21%, 0.30%, and 0.76%. The onn current-jank counter increased slightly despite a lower duration p90; this is not a universal jank improvement. A preceding onn crossover with only the longer delay gave 0.14%/0.14% on the old delay and 0.76%/1.21% on the candidate, so the small onn increase is explicitly retained in the evidence. The final code also includes the window-update guard. It is retained for the large repeatable TV improvement and elimination of redundant work, while preserving the onn's existing Memory saver Off setting. These are short, ordered trials rather than a randomized endurance study. Zero measured janky frames does not promise zero stutter in other workloads.
The final 64 MiB traces cover startup and the complete input sequence. Only the initial window relayout remains on either device; the per-input relayout slices disappear. Mean dequeueBuffer time in these captures was about 0.24 ms on the TV and 0.18 ms on the onn, compared with 7.36/3.36 ms in the retained control samples. TV mean DrawFrames fell to 5.12 ms and mean doFrame to 1.39 ms; most app FrameTimeline slices were on-time rather than buffer-stuffed. Startup still contributes a few late frames in this trace, unlike the untraced counters reset after settling. Trace overhead and different retained windows prevent treating these means as exact speedup ratios, but they corroborate removal of the repeated window/queue work. The final UI-only subtitle correction does not change these rendering paths.
The broader 42-key normal/rapid navigation regression also passed on both devices. Final FrameMetrics median/p90 totals were onn 10.28/13.50 ms normal and 10.67/13.37 ms rapid; TV 12.50/13.58 ms normal and 23.92/24.45 ms rapid with its saved Memory-saver setting On. These totals include pipeline waits and are not the current gfxinfo jank counter. In particular, some rapid TV frames remain longer even though the matched 200 ms workload's current jank is much lower. All samples had zero dropped callbacks.
Both devices passed the final 200 ms accent/coalescing regression, same-color cancellation, reduced motion, pending-work cancellation on pause, full wake recovery, pause-only image reuse, memory trimming, screensaver dismissal, five stop/start cycles, and runtime renderer switching. The original app/timer/media/accent/order preferences were restored. The final signed version is 1.1.12, versionCode 15, using the existing certificate. Full raw reports, SQL summaries, and traces remain in ignored `output/performance/round5/`.
Final UI checks verified the removed package is absent on both devices, Settings and Default launcher contain no obsolete integration text/actions, Back stays in Luma, and physical-input controls remain visible only on the TV. The installed APK hashes match the final signed payload. Wallpaper, app art, original spacing, and focus behavior remain intact. Enabled accessibility lists remain Button Mapper only on the onn and null on the TV; the existing Home override remains Off on both. Memory saver remains Off on the onn and On on the TV. The supplied benchmark documents in the repository root were left untouched and untracked.
After settling with Android settings foreground, both launcher processes consumed zero CPU ticks over five seconds. This round's temporary diagnostic APKs, scripts, on-device reports, locks, and trace files were removed after archiving the reports locally. Both devices were returned to Luma. Android's stock launcher and unrelated apps/settings remain unchanged.

Binary file not shown.

Binary file not shown.

View file

@ -1,11 +1,11 @@
{
"schema": 1,
"packageName": "tv.luma.launcher",
"versionCode": 14,
"versionName": "1.1.11",
"versionCode": 15,
"versionName": "1.1.12",
"minSdk": 26,
"apk": "Luma.apk",
"size": 2761885,
"sha256": "a60a01942b4c64f6af3fa49d71441f85eb956a6f199e3c95c8cd6106af74470a",
"notes": "Reduces allocation when returning Home by reusing unchanged app tiles. Reuses Plex artwork that is already displayed and avoids redundant background rebuilds. Keeps the previous artwork while a replacement loads, cancels obsolete requests, and restores interrupted artwork loads after resume. Layout, image quality, and device-independent rendering defaults are unchanged."
"sha256": "77892c9ac3eea5559423d3a7692374c1a4c676b6a5da1cd712773e0bc5eb91c6",
"notes": "Removes obsolete alternate-launcher shortcuts and routing integration. Avoids redundant window relayouts when remote input resets the screensaver timer. Background app-color transitions wait for a 250 ms pause in navigation and skip animations to an already displayed color. Tile focus stays immediate, with the same image quality and smooth final crossfade. No device-specific rendering paths."
}

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""On-device integration checks. Operates only Luma UI and launches installed apps.
Run with the TV awake. Keeps Projectivy installed as a fallback.
Run with the TV awake and configure Luma Home routing before Home-key checks.
"""
import argparse
import re
@ -98,16 +98,10 @@ if args.part=='navigation':
elif args.part=='home-routing':
start();key(82);tap_text('Default launcher')
text_exists('Home button override: On')
tap_text('Open Projectivy');time.sleep(2)
assert package()=='com.spocky.projengmenu',package()
time.sleep(3)
assert package()=='com.spocky.projengmenu',package()
ok('Explicit Projectivy fallback remains open without a redirect loop')
key(3);time.sleep(1)
assert package()=='tv.luma.launcher',package()
key(4)
for _ in range(5):key(3)
assert package()=='tv.luma.launcher',package()
ok('Home returns from fallback and repeated Home presses stay in Luma')
ok('Repeated Home presses stay in Luma')
adb('shell','am','start','-a','android.settings.SETTINGS');time.sleep(1)
assert package()!='tv.luma.launcher'
key(3);time.sleep(1)
@ -120,8 +114,7 @@ elif args.part=='home-routing':
assert package()=='tv.luma.launcher',package()
ok('Home dismisses the screensaver and returns to the app grid')
assert 'LumaHomeService' in adb('shell','dumpsys','activity','services','tv.luma.launcher')
assert 'com.spocky.projengmenu' in adb('shell','pm','list','packages','-e','com.spocky.projengmenu')
ok('Home override is bound; Projectivy remains enabled')
ok('Home override is bound')
elif args.part=='customization':
start();key(82);tap_text('Appearance')

View file

@ -90,7 +90,7 @@ public final class AccentSchedulingInstrumentation extends Instrumentation {
call("setMotion", new Class<?>[] {boolean.class}, true);
for (int color : new int[] {Color.RED, Color.CYAN, Color.GREEN}) {
color(color, true);
Thread.sleep(60);
Thread.sleep(200);
if (get("frame") != frame || (int) get("generation") != generation)
throw new AssertionError("passing selection composed a background");
}
@ -105,6 +105,24 @@ public final class AccentSchedulingInstrumentation extends Instrumentation {
.append("PASS: coalesced passing colors, retained final color; memorySaver=")
.append(memory)
.append('\n');
color(Color.WHITE, false);
settled();
Object settledFrame = get("frame"), settledAnimator = get("colorAnimator");
int settledGeneration = (int) get("generation");
color(Color.RED, true);
Thread.sleep(200);
color(Color.WHITE, true);
settled();
if (get("frame") != settledFrame
|| (int) get("generation") != settledGeneration
|| get("colorAnimator") != settledAnimator)
throw new AssertionError("returning to the displayed color started redundant work");
report
.append(
"PASS: returning to displayed color needs no composition or color animation;"
+ " memorySaver=")
.append(memory)
.append('\n');
color(Color.MAGENTA, true);
call("pause", new Class<?>[0]);
generation = (int) get("generation");

View file

@ -11,4 +11,6 @@
<instrumentation android:name=".WarmReturnInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name="tv.luma.launcher.PlexArtworkInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".GridReuseInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".JankInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
<instrumentation android:name=".WindowFlagsInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
</manifest>

View file

@ -0,0 +1,155 @@
package tv.luma.launcher.tests;
import android.app.*;
import android.content.*;
import android.graphics.*;
import android.os.*;
import android.view.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
/**
* Current gfxinfo jank with original or matched app pairs; runtime isolations never change
* defaults.
*/
public final class JankInstrumentation extends Instrumentation {
private String mode = "matched", memory = "keep";
private Object get(Object o, String n) throws Exception {
Field f = o.getClass().getDeclaredField(n);
f.setAccessible(true);
return f.get(o);
}
private void call(Object o, String n, Class<?>[] types, Object... args) throws Exception {
Method m = o.getClass().getDeclaredMethod(n, types);
m.setAccessible(true);
runOnMainSync(
() -> {
try {
m.invoke(o, args);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
private String shell(String cmd) throws Exception {
try (ParcelFileDescriptor fd = getUiAutomation().executeShellCommand(cmd);
InputStream in = new ParcelFileDescriptor.AutoCloseInputStream(fd);
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
byte[] b = new byte[8192];
int n;
while ((n = in.read(b)) != -1) out.write(b, 0, n);
return out.toString("UTF-8");
}
}
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
if (b != null) {
mode = b.getString("mode", "matched");
memory = b.getString("memory", "keep");
}
start();
}
@Override
public void onStart() {
Bundle result = new Bundle();
StringBuilder report = new StringBuilder();
int status = Activity.RESULT_OK;
SharedPreferences p = getTargetContext().getSharedPreferences("luma", 0);
Map<String, ?> old = new HashMap<>(p.getAll());
try {
SharedPreferences.Editor edit = p.edit().putBoolean("media", false);
if (!mode.equals("original"))
edit.putString(
"order", "com.plexapp.android,com.spotify.tv.android," + p.getString("order", ""));
if (mode.equals("fixed")) edit.putInt("accent", 0xff5b4125);
else edit.putInt("accent", 0);
if (!edit.commit()) throw new AssertionError("test preferences");
Activity a =
startActivitySync(
new Intent(Intent.ACTION_MAIN)
.setComponent(
new ComponentName("tv.luma.launcher", "tv.luma.launcher.MainActivity"))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
Thread.sleep(2500);
Object scene = get(a, "scene");
if (!memory.equals("keep"))
call(scene, "setMemorySaver", new Class<?>[] {boolean.class}, memory.equals("on"));
call(scene, "configure", new Class<?>[] {String.class, float.class}, "alpine", .2f);
call(scene, "setMotion", new Class<?>[] {boolean.class}, true);
Map<?, ?> tiles = (Map<?, ?>) get(a, "tiles");
View[] items = tiles.values().toArray(new View[0]);
if (items.length < 2) throw new AssertionError("insufficient app tiles");
if (!mode.equals("original")
&& (!items[0].getTag().equals("com.plexapp.android")
|| !items[1].getTag().equals("com.spotify.tv.android")))
throw new AssertionError("matched pair unavailable");
if (mode.equals("hidden")) runOnMainSync(() -> ((View) scene).setVisibility(View.INVISIBLE));
if (mode.equals("noshadow"))
runOnMainSync(
() -> {
for (View tile : items)
try {
((Paint) get(tile, "shadowPaint"))
.setColorFilter(
new PorterDuffColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN));
} catch (Exception e) {
throw new RuntimeException(e);
}
});
runOnMainSync(items[0]::requestFocus);
Thread.sleep(900);
report
.append("mode=")
.append(mode)
.append(" memorySaver=")
.append(get(scene, "useTintMask"))
.append(" pair=")
.append(items[0].getTag())
.append(',')
.append(items[1].getTag())
.append('\n');
shell("dumpsys gfxinfo tv.luma.launcher reset");
Trace.beginSection("LumaJankWorkload");
long start = SystemClock.uptimeMillis();
for (int i = 0; i < 60; i++) {
long due = start + i * 200L;
long wait = due - SystemClock.uptimeMillis();
if (wait > 0) Thread.sleep(wait);
sendKeyDownUpSync(i % 2 == 0 ? KeyEvent.KEYCODE_DPAD_RIGHT : KeyEvent.KEYCODE_DPAD_LEFT);
}
Thread.sleep(500);
Trace.endSection();
report
.append("injected=60 elapsedMs=")
.append(SystemClock.uptimeMillis() - start)
.append('\n');
report.append(shell("dumpsys gfxinfo tv.luma.launcher framestats"));
report.append("\nPASS: current jank capture completed\n");
} catch (Throwable t) {
report.append("FAIL: ").append(t).append('\n');
status = Activity.RESULT_CANCELED;
} finally {
SharedPreferences.Editor edit = p.edit();
for (String k : new String[] {"order", "media", "accent"}) {
Object v = old.get(k);
if (!old.containsKey(k)) edit.remove(k);
else if (v instanceof Boolean) edit.putBoolean(k, (Boolean) v);
else if (v instanceof Integer) edit.putInt(k, (Integer) v);
else edit.putString(k, (String) v);
}
if (!edit.commit()) {
report.append("FAIL: preferences not restored\n");
status = Activity.RESULT_CANCELED;
}
}
result.putString("stream", report.toString());
finish(status, result);
}
}

View file

@ -0,0 +1,102 @@
package tv.luma.launcher.tests;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import java.lang.reflect.*;
import java.util.concurrent.atomic.AtomicInteger;
/** Repeated interaction must not dispatch identical window attributes and request relayout. */
public final class WindowFlagsInstrumentation extends Instrumentation {
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
start();
}
@Override
public void onStart() {
Bundle result = new Bundle();
StringBuilder report = new StringBuilder();
int status = Activity.RESULT_OK;
SharedPreferences prefs = getTargetContext().getSharedPreferences("luma", 0);
boolean existed = prefs.contains("saverTimeout");
int original = prefs.getInt("saverTimeout", 10);
Activity activity = null;
Window.Callback callback = null;
try {
prefs.edit().putInt("saverTimeout", 10).commit();
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(1800);
final Activity a = activity;
callback = a.getWindow().getCallback();
final Window.Callback delegate = callback;
AtomicInteger changes = new AtomicInteger();
Window.Callback observer =
(Window.Callback)
Proxy.newProxyInstance(
Window.Callback.class.getClassLoader(),
new Class<?>[] {Window.Callback.class},
(proxy, method, args) -> {
if (method.getName().equals("onWindowAttributesChanged"))
changes.incrementAndGet();
try {
return method.invoke(delegate, args);
} catch (InvocationTargetException e) {
throw e.getCause();
}
});
runOnMainSync(() -> a.getWindow().setCallback(observer));
for (int i = 0; i < 20; i++) runOnMainSync(a::onUserInteraction);
if (changes.get() != 0)
throw new AssertionError(
"repeated interaction dispatched " + changes.get() + " redundant window updates");
report.append("PASS: twenty interactions caused zero redundant window-attribute updates\n");
prefs.edit().putInt("saverTimeout", 0).commit();
runOnMainSync(a::onUserInteraction);
if (changes.get() != 1
|| (a.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
!= 0) throw new AssertionError("screensaver Off did not release keep-screen-on once");
runOnMainSync(a::onUserInteraction);
if (changes.get() != 1)
throw new AssertionError("repeated Off interaction updated the window");
prefs.edit().putInt("saverTimeout", 10).commit();
runOnMainSync(a::onUserInteraction);
if (changes.get() != 2
|| (a.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
== 0)
throw new AssertionError("screensaver timer did not reacquire keep-screen-on once");
runOnMainSync(() -> callActivityOnPause(a));
if ((a.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
!= 0) throw new AssertionError("pause retained screen-on flag");
runOnMainSync(() -> callActivityOnResume(a));
if ((a.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
== 0) throw new AssertionError("resume did not restore timer screen-on flag");
report.append("PASS: timeout changes and pause/resume update keep-screen-on correctly\n");
} catch (Throwable error) {
report.append("FAIL: ").append(error).append('\n');
status = Activity.RESULT_CANCELED;
} finally {
if (activity != null && callback != null) {
final Activity a = activity;
final Window.Callback c = callback;
runOnMainSync(() -> a.getWindow().setCallback(c));
}
SharedPreferences.Editor edit = prefs.edit();
if (existed) edit.putInt("saverTimeout", original);
else edit.remove("saverTimeout");
if (!edit.commit()) {
report.append("FAIL: timeout not restored\n");
status = Activity.RESULT_CANCELED;
}
}
result.putString("stream", report.toString());
finish(status, result);
}
}

View file

@ -0,0 +1,17 @@
buffers { size_kb: 65536 fill_policy: RING_BUFFER }
duration_ms: 22000
data_sources { config { name: "linux.ftrace" ftrace_config {
ftrace_events: "sched/sched_switch"
ftrace_events: "sched/sched_waking"
ftrace_events: "power/cpu_frequency"
ftrace_events: "power/cpu_idle"
atrace_categories: "gfx"
atrace_categories: "view"
atrace_categories: "wm"
atrace_categories: "dalvik"
atrace_apps: "tv.luma.launcher"
} } }
data_sources { config { name: "linux.process_stats" process_stats_config { scan_all_processes_on_start: true proc_stats_poll_ms: 1000 } } }
data_sources { config { name: "android.surfaceflinger.frametimeline" } }
data_sources { config { name: "gpu.renderstages" } }
data_sources { config { name: "android.gpu.memory" } }