Skip to content

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

docs: one section for the key-helper repeat trade, and the switch that buys the repeat back

xbsheng5b6a93b168b3
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 2474d0231..71b8e0e7d 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -454,18 +454,6 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/
once by hand. On a TV whose list disables the updater, this only happens when you install an
update on purpose: enable the updater, update, `check.py --fix`, disable it again.
-## Held-down remote keys do not repeat (volume steps once per long press)
-
-On some firmware — seen on a TCL Google TV 12 build — enabling any accessibility service that requests
-key filtering (the launcher's `HomeKeyService` and `InputKeyService`) breaks key auto-repeat: the held
-button produces a single press. With every such service disabled the repeat returns.
-
-There is no way to keep the remote buttons those helpers power *and* the repeat on those builds; choose
-one. To keep the helpers enabled but stop them filtering (repeat works, the buttons they handled go
-dead), push a theme with `"key_filter": false` in `config.json` — the service drops
-`FLAG_REQUEST_FILTER_KEY_EVENTS` at runtime instead of needing the whole service disabled. `config.xml`
-has the same switch as the `key_filter` bool for a rebuild.
-
## Accessibility helper enabled but the remote button does nothing
The optional `HomeKeyService` and `InputKeyService` only filter remote keys once Android has bound to
@@ -622,5 +610,9 @@ This is a trade, not a defect to fix: the buttons the helpers exist for (a gear
`KEYCODE_NOTIFICATION` 83, app buttons sending vendor keycodes such as 4062) were answered by the stock
home, so on a set whose list disabled launcherx only a helper can answer them. Either keep the repeat and
install without `INPUT_KEY_SERVICE=1`/`HOME_KEY_SERVICE=1`, or keep the buttons and accept one step per
-press, or leave launcherx enabled and bind nothing. Write back the exact string the first read printed;
-the empty list also unbinds TalkBack. Bisect, keycodes and limits: [the G09 note](devices/tcl-55p71b-g09-key-repeat.md).
+press, or leave launcherx enabled and bind nothing, or keep the services bound and stop them filtering:
+`"key_filter": false` in a theme's `config.json` — the same bool in `config.xml` for a rebuild — makes
+them drop `FLAG_REQUEST_FILTER_KEY_EVENTS` at runtime, so the ramp comes back and the buttons they
+handled go dead, the same trade without a `settings` write. Write back the exact string the first read
+printed; the empty list also unbinds TalkBack. Bisect, keycodes and limits:
+[the G09 note](devices/tcl-55p71b-g09-key-repeat.md).
diff --git a/tests/test_g09_key_repeat_note.py b/tests/test_g09_key_repeat_note.py
index 53e04fbb2..06cf8efa5 100644
--- a/tests/test_g09_key_repeat_note.py
+++ b/tests/test_g09_key_repeat_note.py
@@ -25,6 +25,8 @@ EXAMPLES = ROOT / "examples" / "README.md"
G09_README = ROOT / "examples" / "tcl-g09-google-tv" / "README.md"
INPUT_SERVICE = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "InputKeyService.java"
HOME_SERVICE = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "HomeKeyService.java"
+CONFIG_XML = ROOT / "launcher" / "app" / "src" / "main" / "res" / "values" / "config.xml"
+CONFIG_JAVA = ROOT / "launcher" / "app" / "src" / "main" / "java" / "com" / "gathin" / "tvhome" / "Config.java"
def flat(path):
@@ -38,6 +40,19 @@ def links(path):
if not target.startswith(("http", "#"))]
+def sections(text):
+ """(heading, flattened body) for every '## ' section of a page.
+
+ A needle anywhere below a heading is not proof that the section carries it: `section` above runs to
+ the end of the page, which is why a fact that moved into the next section still reads as present.
+ """
+ out = []
+ for block in re.split(r"(?m)^## ", text)[1:]:
+ heading, _, body = block.partition("\n")
+ out.append(("## " + heading.strip(), re.sub(r"\s+", " ", body)))
+ return out
+
+
class KeyRepeatNoteTest(unittest.TestCase):
def setUp(self):
self.page = NOTE.read_text(encoding="utf-8")
@@ -157,5 +172,56 @@ class EntryPointsTest(unittest.TestCase):
self.assertIn("no debloat list of its own", bullets[0])
+class OneSectionForTheTradeTest(unittest.TestCase):
+ """The switch that buys the repeat back belongs in the same section as the evidence.
+
+ docs/TROUBLESHOOTING.md used to carry this trade twice: a short "Held-down remote keys do not
+ repeat" section that named `key_filter` and nothing else, and, 130 lines further down, the section
+ with the G09/MOSR4 bisect, `capabilities=8` and the link to the note - which never mentioned the
+ switch. A reader who found either one got half of it, and the half that named the switch said
+ "there is no way to keep the buttons and the repeat" without the build, the bisect or the limits.
+ """
+
+ def setUp(self):
+ self.found = sections(TROUBLE.read_text(encoding="utf-8"))
+
+ def test_the_switch_is_documented_in_exactly_one_section(self):
+ naming = [heading for heading, body in self.found if "key_filter" in body]
+ self.assertEqual(len(naming), 1,
+ f"key_filter is documented in {len(naming)} sections: {naming}")
+
+ def test_that_section_carries_the_evidence_and_the_note(self):
+ for heading, body in self.found:
+ if "key_filter" not in body:
+ continue
+ for needle in ("capabilities=8", "INPUT_KEY_SERVICE=1", "FLAG_REQUEST_FILTER_KEY_EVENTS",
+ "tcl-55p71b-g09-key-repeat.md"):
+ with self.subTest(needle=needle):
+ self.assertIn(needle, body, f"{heading} names key_filter but not {needle}")
+
+ def test_the_switch_is_one_the_launcher_reads(self):
+ self.assertIn('<bool name="key_filter">', CONFIG_XML.read_text(encoding="utf-8"),
+ "the doc names a key_filter switch config.xml does not define")
+ self.assertIn("R.bool.key_filter", CONFIG_JAVA.read_text(encoding="utf-8"),
+ "the doc names a key_filter switch the launcher never reads")
+
+
+class TheSectionReaderTest(unittest.TestCase):
+ """sections() itself, so the two tests above cannot pass by finding no sections."""
+
+ def test_returns_one_entry_per_heading_with_its_own_body(self):
+ found = dict(sections("intro\n## A\nbody a\n\n## B\nbody b\n"))
+ self.assertEqual(list(found), ["## A", "## B"])
+ self.assertIn("body a", found["## A"])
+ self.assertNotIn("body b", found["## A"])
+
+ def test_a_wrapped_sentence_is_flattened_so_it_still_matches(self):
+ found = dict(sections("## A\ntools/tv.py 'settings get secure\nenabled_accessibility_services'\n"))
+ self.assertIn("settings get secure enabled_accessibility_services", found["## A"])
+
+ def test_a_page_without_headings_has_no_sections(self):
+ self.assertEqual(sections("just prose, no headings\n"), [])
+
+
if __name__ == "__main__":
unittest.main()