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: sabrina casting needs a receiver restart; close Wireless debugging separately
Facundo Lopez32a5d75196b0
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex 046977d6b..dad73b1ff 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -30,7 +30,10 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/then `adb connect`), run `adb tcpip 5555`, and `tools/tv.py` works from then on. `dns-sd -B_adb-tls-pairing._tcp` (or `adb mdns services`) shows the pairing port while the code is on screen.Android switches Wireless debugging off whenever Wi-Fi drops; turn it back on and `adb` reconnects- without a new code. Port 5555 from `adb tcpip` usually lasts only until the next reboot.+ without a new code. Port 5555 from `adb tcpip` usually lasts only until the next reboot. When you+ close up, switch Wireless debugging off on its own: on a Chromecast with Google TV 4K (`sabrina`)+ turning USB debugging off left the Wireless debugging port accepting connections, and+ `tools/adb-closed.py` only checks 5555. `adb mdns services` lists that port while it is open.- **USB devices go dead while USB debugging is on**, seen on the Xiaomi Mi Box S and the Xiaomi TVBox S 3rd gen ([MiTV-AFMU0, Google TV 14](https://github.com/Gathin23/cleanyourtv/issues/737)):their firmware switches the USB port to ADB device mode, which cuts the power to a USB speaker or@@ -307,7 +310,13 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/the credentials in memory, so casting survives until the next reboot - and only in that process.`am force-stop com.google.android.apps.mediashell` followed by the receiver coming back prints`Retry loading factory credentials` and `No private key, hence empty signature` again, so anything- that restarts it (a crash, a force-stop, an update) needs the same sequence. Reported on Google's+ that restarts it (a crash, a force-stop, an update) needs the same sequence. Re-enabling the+ wizard is not always enough after a reboot: on a Chromecast with Google TV 4K (`sabrina`,+ UTTC.250917.004) no `ClientAuthSigner` line came within 3 minutes and phones did not even list the+ device. Restart the receiver while setupwraith is enabled instead: `am force-stop+ com.google.android.apps.mediashell`, then `am start-foreground-service -n+ com.google.android.apps.mediashell/.CastReceiverService` (after a force-stop nothing starts it+ again), and the signer line and `MdnsAppFilter: Done announcing.` follow within seconds. Reported on Google'sown Chromecast hardware (`boreal`) and, with the same log lines, on a Google TV Streamer(`kirkwood`, `UTTK.260317.003`), where the `CastInfoProvider` also lives inside the setupwraithAPK; the Xiaomi Mi Box S 2nd gen list says casting from a Pixel still works there withdiff --git a/examples/google-chromecast-gtv-4k/debloat.txt b/examples/google-chromecast-gtv-4k/debloat.txtindex de129b0c3..3999cdfd8 100644--- a/examples/google-chromecast-gtv-4k/debloat.txt+++ b/examples/google-chromecast-gtv-4k/debloat.txt@@ -28,6 +28,13 @@# "Created singleton instance of ClientAuthSigner" in logcat, then disable it again - the receiver# holds the credentials in memory, so casting works until the next reboot# (docs/TROUBLESHOOTING.md, "Casting fails with Untrusted device").+# Seen again after a reboot: re-enabling setupwraith brought no ClientAuthSigner line within 3 minutes+# and phones did not list the device at all. With setupwraith enabled, restart the receiver instead:+# am force-stop com.google.android.apps.mediashell+# am start-foreground-service -n com.google.android.apps.mediashell/.CastReceiverService+# (nothing starts it again after a force-stop); the signer line follows within seconds.+# - Turning USB debugging off leaves Wireless debugging listening on its own port. Switch both off when+# you are done; tools/adb-closed.py only checks 5555.# - With launcherx disabled the YouTube button on the remote does nothing. It sends BUTTON_3# (keycode 190). Button Mapper only remaps added buttons in its paid Pro version; Key Mapper# (open source, keymapperorg/KeyMapper) does it for free. Play Store lists Key Mapper as incompatiblediff --git a/tests/test_sabrina_cast_restart_note.py b/tests/test_sabrina_cast_restart_note.pynew file mode 100644index 000000000..577decfdc--- /dev/null+++ b/tests/test_sabrina_cast_restart_note.py@@ -0,0 +1,69 @@+"""The Chromecast with Google TV 4K notes must keep the receiver restart and the wireless-debugging close.++On `sabrina` (UTTC.250917.004), after a reboot, re-enabling setupwraith alone brought no+`ClientAuthSigner` line within 3 minutes and phones did not list the device. Force-stopping the+receiver with setupwraith enabled and starting `CastReceiverService` by hand loaded the credentials in+seconds. Closing up, turning USB debugging off left the Wireless debugging port open, which+tools/adb-closed.py does not check.++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")+EXAMPLE = (ROOT / "examples" / "google-chromecast-gtv-4k" / "debloat.txt").read_text(encoding="utf-8")+START = "am start-foreground-service -n com.google.android.apps.mediashell/.CastReceiverService"+++def bullets(text):+ """Split a markdown doc into its `- **Title**` bullets, wrapping lines included."""+ found, current = [], None+ for line in text.splitlines():+ if line.startswith("- **"):+ if current is not None:+ found.append(current)+ current = line+ elif current is not None and (line.startswith(" ") or not line.strip()):+ current += "\n" + line+ else:+ if current is not None:+ found.append(current)+ current = None+ if current is not None:+ found.append(current)+ return found+++def bullet_containing(needle):+ matches = [b for b in bullets(DOC) if needle in b]+ assert len(matches) == 1, f"expected one bullet with {needle!r}, found {len(matches)}"+ return re.sub(r"\s+", " ", matches[0])+++class SabrinaCastRestartNoteTest(unittest.TestCase):+ def test_the_casting_bullet_restarts_the_receiver(self):+ casting = bullet_containing("Casting from a phone fails")+ self.assertIn("sabrina", casting)+ self.assertIn("am force-stop com.google.android.apps.mediashell", casting)+ self.assertIn(START, casting)+ self.assertIn("ClientAuthSigner", casting)++ def test_the_wireless_bullet_says_to_switch_it_off_separately(self):+ wireless = bullet_containing("USB debugging never opens port 5555")+ self.assertIn("switch Wireless debugging off on its own", wireless)+ self.assertIn("tools/adb-closed.py", wireless)++ def test_the_example_header_carries_both(self):+ header = "\n".join(l for l in EXAMPLE.splitlines() if l.startswith("#"))+ self.assertIn("am force-stop com.google.android.apps.mediashell", header)+ self.assertIn(START, header)+ self.assertIn("Wireless debugging", header)+++if __name__ == "__main__":+ unittest.main()