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
tests: the Keys-table guard reads integer-array keys, and settings_key_scancodes has its row
xbsheng1034d7d34a9e
diff --git a/tests/test_switches.py b/tests/test_switches.pyindex 28fc09f43..c3622d6c2 100644--- a/tests/test_switches.py+++ b/tests/test_switches.py@@ -49,7 +49,7 @@ SCREENSHOT_WANTED = {"input_uri_scheme", "key_filter", "launch_actions", "launcher_settings_button", "library_apps","library_button", "live_tv_action", "lunar_utc_offset", "live_tv_input_id", "live_tv_package", "module_cards","race_calendar", "reduced_motion", "reorder_button", "restore_key_services", "rows_below_dock",- "settings_fallback_components", "settings_key_keycodes", "shamsi_date",+ "settings_fallback_components", "settings_key_keycodes", "settings_key_scancodes", "shamsi_date","show_home_settings_shortcut", "show_inputs_pill", "show_network_pill", "show_stats","source_panel_action", "source_panel_extra", "source_panel_service", "stock_home_redirect","tile_menu", "top_menu", "vpn_app", "wallpaper", "wallpaper_captions", "wallpaper_dim",diff --git a/tests/test_theme_keys_config.py b/tests/test_theme_keys_config.pyindex 35bb9a4ee..5962d9c4f 100644--- a/tests/test_theme_keys_config.py+++ b/tests/test_theme_keys_config.py@@ -15,6 +15,14 @@ config.xml has a row. It does not ask the table to stop carrying theme-only keysor `wallpaper_rotation_minutes`, which no config.xml resource backs - those are the keys a theme setsand the table is their only home.+`<integer-array>` is one of the resource forms the launcher reads, and it was the one this file did not:+the pattern below listed bool, string, integer, string-array, array and color, so a key HomeKeyService or+InputKeyService reads as `R.array.<name>` was never compared with the table. `settings_key_scancodes`+(the scancode half of `settings_key_keycodes`, read by HomeKeyService.java) went without a row while its+sibling had one, on a table whose own line says a theme can point the Settings button at a keycode but+says nothing about the scan code that a remote which sends none needs. A test below reads the three+integer-array keys, so dropping the form again fails here instead of leaving a key unlisted.+`latitude` and `longitude` are the two exceptions, with their reason in EXEMPT: they are config.xmllines a build sets, docs/sky.md documents them, and tests/test_sky_place_note.py requires the Keystable to keep naming neither (a theme cannot move the sun). A test here keeps that exemption honest by@@ -40,7 +48,10 @@ SKY_VIEW = JAVA_DIR / "SkyView.java"# as `false` or `#RRGGBB` does not.KEY = re.compile(r"`([a-z][a-z0-9_]*)`")# The resources config.xml defines: name -> type, as the launcher sees them (a string-array is R.array).-RESOURCE = re.compile(r'<(bool|string|integer|string-array|array|color)\s+name="([a-z][a-z0-9_]*)"')+# `integer-array` is a form of its own and comes before `integer`, so the longer name is tried first:+# without it a key read as R.array.<name> never reached the comparison below, which is how+# settings_key_scancodes stayed without a row.+RESOURCE = re.compile(r'<(bool|string|integer-array|string-array|integer|array|color)\s+name="([a-z][a-z0-9_]*)"')# What the Java side reads: R.bool.x, R.string.x, R.integer.x, R.array.x, R.color.x.READ = re.compile(r"R\.(?:bool|string|integer|array|color)\.([a-z][a-z0-9_]*)")# A key read from a theme's config.json: string(json, "dock_title", ...) and its siblings.@@ -151,6 +162,33 @@ class KeysTableCoversConfigXmlTest(unittest.TestCase):self.assertIn(name, read, f"config.xml and the Java side no longer agree on `{name}`")self.assertGreaterEqual(len(read), 40, "far fewer keys read from config.xml than before")+ def test_an_integer_array_is_read_as_a_key(self):+ # The form the pattern above used to skip. These three are `<integer-array>` in config.xml and+ # every one of them is read by a helper, so a parser that cannot see the form leaves them out of+ # the comparison entirely - which is how settings_key_scancodes went without a row.+ config = config_keys(self.config)+ read = read_from_config(config, self.sources)+ integer_arrays = {name for name, kind in config.items() if kind == "integer-array"}+ self.assertGreaterEqual(len(integer_arrays), 3,+ "config.xml has fewer integer arrays than it used to: is the parser "+ "still reading them?")+ for name in ("settings_key_scancodes", "settings_key_keycodes", "input_key_keycodes"):+ with self.subTest(key=name):+ self.assertIn(name, integer_arrays, f"`{name}` is no longer an integer-array in config.xml")+ self.assertIn(name, read, f"the launcher reads `{name}` and the parser lost it")++ def test_settings_key_scancodes_has_its_row(self):+ # The scancode half of settings_key_keycodes: the same buttons, for remotes that send a code+ # Android maps to no keycode. It is config.xml only, which the row has to say.+ row = row_for(self.text, "settings_key_scancodes")+ self.assertTrue(row, "the Keys table has no settings_key_scancodes row")+ self.assertIn("`config.xml` only", type_cell(row),+ "`Config.java` never reads settings_key_scancodes from a theme, so the row has to "+ "say it is config.xml only, as settings_fallback_components' does")+ helper = (JAVA_DIR / "HomeKeyService.java").read_text(encoding="utf-8")+ self.assertIn("R.array.settings_key_scancodes", helper,+ "HomeKeyService.java no longer reads settings_key_scancodes: drop or rewrite its row")+def test_every_key_the_launcher_reads_has_a_row(self):missing = missing_rows(self.text, self.config, self.sources)for name in missing:diff --git a/themes/README.md b/themes/README.mdindex 651b8810c..f0a804aab 100644--- a/themes/README.md+++ b/themes/README.md@@ -125,6 +125,7 @@ A new key needs one there in the same pull request.| `festival_until` | `YYYY-MM-DD` | Last day the festive skin shows; it switches itself off after that. A malformed date turns it off || `greeting` | string | Replaces the time-of-day greeting while the festive skin is on || `accent_color` | `#RRGGBB` | Colour of the focus glow while the festive skin is on; diya gold if not set, pumpkin orange for `halloween` |+| `settings_key_scancodes` | list, `config.xml` only | The same buttons by Linux scancode, for `HomeKeyService` (`HOME_KEY_SERVICE=1`); the Xiaomi/Fengmi projector remote's gear is scan 384. `Config.java` reads `settings_key_keycodes` out of a theme but never this one, so a `config.json` that sets it is dropped - it belongs in `config.xml` before the build. Find a code with `tools/tv.py 'getevent -lt'` || `settings_key_keycodes` | list of keycodes | Remote buttons that open Settings, for `HomeKeyService` (TCL Google TV gear: `[83]`) || `settings_key_panel` | bool | Those buttons open a small quick settings panel (TV settings, Display, Network, Apps, Launcher settings) instead of the TV's Settings || `settings_fallback_components` | list, `config.xml` only | Vendor screens tried in order when nothing usable answers the standard Settings action (Xiaomi China, TCL/FFALCON, and Fire OS, where the real menu lives in its launcher), each as `package/activity`; the first one whose package is installed wins, and when none is, the standard intent is sent anyway and may open nothing. Fire OS answers that intent with a `CTSDummy` stub, which counts as missing so the fallback runs. A package named here also has to be listed in the launcher's `<queries>` (Android 11 package visibility), so a set whose settings app is neither of these needs a build, not a theme push. Not read from a theme |