Skip to content

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

SHIELD lists: keep tvrecommendations enabled, it breaks the SHIELD TV phone app

Brian Gilbertd1d5bf5be659
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 70117ad59..4a579559a 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -519,6 +519,38 @@ reads `[TclAppBoot]:forbid bind service ComponentInfo{com.gathin.tvhome/com.gath
and whose `appops get` names the op `AUTO_START`: use the name `appops get` prints. When reporting, give the
model, build, current user and the relevant redacted lines, not the raw dump.
+## SHIELD TV phone app connects, but no key does anything
+
+On an NVIDIA SHIELD, the SHIELD TV phone app finds the box and connects, but the D-pad, OK, Back and
+power buttons in the app do nothing. Restarting the remote server brings them back until the next
+reboot. The key helpers are not the cause: it happens with them off too.
+
+The app's keys go through `com.nvidia.shield.remote.server`, which injects them through its own
+`virtualinput.InputService`, a `TvRemoteProvider` that Android's TV remote service binds at boot.
+Read the state without changing anything:
+
+```sh
+tools/tv.py "logcat -d | grep -E 'Key injection failed|Beyonder_VIS'"
+tools/tv.py "dumpsys activity services com.nvidia.shield.remote.server | awk '/\* ServiceRecord/{inb=/virtualinput.InputService/} inb' | grep -c IntentBindRecord"
+```
+
+`Key injection failed` with `Beyonder_VIS ... mProvider ... isInitialized=false`, and a count of `0`, is
+this fault: the service runs but Android never bound it. `1` is a bound, working service.
+
+Cause: `com.google.android.tvrecommendations` disabled. With it disabled, the provider is not bound after
+boot. Bisected with a reboot per step on a 2017 SHIELD (`darcy`) and confirmed on a 2015/2017 one
+(`foster_e`), both on SHIELD Experience with Android 11: every reboot with it off left the count at `0`,
+every reboot with it on gave `1`. Fix:
+
+```sh
+tools/tv.py "pm enable com.google.android.tvrecommendations"
+```
+
+Wait about 20 seconds before rebooting: Android writes package state to disk with a delay, and a reboot
+straight after `pm enable` can lose the change. `am force-stop com.nvidia.shield.remote.server` makes
+Android bind the provider at once, but only until the next boot. The SHIELD lists in `examples/` keep
+`tvrecommendations` enabled for this reason.
+
## Fire TV (Fire OS): debloat works, the launcher cannot take Home
Why Google TV differs: on Google TV a third-party app can take the HOME role, so the launcher, the
diff --git a/examples/nvidia-shield-tv-2019/debloat.txt b/examples/nvidia-shield-tv-2019/debloat.txt
index b8fcb0641..e93b20727 100644
--- a/examples/nvidia-shield-tv-2019/debloat.txt
+++ b/examples/nvidia-shield-tv-2019/debloat.txt
@@ -54,7 +54,12 @@ com.nvidia.factory # factory test mode
com.nvidia.inputviewer # input test viewer
# Sponsored rows, promos and auto-installs
-com.google.android.tvrecommendations # sponsored / "Top picks" rows on the stock home
+# com.google.android.tvrecommendations - keep it enabled. Disabled, Android stops binding the SHIELD TV
+# phone app's input service (com.nvidia.shield.remote.server, virtualinput.InputService, a TvRemoteProvider)
+# at boot: the app still connects, but every key fails ("Key injection failed", "Beyonder_VIS ...
+# isInitialized=false"). Bisected with a reboot per step on a 2017 SHIELD (darcy) and confirmed on a
+# 2015/2017 one (foster_e), SHIELD Experience on Android 11 (docs/TROUBLESHOOTING.md). The sponsored rows it
+# feeds only show on the stock home, which this list replaces anyway.
android.autoinstalls.config.nvidia # Play auto-installs of partner apps
com.nvidia.shield.welcome # first-run promo
com.nvidia.factorybundling # accessory bundle offers
diff --git a/examples/nvidia-shield-tv-pro-2019/debloat.txt b/examples/nvidia-shield-tv-pro-2019/debloat.txt
index d4e8a14fe..9eb5e5df2 100644
--- a/examples/nvidia-shield-tv-pro-2019/debloat.txt
+++ b/examples/nvidia-shield-tv-pro-2019/debloat.txt
@@ -49,7 +49,12 @@ com.nvidia.diagtools # log collector; re-enable if NVIDIA supp
com.google.android.feedback
# Sponsored rows and auto-installs
-com.google.android.tvrecommendations # sponsored / "Top picks" rows on the stock home
+# com.google.android.tvrecommendations - keep it enabled. Disabled, Android stops binding the SHIELD TV
+# phone app's input service (com.nvidia.shield.remote.server, virtualinput.InputService, a TvRemoteProvider)
+# at boot: the app still connects, but every key fails ("Key injection failed", "Beyonder_VIS ...
+# isInitialized=false"). Bisected with a reboot per step on a 2017 SHIELD (darcy) and confirmed on a
+# 2015/2017 one (foster_e), SHIELD Experience on Android 11 (docs/TROUBLESHOOTING.md). The sponsored rows it
+# feeds only show on the stock home, which this list replaces anyway.
android.autoinstalls.config.nvidia # Play auto-installs of partner apps
# NVIDIA gaming leftovers (GameStream closed in 2023)
diff --git a/tests/test_shield_tvrecommendations_note.py b/tests/test_shield_tvrecommendations_note.py
new file mode 100644
index 000000000..f19139d43
--- /dev/null
+++ b/tests/test_shield_tvrecommendations_note.py
@@ -0,0 +1,56 @@
+"""The SHIELD lists must keep com.google.android.tvrecommendations enabled.
+
+Disabled, Android stops binding the SHIELD TV phone app's input service at boot: the app connects and
+every key fails. Bisected on two SHIELDs (darcy and foster_e, Android 11), and both example lists had it
+as an active line. These tests keep the line out of the SHIELD lists and keep the diagnosis in
+docs/TROUBLESHOOTING.md. Run from the repository root:
+python3 -m unittest discover -s tests -v
+"""
+from pathlib import Path
+import re
+import unittest
+
+
+ROOT = Path(__file__).resolve().parents[1]
+DOC = (ROOT / "docs" / "TROUBLESHOOTING.md").read_text(encoding="utf-8")
+PACKAGE = "com.google.android.tvrecommendations"
+SHIELD_LISTS = sorted((ROOT / "examples").glob("nvidia-shield-*/debloat.txt"))
+
+
+def active_packages(path):
+ """The package names a list would disable: first word of every line that is not a comment."""
+ names = []
+ for line in path.read_text(encoding="utf-8").splitlines():
+ line = line.strip()
+ if line and not line.startswith("#"):
+ names.append(line.split()[0])
+ return names
+
+
+def section(title):
+ start = DOC.index(title)
+ end = DOC.find("\n## ", start + len(title))
+ return re.sub(r"\s+", " ", DOC[start:end if end != -1 else None])
+
+
+class ShieldTvRecommendationsTest(unittest.TestCase):
+ def test_there_are_shield_lists_to_check(self):
+ self.assertGreaterEqual(len(SHIELD_LISTS), 2)
+
+ def test_no_shield_list_disables_it(self):
+ for path in SHIELD_LISTS:
+ with self.subTest(list=path.parent.name):
+ self.assertNotIn(PACKAGE, active_packages(path))
+ self.assertIn(PACKAGE, path.read_text(encoding="utf-8"),
+ "keep the commented line, so the reason stays next to the package")
+
+ def test_troubleshooting_has_the_diagnosis_and_the_fix(self):
+ text = section("## SHIELD TV phone app connects, but no key does anything")
+ for needle in ("Key injection failed", "isInitialized=false", "virtualinput.InputService",
+ "IntentBindRecord", f"pm enable {PACKAGE}", "20 seconds", "darcy", "foster_e"):
+ with self.subTest(needle=needle):
+ self.assertIn(needle, text)
+
+
+if __name__ == "__main__":
+ unittest.main()