Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

examples: the Hikeen README states the 12 packages its list disables

xbshengcb62d8ace625
diff --git a/examples/hikeen-smart-rtd285o/README.md b/examples/hikeen-smart-rtd285o/README.md
index 0075fb938..784a9904b 100644
--- a/examples/hikeen-smart-rtd285o/README.md
+++ b/examples/hikeen-smart-rtd285o/README.md
@@ -2,7 +2,8 @@
A white-label smart TV: the set itself reports only "Smart" / "SmartTV"; "Hikeen" is the OEM whose
packages (`com.hikeen.*`, `cn.zeasn.overseas.tv.hikeen.orion`) the firmware carries. Zeasn's "orion"
-launcher is the stock Home. The debloat list disables 26 packages.
+launcher is the stock Home. The debloat list disables 12 packages; 14 more - this owner's preloaded
+apps, casting and voice - are commented out for a reader to choose.
## Quirks of this board
diff --git a/tests/test_example_list_count.py b/tests/test_example_list_count.py
index 2a828b241..77b98f66c 100644
--- a/tests/test_example_list_count.py
+++ b/tests/test_example_list_count.py
@@ -1,16 +1,25 @@
"""Checks that an example folder's README says how many packages its debloat.txt disables.
A folder README answers "what is in that file?" with a number, and that number is the only place a
-reader learns the size of the list before opening it. It states it in one of three ways:
+reader learns the size of the list before opening it. It states it in one of four ways:
| `debloat.txt` | The 30 packages that were disabled, grouped and commented |
The [debloat list](debloat.txt) disables 71 packages: everything the owner does not use
1. **Debloated 23 packages** - ad services, app stores, background junk
+ The debloat list disables 12 packages.
Nothing tied any of them to the file, so adding packages to a list leaves the README describing a list
that no longer exists. Only the table row was read at first; the prose forms are read now, because a
count restated in a sentence drifts the same way - two folders' lists had shrunk under theirs.
+The fourth form is the one that had no link to read: a sentence that names the file in words. Round
+AL commented the Hikeen set's owner-choice lines out (`examples/hikeen-smart-rtd285o/debloat.txt`,
+14 of them), which left that folder's "The debloat list disables 26 packages" describing a list that
+now sends 12 - and every other reader here needs `[...](debloat.txt)` or the bold step, so the suite
+stayed green. The words are read the same way the link is: the present tense "disables", a sentence
+that names the debloat list or `debloat.txt` itself, and nothing that names another list (a folder
+with a `debloat-keep-cast.txt` states its own count about that file).
+
The number is compared with the packages tools/disable.sh would actually send, parsed the way that
script parses a list (a trailing `# comment` is not part of the line, whole-line `#` comments and
blank lines are skipped, the first field is the package name). Nothing is copied in: the claim comes
@@ -32,10 +41,20 @@ COUNT = re.compile(r"(\d+)\s+packages\b")
# `The [debloat list](debloat.txt) disables 71 packages: everything the owner does not use` - the
# number has to stay in the same sentence as the link, so the gap is short.
PROSE_LINK = re.compile(r"\[[^\]]*\]\([^)]*debloat\.txt[^)]*\)[^\n]{0,80}?(\d+)\s+packages\b")
+# `The debloat list disables 26 packages.` - the same sentence with the file named in words instead of
+# linked, which is the form the Hikeen folder uses and no reader here saw. It has to name this folder's
+# 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.
+PROSE_WORDS = re.compile(
+ r"(?:\bdebloat list\b|`debloat\.txt`)[^\n]{0,80}?\bdisables\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\*\*")
PROSE = (
(PROSE_LINK, "the sentence about the debloat list"),
+ (PROSE_WORDS, "the sentence that names the list in words"),
(PROSE_STEP, "the step that says what was done"),
)
ROW = "the debloat.txt row"
@@ -60,6 +79,10 @@ def claims(readme_text):
A line that is the table row is not searched for the prose forms as well: a row that names the
file and repeats the number in a link would otherwise be the same claim read twice.
+
+ The prose forms can overlap: `The [debloat list](debloat.txt) disables 71 packages` is the link
+ reader's sentence and the words reader's too, since it names the list both ways. Both capture the
+ same digits, so a number already read on that line is not read again - one claim, one failure.
"""
found = []
for line in readme_text.split("\n"):
@@ -69,8 +92,13 @@ def claims(readme_text):
if count:
found.append((ROW, int(count.group(1))))
continue
+ read = []
for pattern, where in PROSE:
for match in pattern.finditer(line):
+ span = match.span(1)
+ if any(span[0] < other[1] and other[0] < span[1] for other in read):
+ continue
+ read.append(span)
found.append((where, int(match.group(1))))
return found
@@ -148,6 +176,34 @@ class CountReaderTest(unittest.TestCase):
)
self.assertEqual(claims(text), [("the sentence about the debloat list", 71)])
+ def test_a_sentence_that_names_the_list_in_words_is_read(self):
+ # The Hikeen folder's form, and the one no reader saw: the file is named, not linked.
+ 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_linked_sentence_is_read_once(self):
+ # Both readers match `The [debloat list](debloat.txt) disables 71 packages`; the number is one
+ # claim, so a stale count is one failure and not two.
+ text = "The [debloat list](debloat.txt) disables 71 packages.\n"
+ self.assertEqual(claims(text), [("the sentence about the debloat list", 71)])
+
+ def test_a_second_list_named_in_words_is_not_read_for_this_one(self):
+ # `examples/.../debloat-keep-cast.txt disables 3 packages` is a claim about that file; the
+ # folder's debloat.txt is the only one this check counts.
+ text = (
+ "debloat-keep-cast.txt disables 3 packages, the cast receivers.\n"
+ "The `debloat-keep-cast.txt` list disables 3 packages.\n"
+ )
+ self.assertEqual(claims(text), [])
+
+ def test_a_session_account_in_the_past_tense_is_not_a_claim(self):
+ # "all 34 packages stayed disabled" is what a run saw, not the size of the file.
+ text = (
+ "After a reboot all 34 packages stayed disabled, nothing re-enabled itself.\n"
+ "`pm list packages -d` held 41 packages in all after the list.\n"
+ )
+ self.assertEqual(claims(text), [])
+
def test_a_step_that_says_what_was_done_is_read(self):
text = "1. **Debloated 23 packages** - ad services, app stores, background junk\n"
self.assertEqual(claims(text), [("the step that says what was done", 23)])