Skip to content

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

docs: the core-package bullet names the TV middleware the tools refuse (#1578)

xbsheng2c94d76899ae
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index f72d8bdd7..683a9a797 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -409,7 +409,11 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/
itself, not bloat. `tools/disable.sh`, `disable.ps1` and `check.py --fix` now refuse any list that
names them (or `com.android.providers.*` other than calendar, contacts, user dictionary and
blocked numbers, `com.android.systemui`, `com.android.shell`, `com.android.phone`,
- `com.android.settings`, `com.android.tv.settings` or `android`), with no switch to override it.
+ `com.android.settings`, `com.android.tv.settings` or `android`), with no switch to override it, and
+ since [#1578](https://github.com/Gathin23/cleanyourtv/issues/1578) the same refusal covers the TV
+ middleware: `com.cltv.mal`, `com.mediatek.tis`, `com.mediatek.tv.service` and
+ `com.mediatek.tv.agent` (the bullet below). The three tools say "core Android or TV middleware
+ packages" in that message, so a run that refuses one of the four reads the same way as this one.
If a set is already stuck and still answers ADB, `pm enable` each of those packages and reboot;
if ADB is gone too, a factory reset from the recovery menu is usually the only way back.
- **The TV restarts in a loop after a debloat**, seen once, on a Haier H50H5F (Google TV 14,
@@ -426,7 +430,9 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/
Wireless debugging usually goes off at every restart and gets a new port each time it is switched
on, so read the port from its screen or `adb mdns services`. This set never stayed up long enough
to switch it back on, and then restarted into the recovery menu, where a factory reset turns every
- disabled package back on (nothing was uninstalled).
+ disabled package back on (nothing was uninstalled). One of those eight, `com.cltv.mal`, is on the
+ list `tools/disable.sh`, `disable.ps1` and `check.py --fix` refuse (the bullet above), so a debloat
+ cannot take it out again; the other seven are not guarded.
- **The TV stays on the boot logo after a list, and disabling the only Home app is enough to do
it**, seen on a KitKat-era set ([COOP COTV-0001](https://github.com/Gathin23/cleanyourtv/issues/795):
Realtek `rtd298x`, Android 4.4.2, SDK 19). 17 packages were disabled over Ethernet ADB, each
diff --git a/tests/test_core_middleware_note.py b/tests/test_core_middleware_note.py
new file mode 100644
index 000000000..06ae7a577
--- /dev/null
+++ b/tests/test_core_middleware_note.py
@@ -0,0 +1,121 @@
+"""The core-package bullet names the TV middleware the tools refuse now (#884, #1578).
+
+`tools/disable.sh`, `disable.ps1` and `check.py --fix` refused the core Android packages of an original
+Mi TV Stick (#884) and nothing else until a Haier H50H5F restarted in a loop after a debloat with
+`com.cltv.mal` off (#1578). The guard covers four TV middleware packages now, PROMPT.md says so, and
+`docs/TROUBLESHOOTING.md` is where an owner whose set is stuck reads what the tools refuse: its #884
+bullet enumerated every guarded name except those four, and the #1578 bullet under it lists
+`com.cltv.mal` among eight packages without saying it is one of the guarded names today.
+
+Both are pinned here against the guard itself, so a name that reaches CORE_RE without the page - or a
+page that claims a name the guard does not hold - fails: the four names are read out of PROMPT.md's
+sentence, refused through recovery.core_packages(), matched against the bash and PowerShell copies of
+the pattern, and required in the bullet. The names on the #1578 list that are *not* guarded are pinned
+too, because the bullet says so: `com.cltv.hybrid` (Live TV) and the tuner inputs are what tested lists
+keep or turn off by hand, not what the tools refuse.
+"""
+import re
+from pathlib import Path
+import sys
+import unittest
+
+ROOT = Path(__file__).resolve().parent.parent
+sys.path.insert(0, str(ROOT / "tools"))
+import recovery # noqa: E402
+
+MIDDLEWARE = ["com.cltv.mal", "com.mediatek.tis", "com.mediatek.tv.service", "com.mediatek.tv.agent"]
+# The rest of the eight packages the #1578 report's disabled-package list names: live TV, the two tuner
+# inputs and the Haier apps. None of them is a name the tools refuse.
+NOT_GUARDED = ["com.cltv.hybrid", "com.mediatek.dtv.tvinput.isdbtuner",
+ "com.mediatek.dtv.tvinput.dvbtuner", "com.haier.apps"]
+
+PAGE = ROOT / "docs" / "TROUBLESHOOTING.md"
+CORE_BULLET = "- **The TV no longer boots after a list that disabled Android's core packages**"
+LOOP_BULLET = "- **The TV restarts in a loop after a debloat**"
+
+
+def bullet(start):
+ """The bullet that begins with `start`, up to the next `- **` at the left margin."""
+ text = PAGE.read_text(encoding="utf-8")
+ rest = text[text.index(start) + len(start):]
+ end = re.search(r"\n- \*\*", rest)
+ return start + (rest[:end.start()] if end else rest)
+
+
+def core_bullet():
+ return bullet(CORE_BULLET)
+
+
+def loop_bullet():
+ return bullet(LOOP_BULLET)
+
+
+def script_pattern(path, regex):
+ match = re.search(regex, path.read_text(encoding="utf-8"), re.M)
+ if not match:
+ raise AssertionError(f"no guard pattern found in {path}")
+ return re.compile(match.group(1))
+
+
+class GuardedMiddlewareTest(unittest.TestCase):
+ def test_the_guard_refuses_the_four(self):
+ self.assertEqual(MIDDLEWARE, recovery.core_packages(MIDDLEWARE))
+
+ def test_the_live_tv_and_tuner_names_are_not_guarded(self):
+ # The #1578 bullet says so, and tested lists keep com.cltv.hybrid on purpose.
+ self.assertEqual([], recovery.core_packages(NOT_GUARDED))
+
+ def test_the_bash_powershell_and_python_patterns_all_hold_them(self):
+ # The #884 bullet names three tools that refuse a list; the four have to be in each pattern.
+ patterns = [recovery.CORE_RE,
+ script_pattern(ROOT / "tools" / "disable.sh", r"^CORE_RE='([^']+)'$"),
+ script_pattern(ROOT / "tools" / "disable.ps1", r"^\$coreRe = '([^']+)'$")]
+ for name in MIDDLEWARE:
+ for pattern in patterns:
+ with self.subTest(name=name, pattern=pattern.pattern[:40]):
+ self.assertTrue(pattern.match(name), f"{name} is not refused by {pattern.pattern}")
+
+ def test_the_core_bullet_names_them(self):
+ text = core_bullet()
+ self.assertIn("pm enable", text, "the bullet is not the one about a set that will not boot")
+ for name in MIDDLEWARE:
+ self.assertIn(f"`{name}`", text,
+ f"the core-package bullet does not name {name}, which the tools refuse (#1578)")
+ self.assertIn("#884", text)
+
+ def test_the_core_bullet_cites_the_haier_issue_and_the_message(self):
+ text = core_bullet()
+ self.assertIn("issues/1578", text,
+ "the bullet names the middleware without saying why, or linking #1578")
+ self.assertIn("core Android or TV middleware", text,
+ "the bullet does not quote the message a refusal of one of the four prints")
+
+ def test_the_prompt_md_sentence_names_the_same_four(self):
+ text = (ROOT / "PROMPT.md").read_text(encoding="utf-8")
+ block = re.search(r"TV\s+middleware \(([^)]*)\)", text)
+ self.assertIsNotNone(block, "PROMPT.md no longer describes the TV middleware packages")
+ named = re.findall(r"`(com\.[a-z0-9.]+)`", block.group(1))
+ self.assertEqual(sorted(MIDDLEWARE), sorted(set(named)),
+ "PROMPT.md and this test disagree about what the middleware is")
+ for name in named:
+ self.assertIn(f"`{name}`", core_bullet(), f"PROMPT.md names {name} and the page does not")
+
+ def test_the_loop_bullet_says_which_of_its_eight_names_is_guarded(self):
+ text = loop_bullet()
+ self.assertIn("`com.cltv.mal`", text)
+ self.assertIn("the bullet above", text,
+ "the loop bullet does not send the reader to the guarded list")
+ self.assertIn("not guarded", text,
+ "the loop bullet does not say the other seven names are not refused")
+ self.assertNotIn("`com.cltv.hybrid`", core_bullet(),
+ "the core-package bullet lists Live TV, which tested lists keep or drop by hand")
+
+ def test_the_page_still_carries_both_bullets(self):
+ text = PAGE.read_text(encoding="utf-8")
+ self.assertEqual(1, text.count(CORE_BULLET))
+ self.assertEqual(1, text.count(LOOP_BULLET))
+ self.assertGreater(len(text), 50_000, "the page was read as something much shorter than itself")
+
+
+if __name__ == "__main__":
+ unittest.main()