Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Merge remote-tracking branch 'origin/main' into key-filter-repeat

Singh, Shantanubaa86b99b2d0
diff --cc docs/TROUBLESHOOTING.md
index 371bf66c4,3f94df06a..6e761306c
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@@ -114,19 -262,28 +262,40 @@@ Things that bit us or contributors, so
package that also claims HOME (PatchWall on Xiaomi) makes Android drop the default. The install
script now picks the known stock launcher among the candidates by itself; otherwise choose one on
the TV or pass `STOCK_LAUNCHER=<package>`.
+ - **Stremio fails every stream with `ConnectException: Failed to connect to /127.0.0.1:11470`**,
+ and only Force stop brings it back until the next reboot. This is not the debloat. It is a Stremio
+ regression in 1.11 ([stremio-bugs#2866](https://github.com/Stremio/stremio-bugs/issues/2866)):
+ `startServer()` only runs once the lifecycle is at least STARTED, so a process Android woke in the
+ background never starts the local server, and opening the app reuses that process. On a TV the
+ waker is Stremio's own `BootReceiver` refreshing the home-screen channels, so it happens on every
+ boot. Leaving the app and reopening does not help (same pid); any fresh process does, `am kill`
+ included. Keeping the boot-woken process from sticking around fixes it for good:
+ `tools/tv.py 'cmd appops set com.stremio.one RUN_ANY_IN_BACKGROUND ignore; cmd appops write-settings'`.
+ The second command is not optional: app-ops are written to disk lazily, and on a Vestel shandao set
+ the op was back to `allow` after the next reboot without it, which looks exactly like the
+ workaround not working. An app started in the foreground is unaffected, and the side effect, that
+ the home-screen channels only refresh while Stremio is open, costs nothing once the recommendation
+ rows are disabled anyway.
+ - **A firmware update quietly undoes the cleanup.** The update installs over the cleaned-up system, so
+ every listed package is enabled again, Home goes back to the stock launcher and new preloads
+ appear that no list mentions. `tools/venv/bin/python -I tools/check.py <list>` reports the first
+ two and exits 1; `--fix` disables them again and puts the launcher back on Home. New preloads it
+ cannot know about, so after a big update compare `tools/tv.py 'pm list packages'` with the list
+ once by hand. On a TV whose list disables the updater, this only happens when you install an
+ update on purpose: enable the updater, update, `check.py --fix`, disable it again.
+## Held-down remote keys do not repeat (volume steps once per long press)
+
+On some firmware — seen on a TCL Google TV 12 build — enabling any accessibility service that requests
+key filtering (the launcher's `HomeKeyService` and `InputKeyService`) breaks key auto-repeat: the held
+button produces a single press. With every such service disabled the repeat returns.
+
+There is no way to keep the remote buttons those helpers power *and* the repeat on those builds; choose
+one. To keep the helpers enabled but stop them filtering (repeat works, the buttons they handled go
+dead), push a theme with `"key_filter": false` in `config.json` — the service drops
+`FLAG_REQUEST_FILTER_KEY_EVENTS` at runtime instead of needing the whole service disabled. `config.xml`
+has the same switch as the `key_filter` bool for a rebuild.
+
## Accessibility helper enabled but the remote button does nothing
The optional `HomeKeyService` and `InputKeyService` only filter remote keys once Android has bound to
diff --cc launcher/app/src/main/java/com/gathin/tvhome/Config.java
index cb541637a,b55b5a100..c8d8e465d
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@@ -93,18 -120,27 +123,29 @@@ final class Config
final boolean overlayApplied;
/** Festive skin from a theme (festival, festival_until, greeting, accent_color); {@link Festival#NONE} if none. */
final Festival festival;
+ /** F1 weekends from a theme's race_calendar (see RaceWeekend); empty when the theme has none. */
+ final List<RaceWeekend.Race> raceCalendar;
+ /** Cinematic top shelf (config.xml, cinematic_home): the focused dock app's artwork behind a larger shelf. */
+ final boolean cinematicHome;
+ /** The glow in the focused app's colour behind the dock (config.xml, ambient_glow); false keeps the background plain. */
+ final boolean ambientGlow;
+ /** Minutes Home may sit untouched before the clock screensaver (config.xml, home_idle_clock_minutes); 0 is off. */
+ final int homeIdleClockMinutes;
private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,
- String liveTvAction, String sourcePanelService, String sourcePanelAction, String inputAction,
+ String liveTvAction, Map<String, String> launchActions, Map<String, String> appLabels,
+ Map<String, String> appBanners, String sourcePanelService, String sourcePanelAction, String inputAction,
int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,
- boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, String vpnApp,
+ boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, boolean showNetworkPill, boolean iconOnlyButtons, boolean libraryButton, int wifiLabelWidth, boolean alwaysShowNames, boolean wallpaperTrueColor, String vpnApp,
boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, int backgroundColor, int skyIntensity,
int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,
- int wallpaperRotationMinutes, int wallpaperDim, boolean overlayApplied,
- Festival festival, int[] inputKeycodes, List<String> appKeys, boolean keyFilter) {
+ int wallpaperRotationMinutes, int wallpaperDim, String wallpaperOrder, boolean overlayApplied,
+ Festival festival, int[] inputKeycodes, List<String> appKeys,
- List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes) {
++ List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes,
++ boolean keyFilter) {
this.inputKeycodes = inputKeycodes;
this.appKeys = Collections.unmodifiableList(appKeys);
+ this.keyFilter = keyFilter;
this.dockApps = Collections.unmodifiableList(dockApps);
this.fillDock = fillDock;
this.hiddenApps = Collections.unmodifiableList(hiddenApps);
@@@ -177,7 -236,9 +241,10 @@@
boolean settingsKeyPanel = res.getBoolean(R.bool.settings_key_panel);
int[] inputKeycodes = res.getIntArray(R.array.input_key_keycodes);
List<String> appKeys = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.app_keys)));
+ boolean cinematic = res.getBoolean(R.bool.cinematic_home);
+ boolean ambientGlow = res.getBoolean(R.bool.ambient_glow);
+ int idleClockMinutes = res.getInteger(R.integer.home_idle_clock_minutes);
+ boolean keyFilter = res.getBoolean(R.bool.key_filter);
boolean applied = false;
File dir = dir(ctx);
@@@ -214,7 -285,9 +291,10 @@@
settingsKeyPanel = bool(json, "settings_key_panel", settingsKeyPanel);
inputKeycodes = intArray(json, "input_key_keycodes", inputKeycodes);
appKeys = stringList(json, "app_keys", appKeys);
+ cinematic = bool(json, "cinematic_home", cinematic);
+ ambientGlow = bool(json, "ambient_glow", ambientGlow);
+ idleClockMinutes = integer(json, "home_idle_clock_minutes", idleClockMinutes, 0, 1440);
+ keyFilter = bool(json, "key_filter", keyFilter);
}
// A theme push or reset invalidates choices made on the TV. On first use, remember the
// current theme without clearing choices from an older launcher version.
@@@ -240,12 -339,45 +346,45 @@@
Festival festival = json == null ? Festival.NONE : Festival.parse(string(json, "festival", ""),
string(json, "festival_until", ""), string(json, "greeting", ""), string(json, "accent_color", ""));
- return new Config(dock, fillDock, hidden, liveTv, liveTvAction, panelService, panelAction, inputAction,
+ return new Config(dock, fillDock, hidden, liveTv, liveTvAction, packageMap(launchActions), packageMap(appLabels),
+ packageMap(appBanners), panelService,
+ panelAction, inputAction,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
- shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, vpn, homeSettings, showStats, library, background,
+ shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, showNetworkPill, iconOnlyButtons, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, vpn, homeSettings, showStats, library, background,
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
- wallpapers, rotationMinutes, wallpaperDim, applied,
- festival, inputKeycodes, appKeys, keyFilter);
+ wallpapers, rotationMinutes, wallpaperDim, wallpaperOrder, applied,
+ festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow,
- Math.max(0, idleClockMinutes));
++ Math.max(0, idleClockMinutes), keyFilter);
+ }
+
+ /**
+ * {@code "race_calendar": [{"round": 18, "name": "United States Grand Prix", "place": "Austin",
+ * "sessions": [{"name": "FP1", "start": "2026-10-23T17:30:00Z"}, ...]}, ...]}. A race or session that does
+ * not parse is left out on its own; the rest of the calendar still counts.
+ */
+ private static List<RaceWeekend.Race> raceCalendar(JSONObject json) {
+ List<RaceWeekend.Race> races = new ArrayList<>();
+ JSONArray list = json.optJSONArray("race_calendar");
+ if (list == null) return races;
+ for (int i = 0; i < list.length(); i++) {
+ JSONObject r = list.optJSONObject(i);
+ JSONArray sessions = r == null ? null : r.optJSONArray("sessions");
+ if (sessions == null) continue;
+ List<RaceWeekend.Session> parsed = new ArrayList<>();
+ for (int j = 0; j < sessions.length(); j++) {
+ JSONObject s = sessions.optJSONObject(j);
+ if (s == null) continue;
+ String name = s.optString("name", "").trim();
+ try {
+ if (!name.isEmpty()) parsed.add(new RaceWeekend.Session(name, java.time.Instant.parse(s.optString("start", ""))));
+ } catch (java.time.format.DateTimeParseException ignored) {
+ // a session without a readable start time cannot be counted down
+ }
+ }
+ if (!parsed.isEmpty()) races.add(new RaceWeekend.Race(r.optInt("round", 0),
+ r.optString("name", "Grand Prix").trim(), r.optString("place", "").trim(), parsed));
+ }
+ return races;
}
private static void syncThemeChoices(SharedPreferences choices, File dir, File config) {
diff --cc launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
index 218eb0823,538ae432a..cf94de8dd
--- a/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
@@@ -36,7 -37,7 +37,8 @@@ public class HomeKeyService extends Acc
settingsKeycodes = config.settingsKeycodes;
settingsPanel = config.settingsKeyPanel;
appKeys = RemoteKeys.parseAppKeys(config.appKeys);
+ appScancodes = RemoteKeys.parseAppScancodes(config.appKeys);
+ RemoteKeys.applyKeyFilter(this, config.keyFilter);
}
private boolean isSettingsKey(KeyEvent event) {
diff --cc launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
index f51579bd9,cdfc24d01..ec7939c98
--- a/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
@@@ -30,7 -31,7 +31,8 @@@ public class InputKeyService extends Ac
Config config = Config.load(this);
inputKeycodes = config.inputKeycodes;
appKeys = RemoteKeys.parseAppKeys(config.appKeys);
+ appScancodes = RemoteKeys.parseAppScancodes(config.appKeys);
+ RemoteKeys.applyKeyFilter(this, config.keyFilter);
}
private boolean isInputKey(int keyCode) {
diff --cc launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java
index 5816f44d8,92cf977e8..8ee7019e5
--- a/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java
@@@ -55,21 -53,26 +55,41 @@@ final class RemoteKeys
return keys;
}
+ /**
+ * Applies the key_filter choice (config.xml or a theme): when false the service drops
+ * FLAG_REQUEST_FILTER_KEY_EVENTS at runtime, so it stays enabled for nothing but stops filtering.
+ * Some firmware (TCL Google TV on Android 12) drops key auto-repeat once ANY service filters keys:
+ * long-pressing volume then steps once per press. Filtering can only be skipped while the service
+ * runs, since the flag is also declared in the manifest metadata.
+ */
+ static void applyKeyFilter(AccessibilityService service, boolean keyFilter) {
+ if (keyFilter) return;
+ AccessibilityServiceInfo info = service.getServiceInfo();
+ if (info == null) return;
+ info.flags &= ~AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;
+ service.setServiceInfo(info);
+ }
+
+ /**
+ * scancode -> package, from the "scan:490:com.wbd.hbomax" entries of the same list. For remotes that send
+ * several app buttons as one keycode and tell them apart by scancode (Sony BRAVIA: YouTube, Prime Video and
+ * Disney+ are all keycode 196, scancodes 485, 490 and 491). Find it with `getevent -lt` while pressing the
+ * button: the EV_KEY code, in hex. Other entries are skipped; for a scancode listed twice the last entry wins.
+ */
+ static Map<Integer, String> parseAppScancodes(Iterable<String> entries) {
+ Map<Integer, String> keys = new HashMap<>();
+ for (String entry : entries) {
+ if (entry == null) continue;
+ String[] parts = entry.split(":", 3);
+ if (parts.length != 3 || !parts[0].trim().equals("scan") || parts[2].trim().isEmpty()) continue;
+ String code = parts[1].trim();
+ if (!code.matches("[0-9]{1,6}")) continue;
+ int scan = Integer.parseInt(code);
+ if (scan > 0) keys.put(scan, parts[2].trim());
+ }
+ return keys;
+ }
+
/** Opens an app from a remote button: its TV entry if it has one, else its phone entry. */
static void launch(Context ctx, String pkg) {
Intent open = ctx.getPackageManager().getLeanbackLaunchIntentForPackage(pkg);
diff --cc themes/README.md
index 8402b75be,e9ae32cfe..8159049f1
--- a/themes/README.md
+++ b/themes/README.md
@@@ -59,8 -70,11 +70,12 @@@ is ignored, and a file that doesn't par
| `settings_key_keycodes` | list of keycodes | Remote buttons that open Settings, for `HomeKeyService` (TCL Google TV gear: `[83]`) |
| `settings_key_panel` | bool | Those buttons open a small quick settings panel (TV settings, Display, Network, Apps, Launcher settings) instead of the TV's Settings |
| `input_key_keycodes` | list of keycodes | More remote buttons that open the input switcher, for `InputKeyService` (`KEYCODE_TV` and `KEYCODE_TV_INPUT` always do) |
- | `app_keys` | list of strings | Remote buttons that open an app, as `"190:com.google.android.youtube.tv"` or `"KEYCODE_BUTTON_3:com.google.android.youtube.tv"`, for `InputKeyService` or `HomeKeyService` |
+ | `app_keys` | list of strings | Remote buttons that open an app, as `"190:com.google.android.youtube.tv"` or `"KEYCODE_BUTTON_3:com.google.android.youtube.tv"`, or by scancode as `"scan:490:com.wbd.hbomax"` for remotes that share one keycode between app buttons (Sony BRAVIA), for `InputKeyService` or `HomeKeyService` |
+| `key_filter` | bool | `false` makes the key helpers stop filtering keys while staying enabled. Use it on firmware where any key-filtering accessibility service breaks long-press repeat (TCL Google TV on Android 12): the remote buttons above stop working, and volume repeat comes back |
+ | `race_calendar` | list of races | F1 race-weekend mode: from 12 hours before a weekend's first session until 4 hours after the race starts, a panel under the clock shows the next session with a countdown (or the live one) and the weekend's session times in the TV's time zone. Write it with `tools/race_calendar.py <theme folder>`, which fetches the season from the free Jolpica API; the launcher itself never goes online |
+ | `home_idle_clock_minutes` | 0 to 1440 | Minutes Home may sit untouched before it shows the clock screensaver (a thin clock and date drifting over a slow glow, as the system "Clock" screensaver does). Any key returns to Home. It starts only from Home, never over Live TV or an app; 0 is off (default) |
+ | `cinematic_home` | bool | Cinematic top shelf: the focused dock app's artwork, softened, fills the top of the screen in its colour, with a larger name, "Last opened" (apps opened from Home), dock position dots, a focus glow in the app's colour and a translucent dock band; off by default |
+ | `ambient_glow` | bool | The glow behind the dock in the focused app's colour (`true` by default); `false` keeps only `background_color` or the wallpaper, e.g. for a calm photo background |
## Wallpapers