Skip to content

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

docs: the KitKat set that hung on INICIALIZANDO came back, and the only Home app was the cause (#795)

xbshengc72ad03fdd5d
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 9527a4e55..32139c8a8 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -200,24 +200,28 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/
test app does not count as something else: on a Xiaomi Mi TV 4A
`com.duokan.factorytest/.FactoryLauncher` answers HOME, so the guard leaves it out, along with any
package named `*factorytest*`, `*factory_test*` or `*factorymode*`.
-- **The TV stays on the boot logo with ADB gone** after a list, seen on a KitKat-era set
- ([COOP COTV-0001](https://github.com/Gathin23/cleanyourtv/issues/795): Realtek `rtd298x`, Android
- 4.4.2, SDK 19). 17 packages were disabled over Ethernet ADB, each answered `new state:
- disabled-user` and `pm list packages -d` read back all 17; the factory launcher
- `com.haiersoft.launcherproject2995hk` was among them with no replacement, because the launcher
- here needs Android 8.0. After the power cycle the set sits on the green robot and `INICIALIZANDO`,
- port 5555 goes from filtered to "No route to host", and there is no recovery button, no service
- port and no public firmware for that board, so `tools/restore.sh` cannot run. What is *not* known:
- whether the disabled packages did it, whether pulling the plug during the first boot damaged
- something, or whether that firmware just needs a long first boot after package state changes.
- Treat it as how these sets get lost rather than as a diagnosis, and on a set that cannot take the
- launcher: leave the stock launcher alone, keep ADB on Ethernet (KitKat has no network-debugging
- toggle, and Wi-Fi closed 5555 on this one), and apply the list in batches with a reboot between
- them. `tools/disable.sh` skips Home's owner when it can name it; since
+- **The TV stays on the boot logo after a list, and disabling the only Home app is enough to do
+ it**, seen on a KitKat-era set ([COOP COTV-0001](https://github.com/Gathin23/cleanyourtv/issues/795):
+ Realtek `rtd298x`, Android 4.4.2, SDK 19). 17 packages were disabled over Ethernet ADB, each
+ answered `new state: disabled-user` and `pm list packages -d` read back all 17; the factory
+ launcher `com.haiersoft.launcherproject2995hk` was among them with no replacement, because the
+ launcher here needs Android 8.0. After the power cycle the set sat on the green robot and
+ `INICIALIZANDO` for 20+ minutes, across a hard power cut and another off/on from the remote. The
+ reporter then isolated it: disabling that one package reproduces the hang and re-enabling it boots
+ the set, so the batch size and the power cut were not the cause. Two things to carry away. First,
+ the screen being stuck does not mean the set is gone: this one still answered ADB on Ethernet while
+ it said `INICIALIZANDO`, and `pm enable` on every package from the pre-change backup plus a reboot
+ brought it back (the recovery steps are in the [device notes](devices/coop-cotv-0001.md)). Second, a
+ vendor package that looks unrelated can be what the launcher runs on - here disabling `com.tsb.tv`
+ stopped the launcher with "Se ha detenido la aplicación lancherProject" instead of breaking the
+ boot - which is why a list goes on in batches with a reboot and a look at the screen between them,
+ on a set that cannot take the launcher especially: leave the stock launcher alone, and keep ADB on
+ Ethernet (KitKat has no network-debugging toggle, and Wi-Fi closed 5555 on this one).
+ `tools/disable.sh` skips Home's owner when it can name it; since
[#795](https://github.com/Gathin23/cleanyourtv/issues/795) it asks `dumpsys activity` when `cmd
- package` is missing (Android 6 and older, where that command does not exist) and warns when
- neither answers. That warning means the guard did not run, not that the list is safe. Nothing here
- brings such a set back - a vendor recovery image does, if one exists.
+ package` is missing (Android 6 and older, where that command does not exist) and warns when neither
+ answers. That warning means the guard did not run, not that the list is safe. Without ADB and
+ without a vendor recovery image, a set stuck this way is still out of reach.
- **China-market Xiaomi rejects a default Home despite `set-home-activity` reporting success**,
verified on MiTV-AETP0 (dofus), Android 9, firmware 22.9.2.851: the framework filters third-party
HOME candidates by a package-name allowlist. Disabling the stock launcher then selects
diff --git a/docs/devices/coop-cotv-0001.md b/docs/devices/coop-cotv-0001.md
new file mode 100644
index 000000000..3f0378812
--- /dev/null
+++ b/docs/devices/coop-cotv-0001.md
@@ -0,0 +1,124 @@
+# COOP COTV-0001 (Realtek rtd298x, Android 4.4.2, Argentina)
+
+Report for a KitKat-era set sold by Cooperativa RENACER (Ushuaia) as "TV LED HD SMART". Source:
+issue [#795](https://github.com/Gathin23/cleanyourtv/issues/795). The first report ended with the
+cause unknown and the set written off; the same reporter then isolated the cause, recovered the TV and
+re-applied the list in batches. That second half is why this note exists — the merged bullet in
+`docs/TROUBLESHOOTING.md` had said a set stuck this way was unrecoverable.
+
+> **Warning:** `com.haiersoft.launcherproject2995hk` is the only Home app on this build, and the repo
+> launcher needs Android 8.0 (minSdk 26) where this set is SDK 19, so nothing can replace it. Disable
+> it and every boot stops on `INICIALIZANDO`. `com.tsb.tv` looks unrelated and is a dependency of that
+> launcher: disabling it crash-loops the launcher instead.
+
+## Device
+
+| Field | Value |
+| :--- | :--- |
+| Retail model | COOP COTV-0001 ("TV LED HD SMART"), serial 001909 |
+| Product / board | `rtd298x_tv001` |
+| SoC | Realtek `rtd298x` |
+| Kernel | 3.7.2-298x |
+| Android / SDK | 4.4.2 / 19 |
+| Build | `rtd298x_tv001-eng 4.4.2 KOT49H eng.yeh.20180522.224300 test-keys` (eng build, test-keys) |
+| Bootloader | 0000.0000.0002 |
+| SELinux | Enforcing |
+| Packages | 58 |
+| Ports | 2× USB-A host, Ethernet, Wi-Fi; no visible recovery button or service port |
+| Developer options | USB debugging only (KitKat has no network-ADB toggle) |
+
+## How the set was reached
+
+- Wi-Fi (192.168.18.3): port 5555 closed, `nmap -Pn -p 1-65535` found no open TCP port at all.
+- Ethernet (192.168.18.32): 5555 open, and that is the only way in. `tools/tv.py` was used because no
+ `adb` binary was installed on the reporter's machine.
+- The first connection raised `ConnectionResetError`; a retry a few seconds later worked. The set
+ seems to accept one ADB session at a time, so a failed connect is not the end of it.
+
+## What went wrong
+
+17 packages were disabled with `pm disable-user --user 0`, each one echoing `new state: disabled-user`,
+and `pm list packages -d` read back all 17. The factory launcher
+`com.haiersoft.launcherproject2995hk` was among them and no replacement was installed, because the
+repo launcher cannot run below Android 8.0. After a power cycle the set sat on the green Android robot
+with `INICIALIZANDO` for 20+ minutes, and stayed there across a hard power cut and another off/on from
+the remote.
+
+## Cause, isolated
+
+Disabling `com.haiersoft.launcherproject2995hk` alone reproduces the hang; re-enabling it and
+rebooting brings the set back. The hard power cut during the first boot was **not** the cause, and
+neither was the batch size: 15 of the same 17 packages are disabled today on a working set.
+
+## The second trap: `com.tsb.tv`
+
+Disabling `com.tsb.tv` makes the launcher crash in a loop with "Se ha detenido la aplicación
+lancherProject", and re-enabling it clears the dialog. Nothing in a package list says that a
+seemingly unrelated vendor package is what the launcher runs on, which is the argument for applying a
+list in batches with a reboot and a look at the screen between them, rather than for any particular
+package name.
+
+## Recovery from `INICIALIZANDO`
+
+- **The stuck screen can still answer ADB.** After the set was written off as unreachable, ping and
+ port 5555 answered again on the Ethernet address while the display still said `INICIALIZANDO`. The
+ reporter suspects the Ethernet cable was loose during the earlier checks and could not confirm it,
+ but check the link and retry before concluding that a KitKat set is lost.
+- Re-enable every package from the pre-change backup, confirm the disabled list is empty, then reboot:
+
+ ```sh
+ tools/tv.py 'pm list packages -d'
+ tools/tv.py 'pm enable com.haiersoft.launcherproject2995hk'
+ # ...once per package that was disabled, or once per package in the backup
+ tools/tv.py 'pm list packages -d' # must print nothing
+ tools/tv.py reboot
+ ```
+
+ This set showed `INICIALIZANDO` once more on the reboot and then booted normally. Boots take 33–73 s.
+- A USB keyboard or a service port is not available on this board, and there is no public firmware, so
+ `tools/restore.sh` is only reachable while ADB answers — which is exactly why the two minutes spent
+ re-checking the Ethernet link matter.
+
+## The list that worked
+
+15 of the original 17, applied in four groups with a reboot and a screen check after each, and the
+last two tried on their own once the set had been stable for a while:
+
+| Group | Packages | Result |
+| :--- | :--- | :--- |
+| 1 | `com.android.galaxy4`, `com.android.noisefield`, `com.android.dreams.phototable`, `com.android.dreams.basic`, `com.android.soundrecorder`, `com.android.speechrecorder` | boots |
+| 2 | `com.realtek.camera`, `com.rtk.android.miracast`, `com.svox.pico` | boots |
+| 3 | `com.adups.fota`, `com.adups.fota.sysoper`, `cn.haiqin.realtek.other.vstoresubclient` | boots, menu and media playback work |
+| 4 | `com.cvte.taskmanager` | boots |
+| later | `com.rtk.mediabrowser`, `com.hikeen.xymenu` | boots; media playback and the TV menu still work |
+
+**Must stay enabled:** `com.haiersoft.launcherproject2995hk` (the only Home app) and `com.tsb.tv`
+(what that launcher runs on). Neither has a replacement on SDK 19.
+
+An earlier idea in the report — skipping `com.adups.*` on old builds — was withdrawn by the reporter:
+both adups packages disabled cleanly and the set booted, so the trap is the Home package, not the
+updater.
+
+## Limits
+
+- One unit, one eng/test-keys build, one evening. The groups were checked with a reboot and a look at
+ the menu and media playback, not package by package; only the launcher and `com.tsb.tv` were
+ isolated on their own.
+- No cold boot after the final list, and no second power cycle, so a delayed failure is still
+ possible.
+- Nothing here says other `rtd298x` builds behave the same, and nothing was tested about
+ `com.realtek.*` packages beyond the two above.
+- `com.rtk.engmenu` was deliberately left untouched.
+- The launcher half is impossible on this set: minSdk 26 against SDK 19. Lowering minSdk is a source
+ change, and an APK rebuilt elsewhere is not something this repo verifies.
+
+## What to do differently
+
+- Keep the stock launcher. `tools/disable.sh` skips the package that owns Home when no other installed
+ app can answer HOME, and on Android 6 and older it asks `dumpsys activity` when `cmd package` is
+ missing (see `docs/TROUBLESHOOTING.md`). On this set that check would have to name
+ `com.haiersoft.launcherproject2995hk` through `dumpsys activity`; the reporter disabled the packages
+ by hand, so it never ran, and whether it names this launcher here is unverified.
+- Keep the ADB path alive: Ethernet, since this firmware has no network-debugging toggle, and one
+ session at a time.
+- Batches with a reboot between them, not one long list: that is how `com.tsb.tv` was caught.
diff --git a/tests/test_coop_cotv_0001_note.py b/tests/test_coop_cotv_0001_note.py
new file mode 100644
index 000000000..da7ad4dc4
--- /dev/null
+++ b/tests/test_coop_cotv_0001_note.py
@@ -0,0 +1,172 @@
+"""The #795 report, second half: the KitKat set was recovered and the cause was isolated.
+
+The merged troubleshooting bullet said a set stuck on `INICIALIZANDO` was not to be brought back, and
+left three candidate causes open. The same reporter then isolated the cause, recovered the TV with
+`pm enable` plus a reboot, and re-applied the list in batches. These tests pin that record, the
+recovery steps, and that the bullet no longer tells readers the set is lost.
+
+Run from the repository root: python3 -m unittest discover -s tests -v
+"""
+import re
+from pathlib import Path
+import unittest
+
+ROOT = Path(__file__).resolve().parents[1]
+NOTE = ROOT / "docs" / "devices" / "coop-cotv-0001.md"
+TROUBLE = ROOT / "docs" / "TROUBLESHOOTING.md"
+ISSUE = "https://github.com/Gathin23/cleanyourtv/issues/795"
+LAUNCHER = "com.haiersoft.launcherproject2995hk"
+DEPENDENCY = "com.tsb.tv"
+
+DISABLED = [
+ "com.android.galaxy4",
+ "com.android.noisefield",
+ "com.android.dreams.phototable",
+ "com.android.dreams.basic",
+ "com.android.soundrecorder",
+ "com.android.speechrecorder",
+ "com.realtek.camera",
+ "com.rtk.android.miracast",
+ "com.svox.pico",
+ "com.adups.fota",
+ "com.adups.fota.sysoper",
+ "cn.haiqin.realtek.other.vstoresubclient",
+ "com.cvte.taskmanager",
+ "com.rtk.mediabrowser",
+ "com.hikeen.xymenu",
+]
+
+LINK = re.compile(r"\]\(([^)\s]+)\)")
+
+BULLET_START = "- **The TV stays on the boot logo after a list"
+
+
+def flat(text):
+ """Prose wrapped across lines, so match on a single line of it."""
+ return re.sub(r"[ \t]*\n[ \t]*", " ", text)
+
+
+def bullet(text, start):
+ """The markdown bullet that begins with `start`, up to the next top-level bullet."""
+ lines = text.split("\n")
+ first = next((i for i, line in enumerate(lines) if line.startswith(start)), None)
+ if first is None:
+ raise AssertionError("no troubleshooting bullet starts with %r" % start)
+ out = [lines[first]]
+ for line in lines[first + 1:]:
+ if line.startswith("- **") or line.startswith("## "):
+ break
+ out.append(line)
+ return "\n".join(out)
+
+
+def broken_links(path):
+ return [
+ target for target in LINK.findall(path.read_text(encoding="utf-8"))
+ if not target.startswith(("http://", "https://", "mailto:", "#"))
+ and target.split("#", 1)[0]
+ and not (path.parent / target.split("#", 1)[0]).exists()
+ ]
+
+
+class CoopNoteTest(unittest.TestCase):
+ def setUp(self):
+ self.text = NOTE.read_text(encoding="utf-8")
+
+ def test_note_exists_and_identifies_the_build(self):
+ self.assertIn("rtd298x_tv001", self.text)
+ self.assertIn("4.4.2", self.text)
+ self.assertIn("SDK 19", self.text)
+ self.assertIn("KOT49H eng.yeh.20180522.224300 test-keys", self.text)
+ self.assertIn("58", self.text)
+
+ def test_note_links_the_issue_and_resolves_its_links(self):
+ self.assertIn(ISSUE, self.text)
+ self.assertEqual(broken_links(NOTE), [])
+
+ def test_cause_is_stated_as_isolated_not_guessed(self):
+ body = flat(self.text)
+ self.assertIn("Disabling `%s` alone reproduces the hang" % LAUNCHER, body)
+ self.assertIn("The hard power cut during the first boot was **not** the cause", body)
+
+ def test_dependency_trap_is_recorded_with_its_evidence(self):
+ body = flat(self.text)
+ self.assertIn("Disabling `%s`" % DEPENDENCY, body)
+ self.assertIn("Se ha detenido la aplicación lancherProject", body)
+ self.assertIn("re-enabling it clears the dialog", body)
+
+ def test_recovery_keeps_the_stuck_screen_reachable(self):
+ body = flat(self.text)
+ self.assertIn("still answer ADB", body)
+ self.assertIn("INICIALIZANDO", body)
+ self.assertIn("pm list packages -d", self.text)
+ self.assertIn("pm enable", self.text)
+ self.assertIn("tools/tv.py reboot", self.text)
+ self.assertIn("33–73 s", self.text)
+
+ def test_every_disabled_package_is_recorded(self):
+ for package in DISABLED:
+ self.assertIn("`%s`" % package, self.text)
+
+ def test_the_two_packages_that_must_stay_enabled_are_named(self):
+ body = flat(self.text).split("**Must stay enabled:**", 1)[1].split("## Limits", 1)[0]
+ self.assertIn(LAUNCHER, body)
+ self.assertIn(DEPENDENCY, body)
+
+ def test_no_example_list_is_claimed(self):
+ """One evening, one power cycle short of a lived-with list: no examples/ entry."""
+ self.assertFalse(
+ (ROOT / "examples" / "coop-cotv-0001").exists(),
+ "an examples/ entry would claim days of use this report does not have",
+ )
+ self.assertIn("## Limits", self.text)
+ self.assertIn("No cold boot", flat(self.text))
+
+ def test_launcher_half_is_described_as_impossible(self):
+ body = flat(self.text)
+ self.assertIn("minSdk 26", body)
+ self.assertIn("SDK 19", body)
+
+ def test_guard_behaviour_is_not_promised_for_this_set(self):
+ body = flat(self.text)
+ self.assertIn("dumpsys activity", body)
+ self.assertIn("unverified", body)
+
+
+class TroubleshootingBulletTest(unittest.TestCase):
+ def setUp(self):
+ self.text = TROUBLE.read_text(encoding="utf-8")
+ self.body = bullet(self.text, BULLET_START)
+
+ def test_bullet_exists_and_links_the_note(self):
+ self.assertIn("devices/coop-cotv-0001.md", self.body)
+ self.assertIn(ISSUE, self.body)
+
+ def test_bullet_states_the_confirmed_cause(self):
+ body = flat(self.body)
+ self.assertIn(LAUNCHER, body)
+ self.assertIn("reproduces the hang", body)
+
+ def test_bullet_drops_the_open_questions_it_no_longer_has(self):
+ body = flat(self.body)
+ self.assertNotIn("What is *not* known", body)
+ self.assertNotIn("Nothing here brings such a set back", body)
+ self.assertNotIn("No route to host", body)
+ self.assertNotIn("Treat it as how these sets get lost", body)
+
+ def test_bullet_keeps_the_recovery_route(self):
+ body = flat(self.body)
+ self.assertIn("answered ADB on Ethernet", body)
+ self.assertIn("pm enable", body)
+ self.assertIn("still out of reach", body)
+
+ def test_bullet_keeps_the_dependency_trap_and_the_batch_workflow(self):
+ body = flat(self.body)
+ self.assertIn(DEPENDENCY, body)
+ self.assertIn("stopped the launcher", body)
+ self.assertIn("Se ha detenido la aplicación lancherProject", body)
+ self.assertIn("batches", body)
+
+
+if __name__ == "__main__":
+ unittest.main()