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
docs: the G03 list's second unit has another remote, and its app buttons need app_keys (#791)
xbsheng67b275035a84
diff --git a/examples/README.md b/examples/README.mdindex b27d8ceaa..c17507851 100644--- a/examples/README.md+++ b/examples/README.md@@ -152,7 +152,7 @@ on that firmware, grouped and commented. These are starting points: comment out| `tcl-c89b-google-tv/` | TCL C89B 85", 2024, a local variant of the C855 (G08, G08_4K_GB, MediaTek tcl9618) | Google TV 14 | Same product and build as the 85RM7L list (UTT2.250416.001 AU02), plus T-Cast, TCL HOME (com.tcl.dashboard), game bar, hearing test, T-solo, the Google TV storefront and the Android 14 ad services; Chromecast, AirPlay, Miracast, Assistant and USB media kept; launcherx + setupwraith off for the launcher (on Ethernet; setupwraith owned no network); config.json maps the gear (83) and the Netflix, Prime Video and YouTube buttons (4062, 4099, 190); HomeKeyService needs AUTO_START plus `appops write-settings` to bind after a restart; one day of use || `tcl-qm6k-google-tv/` | TCL QM6K Pro, 2025 (G08, MediaTek tcl9618) | Google TV 14 | Samba TV ACR (ttvs), TCL TV+, TCL Live, store/hotel demo; setupwraith must go for a custom launcher (also AU14, #23); a QM7 (2024) owner ran this list with seven extra packages — [deltas and a hung Cast receiver](../docs/devices/tcl-75qm751g-qm7.md) || `tcl-g07-google-tv/` | TCL Smart TV (G07, G07_4K_GB_NF, Realtek RTD2851A, 2 GB) | Google TV 11 | TCL BI analytics (ttvs, also the firmware updater), TGuard, waterfall, TCL Live, TCL Home dashboard, messages, hotel/demo, partner auto-installs; voice, Miracast, MagiConnect, T-Solo, firmware updates and unused preloads off by choice, Chromecast kept; launcherx, setupwraith and dreamx off (Wi-Fi belonged to android.uid.system), reboot-checked; Input key works without InputKeyService, gear is scancode 561 (`settings_key_scancodes`), Netflix and YouTube buttons need an accessibility helper |-| `tcl-g03-google-tv/` | TCL Smart TV Pro (G03, G03_4K_GB, BeyondTV4, Realtek R51MT05, V8-R51MT05-LF1V620), Middle East firmware | Google TV 11 | Same platform as tcl-43c645: TCL BI analytics and logkit, promo rows (TCL Channel, BrowseHere), dashboard, messages, partner auto-installs; streaming apps, voice, Chromecast, Miracast/T-Cast, USB player, game bar, TCL Live off by choice, firmware updates kept; launcherx, setupwraith and dreamx off (setupwraith owned the Wi-Fi: forget and re-join first), reboot-checked; Input key works without InputKeyService, gear is keycode 4077 (`settings_key_keycodes`), config.json sets Live TV to com.tcl.tv |+| `tcl-g03-google-tv/` | TCL Smart TV Pro (G03, G03_4K_GB, BeyondTV4, Realtek R51MT05, V8-R51MT05-LF1V620), Middle East firmware | Google TV 11 | Same platform as tcl-43c645: TCL BI analytics and logkit, promo rows (TCL Channel, BrowseHere), dashboard, messages, partner auto-installs; streaming apps, voice, Chromecast, Miracast/T-Cast, USB player, game bar, TCL Live off by choice, firmware updates kept; launcherx, setupwraith and dreamx off (setupwraith owned the Wi-Fi: forget and re-join first), reboot-checked; Input key works without InputKeyService, gear is keycode 4077 (`settings_key_keycodes`), config.json sets Live TV to com.tcl.tv; a second unit on the same build ships a Bluetooth TCL_RC902V_M1 remote whose Netflix/YouTube/Prime buttons die with launcherx and come back from `app_keys` (in config.json, verified with the real remote) || `tcl-g05-google-tv/` | TCL Smart TV Pro (G05, G05_4K_US, MediaTek MT5889) | Google TV 11 | TCL Channel, waterfall, ttvs BI, TGuard; Quick Panel off by choice; setupwraith returned after a reboot, launcher half unverified || `tcl-g09-google-tv/` | TCL Smart TV Pro (G09, G09_4K_GB, Amlogic T5M, 2 GB), UK firmware, Brazil | Google TV 12 | TCL BI analytics, log upload, TIAS, TGuard, waterfall, TCL Live FAST channels, home-screen pushes, messages, store demo, hotel mode, partner auto-installs; Chromecast and USB media player off by choice; firmware updates come through Play Services, so ttvs can go; launcherx, setupwraith and dreamx off, reboot-checked; Input key works without InputKeyService; config.json has the dock || `tcl-uniontv-latin-america/` | TCL UnionTV, Latin America (TCL-built like Thomson 32HE5800, Realtek RT2841) | Android TV 9 | TCL BI analytics, promo rows/partner customizer, app store, cleaner, user center; Ambient Mode, TTS, TalkBack and voice off; Chromecast and firmware updater kept; standby (STR) takes Ethernet down, no network wake |diff --git a/examples/tcl-g03-google-tv/config.json b/examples/tcl-g03-google-tv/config.jsonindex e7de56ea5..2ba555e03 100644--- a/examples/tcl-g03-google-tv/config.json+++ b/examples/tcl-g03-google-tv/config.json@@ -3,5 +3,10 @@"settings_key_keycodes": [4077],- "settings_key_panel": true+ "settings_key_panel": true,+ "app_keys": [+ "KEYCODE_TCL_NETFLIX:com.netflix.ninja",+ "KEYCODE_TCL_YOUTUBE:com.google.android.youtube.tv",+ "4099:com.amazon.amazonvideo.livingroom"+ ]}diff --git a/examples/tcl-g03-google-tv/debloat.txt b/examples/tcl-g03-google-tv/debloat.txtindex 6ac0c022f..0b0e02780 100644--- a/examples/tcl-g03-google-tv/debloat.txt+++ b/examples/tcl-g03-google-tv/debloat.txt@@ -16,9 +16,11 @@## Stock launcher: com.google.android.apps.tv.launcherx. Live TV / HDMI: com.tcl.tv (TVActivity) with inputs from# com.tcl.tvinput (tuner, HDMI 1-3, AV). The launcher's default live_tv_package is MediaTek's, so the Inputs menu-# has no Live TV row until a theme sets "live_tv_package": "com.tcl.tv". config.json in this folder sets it-# and the gear button below; push it with: TV_HOST=<tv ip> tools/theme.sh examples/tcl-g03-google-tv-# Already disabled at the factory: au.com.stan.and (Stan), tv.wuaki.apptv (Rakuten TV).+# has no Live TV row until a theme sets "live_tv_package": "com.tcl.tv". config.json in this folder sets it,+# the gear button and the app buttons described under "Second unit" below; push it with:+# TV_HOST=<tv ip> tools/theme.sh examples/tcl-g03-google-tv+# Already disabled at the factory: au.com.stan.and (Stan), tv.wuaki.apptv (Rakuten TV); the second unit below+# also had com.tcl.smartalexa off at the factory.## Before batch 6 (setupwraith): on this unit the Wi-Fi saved during first setup belonged to setupwraith# (`dumpsys wifi | grep -o 'cname=[^ ]*'`), so disabling it would have deleted the network. Forgetting the@@ -33,6 +35,22 @@# "settings_key_panel": true it opens the launcher's quick settings panel over any app.# - `input keyevent SETTINGS` opens Android's version easter egg here; inject 176 instead.#+# Second unit, 2026-10-21, same AR09 build, applied in the batches below with a screenshot after each and then+# rebooted with launcherx off: the list minus Netflix and Prime Video, minus the factory-off smartalexa, plus+# launcherx (38 packages) stayed disabled, and HDMI, Netflix playback, the remote and Wi-Fi all worked.+# AdGuard's Private DNS (private_dns_mode hostname) changed nothing for playback. Two things differ:+# - Its Bluetooth remote is "TCL_RC902V_M1" (also /dev/input/event3, Generic.kl), not the "TCL_RC902V_MM" above.+# Netflix (HID 0x0c0051, TCL_NETFLIX), YouTube (0x0c0057, TCL_YOUTUBE) and Prime Video (0x0c005f, keycode+# 4099) are broadcasts only launcherx answers, so all three do nothing once it is off. `getevent -lt` prints+# the HID usage and the Linux key under each button, which is how the two remotes are told apart.+# - HOME_KEY_SERVICE=1 with the app_keys in config.json brings all three back (verified with the real remote;+# a button whose app you disabled still opens nothing). Gear is keycode 4077 on this remote too, so+# settings_key_keycodes and settings_key_panel above apply unchanged.+# setupwraith owned the Wi-Fi on this unit as well, and this order worked: forget and re-join the network,+# disable setupwraith while launcherx still owns Home, run launcher/build-and-install.sh, switch the+# screensaver, then disable dreamx. Home landed on the new launcher straight away (mFocusedApp checked), with+# no RecoveryActivity in between.+## DO NOT DISABLE: com.tcl.tv, com.tcl.tvinput (Live TV, tuner, HDMI/AV), com.tcl.suspension (Quick panel and the# Input key's source panel), com.tcl.settings, com.tcl.system.server, com.tcl.providers.config, com.tcl.initsetup,# com.tcl.factory.view, com.tcl.tcl_bt_rcu_service, com.tcl.autopair (remote), com.tcl.inputmethod.internationaldiff --git a/tests/test_tcl_g03_theme_config.py b/tests/test_tcl_g03_theme_config.pynew file mode 100644index 000000000..b8d7f3736--- /dev/null+++ b/tests/test_tcl_g03_theme_config.py@@ -0,0 +1,83 @@+"""Checks the example theme files that no other test reads.++`examples/*/config.json` is what `tools/theme.sh` pushes to a TV, so a typo in `app_keys` reaches the+device as a button that silently opens nothing. This pins the G03 file, which now carries the three+app buttons from the second unit in #791: the mappings have to be well formed, point at apps that+exist (listed here, or the vendor YouTube app), and keep the Live TV and gear settings they sit next to.+The debloat header is prose and is deliberately not matched here.+"""+import json+import re+from pathlib import Path+import unittest+++ROOT = Path(__file__).resolve().parents[1]+EXAMPLE = ROOT / "examples" / "tcl-g03-google-tv"+CONFIG_PATH = EXAMPLE / "config.json"+LIST_PATH = EXAMPLE / "debloat.txt"++APP_KEY = re.compile(r"^(KEYCODE_[A-Z0-9_]+|[0-9]+):(.+)$")+PACKAGE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z0-9_]+)+$")+# Buttons that #791 mapped. Netflix and Prime Video are in the list; YouTube is the kept system app.+EXPECTED = {+ "com.netflix.ninja",+ "com.amazon.amazonvideo.livingroom",+ "com.google.android.youtube.tv",+}+++def listed_packages():+ packages = []+ for line in LIST_PATH.read_text(encoding="utf-8").split("\n"):+ body = line.split("#", 1)[0].strip()+ if body:+ packages.append(body)+ return packages+++class G03ThemeTest(unittest.TestCase):+ def setUp(self):+ self.config = json.loads(CONFIG_PATH.read_text(encoding="utf-8"))+ self.app_keys = self.config.get("app_keys") or []++ def test_app_keys_are_keycode_package_pairs(self):+ self.assertTrue(self.app_keys, "the second unit's three buttons live here")+ for entry in self.app_keys:+ with self.subTest(entry=entry):+ match = APP_KEY.match(entry)+ self.assertIsNotNone(match, "expected keycode:package, or scan:code:package for scancode remotes")+ assert match is not None+ self.assertRegex(match.group(2), PACKAGE)++ def test_app_keys_open_the_three_buttons(self):+ targets = set()+ for entry in self.app_keys:+ match = APP_KEY.match(entry)+ self.assertIsNotNone(match, entry)+ assert match is not None+ targets.add(match.group(2))+ self.assertEqual(targets, EXPECTED,+ "Netflix, YouTube and Prime Video are the buttons the M1 remote stopped sending")+ keycodes = {entry.split(":", 1)[0] for entry in self.app_keys}+ self.assertTrue({"KEYCODE_TCL_NETFLIX", "KEYCODE_TCL_YOUTUBE"} <= keycodes,+ "the vendor keycodes are what getevent -lt reports for those buttons")++ def test_no_keycode_is_mapped_twice(self):+ keycodes = [entry.split(":", 1)[0] for entry in self.app_keys]+ self.assertEqual(sorted(keycodes), sorted(set(keycodes)), "one button, one app")++ def test_mapped_apps_are_the_ones_this_list_knows(self):+ listed = listed_packages()+ self.assertIn("com.netflix.ninja", listed, "a mapping to an app the list does not list or keep is a dead button")+ self.assertIn("com.amazon.amazonvideo.livingroom", listed)+ self.assertIn("com.google.android.youtube.tv", EXPECTED, "YouTube is preinstalled and kept")++ def test_keeps_the_live_tv_and_gear_settings(self):+ self.assertEqual(self.config["live_tv_package"], "com.tcl.tv")+ self.assertEqual(self.config["settings_key_keycodes"], [4077])+ self.assertTrue(self.config["settings_key_panel"])+++if __name__ == "__main__":+ unittest.main()