Skip to content

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

Merge PR #479: launcher: stock_home_redirect, for firmware that turns the stock launcher back on (XGIMI)

Gathin23ea6f3c62a680
diff --cc launcher/app/src/main/AndroidManifest.xml
index 6fce9279c,3bd6fd4d5..9b5cdaa5c
--- a/launcher/app/src/main/AndroidManifest.xml
+++ b/launcher/app/src/main/AndroidManifest.xml
@@@ -33,11 -30,13 +33,16 @@@
<action android:name="android.intent.action.MAIN" />
<category android:name="com.gathin.tvhome.category.DOCK_CARD" />
</intent>
+ <!-- stock_home_redirect: HomeKeyService looks up the stock launcher's HOME activity. -->
+ <intent>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.HOME" />
+ </intent>
<!-- China-market MIUI TV firmware: the Settings and Wi-Fi pills fall back to Xiaomi's settings app. -->
<package android:name="com.xiaomi.mitv.settings" />
+ <!-- Coocaa OS sources for the Inputs menu (coocaa_sources); see CoocaaSources. -->
+ <provider android:authorities="com.skyworth.tv.provider" />
+ <provider android:authorities="com.skyworth.tv.sdk.provider" />
</queries>
<application
diff --cc launcher/app/src/main/java/com/gathin/tvhome/Config.java
index 568affeb1,fbb82a302..a63124a01
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@@ -108,9 -86,8 +108,11 @@@ final class Config
final int[] inputKeycodes;
/** Remote buttons that open an app, "keycode:package" or "KEYCODE_NAME:package" (config.xml app_keys). */
final List<String> appKeys;
+ /** Whether the key services request key filtering (config.xml or theme key_filter); false keeps key
+ * auto-repeat working on firmware whose AccessibilityInputFilter drops repeats (TCL Android 12). */
+ final boolean keyFilter;
+ /** Stock launcher whose home screen is sent back here if the firmware revives it (config.xml stock_home_redirect). */
+ final String stockHomeRedirect;
/** The Settings button opens the quick settings panel instead of the TV's Settings (settings_key_panel). */
final boolean settingsKeyPanel;
/** Whether themes may show a wallpaper (config.json, wallpaper). */
@@@ -134,26 -106,20 +136,27 @@@
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, 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,
+ String liveTvAction, String liveTvInputId, Map<String, String> launchActions, Map<String, String> appLabels,
+ Map<String, String> appBanners, String sourcePanelService, String sourcePanelAction,
+ String sourcePanelExtra, boolean coocaaSources, String inputAction,
+ String inputUriScheme, int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,
+ 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,
+ int wallpaperRotationMinutes, int wallpaperDim, String wallpaperOrder, boolean overlayApplied,
- Festival festival, int[] inputKeycodes, List<String> appKeys,
+ Festival festival, int[] inputKeycodes, List<String> appKeys, String stockHomeRedirect,
- List<RaceWeekend.Race> raceCalendar, boolean cinematicHome) {
+ List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes,
+ boolean keyFilter) {
this.inputKeycodes = inputKeycodes;
this.appKeys = Collections.unmodifiableList(appKeys);
+ this.keyFilter = keyFilter;
+ this.stockHomeRedirect = stockHomeRedirect;
this.dockApps = Collections.unmodifiableList(dockApps);
this.fillDock = fillDock;
this.hiddenApps = Collections.unmodifiableList(hiddenApps);
@@@ -257,10 -200,8 +260,11 @@@
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)));
+ String stockHomeRedirect = res.getString(R.string.stock_home_redirect).trim();
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);
@@@ -311,10 -241,8 +315,11 @@@
settingsKeyPanel = bool(json, "settings_key_panel", settingsKeyPanel);
inputKeycodes = intArray(json, "input_key_keycodes", inputKeycodes);
appKeys = stringList(json, "app_keys", appKeys);
+ stockHomeRedirect = string(json, "stock_home_redirect", stockHomeRedirect);
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.
@@@ -366,15 -289,14 +371,15 @@@
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, packageMap(launchActions), packageMap(appLabels),
+ return new Config(dock, fillDock, hidden, liveTv, liveTvAction, liveTvInputId, packageMap(launchActions), packageMap(appLabels),
packageMap(appBanners), panelService,
- panelAction, inputAction,
+ panelAction, panelExtra, coocaaSources, inputAction, inputUriScheme,
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, stockHomeRedirect, json == null ? Collections.emptyList() : raceCalendar(json), cinematic);
+ wallpapers, rotationMinutes, wallpaperDim, wallpaperOrder, applied,
- festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow,
++ festival, inputKeycodes, appKeys, stockHomeRedirect, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow,
+ Math.max(0, idleClockMinutes), keyFilter);
}
/**
diff --cc launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
index 063f4ffab,4ad416501..534a6a0a4
--- a/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
@@@ -1,11 -1,9 +1,13 @@@
package com.gathin.tvhome;
import android.accessibilityservice.AccessibilityService;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.UserManager;
+ import android.content.pm.PackageManager;
+ import android.content.pm.ResolveInfo;
import android.provider.Settings;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;
@@@ -30,10 -33,8 +37,12 @@@ public class HomeKeyService extends Acc
private boolean settingsPanel;
/** app_keys, the same map InputKeyService reads, for setups that run only this service. */
private Map<Integer, String> appKeys = Collections.emptyMap();
+ private Map<Integer, String> appScancodes = Collections.emptyMap();
+
+ /** Waits for the user to unlock when Android binds this service at boot; null once the config is read. */
+ private BroadcastReceiver unlockReceiver;
+ /** The stock launcher's HOME activities (stock_home_redirect), disabled ones included. */
+ private final Set<String> stockHome = new HashSet<>();
@Override
protected void onServiceConnected() {
@@@ -80,8 -45,13 +89,15 @@@
settingsKeycodes = config.settingsKeycodes;
settingsPanel = config.settingsKeyPanel;
appKeys = RemoteKeys.parseAppKeys(config.appKeys);
+ appScancodes = RemoteKeys.parseAppScancodes(config.appKeys);
+ RemoteKeys.applyKeyFilter(this, config.keyFilter);
+ stockHome.clear();
+ if (!config.stockHomeRedirect.isEmpty()) {
+ Intent home = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME).setPackage(config.stockHomeRedirect);
+ for (ResolveInfo ri : getPackageManager().queryIntentActivities(home, PackageManager.MATCH_DISABLED_COMPONENTS)) {
+ stockHome.add(ri.activityInfo.name);
+ }
+ }
}
private boolean isSettingsKey(KeyEvent event) {
diff --cc themes/README.md
index fbef9a935,cd10fac94..07cec607e
--- a/themes/README.md
+++ b/themes/README.md
@@@ -74,13 -62,10 +74,15 @@@ 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"`, 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 |
+| `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`. `"input:<input id>"` in place of the package switches to a TV input instead, e.g. `"scan:227:input:com.tcl.tvinput/.passthroughinput.TvPassThroughService/HW1413744640"` for an HDMI port (ids from `dumpsys tv_input`) |
+ | `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` |
+ | `stock_home_redirect` | string | Stock launcher package; if the firmware turns it back on (XGIMI), its home screen is sent straight back here (`HOME_KEY_SERVICE=1`) |
| `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