Skip to content

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

docs: the list recipe says which keys a folder's config.json may carry

xbsheng84f3148dd622
diff --git a/docs/workflows/tv-list.md b/docs/workflows/tv-list.md
index 3d0230171..14cdbc40f 100644
--- a/docs/workflows/tv-list.md
+++ b/docs/workflows/tv-list.md
@@ -31,9 +31,14 @@
5. Change nothing outside the folder. The tables in `examples/README.md` and `README.nl.md`, the brand grid and the
counts (the `TV models` number in the card's alt text) are generated from every `tv.json` by
`tools/gen_tables.py`, which a maintainer runs after merging; CI compares them only on `main`.
-6. A `README.md` for TV-specific notes and a `config.json` with the dock are welcome in the folder. 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.
+6. A `README.md` for TV-specific notes and a `config.json` with the dock are welcome in the folder. That
+ `config.json` takes only the keys `themes/README.md`'s Keys table says a theme can set: the rows it marks
+ `config.xml` only - the vendor settings screens, the icon tiles - are never read out of a pushed file, so
+ `theme.sh` drops them without a word and the launcher keeps its own value. A set that needs one wants that
+ line in the folder's `README.md`, for the owner to set in `launcher/app/src/main/res/values/config.xml`
+ before building. `tests/test_shipped_config_keys_are_read.py` holds every shipped `config.json` to the
+ table. 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.
A model with notes but no several-day list goes in `docs/devices/<brand-model>.md`, with one line under the notes
list at the end of `examples/README.md`. A folder in `examples/` must have packages in it.
diff --git a/tests/test_shipped_config_keys_are_read.py b/tests/test_shipped_config_keys_are_read.py
index b612fefe5..bfc4e89d8 100644
--- a/tests/test_shipped_config_keys_are_read.py
+++ b/tests/test_shipped_config_keys_are_read.py
@@ -16,6 +16,13 @@ ignored.
The readers are not copied in here: they come out of Config.java's own calls on the parsed overlay, so
a reader that is renamed or dropped fails this test rather than leaving the key it read quietly dead.
+`docs/workflows/tv-list.md` step 6 is where a list PR is told a folder may carry a `config.json` with its
+dock, and it said nothing about the keys one takes, while the theme recipe beside it
+(`docs/workflows/theme.md` step 1) has always said "only keys from the table in `themes/README.md`": a
+folder whose `config.json` carried `settings_fallback_components` failed the two checks below with nothing
+in the page a list author reads to point at. The step states the rule now; the two tests under RecipeTest
+hold it there, and hold the sentence it points at to what Config.java really reads.
+
Run from the repository root: python3 -m unittest discover -s tests -v
"""
import json
@@ -26,6 +33,9 @@ import unittest
ROOT = Path(__file__).resolve().parents[1]
CONFIG_JAVA = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "Config.java"
THEMES_README = ROOT / "themes" / "README.md"
+RECIPE = ROOT / "docs" / "workflows" / "tv-list.md"
+# A numbered step of the recipe; the lines under it are indented by three spaces, as the page does.
+NUMBERED = re.compile(r"^\d+\.\s")
# The readers Config.java calls on the overlay it read from the TV: bool(json, "columns", ...) and the
# two plain lookups a nested value takes, json.optJSONObject("wallpaper_moods") and
@@ -65,6 +75,25 @@ def key_rows(text):
return rows
+def steps(text):
+ """(number, body) for each numbered step of the recipe, its indented continuation lines included."""
+ found = []
+ for line in text.split("\n"):
+ if NUMBERED.match(line):
+ found.append([line.split(".", 1)[0], [line]])
+ elif found and line.startswith(" ") and line.strip():
+ found[-1][1].append(line)
+ return [(number, "\n".join(lines)) for number, lines in found]
+
+
+def welcoming_step(text):
+ """The recipe's step that invites a folder's config.json, or '' when no step does."""
+ for _, body in steps(text):
+ if "`config.json`" in body:
+ return body
+ return ""
+
+
class ShippedConfigKeysTest(unittest.TestCase):
def setUp(self):
self.known = overlay_keys(CONFIG_JAVA.read_text(encoding="utf-8"))
@@ -105,5 +134,29 @@ class ShippedConfigKeysTest(unittest.TestCase):
self.assertEqual([], problems)
+class RecipeTest(unittest.TestCase):
+ """docs/workflows/tv-list.md, the page a list PR follows, on the config.json it welcomes."""
+
+ def test_the_recipe_that_welcomes_a_config_json_states_which_keys_it_takes(self):
+ body = welcoming_step(RECIPE.read_text(encoding="utf-8"))
+ self.assertTrue(body, "docs/workflows/tv-list.md no longer welcomes a folder's config.json, so this "
+ "test has no step to read")
+ for needle in ("themes/README.md", "config.xml", "tests/test_shipped_config_keys_are_read.py"):
+ with self.subTest(needle=needle):
+ self.assertIn(needle, body, f"the step that welcomes a folder's config.json does not name {needle}")
+
+ def test_the_keys_the_table_calls_config_xml_only_are_the_unread_ones(self):
+ # The recipe sends the reader to the Keys table's `config.xml` only rows, so a key marked that way has
+ # to be one Config.java cannot read out of a pushed file - otherwise the page keeps a settable key out.
+ rows = key_rows(THEMES_README.read_text(encoding="utf-8"))
+ config_only = {key for key, kind in rows.items() if "config.xml" in kind}
+ self.assertGreaterEqual(len(config_only), 2,
+ f"the Keys table marks only {sorted(config_only)} as config.xml only")
+ known = overlay_keys(CONFIG_JAVA.read_text(encoding="utf-8"))
+ self.assertEqual([], sorted(config_only & known),
+ "the Keys table calls these config.xml only while Config.java reads them from a "
+ "theme's config.json")
+
+
if __name__ == "__main__":
unittest.main()