Skip to content

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

examples: two lists stop disabling a package their own notes say stays enabled

Mazin Kanuga5f464a514557
diff --git a/examples/liberton-ltv-24h01at/debloat.txt b/examples/liberton-ltv-24h01at/debloat.txt
index 231f6e195..e7f0acd69 100644
--- a/examples/liberton-ltv-24h01at/debloat.txt
+++ b/examples/liberton-ltv-24h01at/debloat.txt
@@ -41,7 +41,7 @@ com.google.android.backdrop # ambient screensaver, replaced by the l
# Assistant, accessibility and preloads the owner does not use
com.homwee.alexacontrol # Alexa integration; Google Assistant stays (katniss kept)
-com.google.android.marvin.talkback # accessibility
+# com.google.android.marvin.talkback # accessibility: refused by the firmware (SecurityException), left enabled
com.google.android.tv.remote.service # Android phone-as-remote app; Chromecast is mediashell
com.google.android.play.games
com.google.android.videos # Play Movies & TV
diff --git a/examples/tcl-32s5400a/debloat.txt b/examples/tcl-32s5400a/debloat.txt
index dd5b3837d..18f75981c 100644
--- a/examples/tcl-32s5400a/debloat.txt
+++ b/examples/tcl-32s5400a/debloat.txt
@@ -100,10 +100,8 @@ com.yupptv.scope.tvapp
# com.google.android.tv.assistant # disable together with katniss
# com.tcl.micmanager # remote microphone manager; together with katniss
# com.google.android.tv.remote.service # Google TV phone-app remote (casting does not need it)
-# com.tcl.ui_mediaCenter # USB media player, together with the next three
-# com.tcl.audioplayer
-# com.tcl.videoplayer
-# com.tcl.imageplayer
+# com.tcl.ui_mediaCenter # USB media player, together with com.tcl.videoplayer
+# com.tcl.videoplayer # (com.tcl.audioplayer and com.tcl.imageplayer are in the list above)
# com.tcl.t_solo # T-Solo: TV sound on Bluetooth headphones only
# com.google.android.backdrop # photo screensaver; screensaver_components was already
# # com.android.dreams.basic/.Colors on this unit
diff --git a/examples/tcl-43p615/debloat.txt b/examples/tcl-43p615/debloat.txt
index 7ce7cf7b1..565365fe8 100644
--- a/examples/tcl-43p615/debloat.txt
+++ b/examples/tcl-43p615/debloat.txt
@@ -83,7 +83,6 @@ com.google.android.backdrop # stock ambient photo screensaver
# boot-re-enable rule. com.tcl.usercenter stays off here, unlike on the Android 9 RTD2851 sets
# (see examples/tcl-beyondtv-rt2851).
com.netflix.ninja # Netflix
-com.google.android.youtube.tv # YouTube
com.google.android.youtube.tvmusic # YouTube Music
com.amazon.amazonvideo.livingroom # Prime Video
com.disney.disneyplus # Disney+
diff --git a/tests/test_example_readme_package_fates.py b/tests/test_example_readme_package_fates.py
index 179abd686..4204ae8e1 100644
--- a/tests/test_example_readme_package_fates.py
+++ b/tests/test_example_readme_package_fates.py
@@ -12,6 +12,10 @@ examples/sankey-smart2ktvse did with com.zeasn.livetv, the software layer under
HDMI inputs (#1203). This test reads the claim where a reader reads it and compares it
with the set the script would actually send.
+A third word, `refused`, says the firmware would not let the package be disabled.
+A list names only what was actually disabled (CONTRIBUTING step 3), so a refused
+package must not be on an active line either.
+
Two packages are exempt from the "disabled" side because they are not disabled by the
list: the stock launchers launcher/build-and-install.sh takes Home from (the list only
names them in a header comment). The exempt set is read out of that script rather than
@@ -32,11 +36,11 @@ EXAMPLES = ROOT / "examples"
# compared rather than skipped; test_list_format is what refuses a bad name in a list.
BACKTICKED = re.compile(r"`([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+)`")
# What a row says about that package, right after the closing backtick.
-FATE = re.compile(r"^\s*(?:is\s+)?(kept|disabled)\b", re.IGNORECASE)
+FATE = re.compile(r"^\s*(?:is\s+)?(kept|disabled|refused)\b", re.IGNORECASE)
def claims(text):
- """(package, "kept"|"disabled") for every backticked package a row gives a fate to.
+ """(package, "kept"|"disabled"|"refused") for every backticked package a row gives a fate to.
Only the words straight after the name count, so "`pkg` (Chromecast kept)" talks
about Chromecast, not about pkg, and "`pkg` deliberately left out" claims nothing.
@@ -87,6 +91,10 @@ def disagreements(folder, notes, active, exempt):
problems.append(
f"{folder}: says {package} is kept, but its debloat.txt disables it "
f"(a trailing comment does not keep a package off the TV)")
+ if fate == "refused" and package in active:
+ problems.append(
+ f"{folder}: says the firmware refuses {package}, but its debloat.txt "
+ f"still lists it (comment the line out, with the reason)")
if fate == "disabled" and package not in active and package not in exempt:
problems.append(
f"{folder}: says {package} is disabled, but its debloat.txt does not list it")
@@ -117,6 +125,10 @@ class ReaderTest(unittest.TestCase):
self.assertEqual(claims(text),
[("com.a.b", "kept"), ("com.c.d", "disabled"), ("com.e.f", "kept")])
+ def test_claims_reads_a_package_the_firmware_refused(self):
+ text = "`com.a.b` is refused by the firmware (SecurityException, left enabled)"
+ self.assertEqual(claims(text), [("com.a.b", "refused")])
+
def test_claims_ignores_a_package_a_row_says_nothing_about(self):
text = ("`com.a.b` deliberately left out because it is a system app; "
"`com.c.d` (shown here, kept by another list) is fine")
@@ -156,6 +168,18 @@ class ReaderTest(unittest.TestCase):
self.assertIn("com.zeasn.livetv", problems[0])
self.assertIn("disables it", problems[0])
+ def test_a_refused_claim_on_an_active_line_is_reported(self):
+ problems = disagreements("liberton", "`com.google.android.marvin.talkback` is refused",
+ active={"com.google.android.marvin.talkback"}, exempt=set())
+ self.assertEqual(len(problems), 1)
+ self.assertIn("com.google.android.marvin.talkback", problems[0])
+ self.assertIn("still lists it", problems[0])
+
+ def test_a_refused_claim_without_a_line_is_fine(self):
+ problems = disagreements("liberton", "`com.google.android.marvin.talkback` is refused",
+ active={"com.a.b"}, exempt=set())
+ self.assertEqual(problems, [])
+
def test_a_disabled_claim_without_a_line_is_reported(self):
problems = disagreements("sankey", "camera `com.android.camera2` disabled",
active={"com.a.b"}, exempt=set())
diff --git a/tests/test_examples.py b/tests/test_examples.py
index 7e9dceddc..e877e89f6 100644
--- a/tests/test_examples.py
+++ b/tests/test_examples.py
@@ -18,12 +18,43 @@ import gen_tables # noqa: E402 (needs tools/ on the path first)
EXAMPLES = ROOT / "examples"
PACKAGE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z0-9_]+)+$")
+# A line that is only a commented-out package, with or without a note after it: how a list keeps one
+# ("# com.google.android.videos # firmware re-enables it on every boot"). Prose that merely starts
+# with a package name ("# com.x also answers HOME") is not one.
+COMMENTED_OUT = re.compile(r"^\s*#\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+)\s*(?:#.*)?$")
def folders():
return sorted(p for p in EXAMPLES.iterdir() if p.is_dir())
+def commented_out_but_listed(lines):
+ """(line number, package) for each package commented out below the first package line that an
+ active line still names.
+
+ tools/disable.sh strips everything from the first `#`, so the active line wins: the package is
+ disabled whatever the commented-out entry says about keeping it (examples/tcl-43p615 disabled
+ YouTube while noting that the owner keeps it). A header may repeat active entries on purpose, as a
+ record of what was applied (examples/amazon-fire-tv-stick-4k-2023), so lines above the first
+ package line are left out.
+ """
+ active = set()
+ first = None
+ for n, line in enumerate(lines, 1):
+ body = line.split("#", 1)[0].strip()
+ if body:
+ active.add(body)
+ first = first or n
+ if first is None:
+ return []
+ found = []
+ for n, line in enumerate(lines[first:], first + 1):
+ match = COMMENTED_OUT.match(line)
+ if match and match.group(1) in active:
+ found.append((n, match.group(1)))
+ return found
+
+
def table_rows(path, header_prefix):
"""Rows of the first markdown table whose header starts with header_prefix."""
lines = path.read_text(encoding="utf-8").split("\n")
@@ -61,6 +92,9 @@ class ExampleListsTest(unittest.TestCase):
self.assertTrue(packages, "no packages: notes without a list belong in docs/devices/")
dupes = sorted({p for p in packages if packages.count(p) > 1})
self.assertFalse(dupes, f"listed twice: {dupes}")
+ kept = [f"line {n}: {p}" for n, p in commented_out_but_listed(lines)]
+ self.assertFalse(kept, "commented out to keep it, but an active line still disables it: "
+ f"{kept}")
def test_every_folder_has_a_valid_tv_json(self):
try:
@@ -78,5 +112,24 @@ class ExampleListsTest(unittest.TestCase):
self.assertEqual(readme_tvs, example_tvs, "the TV column differs between the two tables")
+class CommentedOutReaderTest(unittest.TestCase):
+ def test_a_kept_entry_that_is_still_active_is_reported(self):
+ lines = ["# TV", "com.a.b # app", "com.c.d",
+ "# com.a.b # came back enabled; the owner keeps it"]
+ self.assertEqual(commented_out_but_listed(lines), [(4, "com.a.b")])
+
+ def test_a_kept_entry_that_is_not_active_is_fine(self):
+ lines = ["# TV", "com.c.d", "# com.a.b # firmware re-enables it on every boot"]
+ self.assertEqual(commented_out_but_listed(lines), [])
+
+ def test_a_header_record_of_active_entries_is_fine(self):
+ lines = ["# TV", "# Applied on this unit:", "# com.a.b", "", "com.a.b"]
+ self.assertEqual(commented_out_but_listed(lines), [])
+
+ def test_prose_that_starts_with_a_package_name_is_not_an_entry(self):
+ lines = ["# TV", "com.a.b", "# com.a.b also answers HOME, so it goes last"]
+ self.assertEqual(commented_out_but_listed(lines), [])
+
+
if __name__ == "__main__":
unittest.main()