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
tests: the count check reads the present-tense shapes four folder pages use
xbsheng75f0401b6a9a
diff --git a/docs/workflows/tv-list.md b/docs/workflows/tv-list.mdindex 73e0289d3..62e3b4b4b 100644--- a/docs/workflows/tv-list.md+++ b/docs/workflows/tv-list.md@@ -50,12 +50,15 @@card states (387, 103)`), so they move in the same commit.6. A `README.md` for TV-specific notes and a `config.json` with the dock are welcome in the folder. Notes arefree prose; three things in a README are read back, two of them against the list beside it.- A package count ("The 38 packages that were disabled", "the debloat list disables 71 packages") is- compared with what `tools/disable.sh` would send for the list, so a line added or commented out later moves- the number in the README with it: `tests/test_example_list_count.py` answers+ A package count ("The 38 packages that were disabled", "the debloat list disables 71 packages", "The+ list disables **N packages**", "The list contains N packages", "`debloat.txt` is the list: N+ packages") is compared with what `tools/disable.sh` would send for the list, so a line added or+ commented out later moves the number in the README with it: `tests/test_example_list_count.py` answers`examples/<folder>/README.md says 12 packages in the debloat.txt row and its debloat.txt carries 8`. A- sentence the page wraps across two lines is still read as one sentence, so a break cannot hide the- number. Its undo+ sentence that only says "The list disables 10 packages" is read while `debloat.txt` is the folder's+ only list, and not in the folders that also ship a `debloat-keep-cast.txt` or another list beside it,+ where those words could be about that file. A sentence the page wraps across two lines is still read+ as one sentence, so a break cannot hide the number. Its undois the other: the restore command a README shows passes the same stock launcher as the list's own Undo line,or none where the list passes none, because those two are where an owner looks for the way back and the copythat passes a different package leaves the stock home disabled. `tests/test_folder_undo_agrees.py` names eachdiff --git a/tests/test_example_list_count.py b/tests/test_example_list_count.pyindex f17a600ea..8acb4f472 100644--- a/tests/test_example_list_count.py+++ b/tests/test_example_list_count.py@@ -20,6 +20,15 @@ stayed green. The words are read the same way the link is: the present tense "dithat names the debloat list or `debloat.txt` itself, and nothing that names another list (a folderwith a `debloat-keep-cast.txt` states its own count about that file).+That sentence states the count in three further ways, and all three were unread: the file introduced+as the list ("`debloat.txt` is the list: 33 packages"), what it holds ("The list contains 12+packages"), and the same count in bold ("The list disables **5 packages**"). Four shipped pages use+one each, so a list edit could leave one of them describing a list that no longer exists with the+suite green, which is the Hikeen failure again. A sentence that says only "The list disables 10+packages" is read while `debloat.txt` is the folder's only list, and left alone in the eight folders+that ship a second one, where "the list" could be that file. A bare fragment ("28 packages, all+disabled") names nothing and is not read.+A sentence is read as a sentence, not as a line: these pages wrap their prose by hand at about 100characters, so the Haier HRA962X2 README ends one line with "the debloat list" and starts the next with"disables 40 packages". #2817 commented that list's two stock-home lines out and left it sending 38,@@ -54,14 +63,31 @@ PROSE_LINK = re.compile(r"\[[^\]]*\]\([^)]*debloat\.txt[^)]*\)[^\n]{0,80}?(\d+)\# own list ("the debloat list", or debloat.txt itself) and use the present tense, so a session's# account of a run ("all 34 packages stayed disabled") and a count about a `debloat-keep-cast.txt` are# not read as claims about debloat.txt.+#+# The same sentence states the count three more ways, and all three were unread: the file introduced as+# the list (`debloat.txt` is the list: 33 packages, tcl-55q7d-pro-google-tv), what it holds (`The list+# contains 12 packages`, xiaomi-mi-box-4s-pro-frozen) and the count set in bold (`The list disables+# **5 packages**`, haam-hm4k75s11tnd). A stale one of those left the suite green the way the Hikeen+# count did.PROSE_WORDS = re.compile(- r"(?:\bdebloat list\b|`debloat\.txt`)[^\n]{0,80}?\bdisables\s+(\d+)\s+packages\b",+ r"(?:\bdebloat list\b|`debloat\.txt`)"+ r"[^\n]{0,80}?(?:\bdisables\b|\bcontains\b|\bis the list:?)\s*\**\s*(\d+)\s+packages\b",+ re.IGNORECASE,+)+# `The list disables 10 packages: telemetry, ...` names no file at all, so it is read only while+# debloat.txt is the folder's only list: with a second list beside it the words could as easily be+# about that file, and a page is not failed on a reading it does not have to mean.+PROSE_THE_LIST = re.compile(+ r"\b(?:the|this) list\b[^\n]{0,80}?(?:\bdisables\b|\bcontains\b)\s*\**\s*(\d+)\s+packages\b",re.IGNORECASE,)# `1. **Debloated 23 packages** - ad services, app stores, background junk`PROSE_STEP = re.compile(r"\*\*[Dd]ebloated (\d+) packages\*\*")STEP = "the step that says what was done"-# The two forms a page can wrap by hand, read a sentence at a time (see sentences() below).+THE_LIST = "the sentence that calls it the list"+# The forms a page can wrap by hand, read a sentence at a time (see sentences() below). The words+# reader needs no folder, so it is always read; `The list ...` is added by claims() only while+# debloat.txt is the folder's only list.PROSE = ((PROSE_LINK, "the sentence about the debloat list"),(PROSE_WORDS, "the sentence that names the list in words"),@@ -133,7 +159,7 @@ def sentences(readme_text):yield sentence-def claims(readme_text):+def claims(readme_text, only_list=False):"""Every package count the README states for its debloat.txt, as (where it says it, number).A line that is the table row is not searched for the prose forms as well: a row that names the@@ -143,8 +169,12 @@ def claims(readme_text):reader's sentence and the words reader's too, since it names the list both ways. Both capture thesame digits, so a number already read in that sentence is not read again - one claim, one failure.- The row and the bold step are read line by line, where they are always written; the two prose forms+ The row and the bold step are read line by line, where they are always written; the prose formsare read a sentence at a time, so a sentence the page wrapped by hand is one claim.++ `only_list` says debloat.txt is the only list the folder ships, which is what makes `The list+ disables 10 packages` a claim about it. With a second list in the folder the sentence could be+ about that file, so the words are not read at all."""found = []for line in readme_text.split("\n"):@@ -156,9 +186,10 @@ def claims(readme_text):continuefor match in PROSE_STEP.finditer(line):found.append((STEP, int(match.group(1))))+ patterns = (PROSE + ((PROSE_THE_LIST, THE_LIST),)) if only_list else PROSEfor sentence in sentences(readme_text):read = []- for pattern, where in PROSE:+ for pattern, where in patterns:for match in pattern.finditer(sentence):span = match.span(1)if any(span[0] < other[1] and other[0] < span[1] for other in read):@@ -172,6 +203,16 @@ def folders():return sorted(p for p in EXAMPLES.iterdir() if p.is_dir() and (p / "debloat.txt").is_file())+def only_list(folder):+ """True when debloat.txt is the only list the folder ships.++ Eight folders carry a second list (`debloat-keep-cast.txt`, `debloat-extra.txt`,+ `debloat-display-only.txt`, ...), and there `The list disables N packages` could be about either+ file, so the words are left unread rather than guessed at.+ """+ return len([p for p in folder.glob("debloat*.txt") if p.is_file()]) == 1++class ExampleListCountTest(unittest.TestCase):def test_readme_count_matches_the_list(self):checked = 0@@ -179,7 +220,7 @@ class ExampleListCountTest(unittest.TestCase):readme = folder / "README.md"if not readme.is_file():continue- stated = claims(readme.read_text(encoding="utf-8"))+ stated = claims(readme.read_text(encoding="utf-8"), only_list(folder))if not stated:continuechecked += 1@@ -204,11 +245,44 @@ class ExampleListCountTest(unittest.TestCase):if (folder / "README.md").is_file()and any(where != ROW- for where, _ in claims((folder / "README.md").read_text(encoding="utf-8"))+ for where, _ in claims(+ (folder / "README.md").read_text(encoding="utf-8"), only_list(folder)+ ))]self.assertTrue(prose, "no example README states its package count in prose any more")+ def test_the_present_tense_shapes_are_read_on_the_tree(self):+ # The three shapes this check grew for are shipped pages, one shape each: the file introduced+ # as the list, what it holds, a count in bold, and `The list ...` with no file named. Pinned+ # by folder so a page that stops stating its count - or a reader that stops reading one -+ # fails here instead of passing quietly.+ expected = {+ "tcl-55q7d-pro-google-tv": ("`debloat.txt` is the list: 33 packages", 33),+ "xiaomi-mi-box-4s-pro-frozen": ("The list contains 12 packages", 12),+ "haam-hm4k75s11tnd": ("The list disables **5 packages**", 5),+ "artel-a55lu8500": ("The list disables 10 packages", 10),+ }+ read = {}+ for folder in folders():+ readme = folder / "README.md"+ if not readme.is_file():+ continue+ read[folder.name] = claims(readme.read_text(encoding="utf-8"), only_list(folder))+ for name, (shape, count) in expected.items():+ with self.subTest(folder=name, shape=shape):+ self.assertIn(+ count, [claim for _, claim in read.get(name, [])],+ f"examples/{name}/README.md states {shape!r} and nothing read it as a claim "+ "about its debloat.txt",+ )+ # At least one of them has to be read as `The list ...`, or the reader added for that shape+ # is exercised by no page at all.+ self.assertIn(+ THE_LIST, [where for claims_read in read.values() for where, _ in claims_read],+ "no example README calls its list `The list` any more",+ )+class CountReaderTest(unittest.TestCase):"""The readers above, against documents written here."""@@ -246,6 +320,51 @@ class CountReaderTest(unittest.TestCase):text = "launcher is the stock Home. The debloat list disables 26 packages.\n"self.assertEqual(claims(text), [("the sentence that names the list in words", 26)])+ def test_the_file_introduced_as_the_list_is_read(self):+ # tcl-55q7d-pro-google-tv's shape: the file is named, then the count after a colon.+ text = (+ "`debloat.txt` is the list: 33 packages, disabled with `tools/disable.sh` in batches,\n"+ "reboot-checked. Undo:\n"+ )+ self.assertEqual(claims(text), [("the sentence that names the list in words", 33)])++ def test_what_the_list_holds_is_read(self):+ # xiaomi-mi-box-4s-pro-frozen's shape, and the file named in words before it.+ text = (+ "The debloat list contains 12 packages: four were already disabled before the session,\n"+ "and eight were disabled in small batches with the project's tools.\n"+ )+ self.assertEqual(claims(text), [("the sentence that names the list in words", 12)])++ def test_a_bold_count_is_read(self):+ # haam-hm4k75s11tnd's shape: the number and its word set in bold.+ text = "The list disables **5 packages**: stock Home recommendations and two demo apps.\n"+ self.assertEqual(claims(text, only_list=True), [(THE_LIST, 5)])+ named = "The debloat list disables **5 packages**: stock Home recommendations.\n"+ self.assertEqual(claims(named), [("the sentence that names the list in words", 5)])++ def test_the_list_with_no_file_named_is_read_only_for_a_single_list_folder(self):+ # `The list disables 10 packages` could be about a `debloat-keep-cast.txt` beside it, so the+ # words are read only while debloat.txt is the folder's only list.+ text = "The list disables 10 packages: telemetry, ACR and the store.\n"+ self.assertEqual(claims(text, only_list=True), [(THE_LIST, 10)])+ self.assertEqual(claims(text), [])+ self.assertEqual(claims(text, only_list=False), [])++ def test_a_bare_count_fragment_names_no_list(self):+ # acer-ar55ar2851udpro's shape: "28 packages, all disabled, none uninstalled." names nothing,+ # so it is not a claim about debloat.txt however right it happens to be.+ text = "28 packages, all disabled, none uninstalled. The header of [`debloat.txt`] says why.\n"+ self.assertEqual(claims(text, only_list=True), [])++ def test_the_list_words_do_not_read_a_second_list(self):+ # The same shape, about the folder's other file: `The ... list` here is the cast list.+ text = (+ "The `debloat-keep-cast.txt` list disables 3 packages.\n"+ "The cast list disables 3 packages.\n"+ )+ self.assertEqual(claims(text, only_list=True), [])+def test_a_sentence_the_page_wrapped_by_hand_is_read(self):# The Haier HRA962X2 README's shape: `the debloat list` ends one line and the count opens the# next, so a reader that matched inside one line saw no claim while the list lost two packages.