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: the MFTR0 note records the OS3.0 OTA, where Home stays on PatchWall (#1355)
xbsheng5e8cf42dd8ce
diff --git a/docs/devices/xiaomi-mitv-mftr0-debloat-home.md b/docs/devices/xiaomi-mitv-mftr0-debloat-home.mdindex 5d314381e..ce2f6e3dc 100644--- a/docs/devices/xiaomi-mitv-mftr0-debloat-home.md+++ b/docs/devices/xiaomi-mitv-mftr0-debloat-home.md@@ -1,4 +1,4 @@-# Xiaomi MiTV-MFTR0: debloat and third-party Home on HyperOS TV 2 (Android 11)+# Xiaomi MiTV-MFTR0: debloat and third-party Home on HyperOS TV 2, and the OS3.0 OTACompanion to [xiaomi-mitv-mftr0-freeguy.txt](xiaomi-mitv-mftr0-freeguy.txt) (inputroutes, Xiaomi settings intents, app discovery). This note covers the 2026-10-22@@ -8,6 +8,9 @@ the same sessions as [MiTV-ASTR0](xiaomi-mitv-astr0-blueplanet.md) (HyperOS TV 3Android 14), and the starting point was the ASTR0 findings. Everything below waschecked per-package on this set first.+A unit of this model that took the OS3.0 OTA answers the Home question differently:+[After the OS3.0.28 OTA](#after-the-os3028-ota-home-does-not-move).+## Same ad screensaver, one generation earlier`com.xiaomi.mitv.hyper.screensaver` exists on OS2 with identical settings@@ -52,3 +55,98 @@ reboot undoes it.install) and it was dropped from the list and re-enabled. `pm disable-user`hides the icon, which reads as "deleted" to the owner; `pm enable` restores itwith data intact.++## After the OS3.0.28 OTA: Home does not move++One owner's unit took a silent OTA on 2026-10-24 from OS2.0 to **`OS3.0.28.0.UFTMATV`+(HyperOS TV 3), Android 14 (SDK 34)** (`persist.os2.upgraded=true`, and+`persist.sys.boot.reason.history` ending in `reboot,ota,...`). Everything above was+written on OS2.0.23.0 / Android 11 and still describes that build. The report is+[#1355](https://github.com/Gathin23/cleanyourtv/issues/1355): one unit, one session,+nothing re-run here. That unit ran a plain third-party home app (`app.orchard.tv`,+MAIN + HOME + DEFAULT) with PatchWall left enabled - not the allowlist identity this+repo installs on CN Xiaomi sets, so this section records what an ordinary third-party+home app meets on that build, not what the trampoline meets.++### Both standard commands report success and change nothing++```shell+cmd role add-role-holder --user 0 android.app.role.HOME app.orchard.tv+cmd role get-role-holders --user 0 android.app.role.HOME # app.orchard.tv+cmd package set-home-activity --user 0 app.orchard.tv/.MainActivity # Success+cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME+# com.mitv.tvhome/.MainActivityUserMode+cmd package query-activities --brief -a android.intent.action.MAIN -c android.intent.category.HOME+# two activities: com.mitv.tvhome/.MainActivityUserMode (0), com.xiaomi.mitv.settings/.entry.FallbackHome (-1000)+```++Four samples in the eight seconds after `input keyevent KEYCODE_HOME` all landed on+PatchWall, and the resolver lists two candidates: PatchWall at priority 0 and+`com.xiaomi.mitv.settings/.entry.FallbackHome` at -1000. The new home app was not one of+them, so this is a resolver choice, not a missing default-home setting.++### Why: a persistent preferred activity with `mAlways=true`++`dumpsys package com.mitv.tvhome` carries the record that outranks both the role and+`set-home-activity`:++```+PreferredActivities:+ mitv.intent.action.PW_CUSTOMIZATION:+ com.mitv.tvhome/.MainActivityUserMode+ mMatch=0x100000 mAlways=true+ Selected from:+ com.mitv.tvhome/.MainActivityUserMode+ com.xiaomi.mitv.settings/.entry.FallbackHome+ Action: "android.intent.action.MAIN"+ Category: "android.intent.category.HOME"+```++The owner's question was how to clear that without root. `clear-package-preferred-activities`+answers `Unknown command` on this build, and nothing in this repo writes+preferred-activity records: the tools disable and re-enable packages and set a home+activity, nothing more. So there is no step to offer for this state, and none is+invented here.++### Disabling the stock launcher leaves HOME with no window on this build++The OS2 sequence above works because the home app is installed under the+allowlist identity (`com.ts.launcher`) and the firmware hands HOME to it once PatchWall+is disabled. With that record in place and no allowlisted home app,+`pm disable-user --user 0 com.mitv.tvhome` was accepted and HOME then resolved to+nothing: `mCurrentFocus=null`, no usable window, until the owner ran+`pm enable --user 0 com.mitv.tvhome` and+`cmd package set-home-activity --user 0 com.mitv.tvhome/.MainActivityUserMode` over ADB.+Until an allowlist-identity build has been tried on this firmware, treat PatchWall as the+only HOME target.++### A second unit of the same model reports the opposite++Another owner of the same model and build (an `MT5879` board, `L55MA-SPL`, 4K panel)+had Projectivy (`com.spocky.projengmenu`) take Home after disabling Xiaomi TV Home,+Google TV Launcher and Xiaomi Settings `FallbackHome`, and it was still in front after+a power cycle. The two units differ in board and in what was disabled, so this note+records both accounts and calls neither settled.++### What else the same build does not let you keep++- No accessibility item anywhere in MiTV settings: `android.settings.ACCESSIBILITY_SETTINGS`+ and the `com.android.tv.settings/.oemlink.Accessibility*` activities the owner tried all+ left the OEM settings app in front.+- Settings written over ADB do not survive a cold start:+ `enabled_accessibility_services` came back `null` and `accessibility_enabled` `0`.+- `pm grant <pkg> android.permission.WRITE_SECURE_SETTINGS` reads back+ `granted=false` after a restart.++For this repo that means a key helper or a settings write on this firmware is a+session-length change: re-apply it after every boot, and do not count on an+accessibility helper surviving one.++### What this note leaves open++- The allowlist route was not tried on this build. It works on OS3.0.106 (ASTR0) and+ OS3.0.115 (MFFU0), and nothing here says it fails on OS3.0.28.+- Where the record came from is not established and that OTA is silent; a factory+ reset was not tried.+- Nothing here was measured with this repo's launcher: the unit ran a third-party home+ app.diff --git a/tests/test_mftr0_os3_home_note.py b/tests/test_mftr0_os3_home_note.pynew file mode 100644index 000000000..1e68a195c--- /dev/null+++ b/tests/test_mftr0_os3_home_note.py@@ -0,0 +1,148 @@+"""docs/devices/xiaomi-mitv-mftr0-debloat-home.md carries the OS3.0 report of #1355.++The note was written on `OS2.0.23.0.RFTMATV` / Android 11 and its Home section is the+answer a reader of this model acts on: install under the allowlist identity, disable+PatchWall, HOME follows. #1355 is a unit of the same model after a silent OTA to+`OS3.0.28.0.UFTMATV` / Android 14, where both standard commands report success and Home+stays on PatchWall, and where disabling PatchWall left HOME with no window at all. A reader+of the OS2 half has no way to know the OTA exists, so the OS3 section is required, and the+intro has to link it.++What this test pins is what a reader acts on: the model and both build strings, the commands+that report success, the preferred-activity record that explains them, the command Android 14+no longer has, the second unit's opposite account, and that nothing in the note hands out an+uninstall step - this repository disables and re-enables, and `pm uninstall` is the one thing+a note here must never suggest. The prose between those identifiers is left free.++The account itself is not verified here: it is one owner's session, recorded as such.++Run from the repository root: python3 -m unittest discover -s tests -v+"""+import re+import unittest+from pathlib import Path++ROOT = Path(__file__).resolve().parents[1]+NOTE = ROOT / "docs" / "devices" / "xiaomi-mitv-mftr0-debloat-home.md"++OS2_HEADING = "## Home: the allowlist trampoline works on OS2 too"+OS3_HEADING = "## After the OS3.0.28 OTA"++# What the report of #1355 actually ran and read, as it appears in the note.+COMMANDS = (+ "cmd role add-role-holder --user 0 android.app.role.HOME",+ "cmd package set-home-activity --user 0",+ "cmd package resolve-activity --brief",+ "cmd package query-activities --brief",+ "dumpsys package com.mitv.tvhome",+)+RECORD = (+ "PreferredActivities",+ "mAlways=true",+ "mitv.intent.action.PW_CUSTOMIZATION",+ "com.mitv.tvhome/.MainActivityUserMode",+ "com.xiaomi.mitv.settings/.entry.FallbackHome",+)+SECOND_UNIT = ("MT5879", "L55MA-SPL", "com.spocky.projengmenu")+# This repo's way onto CN Xiaomi Home, named so the OS3 half still points a reader at it.+ALLOWLIST = "com.ts.launcher"+++def section(text, heading):+ """The lines below the line starting with `heading`, up to the next top-level heading."""+ out, inside = [], False+ for line in text.splitlines():+ if not inside:+ inside = line.startswith(heading)+ continue+ if line.startswith("## "):+ break+ out.append(line)+ return "\n".join(out)+++def slug(heading_text):+ """GitHub's anchor for a heading: lower case, punctuation dropped, spaces to hyphens."""+ text = re.sub(r"!?\[([^\]]*)\]\([^)]*\)", r"\1", heading_text).strip().lower()+ return re.sub(r"[^\w\- ]", "", text, flags=re.U).replace(" ", "-")+++class Os3NoteTest(unittest.TestCase):+ def setUp(self):+ self.text = NOTE.read_text(encoding="utf-8")+ self.os3 = section(self.text, OS3_HEADING)+ self.os2 = section(self.text, OS2_HEADING)++ def test_the_section_is_there_and_not_a_stub(self):+ self.assertGreaterEqual(len(self.os3.splitlines()), 40, "the OS3.0 section was not read")++ def test_the_note_keeps_the_build_it_was_written_on(self):+ # The OS2 half is the part a reader of this model already relies on: the OS3 section+ # has to be an addition to it, not a replacement.+ self.assertIn("OS2.0.23.0.RFTMATV", self.text)+ self.assertIn("Android 11", self.text)+ self.assertIn(ALLOWLIST, self.os2)++ def test_the_section_names_the_build_that_changed_it(self):+ self.assertIn("OS3.0.28.0.UFTMATV", self.os3)+ self.assertIn("Android 14", self.os3)++ def test_the_section_names_the_commands_that_report_success(self):+ for command in COMMANDS:+ with self.subTest(command=command):+ self.assertIn(command, self.os3)++ def test_the_section_names_the_record_that_outranks_them(self):+ for token in RECORD:+ with self.subTest(token=token):+ self.assertIn(token, self.os3)++ def test_the_section_records_the_command_android_14_no_longer_has(self):+ self.assertIn("clear-package-preferred-activities", self.os3)+ self.assertIn("Unknown command", self.os3)++ def test_the_section_still_points_at_the_allowlist_route(self):+ # The OS3 unit did not use it, so the note has to keep the route in view rather than+ # let a reader conclude that CN Xiaomi Home is finished.+ self.assertIn(ALLOWLIST, self.os3)++ def test_the_section_records_the_second_unit(self):+ for token in SECOND_UNIT:+ with self.subTest(token=token):+ self.assertIn(token, self.os3)++ def test_the_note_offers_no_uninstall_step(self):+ self.assertNotRegex(self.text, r"\bpm\s+uninstall\b",+ "this note must not hand out an uninstall: the tools disable and re-enable")++ def test_the_os2_half_links_the_os3_section(self):+ # A reader who stops at the OS2 Home section has to be able to find out about the OTA.+ heading = next(line for line in self.text.splitlines() if line.startswith(OS3_HEADING))+ anchor = "#" + slug(heading[3:])+ self.assertIn(f"]({anchor})", self.text, "the OS2 half does not link the OS3 section")+++class SectionReaderTest(unittest.TestCase):+ """The splitter above has to be able to fail on pages written here."""++ def test_a_page_without_the_heading_reads_as_empty(self):+ self.assertEqual(section("## Other\nbody\n", OS3_HEADING), "")++ def test_a_deeper_heading_stays_inside_the_section(self):+ text = "## After the OS3.0.28 OTA: x\nfirst\n### a sub-heading\nsecond\n## Next\nafter\n"+ self.assertEqual(section(text, OS3_HEADING), "first\n### a sub-heading\nsecond")++ def test_the_next_top_level_heading_ends_the_section(self):+ text = "intro\n## After the OS3.0.28 OTA: x\ninside\n## Another\noutside\n"+ self.assertEqual(section(text, OS3_HEADING), "inside")++ def test_the_heading_itself_is_not_part_of_the_section(self):+ self.assertNotIn(OS3_HEADING, section(f"{OS3_HEADING}\nx\n", OS3_HEADING))++ def test_a_slug_drops_punctuation_and_keeps_digits(self):+ self.assertEqual(slug("After the OS3.0.28 OTA: Home does not move"),+ "after-the-os3028-ota-home-does-not-move")+++if __name__ == "__main__":+ unittest.main()