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
themes: the two themes that want no glow stop asking for glow_style off
xbsheng89d8c9de131e
diff --git a/tests/test_shipped_config_values.py b/tests/test_shipped_config_values.pyindex c61f8dcd2..4748eb977 100644--- a/tests/test_shipped_config_values.py+++ b/tests/test_shipped_config_values.py@@ -18,6 +18,16 @@ reader that changes its range, or stops reading a key, fails this test rather ththeme quietly ignored. Keys read by another class (`race_calendar` in RaceCalendar.java,`wallpaper_moods` in WallpaperRotation.java) are not this file's business.+Three keys are narrowed further, to a set of values rather than a type: `glow_style` (radial or horizon),+`glass_style` (glass, rim or halo) and `wallpaper_order` (sequential or shuffle). `string()` keeps any+string, so a value outside the set is not something the checks above see; the reader then folds it to its+fallback without a word. `themes/cinematic` and `themes/red-rain` shipped `"glow_style": "off"`, a value+`Config.glowStyle()` answers with radial, so a theme that meant to say "no glow here" said nothing at all -+and a theme author who copies either one has the same line, since the Keys table named the two values it+takes and said nothing about a third. The sets are read out of the constants those readers compare+against, so a value the launcher stops taking fails this test rather than leaving a shipped theme on its+fallback.+The same bounds are stated a second time, in the Keys table of themes/README.md, and that copy is theone a theme author reads: the cell gives `0 to 300` for `wifi_label_width`, `1 to 8` for `columns`,and tools/manage.py set refuses a value outside that cell before it writes anything@@ -39,8 +49,20 @@ import unittestROOT = Path(__file__).resolve().parents[1]CONFIG_JAVA = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "Config.java"+WALLPAPER_JAVA = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "WallpaperRotation.java"KEYS_TABLE = ROOT / "themes" / "README.md"+# The keys a reader narrows to a set of its own, and where that set is written down: the class holding the+# constants, the prefix they share, and how the reader compares a value - `trimmed` for glowStyle() and+# glassStyle(), which trim and equalsIgnoreCase, `exact` for WallpaperRotation.validOrder(), which compares+# the string as it was read.+ENUMS = {+ "glow_style": ("Config.java", "GLOW_", "trimmed"),+ "glass_style": ("Config.java", "GLASS_", "trimmed"),+ "wallpaper_order": ("WallpaperRotation.java", "ORDER_", "exact"),+}+CONSTANT = r"\b{prefix}([A-Z_]+)\s*=\s*\"([a-z-]+)\""+# The readers that take no bounds, and what the launcher needs for each. `string(json, ...)` is matched# before `stringList(json, ...)` would be by the alternation, so the longer name comes first.PLAIN_READER = re.compile(r"\b(stringList|intArray|bool|string|color)\(\s*json\s*,\s*\"([a-z0-9_]+)\"")@@ -67,8 +89,21 @@ def readers(java_text):return found-def problems(values, kinds):+def enum_values(java_text, prefix):+ """Every value a class gives a constant named with that prefix, comments aside."""+ return {value for _, value in re.findall(CONSTANT.format(prefix=prefix), java_text)}+++def accepted_enums():+ """key -> (values, how), read out of the constants those readers compare a value against."""+ java = {"Config.java": CONFIG_JAVA, "WallpaperRotation.java": WALLPAPER_JAVA}+ return {key: (enum_values(java[name].read_text(encoding="utf-8"), prefix), how)+ for key, (name, prefix, how) in ENUMS.items()}+++def problems(values, kinds, enums=None):"""[(key, why)] for the values the launcher would drop, judged by the reader the key is read with."""+ enums = enums or {}out = []for key, value in values.items():if key not in kinds:@@ -80,6 +115,12 @@ def problems(values, kinds):elif kind == "string":if not isinstance(value, str):out.append((key, f"{json.dumps(value)} is not a string, and string() keeps the fallback"))+ elif key in enums:+ allowed, how = enums[key]+ seen = value.strip().lower() if how == "trimmed" else value+ if seen not in allowed:+ out.append((key, f"{json.dumps(value)} is not one of {', '.join(sorted(allowed))}, "+ f"and the launcher keeps the value it falls back to"))elif kind == "integer":if isinstance(value, bool) or not isinstance(value, (int, float)):out.append((key, f"{json.dumps(value)} is not a number, and integer() keeps the fallback"))@@ -155,6 +196,7 @@ def range_problems(table, kinds):class ShippedConfigValuesTest(unittest.TestCase):def setUp(self):self.kinds = readers(CONFIG_JAVA.read_text(encoding="utf-8"))+ self.enums = accepted_enums()def test_the_readers_are_there(self):# A parser that read nothing would make every check below pass for any value.@@ -169,6 +211,41 @@ class ShippedConfigValuesTest(unittest.TestCase):self.assertEqual(self.kinds.get("wifi_label_width"), ("integer", (0, 300)),"wifi_label_width's bounds moved; the example and the Keys row follow them")+ def test_the_enum_values_are_read_out_of_the_launcher(self):+ # A constant parse that found nothing would let every value through, the way it did for "off".+ self.assertEqual(self.enums.get("glow_style"), ({"radial", "horizon"}, "trimmed"))+ self.assertEqual(self.enums.get("glass_style"), ({"glass", "rim", "halo"}, "trimmed"))+ self.assertEqual(self.enums.get("wallpaper_order"), ({"sequential", "shuffle"}, "exact"))++ def test_a_value_outside_the_set_is_reported(self):+ # "off" is the value the two themes shipped: a string, so the type sweep passed it and+ # glowStyle() answered radial. The spelling is the reader's - glow and glass trim and ignore+ # case, validOrder() does not, so `Sequential` is not `sequential`.+ for key, value, listed in (("glow_style", "off", "horizon, radial"),+ ("glass_style", "frosted", "glass, halo, rim"),+ ("wallpaper_order", "Sequential", "sequential, shuffle")):+ with self.subTest(key=key, value=value):+ reported = dict(problems({key: value}, self.kinds, self.enums))+ self.assertIn(key, reported, f"`{key}: {value}` was let through")+ self.assertIn(listed, reported[key])+ for key, value in (("glow_style", " HORIZON "), ("glass_style", "rim"),+ ("wallpaper_order", "shuffle")):+ with self.subTest(key=key, value=value):+ self.assertEqual(problems({key: value}, self.kinds, self.enums), [])++ def test_the_themes_that_want_no_glow_say_it_with_the_booleans(self):+ # MainActivity reads `if (!ambientGlow) ambient.setVisibility(View.GONE)` and returns from+ # setAmbient() while the glow is off, so these two booleans are what a theme has to say; there+ # is no glow_style that means "none", and a third value reaches the screen as radial.+ for name in ("cinematic", "red-rain"):+ path = ROOT / "themes" / name / "config.json"+ values = json.loads(path.read_text(encoding="utf-8"))+ with self.subTest(theme=name):+ self.assertFalse(values.get("ambient_glow"), f"{name} no longer turns the ambient glow off")+ self.assertFalse(values.get("app_glow"), f"{name} no longer turns the app glow off")+ self.assertEqual(problems(values, self.kinds, self.enums), [],+ f"{name} asks for a value the launcher folds to its fallback")+def test_no_shipped_value_is_one_the_launcher_drops(self):files = config_files()self.assertGreaterEqual(len(files), 50, "fewer config.json files found than the tree ships")@@ -178,7 +255,7 @@ class ShippedConfigValuesTest(unittest.TestCase):for path in files:values = json.loads(path.read_text(encoding="utf-8"))checked += sum(1 for key in values if key in self.kinds)- for key, why in problems(values, self.kinds):+ for key, why in problems(values, self.kinds, self.enums):with self.subTest(file=str(path.relative_to(ROOT)), key=key):self.fail(f"{path.relative_to(ROOT)} sets `{key}` and {why}: the launcher shows its "f"built-in value instead, and nothing says so")diff --git a/themes/README.md b/themes/README.mdindex f00fd6fc5..de968e415 100644--- a/themes/README.md+++ b/themes/README.md@@ -186,8 +186,8 @@ A new key needs one there in the same pull request.| `clock_wallpaper` | bool | The clock screensaver over Home's wallpaper instead of black with a coloured glow; the clock still moves every minute (`false` by default) || `clock_wallpaper_dim` | 0 to 90 | How dark that wallpaper is behind the clock, in percent (50 by default) || `clock_glow` | bool | The clock screensaver's coloured glow (`true` by default); `false` leaves the moving clock on plain black, e.g. for an OLED |-| `glow_style` | string | Shape of the glow behind the focused app, in its colour: `radial` (default) or `horizon`, the colour washing down from the top edge to black; the cinematic shelf keeps its own |-| `glass_style` | string | Look of the focus highlight: `glass` (default: a translucent slab with a bright top sheen, a crisp rim and a faint outer glow), `rim` (the crisp rim alone, no sheen, fill or glow, for a quiet focus over a wallpaper) or `halo` (the rim with a lighter outer glow) |+| `glow_style` | string | Shape of the glow behind the focused app, in its colour: `radial` (default) or `horizon`, the colour washing down from the top edge to black; the cinematic shelf keeps its own. Any other value falls back to `radial`; there is no value for "none", so a theme without a glow sets `ambient_glow` and `app_glow` to `false` |+| `glass_style` | string | Look of the focus highlight: `glass` (default: a translucent slab with a bright top sheen, a crisp rim and a faint outer glow), `rim` (the crisp rim alone, no sheen, fill or glow, for a quiet focus over a wallpaper) or `halo` (the rim with a lighter outer glow). Any other value falls back to `glass` || `cinematic_home` | bool | Cinematic top shelf: the focused dock app's artwork, softened, fills the top of the screen in its colour, with a larger name, "Last opened" (apps opened from Home), dock position dots, a focus glow in the app's colour and a translucent dock band; off by default || `cinematic_dots` | bool | With `cinematic_home`, the dock position dots under the app's name (`true` by default); `false` leaves them out || `cinematic_white_focus` | bool | With `cinematic_home`, the focus highlight stays white on the dock instead of taking the focused app's colour (`false` by default); `app_glow` still colours every tile |diff --git a/themes/cinematic/config.json b/themes/cinematic/config.jsonindex 9b2a93b88..88b40b3e3 100644--- a/themes/cinematic/config.json+++ b/themes/cinematic/config.json@@ -26,7 +26,6 @@"icon_only_buttons": true,"ambient_glow": false,"app_glow": false,- "glow_style": "off","focus_overshoot": false,"advanced_effects": true}diff --git a/themes/red-rain/config.json b/themes/red-rain/config.jsonindex cb0a5c487..a201be313 100644--- a/themes/red-rain/config.json+++ b/themes/red-rain/config.json@@ -26,7 +26,6 @@"icon_only_buttons": true,"ambient_glow": false,"app_glow": false,- "glow_style": "off","focus_overshoot": false,"advanced_effects": true}