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: home_ignore_channel_keys, so a channel key on Home does not open Live TV
djlex1f8ce4997c7b
diff --git a/docs/switches.md b/docs/switches.mdindex d497df982..0c97ea111 100644--- a/docs/switches.md+++ b/docs/switches.md@@ -36,6 +36,7 @@ rule sit on its wanted list until a screenshot arrives.| `home_idle_clock_minutes` | <img src="clock-screensaver.png" width="320" alt="home_idle_clock_minutes on a TV"> || `back_opens_clock` | <img src="switches/back_opens_clock.jpg" width="320" alt="back_opens_clock on a TV"> || `gamepad_passthrough` | <img src="switches/gamepad_passthrough.jpg" width="320" alt="gamepad_passthrough on a TV"> |+| `home_ignore_channel_keys` | <img src="switches/home_ignore_channel_keys.png" width="320" alt="home_ignore_channel_keys on a TV"> || `consume_volume_keys` | <img src="switches/consume_volume_keys.jpg" width="320" alt="consume_volume_keys on a TV"> || `wifi_status_warnings` | <img src="switches/wifi_status_warnings.jpg" width="320" alt="wifi_status_warnings on a TV"> || `top_bar_apps` | <img src="switches/top_bar_apps.jpg" width="320" alt="top_bar_apps on a TV"> |diff --git a/docs/switches/home_ignore_channel_keys.png b/docs/switches/home_ignore_channel_keys.pngnew file mode 100644index 000000000..652417323Binary files /dev/null and b/docs/switches/home_ignore_channel_keys.png differdiff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex feb5a8166..1ae0abfe4 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -179,6 +179,8 @@ final class Config {final boolean gamepadPassthrough;/** With keyFilter on, the key services swallow Volume Up/Down and repeat a held one themselves (consume_volume_keys). */final boolean consumeVolumeKeys;+ /** Channel Up/Down do nothing while Home is in front, instead of opening the TV's Live TV app. */+ final boolean homeIgnoreChannelKeys;/** Stock launcher whose home screen is sent back here if the firmware revives it (config.xml stock_home_redirect). */final String stockHomeRedirect;/** A Live TV window the firmware opens by itself at power-on is sent back to Home (power_on_home). */@@ -291,7 +293,7 @@ final class Config {List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, boolean appGlow, boolean fadeRows, int homeIdleClockMinutes,boolean keyFilter, boolean dockGlass, String glowStyle, boolean wallpaperCaptions,boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding, boolean dockBand, boolean cinematicDots, boolean cinematicWhiteFocus, boolean wifiStatusColor, int cinematicScrim, int cinematicArt,- Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly, boolean inputsCecStateOnly,+ Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean homeIgnoreChannelKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly, boolean inputsCecStateOnly,int openOnStartNetworkWait, boolean openOnStartOnWake, boolean iconOnlyVpn, String clockFormat, boolean backOpensClock, boolean glowSnap) {this.handleViewInputs = handleViewInputs;this.tileMenu = tileMenu;@@ -389,6 +391,7 @@ final class Config {this.wallpaperMoods = wallpaperMoods;this.gamepadPassthrough = gamepadPassthrough;this.consumeVolumeKeys = consumeVolumeKeys;+ this.homeIgnoreChannelKeys = homeIgnoreChannelKeys;this.powerOnHome = powerOnHome;this.homeLongPressHome = homeLongPressHome;this.powerOnHomeAlways = powerOnHomeAlways;@@ -508,6 +511,7 @@ final class Config {boolean keyFilter = res.getBoolean(R.bool.key_filter);boolean gamepadPassthrough = res.getBoolean(R.bool.gamepad_passthrough);boolean consumeVolumeKeys = res.getBoolean(R.bool.consume_volume_keys);+ boolean homeIgnoreChannelKeys = res.getBoolean(R.bool.home_ignore_channel_keys);boolean powerOnHome = res.getBoolean(R.bool.power_on_home);boolean homeLongPressHome = res.getBoolean(R.bool.home_long_press_home);boolean powerOnHomeAlways = res.getBoolean(R.bool.power_on_home_always);@@ -622,6 +626,7 @@ final class Config {keyFilter = bool(json, "key_filter", keyFilter);gamepadPassthrough = bool(json, "gamepad_passthrough", gamepadPassthrough);consumeVolumeKeys = bool(json, "consume_volume_keys", consumeVolumeKeys);+ homeIgnoreChannelKeys = bool(json, "home_ignore_channel_keys", homeIgnoreChannelKeys);powerOnHome = bool(json, "power_on_home", powerOnHome);homeLongPressHome = bool(json, "home_long_press_home", homeLongPressHome);powerOnHomeAlways = bool(json, "power_on_home_always", powerOnHomeAlways);@@ -712,7 +717,7 @@ final class Config {json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow, appGlow, fadeRows,Math.max(0, idleClockMinutes), keyFilter, dockGlass, glowStyle, wallpaperCaptions, handleViewInputs, tileMenu, dockEvenPadding,dockBand, cinematicDots, cinematicWhiteFocus, wifiStatusColor, cinematicScrim, cinematicArt, wallpaperMoods, gamepadPassthrough,- consumeVolumeKeys, powerOnHome, homeLongPressHome, wifiStatusWarnings, topBarApps, showGreeting, headerWhite, clockWallpaper,+ consumeVolumeKeys, homeIgnoreChannelKeys, powerOnHome, homeLongPressHome, wifiStatusWarnings, topBarApps, showGreeting, headerWhite, clockWallpaper,Math.max(0, Math.min(90, clockWallpaperDim)), clockGlow, glassStyle, singleRow && dockRow, dockBandAll, lunar, lunarOffset,dateBelowClock, vpnPill, locale, powerOnHomeAlways, inputsConnectedOnly, inputsCecStateOnly,Math.max(0, Math.min(600, openOnStartNetworkWait)), openOnStartOnWake, iconOnlyVpn, clockFormat, backOpensClock, glowSnap);diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex 870ca5168..76251f1f3 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -119,6 +119,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {*/private static final long TIME_VALID_AFTER_MS = 1_735_689_600_000L;private String liveTvPkg;+ private boolean homeIgnoreChannelKeys;/** Launcher settings' change count this Home was built with (see onResume). */private long settingsRevision;/** Idle time on Home before ClockActivity; 0 is off (config.xml, home_idle_clock_minutes). */@@ -481,6 +482,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {festival = cfg.festival;festive = festival.active(LocalDate.now());liveTvPkg = cfg.liveTvPackage;+ homeIgnoreChannelKeys = cfg.homeIgnoreChannelKeys;idleClockMs = cfg.homeIdleClockMinutes * MINUTE_MS;backOpensClock = cfg.backOpensClock;bootToLiveTv = cfg.bootToLiveTv;@@ -1419,6 +1421,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {*/@Overridepublic boolean dispatchKeyEvent(KeyEvent event) {+ if (homeIgnoreChannelKeys && RemoteKeys.isChannelKey(event.getKeyCode())) return true;// Vendor keys (TCL Netflix button, 4062) never reach the key services, only the focused window, so their// "hold:" entries run here too or nowhere. Only while resumed: onPause releases Home's holds, and a DOWN// taken after that would arm one nothing releases.diff --git a/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java b/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.javaindex f25bf8f71..2f6fec37b 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/RemoteKeys.java@@ -303,6 +303,11 @@ final class RemoteKeys {*/static final int XIAOMI_SHORT_MENU_FLAGS = 0x7531;+ /** Channel Up or Down, for home_ignore_channel_keys. */+ static boolean isChannelKey(int keyCode) {+ return keyCode == KeyEvent.KEYCODE_CHANNEL_UP || keyCode == KeyEvent.KEYCODE_CHANNEL_DOWN;+ }+/** True for the UP that ends a Menu press: not cancelled, or cancelled only as Xiaomi's injected short press is. */static boolean menuReleased(int action, int flags) {if (action != KeyEvent.ACTION_UP) return false;diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 2255d16f0..5909262de 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -141,6 +141,12 @@the helper's own. Leave it off where a tap is one step. A theme can set it ("consume_volume_keys"). --><bool name="consume_volume_keys">false</bool>+ <!-- true: Channel Up/Down do nothing while Home is in front. Unhandled, they open the TV's Live TV app (Sony+ BRAVIA, Android 9: com.sony.dtv.tvx), which is a stray press on a set nobody watches broadcast on. Inside any+ other app the keys go on as before, and no key helper is needed. A theme can set it+ ("home_ignore_channel_keys"). -->+ <bool name="home_ignore_channel_keys">false</bool>+<!-- Vendor source numbers for the Inputs menu, "HW<n>=<number>" by the framework input id's last part(`tools/tv.py 'dumpsys tv_input'` lists them). A mapped input opens by sending input_action with thenumber as the int extra "input"; "HW<n>=-" leaves a port the board reports but the set does not havediff --git a/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java b/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.javaindex adf081de4..5b734d94e 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/RemoteKeysTest.java@@ -321,4 +321,11 @@ public class RemoteKeysTest {assertFalse(RemoteKeys.menuReleased(1, 0x20 | 0x100 | 0x8));assertFalse(RemoteKeys.menuReleased(1, RemoteKeys.XIAOMI_SHORT_MENU_FLAGS & ~0x4000));}++ @Test public void channelKeysAreChannelUpAndDownOnly() {+ assertTrue(RemoteKeys.isChannelKey(166)); // KEYCODE_CHANNEL_UP+ assertTrue(RemoteKeys.isChannelKey(167)); // KEYCODE_CHANNEL_DOWN+ assertFalse(RemoteKeys.isChannelKey(170)); // KEYCODE_TV+ assertFalse(RemoteKeys.isChannelKey(24)); // KEYCODE_VOLUME_UP+ }}diff --git a/themes/README.md b/themes/README.mdindex fe2014389..a373bea57 100644--- a/themes/README.md+++ b/themes/README.md@@ -166,6 +166,7 @@ A new key needs one there in the same pull request.| `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`); the switch asks `live_tv_package` first, so set it, or an app that also claims the channel URI (a file manager on a TCL G03) can take the press and turn it into a chooser, while `input_uri_scheme` and `input_action` shape the Inputs rows and a tile's `launch_actions` rather than this target. `"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). An action word in place of the package runs that action: `back`, `home`, `recents`, `mute`, `sleep` (standby, Android 9 and later), `screensaver`, `settings`, `wifi`, `library` (Home with the App library open, for a remote's Apps button, `"284:library"`; needs `app_library`) or `ignore` (swallows the button so it does nothing, for a shortcut pressed by accident), e.g. `"KEYCODE_PROG_YELLOW:mute"` or `"scan:586:ignore"`. 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. Prefix it with `front:` for what a tap does while the button's own app is already in front (`HomeKeyService` only), and use `"guide:<package>"` as a target to open that Live TV app's program guide: `"172:com.vt.tv.tvcenter"` with `"front:172:guide:com.vt.tv.tvcenter"` opens Live TV, then its guide, on a Hisense hengshan set whose firmware sends the Live TV button (`KEYCODE_GUIDE`) only to the stock launcher || `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, Moonlight with two controllers); 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 |+| `home_ignore_channel_keys` | bool | `true` makes Channel Up/Down do nothing while Home is in front, where they would otherwise open the TV's Live TV app (Sony BRAVIA, Android 9). Inside other apps the keys work as before, and no key helper is needed. Off by default. || `consume_volume_keys` | bool | `true` makes the key helpers swallow Volume Up/Down and repeat a held one themselves (after 500 ms, every 60 ms). Use it on firmware that applies a volume key both before the helper and when the helper hands it back, so one tap moves two steps (TCL G03 / BeyondTV4, Android 11, #1100). Needs `key_filter` on. 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`). The Home-key half (a stock home already on screen when Home is pressed, #1116) needs `key_filter` on: with `key_filter: false` it stays on the stock home until another app opens (#2779) || `power_on_home` | bool | For firmware that opens the Live TV app (`live_tv_package`) by itself at every power-on (Changhong / Homwee): until the first key press after boot or screen-on, that Live TV window is sent back to Home (`HOME_KEY_SERVICE=1`). Ignored with `boot_to_live_tv`, or with Live TV as the Open on start app. Off by default |