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
examples: the LS800 folder ships no restore script, and no list folder can
xbshengc46e8464f826
diff --git a/docs/workflows/tv-list.md b/docs/workflows/tv-list.mdindex c44648875..cc904e7e6 100644--- a/docs/workflows/tv-list.md+++ b/docs/workflows/tv-list.md@@ -40,6 +40,8 @@before building. `tests/test_shipped_config_keys_are_read.py` holds every shipped `config.json` to thetable. Do not add install or restore scripts, Private DNS or AdGuard setup, or `pm uninstall` steps: thefolder only disables, and `tools/disable.sh` and `tools/restore.sh` do the rest.+ `tests/test_list_folders_ship_lists_only.py` holds every folder under `examples/` to that, so a script+ in the folder is a red suite rather than a second answer to the undo every list already has.A model with notes but no several-day list goes in `docs/devices/<brand-model>.md`, with one line under the noteslist at the end of `examples/README.md`. A folder in `examples/` must have packages in it.diff --git a/examples/epson-ls800/README.md b/examples/epson-ls800/README.mdindex 22bd8047a..cd25bd1f1 100644--- a/examples/epson-ls800/README.md+++ b/examples/epson-ls800/README.md@@ -8,7 +8,6 @@ launcher as Home. Tested on 21 October 2026.|---|---|| `debloat.txt` | The 9 packages that were disabled, grouped and commented, with what to keep and why (`build-and-install.sh` disables the stock launcher on top) || `config.json` | Dock order and hidden tiles; push it with `tools/theme.sh` |-| `restore.sh` | Undo everything below in one go |All commands run from the repo root, with the projector's IP in `TV_HOST`.@@ -54,12 +53,21 @@ Projector Settings → Information → Projector Operation Log Information, notTV_HOST=<projector-ip> tools/tv.py 'pm enable com.instagram.airwave'```-Use the package name from `debloat.txt`. To put everything back, the launcher included:+Use the package name from `debloat.txt`. To put everything back, the shared tools do each part:```bash-TV_HOST=<projector-ip> examples/epson-ls800/restore.sh # add --uninstall-launcher to remove it too+# The list, and the stock launcher with it+TV_HOST=<projector-ip> tools/restore.sh examples/epson-ls800/debloat.txt com.google.android.tvlauncher+# The theme this folder pushed+TV_HOST=<projector-ip> tools/theme.sh --reset+# The Inputs names set above+TV_HOST=<projector-ip> tools/tv.py 'settings delete secure tv_input_custom_labels'```+`tools/restore.sh` leaves the new launcher installed, as it does for every list; take it off from the+projector's Settings → Apps if you want it gone. A list folder ships no script of its own: the folders+that carried one were trimmed to the shared tools ([#1717](https://github.com/Gathin23/cleanyourtv/pull/1717)).+## Change the dock or the wallpaperEdit `dock_apps` in `config.json` (four package names, left to right; `tools/tv.py 'pm list packages'`diff --git a/examples/epson-ls800/restore.sh b/examples/epson-ls800/restore.shdeleted file mode 100755index e79b87a22..000000000--- a/examples/epson-ls800/restore.sh+++ /dev/null@@ -1,22 +0,0 @@-#!/usr/bin/env bash-# Put an Epson LS800 back the way it came: re-enable every package in debloat.txt, give Home back to the-# stock launcher, and undo the extras from examples/epson-ls800/README.md (input names, theme).-# The Projector Operation Log toggle (Projector Settings > Information) is not touched; switch it back on-# there if you want it.-#-# Usage, from the repo root: TV_HOST=<projector ip> examples/epson-ls800/restore.sh [--uninstall-launcher]-set -euo pipefail-cd "$(dirname "$0")/../.."-: "${TV_HOST:?set TV_HOST to the projector IP address}"-PY=tools/venv/bin/python-[ -x "$PY" ] || PY=tools/venv/Scripts/python.exe-tv() { "$PY" -I tools/tv.py "$@"; }--tools/restore.sh examples/epson-ls800/debloat.txt com.google.android.tvlauncher-tools/theme.sh --reset || true-tv 'settings delete secure tv_input_custom_labels'-if [ "${1:-}" = --uninstall-launcher ]; then- tv 'pm uninstall com.gathin.tvhome'-fi-tv 'cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME | tail -n 1'-echo "Restored. Press Home on the remote; restart the projector if the old home screen does not come up."diff --git a/tests/test_list_folders_ship_lists_only.py b/tests/test_list_folders_ship_lists_only.pynew file mode 100644index 000000000..2279ce4b8--- /dev/null+++ b/tests/test_list_folders_ship_lists_only.py@@ -0,0 +1,157 @@+"""A folder under `examples/` ships a list and its notes, never a script of its own.++`docs/workflows/tv-list.md` step 6 is the recipe a list PR follows, and it says: "Do not add install or+restore scripts, Private DNS or AdGuard setup, or `pm uninstall` steps: the folder only disables, and+`tools/disable.sh` and `tools/restore.sh` do the rest." `AGENTS.md`'s hard rules ("no install or restore+scripts, inside a list folder") and `docs/DOS-AND-DONTS.md`'s Don't column say the same, and+`.github/maintainer/MAINTAINER.md` names `pm uninstall` steps in a list folder as rework.++`examples/epson-ls800` was the one folder that did not keep to it. Its `restore.sh` re-enabled the list,+reset the theme and rewrote the Inputs labels in one command, and it also ran+`pm uninstall com.gathin.tvhome` behind `--uninstall-launcher` - an uninstall, in a script, in a list+folder. The folder's own `debloat.txt` already named `tools/restore.sh examples/epson-ls800/debloat.txt+com.google.android.tvlauncher` as its undo, so the script was a second, drifting answer to a question the+shared tool answers, and the only executable file in `examples/` (`git ls-files -s examples` has it as+100755 and nothing else). Two folders were trimmed the same way before - `examples/tcl-43c645` in #1717 and+`examples/benq-gv32` - and no check read a folder for a script, so this one stayed.++So the rule is checked here instead of trusted: no file under `examples/` that a shell or PowerShell on+the reader's computer runs, at any depth, and no file in `examples/` committed executable. A stand-in tree+written in the test holds the walk itself: a folder with `restore.sh`, a script one level down, a Windows+`.ps1` and a script beside the list are each reported, and a folder carrying only what a list folder ships+is quiet.++Run from the repository root: python3 -m unittest discover -s tests -v+"""+import subprocess+import tempfile+import unittest+from pathlib import Path++ROOT = Path(__file__).resolve().parents[1]+EXAMPLES = ROOT / "examples"+RECIPE = ROOT / "docs" / "workflows" / "tv-list.md"++# The suffixes a shell on the reader's computer runs without being asked twice.+SCRIPT_SUFFIXES = (".sh", ".bash", ".zsh", ".fish", ".ps1", ".bat", ".cmd")++# What step 6 tells a list author, and the check it is now held to.+RULE = "Do not add install or restore scripts"+RULE_NAMES = ("pm uninstall", "tools/restore.sh")+CHECK = "tests/test_list_folders_ship_lists_only.py"+++def scripts(examples):+ """`folder/file` for every script a folder under `examples/` ships, at any depth."""+ return sorted(path.relative_to(examples).as_posix() for path in examples.rglob("*")+ if path.is_file() and path.suffix.lower() in SCRIPT_SUFFIXES)+++def executable_files(root, folder="examples"):+ """`mode path` for every file under `folder` git holds with an executable bit, or None without git."""+ try:+ result = subprocess.run(["git", "ls-files", "-s", folder], cwd=root, capture_output=True,+ text=True, check=True)+ except (OSError, subprocess.CalledProcessError):+ return None+ return [" ".join(line.split("\t")[0].split()[:1] + [line.split("\t")[-1]])+ for line in result.stdout.splitlines() if line.startswith("100755 ")]+++def folders(examples):+ """Every list folder under `examples/`: a directory carrying a debloat list."""+ return sorted(path for path in examples.iterdir() if path.is_dir() and any(path.glob("debloat*.txt")))+++class ListFoldersTest(unittest.TestCase):+ def test_no_folder_ships_a_script_of_its_own(self):+ found = scripts(EXAMPLES)+ self.assertEqual([], found,+ "a list folder ships a list, not a script: docs/workflows/tv-list.md step 6 says "+ "'Do not add install or restore scripts, Private DNS or AdGuard setup, or `pm "+ "uninstall` steps', and tools/disable.sh, tools/restore.sh and the launcher's own "+ "install script do everything a folder needs. Found: " + ", ".join(found))++ def test_the_walk_reads_every_folder(self):+ # Without this, a walk that stopped finding folders would pass the test above by finding nothing.+ found = folders(EXAMPLES)+ self.assertGreaterEqual(len(found), 350, "expected every list folder under examples/")+ self.assertIn(EXAMPLES / "epson-ls800", found)+ self.assertTrue((EXAMPLES / "epson-ls800" / "tv.json").is_file(),+ "the LS800 folder still ships its list, its tv.json and a config.json")++ def test_no_file_in_a_list_folder_is_committed_executable(self):+ found = executable_files(ROOT)+ if found is None:+ self.skipTest("git is not installed here; the walk above still reads the suffixes")+ self.assertEqual([], found,+ "a list folder holds no file the shell runs, so nothing in examples/ is committed "+ "executable - a list's commands go through tools/venv/bin/python -I tools/<x>.py, "+ "or the tools own script")++ def test_the_recipe_states_the_rule_and_names_this_check(self):+ page = RECIPE.read_text(encoding="utf-8")+ step = page[page.index("6. A `README.md` for TV-specific notes"):]+ step = step[:step.index("\n\n")]+ self.assertIn(RULE, step, "docs/workflows/tv-list.md step 6 no longer states the rule")+ for needle in RULE_NAMES:+ self.assertIn(needle, step,+ f"step 6 no longer names {needle!r} among the things a list folder does not add")+ self.assertIn(CHECK, step, "step 6 does not name the check that holds every folder to the rule")+++class TheWalkTest(unittest.TestCase):+ """The same reader over a tree written here, so a walk that stops reading fails loudly."""++ def tree(self, tmp, files):+ examples = Path(tmp) / "examples"+ for name, text in files.items():+ path = examples / name+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(text, encoding="utf-8")+ examples.mkdir(parents=True, exist_ok=True)+ return examples++ def test_a_folder_with_a_restore_script_is_reported(self):+ with tempfile.TemporaryDirectory() as tmp:+ examples = self.tree(tmp, {"x/debloat.txt": "# TV\ncom.example.one\n",+ "x/tv.json": "{}\n",+ "x/restore.sh": "#!/bin/sh\npm enable com.example.one\n"})+ self.assertEqual(["x/restore.sh"], scripts(examples))++ def test_a_script_below_the_folder_is_reported(self):+ # A folder a list PR builds by hand can put a script anywhere; the rule is about the folder, not its root.+ with tempfile.TemporaryDirectory() as tmp:+ examples = self.tree(tmp, {"x/debloat.txt": "# TV\ncom.example.one\n",+ "x/tools/undo.sh": "#!/bin/sh\n"})+ self.assertEqual(["x/tools/undo.sh"], scripts(examples))++ def test_a_windows_script_beside_the_list_is_reported(self):+ with tempfile.TemporaryDirectory() as tmp:+ examples = self.tree(tmp, {"x/debloat.txt": "# TV\ncom.example.one\n",+ "x/debloat.ps1": "pm enable com.example.one\n",+ "x/install.cmd": "@echo off\n"})+ self.assertEqual(["x/debloat.ps1", "x/install.cmd"], scripts(examples))++ def test_a_folder_carrying_only_what_a_list_folder_ships_is_quiet(self):+ with tempfile.TemporaryDirectory() as tmp:+ examples = self.tree(tmp, {"x/debloat.txt": "# TV\ncom.example.one\n",+ "x/debloat-keep-cast.txt": "# TV\ncom.example.two\n",+ "x/tv.json": "{}\n",+ "x/config.json": "{\"dock_apps\": []}\n",+ "x/README.md": "# TV\n\nUndo: tools/restore.sh x/debloat.txt\n",+ "x/home.jpg": ""})+ self.assertEqual([], scripts(examples))++ def test_a_shipped_script_was_the_whole_rule_in_this_tree(self):+ # The rule the test above reads today, kept honest: no folder's notes name a script of its own.+ for folder in folders(EXAMPLES):+ for page in folder.glob("*.md"):+ for line in page.read_text(encoding="utf-8").splitlines():+ self.assertNotIn(f"examples/{folder.name}/restore.sh", line,+ f"{page.relative_to(ROOT)} tells a reader to run a script inside the "+ f"list folder; the undo is tools/restore.sh {page.relative_to(ROOT).parent}/debloat.txt")+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/test_restore_references.py b/tests/test_restore_references.pyindex 79aa7060d..dd5d9b9a6 100644--- a/tests/test_restore_references.py+++ b/tests/test_restore_references.py@@ -11,10 +11,13 @@ for tools/disable.sh and disable.ps1, so a list's own Apply and Undo lines bothlist: debloat.txt, or a second list beside it such asexamples/google-chromecast-gtv-4k/debloat-keep-cast.txt.-The same goes for the install and restore scripts three list folders still ship from before the rule-that a list folder holds none (AGENTS.md, "Hard rules"): a page that sends an owner to-`examples/<folder>/restore.sh` names a file the folder has to have, and the TCL 55S470G header-named one that was not there.+The same goes for a folder's own install and restore script: a page that sends an owner to+`examples/<folder>/restore.sh` names a file the folder has to have, and the TCL 55S470G header named+one that was not there. No folder ships one any more - `examples/epson-ls800` was the last, and it went+the way `examples/benq-gv32` and `examples/tcl-43c645` went before it (#1717): the undo is+`tools/restore.sh` with the list, `tools/theme.sh --reset` for the theme, and+`tests/test_list_folders_ship_lists_only.py` keeps a new folder from arriving with a script of its own.+A page or a list header that still names one is a typo now, so the sweep reads none.And a command that passes the stock launcher but no list names nothing at all: restore.sh takes thelist as its first argument and the stock launcher as its second, so the CVTE T972 page's@@ -50,9 +53,9 @@ APPLY = re.compile(r"disable\.(?:sh|ps1)" + LIST_ARGUMENT)# placeholder. Three translations (it, ja, vi) write it as a made-up folder name, in quotes.PLACEHOLDERS = {"examples/il-tuo-modello/debloat.txt", "examples/your-model/debloat.txt","examples/model-cua-ban/debloat.txt"}-# A helper script inside a list folder, e.g. `examples/epson-ls800/restore.sh`. Three folders still-# ship the install and restore scripts their submission came with (#265); a page or a list header-# that sends an owner to one names a file the folder has to have.+# A helper script inside a list folder, e.g. `examples/epson-ls800/restore.sh`. The folders that shipped+# the install and restore scripts their submission came with (#265) have all been trimmed to the shared+# tools, so a page or a list header that still names one names a file the folder no longer has.FOLDER_SCRIPT = re.compile(r"(examples/[A-Za-z0-9._-]+/(?:restore|disable|install|build-and-install)\."r"(?:sh|ps1))")# `tools/restore.sh <list> <stock launcher>`: the list is restore.sh's first argument, the stock@@ -201,18 +204,21 @@ class RestoreReferencesTest(unittest.TestCase):"a list's Apply line runs another file, so the TV gets another set of packages ""than the list shows")- def test_a_folder_script_a_page_names_is_there(self):- # examples/epson-ls800 ships the restore script it came with, and its page names it (tcl-43c645- # dropped its own scripts for the shared tools, #1717); the TCL 55S470G header named one its- # folder does not have, so an owner's first undo command was "No such file".+ def test_no_page_sends_an_owner_to_a_script_inside_a_list_folder(self):+ # examples/epson-ls800 shipped the restore script it came with and its page named it; that was the+ # last one, and it goes the way tcl-43c645 (#1717) and benq-gv32 went - the undo is+ # tools/restore.sh, tools/theme.sh --reset and the one settings command the folder's README gives.+ # The TCL 55S470G header named a folder script its folder did not have, so an owner's first undo+ # command was "No such file"; with no folder shipping one, every such name is a typo.missing = [(str(path), name) for path, name in read_script_references(ROOT)if not (ROOT / name).is_file()]self.assertEqual([], missing,"these lines hand the owner a script inside a list folder that is not in the ""repo, so the command fails before anything reaches the TV")- self.assertGreaterEqual(len(read_script_references(ROOT)), 2,- "the folders that do ship such a script should be read; the scanner "- "found fewer")+ self.assertEqual([], [name for _, name in read_script_references(ROOT)],+ "a list folder ships no script of its own (docs/workflows/tv-list.md step 6, "+ "AGENTS.md's hard rules, MAINTAINER.md's 'dropped on merge', and "+ "tests/test_list_folders_ship_lists_only.py), so no page or list header names one")def test_a_restore_that_names_the_launcher_names_the_list(self):# The CVTE T972 page sent an owner to `tools/restore.sh ... com.cvte.tv.launcher.highend`: the