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
docs: a bound key helper costs the remote's auto-repeat on TCL G09
xbshenga2c595f6fbe6
diff --git a/PROMPT.md b/PROMPT.mdindex 9b192574b..9b04ef0c8 100644--- a/PROMPT.md+++ b/PROMPT.md@@ -114,6 +114,11 @@ LauncherInput and Settings/dashboard buttons, so after disabling it ask me to press each one, and remap any thatdo nothing with the launcher's key services: `input_key_keycodes` and `app_keys` withINPUT_KEY_SERVICE=1, `settings_key_keycodes` with HOME_KEY_SERVICE=1 (`config.xml` or the theme).+ Enabling either helper has a cost that is not about the buttons it maps: ask me to hold volume up before+ and after, because on a TCL G09 Google TV 12 build a bound key-filtering service drops the key repeats,+ so a ramping volume becomes one step per press - one helper or both, all or nothing - and the price of+ the app buttons is the ramp (`docs/devices/tcl-55p71b-g09-key-repeat.md` has the bisect and the three+ ways out). Say which one I am giving up instead of enabling it quietly.A button the TV logs as `KEY_UNKNOWN` or `KEY_PROGRAM` cannot be matched by keycode, since everyunmapped button shares it: read the scancode with `getevent -lt` and use `settings_key_scancodes`,which only `config.xml` carries (a theme can set keycodes, not scancodes).diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex 3f94df06a..9c579058d 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -338,3 +338,28 @@ change and the denial is back. Seen on a TCL C89B (Google TV 14, `G08`, `UTT2.25reads `[TclAppBoot]:forbid bind service ComponentInfo{com.gathin.tvhome/com.gathin.tvhome.HomeKeyService}`and whose `appops get` names the op `AUTO_START`: use the name `appops get` prints. When reporting, give themodel, build, current user and the relevant redacted lines, not the raw dump.++## A key helper is bound and a held remote button stopped repeating++Hold volume up or down and the volume moves one step per press instead of ramping. The remote is not+broken and neither is the debloat: the kernel still repeats the key, and the ramp is back the moment no+key-filtering accessibility service is bound. On a TCL 55P71B Pro (`G09`, Google TV 12,+`STT2.230203.001.AS23`) it was all or nothing - `HomeKeyService` alone, `InputKeyService` alone and both+together all broke it, with `settings put secure enabled_accessibility_services ''` plus+`accessibility_enabled 0` restoring it. The dumps show `capabilities=8`+(`CAPABILITY_CAN_FILTER_KEY_EVENTS`), so the platform routes every key through a filter path that drops+the repeats, before an app sees them; the launcher's own helpers return `false` for keys they do not map,+so they are not consuming the volume key. Check the state first, do not rewrite the list blind:++```sh+tools/tv.py 'settings get secure enabled_accessibility_services'+tools/tv.py 'settings get secure accessibility_enabled'+tools/tv.py 'dumpsys accessibility'+```++This is a trade, not a defect to fix: the buttons the helpers exist for (a gear button sending+`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).diff --git a/docs/devices/tcl-55p71b-g09-key-repeat.md b/docs/devices/tcl-55p71b-g09-key-repeat.mdnew file mode 100644index 000000000..db7100c7d--- /dev/null+++ b/docs/devices/tcl-55p71b-g09-key-repeat.md@@ -0,0 +1,107 @@+# TCL 55P71B Pro (G09, Google TV 12): a bound key helper costs remote key auto-repeat++Owner report: [#763](https://github.com/Gathin23/cleanyourtv/issues/763). One unit, one session: TCL+55P71B Pro "Smart TV Pro", device `G09`, Android 12 (Google TV), firmware `STT2.230203.001.AS23`,+Amlogic.++## The symptom++Hold volume up or down and the volume moves one step, on the home screen and inside an app. Pressing+the button that many times gives that many steps. The remote is fine and the debloat is not involved:+the kernel still repeats the key (hold it and watch `tools/tv.py 'getevent -lt'`), and the same remote+ramps normally again as soon as no key-filtering accessibility service is bound.++## The bisect++The owner enabled the launcher's two optional helpers one at a time and then together:++| `enabled_accessibility_services` | holding volume up/down |+| --- | --- |+| both `HomeKeyService` and `InputKeyService` | one step per press |+| `HomeKeyService` alone | one step per press |+| `InputKeyService` alone | one step per press |+| `""`, with `accessibility_enabled 0` | ramps continuously |++All or nothing. This is not one helper mishandling `VOLUME_UP`: the dump while broken lists both as+`Service[label=Home button, capabilities=8]` and `Service[label=Home, capabilities=8]`, and capability+8 is `CAPABILITY_CAN_FILTER_KEY_EVENTS`. Any bound service that asks to filter key events puts this+firmware's input path in a mode where the first press arrives and the repeats that follow are dropped.++Read the state without changing anything:++```sh+tools/tv.py 'settings get secure enabled_accessibility_services'+tools/tv.py 'settings get secure accessibility_enabled'+tools/tv.py 'dumpsys accessibility'+```++To get the repeat back for a test, and to put the helpers back afterwards:++```sh+# keep the string the first read printed; the empty list also unbinds TalkBack and any other service+tools/tv.py "settings put secure enabled_accessibility_services ''; settings put secure accessibility_enabled 0"+tools/tv.py "settings put secure enabled_accessibility_services com.gathin.tvhome/com.gathin.tvhome.HomeKeyService:com.gathin.tvhome/com.gathin.tvhome.InputKeyService; settings put secure accessibility_enabled 1"+```++That second line is the launcher's two helpers, not "the value": write back what the read printed.+`theme.sh` already re-puts the list after a theme push, `am force-stop com.gathin.tvhome` drops it on+its own (see [TROUBLESHOOTING](../TROUBLESHOOTING.md)), and re-running `launcher/build-and-install.sh`+without `INPUT_KEY_SERVICE=1`/`HOME_KEY_SERVICE=1` leaves the helpers off.++## The launcher is not the one eating the repeats++Both helpers return `false` for keys they do not map, so a volume key never reaches launcher code and+is not consumed there: `InputKeyService.onKeyEvent` passes anything that is not in `app_keys`,+`input_key_keycodes`, `KEYCODE_TV` or `KEYCODE_TV_INPUT`, and `HomeKeyService` passes everything except+`KEYCODE_ALL_APPS` and the settings keycodes/scancodes. The repeat is lost before the app sees the+event. What the report does not contain is an `onKeyEvent` line for a held volume key, so "the+platform's filter drops the repeat" is the reporter's reading of the bisect, not a captured log. A+future report that logs the repeat event arriving at a helper and being passed through would move the+blame back into the launcher.++## What the helpers buy, and what this costs++The buttons a helper exists for on this remote:++| Button | What arrives | Helper |+| --- | --- | --- |+| Gear (TV settings) | `KEYCODE_NOTIFICATION` 83, scancode 561 | `settings_key_keycodes` / `settings_key_scancodes`, `HOME_KEY_SERVICE=1` |+| Netflix | vendor keycode 4062, scancode 472 | `app_keys`, `INPUT_KEY_SERVICE=1` |+| Prime Video | vendor keycode 4099 | `app_keys` |+| YouTube | vendor keycode 4065 | `app_keys` |+| Input | `KEYCODE_TV` / `KEYCODE_TV_INPUT` | `InputKeyService`, and TCL draws that panel itself on this set |++Vendor keycodes reach nothing on their own: `com.tcl.ttvs`'s `KeyDownBehaviorReceiver` logs+`keyString=4062 keyCode=4062 type=IR` and acts on nothing. These buttons were answered by the stock+home, and the [G09 example list](../../examples/tcl-g09-google-tv/debloat.txt) disables launcherx, so+after the cleanup only a helper can answer them. That is where the trade comes from: on this firmware+the buttons and the volume ramp cannot both be had, because both need the same filter capability.++## Choices++- **Keep the repeat and skip the helpers.** Do not pass `INPUT_KEY_SERVICE=1` or `HOME_KEY_SERVICE=1`+ when installing. The price is the gear button and the remote's app buttons: see the+ [G09 example](../../examples/tcl-g09-google-tv/README.md), whose install line passes+ `INPUT_KEY_SERVICE=1` for exactly those buttons, so a set that behaves like this one pays for them+ with the volume ramp. The Input button keeps working there without any helper.+- **Keep the buttons and accept stepwise volume.** The volume keys still change the volume, one step+ per press; the launcher cannot make the platform ramp it again. Setting volume from a phone app or+ through an AVR/soundbar remote was not compared on this set.+- **Keep launcherx enabled and bind no helper.** The stock home answers those buttons, so the repeat+ survives. This is the only configuration that has both, and the price is the stock home screen the+ cleanup was replacing.++It is a toggle, not a fix: two one-line `settings` writes switch between the two behaviours whenever+you want, but never both at once.++## Limits++One unit, one firmware build (`STT2.230203.001.AS23`), one session. Only volume up/down was held:+channel up/down, a held D-pad (seek) and the media keys were not tried, so "auto-repeat" here means the+key that was measured. Whether a filter service that is not the launcher's (TalkBack, a remote app)+does the same is untested; the capability in the dump is the only common factor seen. No cold boot, no+second remote. The two other G09 units in this repo (UK `G09_4K_GB` AS24 in Brazil, and+`G09_4K_GB_32BIT` AS10) never looked at this, so the claim belongs to the build, not to "G09". No+launcher-side fix is offered, and none should be expected: an app can decline the key - these two+already do - but cannot hand a repeat that the platform dropped back to the input stack, and putting+`VOLUME_UP` in `app_keys` would open an app rather than ramp the volume.diff --git a/examples/README.md b/examples/README.mdindex b27d8ceaa..81fe9ce18 100644--- a/examples/README.md+++ b/examples/README.md@@ -198,6 +198,7 @@ on that firmware, grouped and commented. These are starting points: comment outNotes for models that have no tested list yet live in [`docs/devices/`](../docs/devices/):+- [TCL 55P71B Pro](../docs/devices/tcl-55p71b-g09-key-repeat.md) (`G09`, Google TV 12, `STT2.230203.001.AS23`, Amlogic): holding volume steps once per press as soon as any key-filtering accessibility service is bound - one helper or both, all or nothing - so the remote's app and gear buttons and a ramping volume are mutually exclusive on this build; the bisect, the capability in `dumpsys accessibility`, the way back to either behaviour and what was not tested; no debloat list of its own.- [Strong LEAP-S3](../docs/devices/strong-leap-s3.md) (SkyworthDigital `4K Google TV Box`, device `YDA`, Amlogic S905Y4, Google TV 14 `UKG3.260128.001.C3.0.12_20260904`): a box on the same firmware family as Wanbo X5 Pro, a one-day list kept as a note, the setupwraith/launcherx order that avoided a black screen, remote keycodes (YouTube 266, gear 83) and why `com.oemservice` and `com.sdt.deviceinfo` were looked at.- [TCL BeyondTV AP08](../docs/devices/tcl-beyondtv-ap08.md), `RTD2851`, Android TV 9, patch `2021-01-05`: single-session launcher and package-change report, streaming apps/voice/casting preserved, physical remote and casting checked after restart; no several-day debloat list.- [Haier `HRA962X2_2G_ALI6G_A`](../docs/devices/haier-hra962x2-ali6g-cn.md), China, API 28 / Android 9, `9.0.0-RS-20230315.0915`: ordinary installer UI, provision HOME handover, physical versus injected Home, a once-per-boot adaptation, the settings overlay service (RootActivity opens the source menu), static wallpaper and exact-state recovery. One-day observations with a locally adapted launcher; no several-day debloat list.diff --git a/examples/tcl-g09-google-tv/README.md b/examples/tcl-g09-google-tv/README.mdindex 820120e42..16665942a 100644--- a/examples/tcl-g09-google-tv/README.md+++ b/examples/tcl-g09-google-tv/README.md@@ -62,6 +62,11 @@ they send TCL's own keycodes, which TCL's shortcut manager hands to the stock hoback through the launcher's `InputKeyService`, which is why the install line above passes`INPUT_KEY_SERVICE=1`. Re-pass it on every reinstall; a reinstall drops the service from the accessibility list.+**Ask for that only if you want the buttons more than a ramping volume.** Once a key-filtering service is+bound, holding volume up/down moves one step instead of repeating, on the whole TV, and one helper or both+makes no difference - see [the G09 key-repeat note](../../docs/devices/tcl-55p71b-g09-key-repeat.md) for the+bisect and for the third option (leave launcherx enabled). The Input button below needs no helper.+| Button | Keycode | Scancode | Note ||---|---|---|---|| Netflix | 4062 | 472 | `app_keys` |diff --git a/tests/test_g09_key_repeat_note.py b/tests/test_g09_key_repeat_note.pynew file mode 100644index 000000000..6d82b86b6--- /dev/null+++ b/tests/test_g09_key_repeat_note.py@@ -0,0 +1,158 @@+"""Pins the G09 key-repeat note and the warning that now sits in front of INPUT_KEY_SERVICE=1 (#763).++Enabling a key helper used to read as a free upgrade: the helpers filter the buttons that were lost with+the stock launcher and the docs said nothing about a cost. On a TCL 55P71B Pro (G09, Google TV 12) a bound+key-filtering service costs the remote's key auto-repeat - holding volume steps once per press - and it is+all or nothing, so the app buttons and a ramping volume cannot both be had on that build. The trap is that+the G09 example's install line passes INPUT_KEY_SERVICE=1 without saying so: an owner who follows it and+then finds the volume button "broken" has no reason to look at the helper he just enabled.++These tests keep the bisect (with its control), the way back to either behaviour, the three choices, the+honest limits, and the pass-through claim pinned to the helpers' own code so that a service which starts+consuming every key fails here instead of quietly invalidating the note. Whitespace is flattened before+matching because every file below wraps its prose.+"""+import re+from pathlib import Path+import unittest+++ROOT = Path(__file__).resolve().parents[1]+NOTE = ROOT / "docs" / "devices" / "tcl-55p71b-g09-key-repeat.md"+TROUBLE = ROOT / "docs" / "TROUBLESHOOTING.md"+PROMPT = ROOT / "PROMPT.md"+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"+++def flat(path):+ return re.sub(r"\s+", " ", path.read_text(encoding="utf-8"))+++def links(path):+ """Every non-http link target in a file, resolved, so a moved page fails instead of 404ing for readers."""+ text = path.read_text(encoding="utf-8")+ return [str((path.parent / target).resolve()) for target in re.findall(r"\]\(([^)\s]+)\)", text)+ if not target.startswith(("http", "#"))]+++class KeyRepeatNoteTest(unittest.TestCase):+ def setUp(self):+ self.page = NOTE.read_text(encoding="utf-8")+ self.flat = flat(NOTE)++ def test_names_the_unit_and_the_build_not_the_family(self):+ self.assertIn("#763", self.flat)+ self.assertIn("55P71B Pro", self.flat)+ self.assertIn("`G09`", self.flat)+ self.assertIn("STT2.230203.001.AS23", self.flat)+ self.assertIn("Android 12", self.flat)+ self.assertIn("the claim belongs to the build, not to \"G09\"", self.flat)++ def test_keeps_the_bisect_and_its_control(self):+ for row in (+ "both `HomeKeyService` and `InputKeyService` | one step per press",+ "`HomeKeyService` alone | one step per press",+ "`InputKeyService` alone | one step per press",+ "`\"\"`, with `accessibility_enabled 0` | ramps continuously",+ ):+ with self.subTest(row=row):+ self.assertIn(row, self.flat)+ self.assertIn("All or nothing", self.flat)++ def test_names_the_capability_that_is_the_common_factor(self):+ self.assertIn("capabilities=8", self.flat)+ self.assertIn("CAPABILITY_CAN_FILTER_KEY_EVENTS", self.flat)+ self.assertIn("dumpsys accessibility", self.flat)+ self.assertIn("settings get secure enabled_accessibility_services", self.flat)++ def test_the_way_back_does_not_tell_people_to_guess(self):+ self.assertIn("write back what the read printed", self.flat)+ self.assertIn("unbinds TalkBack", self.flat,+ "clearing the list drops every other accessibility service too")+ self.assertIn("theme.sh", self.flat)+ self.assertIn("INPUT_KEY_SERVICE=1", self.flat)+ self.assertNotIn("equivalent", self.flat,+ "there is no 'equivalent' list to regenerate, only the string that was there")++ def test_the_launcher_is_exonerated_by_its_own_code(self):+ self.assertIn("The launcher is not the one eating the repeats", self.flat)+ self.assertIn("return `false` for keys they do not map", self.flat)+ input_service = flat(INPUT_SERVICE)+ home_service = flat(HOME_SERVICE)+ self.assertIn("if (app == null && !isInputKey(event.getKeyCode())) return false;", input_service,+ "InputKeyService must keep passing unmatched keys through, or the note is wrong")+ self.assertIn("if (event.getKeyCode() != KeyEvent.KEYCODE_ALL_APPS) return false;", home_service,+ "HomeKeyService must keep passing unmatched keys through, or the note is wrong")+ self.assertIn("not a captured log", self.flat,+ "the platform-filter reading is inference until an onKeyEvent line exists")++ def test_records_the_trade_with_the_keycodes_that_make_it_real(self):+ for needle in ("`KEYCODE_NOTIFICATION` 83", "scancode 561", "4062", "scancode 472", "4099", "4065"):+ with self.subTest(needle=needle):+ self.assertIn(needle, self.flat)+ self.assertIn("cannot both be had", self.flat)+ self.assertIn("KeyDownBehaviorReceiver", self.flat)++ def test_offers_the_three_ways_out_and_a_toggle(self):+ self.assertIn("## Choices", self.page)+ self.assertIn("Keep the repeat and skip the helpers", self.flat)+ self.assertIn("Keep the buttons and accept stepwise volume", self.flat)+ self.assertIn("Keep launcherx enabled and bind no helper", self.flat)+ self.assertIn("never both at once", self.flat)++ def test_limits_stay_honest(self):+ self.assertIn("## Limits", self.page)+ for needle in ("One unit, one firmware build", "Only volume up/down was held", "No cold boot",+ "No launcher-side fix is offered", "does the same is untested"):+ with self.subTest(needle=needle):+ self.assertIn(needle, self.flat)++ def test_links_resolve(self):+ for target in links(NOTE):+ with self.subTest(target=target):+ self.assertTrue(Path(target).exists(), "relative link target does not exist")+++class EntryPointsTest(unittest.TestCase):+ def test_example_warns_before_the_install_line(self):+ text = flat(G09_README)+ index = text.index("`INPUT_KEY_SERVICE=1`")+ warning = text.index("Ask for that only if you want the buttons more than a ramping volume")+ self.assertLess(index, warning, "the warning has to follow the install line it qualifies")+ self.assertIn("moves one step instead of repeating", text)+ self.assertIn(str(NOTE.resolve()), links(G09_README))+ self.assertIn("leave launcherx enabled", text)++ def test_troubleshooting_section_names_the_symptom_and_the_trade(self):+ text = flat(TROUBLE)+ heading = "## A key helper is bound and a held remote button stopped repeating"+ self.assertEqual(text.count(heading), 1)+ start = text.index(heading)+ section = text[start:]+ for needle in ("one step per press instead of ramping", "capabilities=8", "4062",+ "INPUT_KEY_SERVICE=1", "unbinds TalkBack", "tcl-55p71b-g09-key-repeat.md"):+ with self.subTest(needle=needle):+ self.assertIn(needle, section)+ self.assertEqual(TROUBLE.read_text(encoding="utf-8").count(heading), 1)++ def test_prompt_asks_before_enabling_a_helper(self):+ text = flat(PROMPT)+ self.assertIn("ask me to hold volume up before", text)+ self.assertIn("all or nothing", text)+ self.assertIn("docs/devices/tcl-55p71b-g09-key-repeat.md", text)+ self.assertIn("Say which one I am giving up", text)++ def test_examples_index_lists_the_note(self):+ text = EXAMPLES.read_text(encoding="utf-8")+ self.assertIn(str(NOTE.resolve()), links(EXAMPLES))+ bullets = [line for line in text.split("\n") if line.startswith("- [TCL 55P71B Pro]")]+ self.assertEqual(len(bullets), 1, "exactly one index bullet for this note")+ self.assertIn("all or nothing", bullets[0])+ self.assertIn("no debloat list of its own", bullets[0])+++if __name__ == "__main__":+ unittest.main()