Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
Launcher: an "inputs" app_keys target opens the Inputs menu
Quentin Lecoq3438fe1c7c09
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java b/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.javaindex dd1a8a146..0ef01dbc1 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java@@ -22,13 +22,17 @@ import java.util.function.ToIntFunction;* prefix makes an entry the long-press action instead: "hold:KEYCODE_BUTTON_8:org.xbmc.kodi" opens Kodi when* that button is held for HOLD_MS, while the unprefixed entry still opens on a tap; "hold:scan:490:..." does* the same for a scancode. One set of maps for both services; whichever filters the key first consumes it.- * A target of "input:<input id>" switches to that TV input (an HDMI port) instead of opening an app.+ * A target of "input:<input id>" switches to that TV input (an HDMI port) instead of opening an app, and a target+ * of "inputs" opens the input switcher, for a remote whose source button sends a key Android does not map.*/final class RemoteKeys {/** How long a button is held before its "hold:" entry wins (Android's long-press timeout). */static final long HOLD_MS = 500;+ /** The app_keys target that opens the input switcher, as "scan:365:inputs". */+ static final String INPUTS = "inputs";+private RemoteKeys() { }/** keycode -> package, with key names resolved by Android. */@@ -157,6 +161,16 @@ final class RemoteKeys {* switches to that TV input (an HDMI port) instead. */static void launch(Context ctx, String pkg) {if (pkg == null) return;+ if (INPUTS.equals(pkg)) {+ // This launcher's own Inputs menu, as InputsRequestActivity opens it: addressed to Home directly, so a+ // vendor input picker that also answers VIEW_INPUTS never turns it into a chooser.+ try {+ ctx.startActivity(new Intent(ctx, MainActivity.class).setAction(MainActivity.ACTION_VIEW_INPUTS)+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));+ } catch (ActivityNotFoundException ignored) {+ }+ return;+ }String inputId = inputId(pkg);if (inputId != null) {// The same passthrough URI the Inputs menu opens, which the Live TV app handles.diff --git a/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java b/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.javaindex 2186a2903..66b5bebba 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java@@ -93,4 +93,10 @@ public class RemoteKeysTest {assertEquals("app", RemoteKeys.target("app", null, 5000));assertNull(RemoteKeys.target(null, "hold.app", 0));}++ @Test public void inputsTargetKeptForAScancode() {+ Map<Integer, String> scans = RemoteKeys.parseAppScancodes(Arrays.asList("scan:365:inputs"));+ assertEquals(RemoteKeys.INPUTS, scans.get(365));+ assertNull(RemoteKeys.inputId(RemoteKeys.INPUTS));+ }}diff --git a/themes/README.md b/themes/README.mdindex fd66ad533..e73fb31e6 100644--- a/themes/README.md+++ b/themes/README.md@@ -100,7 +100,7 @@ A new key needs one there in the same pull request.| `settings_fallback_components` | list, `config.xml` only | Vendor screens tried in order when nothing usable answers the standard Settings action (Xiaomi China, TCL/FFALCON, and Fire OS, where the real menu lives in its launcher), each as `package/activity`; the first one whose package is installed wins, and when none is, the standard intent is sent anyway and may open nothing. Fire OS answers that intent with a `CTSDummy` stub, which counts as missing so the fallback runs. A package named here also has to be listed in the launcher's `<queries>` (Android 11 package visibility), so a set whose settings app is neither of these needs a build, not a theme push. Not read from a theme || `restore_key_services` | bool | After a force stop of the launcher, Home puts the remote's accessibility helpers (`HomeKeyService`, `InputKeyService`) back on the enabled list; needs `RESTORE_KEY_SERVICES=1` at install. Off by default || `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`. `"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`). Prefix an entry with `hold:` to make it the long-press action, e.g. `"hold:190:com.netflix.ninja"`, while the unprefixed entry still opens on a tap |+| `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`). `"inputs"` in place of the package opens the Inputs menu, for a remote whose source button sends a key Android does not map, e.g. `"scan:365:inputs"` (TCL 65C745). Prefix an entry with `hold:` to make it the long-press action, e.g. `"hold:190:com.netflix.ninja"`, while the unprefixed entry still opens on a tap || `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 || `gamepad_passthrough` | bool | `true` makes the key helpers stop filtering keys while a game controller is connected, so games see its buttons (Steam Link with an Xbox controller); the remote buttons above do nothing until it disconnects. Needs `key_filter` on. A voice remote that reports a joystick does not count. Off by default || `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`) |