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 display density override that comes back as 640 is not a launcher bug (#590)
xbsheng6f629c1b893f
diff --git a/PROMPT.md b/PROMPT.mdindex a3766df22..4b2a2beb8 100644--- a/PROMPT.md+++ b/PROMPT.md@@ -124,6 +124,12 @@ VerifyFix what you see before moving on.- Live TV and HDMI screenshots come back empty (0 bytes); that is the TV, not a broken debloat. Check`dumpsys activity activities | grep topResumedActivity` instead (see `docs/TROUBLESHOOTING.md`).+- If the screen looks enlarged and clipped after an install or a reboot, check the display overrides+ before editing the launcher grid: `wm size` and `wm density` show a physical value next to an+ override, and an override left over from an old resolution experiment, or a density that comes back+ wrong on some MediaTek Sony firmware, is not a launcher bug. An empty+ `settings get secure display_density_forced` is a normal default, not damage - read all three+ values first and put them back if you undo (`docs/TROUBLESHOOTING.md`).- If a remote button relies on an accessibility helper, check that the service is enabled and boundfor the current user, then ask me to press the real button; an injected key is not proof (see`docs/TROUBLESHOOTING.md`).diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex b23592a85..4ff85dcf5 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -85,6 +85,25 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/and a [Sony KDL-49W800G](https://github.com/Gathin23/cleanyourtv/issues/92). Press Home before`screencap`. An empty capture means nothing about the ADB connection or playback; check thoseseparately.+- **The whole UI is huge and clipped, and it is not the launcher**, seen on a Sony K-85XR70+ (`BRAVIA 4K AE2`, Android 14, China firmware,+ [#590](https://github.com/Gathin23/cleanyourtv/issues/590)). Its UI runs at 1920×1080 on a 4K panel+ by design ([#29](https://github.com/Gathin23/cleanyourtv/issues/29)), and two confirmed boots came+ up with an override density of 640 where 320 worked: everything doubles in size, tiles clip, and it+ looks like a grid bug. Read the overrides before touching the layout:+ ```sh+ tools/tv.py 'wm size' # Physical size vs Override size+ tools/tv.py 'wm density' # Physical density vs Override density+ tools/tv.py 'settings --user 0 get secure display_density_forced'+ ```+ An `Override size` left behind by an old resolution experiment is the first thing to explain, and an+ empty saved density is a normal Android default rather than damage. `wm density reset` fixes the+ session; on this firmware it came back as 640 at the next boot, and `wm density 320` alone did not+ stick because it left the saved setting empty. Put `settings --user 0 put secure+ display_density_forced 320` after it, reboot, and read all three lines back before believing it.+ Don't copy the number to another TV: record the three values first, and undo with `wm density reset`+ plus `settings delete secure display_density_forced`. Device note:+ [Sony K-85XR70](devices/sony-k85xr70-ae2.md).- **Disable the stock launcher only after the new one is installed**, or the Home button lands ona factory test app. Launch the replacement by hand first. `set-home-activity` can report`Success` while HOME still resolves to the stock launcher (priority 2) until that one is disabled.diff --git a/docs/devices/sony-k85xr70-ae2.md b/docs/devices/sony-k85xr70-ae2.mdnew file mode 100644index 000000000..4750de1a6--- /dev/null+++ b/docs/devices/sony-k85xr70-ae2.md@@ -0,0 +1,104 @@+# Sony K-85XR70 (`BRAVIA 4K AE2`, China): a 1080p UI, and a density that comes back as 640++Two reports from the same owner of the same set: the launcher compatibility report in+[#29](https://github.com/Gathin23/cleanyourtv/issues/29) (closed) and the display-density report in+[#590](https://github.com/Gathin23/cleanyourtv/issues/590). There is no debloat list here and this is+not an `examples/` entry - it is the display half of the picture, which is worth its own note because+the symptom (an enlarged, clipped UI) reads like a broken launcher grid.++## Identify the firmware++| Field | Reported value |+|---|---|+| Retail model | Sony K-85XR70 |+| Android model | `BRAVIA 4K AE2` / `BRAVIA_AE2` |+| Android / SDK | Android 14 / 34, China firmware, no GMS |+| Build id | `114.602.170.1` (China/CNA), from [#29](https://github.com/Gathin23/cleanyourtv/issues/29) |+| Panel | 3840×2160, reported physical density 320 |+| UI resolution | 1920×1080 |+| Stock HOME | `com.dangbei.TVHomeLauncher/com.dangbei.leard.leradlauncher.ui.sony.main.MainActivity` |+| Live TV package | `com.sony.dtv.tvlin` |++## The 1080p UI is the firmware, not a setting you broke++From [#29](https://github.com/Gathin23/cleanyourtv/issues/29): the panel is 4K but the Android UI runs+at 1920×1080, and asking for a 4K UI changed nothing. The firmware says so in its own properties:+`ro.surface_flinger.max_graphics_width=1920`, `ro.surface_flinger.max_graphics_height=1080` and+`ro.vendor.mtk.ui.resolution=2K`. That is the normal state of this model, so a 1080p UI is not+evidence of damage and not something to "fix" on a set you don't own. Video playback and HDMI input+are separate paths and #29 makes no claim about them.++The [#590](https://github.com/Gathin23/cleanyourtv/issues/590) follow-up is a different problem in the+same place: the logical size stayed 1920×1080 and the runtime density went to 640, **twice the+intended size**.++## What #590 measured++Three confirmed boots. The owner had a 1920×1080 size override on the TV before this began (from+earlier resolution experiments, per the report; who wrote it was never established) and a working+density of 320.++| Boot | `wm size` | `wm density` | `settings get secure display_density_forced` |+|---|---|---|---|+| Working session | Override size 1920×1080 | Override density 320 | empty |+| After reboot, twice | Override size 1920×1080 | **Override density 640** | empty |+| After the workaround below | Override size 1920×1080 | Override density 320 | 320 |++So the saved density was empty in all three boots, the good one included. It is not a value the owner+had set and lost: the same empty setting produced 320 in a session and 640 after a reboot, which is+the mismatch #590 reports. Something in the boot path picks 640 and the report could not establish+what.++`wm density reset` brought back a usable 320 session, and the next boot returned to 640. Running+`wm density 320` alone did the same: on this firmware it leaves the saved density empty, so nothing+carries over. This is the part that costs an hour - the first command looks like it fixed the TV+until you reboot.++## The workaround, and how to check it++Both commands, in this order, then a real reboot:++```sh+tools/tv.py 'wm density 320'+tools/tv.py 'settings --user 0 put secure display_density_forced 320'+tools/tv.py reboot+tools/tv.py 'wm size; wm density; settings --user 0 get secure display_density_forced'+```++After the reboot the owner read back 1920×1080, density 320 and a saved 320, and HOME, the stock+launcher's enabled state, the disabled-package set, the first-install time and the animation scales+all matched the pre-boot baseline. Nothing was cleared, and no launcher crash appeared in the crash+buffer.++Two cautions that matter more than the fix:++- **Record the three values before you change anything**, because an empty saved density is a valid+ Android default and the original state here *was* empty. Undo with `wm density reset` and+ `settings delete secure display_density_forced`.+- **Do not copy 320 to another TV.** It is the value this panel wants at 1080p. A different panel or+ a different size override needs its own number, and a launcher should never force a global density.++## What is not established++- The exact vendor framework branch that picks 640 when the saved value is empty. Generic AOSP code+ does not explain it, and `DisplayDeviceRepository` still reports native 3840×2160 at 640 dpi+ *after* the successful workaround - so native 640 alone is not proof of a broken driver.+- A factory-default reproduction: the 1080p size override was already there when the report started.+- Stability: two failing boots and one good boot after the workaround, no long standby and no+ repeated cycles.+- Wireless debugging needed a fresh connection port after each reboot; the pairing itself survived.++`ro.sf.lcd_density=320`, `vendor.mtk.sf.lcd.density=320`, `ro.config.density_override` empty and+`config_maxUiWidth=3840` were also read, which is why the working value is 320 rather than 640.++## Launcher compatibility (from #29)++Kept here because it is the same set: the dangbei launcher above is the stock Home, the project's+launcher could be selected as HOME with the stock one still enabled, it ran without Google Play+services at all, and the legacy Python connection path did not establish a session in that setup+while official `adb` over Wireless debugging pairing did. Those are that TV's results, not a claim+about Android 11+ in general.++The diagnostic and the commands also live in+[docs/TROUBLESHOOTING.md](../TROUBLESHOOTING.md), because the symptom turns up after a reboot with no+report to compare against.diff --git a/examples/README.md b/examples/README.mdindex efc67da78..53ba95849 100644--- a/examples/README.md+++ b/examples/README.md@@ -156,6 +156,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/):- [Sony XR-75X91K (China firmware)](../docs/devices/sony-xr-75x91k-cn.md), owner-reported retail model, `BRAVIA 4K VH21` / `BRAVIA_VH21`, Android 12: ChinaHome launcher component, preferred-Home handover with stock Home enabled, Sony TV/input routing and explicit validation limits; no tested debloat list.+- [Sony K-85XR70](../docs/devices/sony-k85xr70-ae2.md), `BRAVIA 4K AE2`, Android 14, China, `114.602.170.1`: the UI runs at 1080p on a 4K panel by firmware, and a boot can bring the override density back as 640 (UI doubled and clipped) until `display_density_forced` is written as well as `wm density`; no debloat list.- [FPD CG50-C3](../docs/devices/fpd-cg50-c3.md), KTC-built `EcoTV Pro A` / `FPD_4KHA0`, MediaTek, Google TV 11 `RTM9.241015.016`, Canada: a one-day list, kept as a note for that reason; setupwraith owned a saved network that was not the one in use, so `FORCE_SETUPWRAITH=1` was safe; the RC-36 remote's gear and notifications buttons arrive as scancodes 240/362 with `KEY_UNKNOWN`/`KEY_PROGRAM`, so they need `settings_key_scancodes` rather than a keycode.- [Durabrand DB Android TV 4K `DURAT32ISDB`](../docs/devices/durabrand-durat32isdb.md) (`dupont`, m7332 Haier/CVTE board, Android TV 11 `RTM6.230109.232`): one-day owner report, ten packages, the two the firmware turns back on at every boot, the Input panel belonging to the MediaTek TV app instead of `tvlauncher`, and the hidden production menu that leaves Play services and Chromecast disabled until it is exited by hand.- [TCL `75c63b`](../docs/devices/tcl-75c63b.md), owner-reported retail model, `Smart TV Pro` / `BeyondTV4`, Android 11, `V8-R51MT05-LF1V652`: launcher-only installation, HOME priorities and component restrictions, correct Live TV player package, restoration and explicit test limits.diff --git a/tests/test_sony_density_note.py b/tests/test_sony_density_note.pynew file mode 100644index 000000000..57a5d860e--- /dev/null+++ b/tests/test_sony_density_note.py@@ -0,0 +1,183 @@+"""The Sony K-85XR70 (#590) density note, and the diagnostic it feeds into TROUBLESHOOTING.++Documentation only, so the tests pin the numbers a reader has to be able to trust (the three boots,+the empty saved density, the two-command workaround and its undo) and the links that carry them.++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" / "sony-k85xr70-ae2.md"+TROUBLE = ROOT / "docs" / "TROUBLESHOOTING.md"+EXAMPLES_README = ROOT / "examples" / "README.md"+PROMPT = ROOT / "PROMPT.md"++LINK = re.compile(r"\]\(([^)\s]+)\)")+++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))+ out = [lines[first]]+ for line in lines[first + 1:]:+ if line.startswith("- **") or line.startswith("## "):+ break+ out.append(line)+ return "\n".join(out)+++def table_rows(text, header_start):+ """The pipe rows of the first table whose header line starts with `header_start`."""+ rows = []+ for line in text.split("\n"):+ if not line.startswith("|"):+ if rows:+ break+ continue+ if line.startswith("|---") or line.startswith("| ---"):+ continue+ if not rows and not line.startswith(header_start):+ continue+ rows.append([cell.strip() for cell in line.strip().strip("|").split("|")])+ return rows+++def broken_links(path):+ broken = []+ for target in LINK.findall(path.read_text(encoding="utf-8")):+ if target.startswith(("http://", "https://", "mailto:", "#")):+ continue+ local = target.split("#", 1)[0]+ if local and not (path.parent / local).exists():+ broken.append(target)+ return broken+++class SonyDensityNoteTest(unittest.TestCase):+ def setUp(self):+ self.text = NOTE.read_text(encoding="utf-8")++ def test_note_exists_and_names_the_firmware(self):+ self.assertTrue(NOTE.is_file(), "docs/devices entry missing")+ for token in ("K-85XR70", "BRAVIA 4K AE2", "114.602.170.1", "Android 14",+ "issues/29", "issues/590"):+ with self.subTest(token=token):+ self.assertIn(token, self.text)++ def test_note_says_the_1080p_ui_is_the_firmware(self):+ # The whole point of keeping #29 and #590 together: 1080p is normal here, 640 is not.+ for token in ("ro.surface_flinger.max_graphics_width", "ro.surface_flinger.max_graphics_height",+ "ro.vendor.mtk.ui.resolution", "1920×1080"):+ with self.subTest(token=token):+ self.assertIn(token, self.text)+ self.assertRegex(self.text, r"(?i)not evidence of damage|is the normal state")++ def test_boot_table_carries_the_three_sessions(self):+ rows = table_rows(self.text, "| Boot |")+ self.assertEqual(len(rows), 4, f"expected header + 3 boots, got {rows}")+ failing = [row for row in rows[1:] if "640" in " ".join(row)]+ self.assertEqual(len(failing), 1, "the 640 boot must be one row")+ self.assertIn("empty", failing[0][-1], "the failing boot had no saved density")+ recovered = [row for row in rows[1:] if "320" in row[-1]]+ self.assertEqual(len(recovered), 1, "one row must show the saved density after the fix")++ def test_table_records_the_properties_the_number_comes_from(self):+ rows = table_rows(self.text, "| Field |")+ table = {row[0]: row[1] for row in rows[1:]}+ self.assertIn("320", table["Panel"])+ self.assertEqual(table["UI resolution"], "1920×1080")++ def test_workaround_is_two_commands_in_order_then_a_reboot(self):+ block = self.text.split("```sh", 1)[1].split("```", 1)[0]+ steps = ["wm density 320",+ "settings --user 0 put secure display_density_forced 320",+ "tv.py reboot"]+ positions = [block.find(step) for step in steps]+ self.assertNotIn(-1, positions, f"missing step in {steps}")+ self.assertEqual(positions, sorted(positions), "the saved density must come after wm density")+ self.assertRegex(self.text, r"(?i)wm density 320` alone did (?:the same|not)")++ def test_note_carries_the_undo_and_the_warning(self):+ self.assertIn("settings delete secure display_density_forced", self.text)+ self.assertIn("wm density reset", self.text)+ self.assertRegex(self.text, r"(?i)do not copy|don't copy 320")+ self.assertRegex(self.text, r"(?i)empty (?:saved density )?is a valid")++ def test_note_admits_what_is_not_established(self):+ self.assertIn("## What is not established", self.text)+ for token in ("factory-default", "vendor framework", "no long standby"):+ with self.subTest(token=token):+ self.assertIn(token, self.text)+ # A density report does not make the set an examples/ entry.+ self.assertFalse(list((ROOT / "examples").glob("sony-k85xr70*")),+ "a report without a debloat list does not belong in examples/")++ def test_note_keeps_the_launcher_findings_separate(self):+ self.assertIn("## Launcher compatibility (from #29)", self.text)+ self.assertIn("com.dangbei.TVHomeLauncher", self.text)+ self.assertIn("com.sony.dtv.tvlin", self.text)+ self.assertRegex(self.text, r"(?i)not a claim\s+about Android 11\+|not a claim about Android 11\+")++ def test_note_links_resolve(self):+ self.assertEqual(broken_links(NOTE), [])+++class TroubleshootingBulletTest(unittest.TestCase):+ def setUp(self):+ self.text = TROUBLE.read_text(encoding="utf-8")+ self.trap = bullet(self.text, "- **The whole UI is huge and clipped")++ def test_bullet_has_the_three_readings(self):+ for command in ("tools/tv.py 'wm size'", "tools/tv.py 'wm density'",+ "settings --user 0 get secure display_density_forced"):+ with self.subTest(command=command):+ self.assertIn(command, self.trap)++ def test_bullet_separates_the_override_from_the_launcher(self):+ self.assertIn("issues/590", self.trap)+ self.assertIn("issues/29", self.trap)+ self.assertRegex(self.trap, r"(?i)override size")+ self.assertRegex(self.trap, r"(?i)empty saved density is a normal Android default")++ def test_bullet_has_the_reboot_trap_and_the_way_out(self):+ self.assertIn("wm density 320", self.trap)+ self.assertIn("display_density_forced 320", self.trap)+ self.assertIn("wm density reset", self.trap)+ self.assertIn("settings delete secure display_density_forced", self.trap)+ self.assertLess(self.trap.find("wm density 320"),+ self.trap.find("display_density_forced 320"),+ "writing the saved density before the runtime one is backwards")++ def test_bullet_does_not_send_the_reader_to_the_other_sony_cases(self):+ # The empty-screenshot and HOME-handover bullets mention other Sony sets; this one must not+ # read like either of them.+ self.assertNotIn("screencap", self.trap)+ self.assertNotIn("leanbacklauncher", self.trap)++ def test_bullet_points_at_the_note_and_that_link_works(self):+ self.assertIn("devices/sony-k85xr70-ae2.md", self.trap)+ self.assertEqual(broken_links(TROUBLE), [])+++class IndexAndPromptTest(unittest.TestCase):+ def test_examples_readme_lists_the_note(self):+ text = EXAMPLES_README.read_text(encoding="utf-8")+ section = text.split("Notes for models that have no tested list yet", 1)[1]+ self.assertIn("docs/devices/sony-k85xr70-ae2.md", section)+ self.assertIn("BRAVIA 4K AE2", section)+ self.assertEqual(broken_links(EXAMPLES_README), [])++ def test_prompt_checks_density_before_the_grid(self):+ text = PROMPT.read_text(encoding="utf-8")+ self.assertIn("`wm density`", text)+ self.assertIn("display_density_forced", text)+ self.assertIn("TROUBLESHOOTING", text)+ self.assertRegex(text, r"(?i)not a launcher bug")+++if __name__ == "__main__":+ unittest.main()