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
examples: second unit notes and theme for Xiaomi TV Box S 3rd gen (MiTV-AFMU0)
Amornnn488e0b487a39
diff --git a/examples/xiaomi-mitv-afmu0/README.md b/examples/xiaomi-mitv-afmu0/README.mdnew file mode 100644index 000000000..7310e14d6--- /dev/null+++ b/examples/xiaomi-mitv-afmu0/README.md@@ -0,0 +1,39 @@+# Xiaomi TV Box S 3rd gen (MiTV-AFMU0, twilight), second unit++Tested with `PROMPT.md` and `examples/xiaomi-mitv-afmu0/debloat.txt` on 2026-10-27.+Model: `MiTV-AFMU0`, codename `twilight`, Amlogic, Google TV on Android 14 (SDK 34).+Firmware: `UKG3.250826.001 / V816.0.11.0.UZFAABX` (HyperOS), 2 GB RAM, `ro.adb.secure=1`.++## What was verified++- **Debloat:** Disabled 24 packages in batches (telemetry, PatchWall, promos, unused preloaded streaming apps).+- **Kept by choice:** Google Play Store, Google Assistant and Bluetooth remote microphone (`com.google.android.katniss`, `com.google.android.tv.remote.service`), Chromecast (`com.google.android.apps.mediashell`), YouTube (`com.google.android.youtube.tv`), Netflix (`com.netflix.ninja`), TrueID TV (`com.truedmp.idtv`), and Xiaomi USB media players (`com.mitv.gallery`, `com.mitv.videoplayer`, `com.xiaomi.mitv.mediaexplorer`).+- **Wi-Fi handover from setupwraith:** During initial wizard setup, Wi-Fi is owned by `com.google.android.tungsten.setupwraith`. Disabling setupwraith while it owns Wi-Fi will cause Android 14 to delete the network and drop ADB. On the TV, forgetting the network and re-joining it in Settings switches ownership to `android.uid.system:1000`. Once owned by system, setupwraith can be disabled safely.+- **Launcher handover:** Built reference launcher (`com.gathin.tvhome`) with platform 34 and minSdk 26. `setupwraith` disabled first, then `com.google.android.apps.tv.launcherx` disabled, and `com.gathin.tvhome/.MainActivity` set as Home activity.++## Remote buttons and key mapping++The Bluetooth remote ("Xiaomi RC", `Vendor_2717_Product_32b9.kl`) behaves as follows once the stock launcher is disabled:++- **Home, Back, D-pad, and Mic:** Work out of the box (Google Assistant kept).+- **Netflix:** Sends `BUTTON_6` (scancode 240 / 416) and starts Netflix directly.+- **YouTube:** Sends `BUTTON_3` (scancode 425), which only the stock launcher answered.+- **Prime Video:** Sends `BUTTON_7` (scancode 207), which only the stock launcher answered.+- **Apps button (bottom right):** Sends `ALL_APPS` (scancode 216).++Enabling `HomeKeyService` (`settings put secure enabled_accessibility_services com.gathin.tvhome/.HomeKeyService` and `settings put secure accessibility_enabled 1`) restores all three buttons via `examples/xiaomi-mitv-afmu0/theme/config.json`:+- `ALL_APPS` is caught by `HomeKeyService` and opens Home.+- `app_keys` maps `scan:425` and `KEYCODE_BUTTON_3` to `com.google.android.youtube.tv`.+- `app_keys` maps `scan:207` and `KEYCODE_BUTTON_7` to `com.truedmp.idtv` (TrueID TV).++## Private DNS (AdGuard DoT)++Android TV hides the Private DNS menu from Settings, but the Android 14 system supports DoT:+```bash+settings put global private_dns_specifier dns.adguard-dns.com+settings put global private_dns_mode hostname+```+Blocks trackers and general app ads via Anycast DoT (port 853). To revert to default:+```bash+settings put global private_dns_mode opportunistic+```diff --git a/examples/xiaomi-mitv-afmu0/debloat.txt b/examples/xiaomi-mitv-afmu0/debloat.txtindex 9993062b7..27438b07b 100644--- a/examples/xiaomi-mitv-afmu0/debloat.txt+++ b/examples/xiaomi-mitv-afmu0/debloat.txt@@ -23,6 +23,11 @@# launcherx and dreamx. Check before disabling: tools/tv.py "dumpsys wifi" | grep -o 'cname=[^ ]*'# - Leave alone: com.xiaomi.android.tvsetup.partnercustomizer, mitv.service, com.droidlogic*.# - With the stock launcher gone, apps without a dock slot just appear in the grid.+# - Remote shortcut keys (Vendor_2717_Product_32b9.kl): YouTube sends BUTTON_3 (scancode 425), Prime Video sends+# BUTTON_7 (scancode 207), and Apps button sends ALL_APPS (scancode 216). Enable HomeKeyService+# (settings put secure enabled_accessibility_services com.gathin.tvhome/.HomeKeyService) and push+# examples/xiaomi-mitv-afmu0/theme/config.json with tools/theme.sh to restore YouTube, map Prime Video, and make+# the Apps button open Home. See README.md.# Telemetry and feedbackcom.miui.tv.analyticsdiff --git a/examples/xiaomi-mitv-afmu0/theme/config.json b/examples/xiaomi-mitv-afmu0/theme/config.jsonnew file mode 100644index 000000000..d2ffe7ad6--- /dev/null+++ b/examples/xiaomi-mitv-afmu0/theme/config.json@@ -0,0 +1,14 @@+{+ "dock_apps": [+ "com.netflix.ninja",+ "com.google.android.youtube.tv",+ "com.truedmp.idtv",+ "com.android.vending"+ ],+ "app_keys": [+ "KEYCODE_BUTTON_3:com.google.android.youtube.tv",+ "scan:425:com.google.android.youtube.tv",+ "KEYCODE_BUTTON_7:com.truedmp.idtv",+ "scan:207:com.truedmp.idtv"+ ]+}diff --git a/examples/xiaomi-mitv-afmu0/tv.json b/examples/xiaomi-mitv-afmu0/tv.jsonindex ff3ea12db..ea3724c2a 100644--- a/examples/xiaomi-mitv-afmu0/tv.json+++ b/examples/xiaomi-mitv-afmu0/tv.json@@ -2,5 +2,5 @@"tv": "Xiaomi TV Box S 3rd gen (MiTV-AFMU0, twilight, Amlogic), streaming box","os": "Google TV 14","brand": "Xiaomi",- "notes": "Mi analytics, PatchWall/Mi Home tab, Mi connect/SmartShare; voice and phone remote off by choice; setup wizard off so launcherx can go"+ "notes": "Mi analytics, PatchWall/Mi Home tab, Mi connect/SmartShare; voice and phone remote off by choice; setup wizard off so launcherx can go; second unit: [notes](xiaomi-mitv-afmu0/README.md)"}