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
Add Xiaomi MiTV-MTEQ0 (baymax, China firmware) list and device notes
Gấu Coder09c1d90d932f
diff --git a/README.md b/README.mdindex c9aafb767..40abc104c 100644--- a/README.md+++ b/README.md@@ -237,6 +237,7 @@ BYINTEK, JMGO, Portronics, Stellamore, Wanbo and XGIMI projectors| Xiaomi MiTV-AESP0 stick (aquaman, 1 GB) | Android TV 9 || Xiaomi MiTV-ANSP0 (小米电视5 Pro 65", jobs, Amlogic), China firmware 23.6.5.3226, 4 GB RAM | Android TV 9 (CN build) || Xiaomi MiTV-ASTP1 (maverick), China firmware 2.40.641.0514.cn, 1 GB RAM, 720p | Android TV 9 (CN build) |+| Xiaomi TV EA Pro 55" (MiTV-MTEQ0, baymax, MediaTek), China firmware 23.6.26.4028 | Android TV 10 (CN build) || Xiaomi MiTV-AXFR1 (rango, Amlogic, 1 GB), India | Android TV 11 || Xiaomi MiTV-AXSO0 (dangal; Mi TV 4C Pro 2019 / 4A Pro) | Android TV 9 || Xiaomi MiTV-AXSO2 (dangalUHD, India, 2 GB) | Android TV 9 |diff --git a/docs/devices/xiaomi-mitv-mteq0-baymax.md b/docs/devices/xiaomi-mitv-mteq0-baymax.mdnew file mode 100644index 000000000..b976f8ce0--- /dev/null+++ b/docs/devices/xiaomi-mitv-mteq0-baymax.md@@ -0,0 +1,123 @@+# Xiaomi MiTV-MTEQ0 (baymax): China firmware notes++Tested on a Xiaomi TV EA Pro 55" (MiTV-MTEQ0, `baymax`, sold as L55MA-EP), MediaTek/MStar,+3840x2160 panel, Android 10 / API 29, China-market firmware `23.6.26.4028`+(`QQ2A.200305.004.A1`). No Google services. Debloat list:+[`examples/xiaomi-mitv-mteq0/debloat.txt`](../../examples/xiaomi-mitv-mteq0/debloat.txt).+One day of use, two reboots, several standby cycles.++## Home++The same package-name HOME allowlist as the MiTV-AETP0+([`xiaomi-mitv-aetp0-dofus.md`](xiaomi-mitv-aetp0-dofus.md)). With the standard+`com.gathin.tvhome` ID, `set-home-activity` prints `Success` but HOME keeps resolving to+`com.mitv.tvhome`, and disabling it leaves `com.android.tv.settings/.system.FallbackHome`+(black screen).++The opt-in identity worked here as documented for the AETP0:++```bash+"$PY" -I tools/tv.py 'pm path com.ts.launcher' # must print nothing+(cd launcher && ./gradlew assembleRelease -PlauncherApplicationId=com.ts.launcher)+"$PY" -I tools/b64push.py launcher/app/build/outputs/apk/release/app-release.apk /data/local/tmp/ts.apk+"$PY" -I tools/tv.py 'pm install -r /data/local/tmp/ts.apk'+"$PY" -I tools/tv.py 'cmd package set-home-activity --user 0 com.ts.launcher/com.gathin.tvhome.MainActivity'+"$PY" -I tools/tv.py 'cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME'+```++`resolve-activity` answered `com.ts.launcher/com.gathin.tvhome.MainActivity`, also with+`com.mitv.tvhome` disabled, after a reboot, and after a force-stop. `com.mitv.cloudcontrol` was+already disabled; the allowlist it had downloaded stays on disk. The launcher's optional overlay+lives in `/sdcard/Android/data/com.ts.launcher/files/config.json`.++An accessibility redirect from FallbackHome is not a durable alternative on this set: see Standby.++## Standby force-stops third-party apps++Pressing Power puts the set into `xiaoai_mode` (screen off). Two seconds later+`MitvPowerManagerService` calls `MitvActivityManagerService.killAllThirdApp`, which force-stops+every running non-system app unless the cloud rule (`MitvConfigParser`, flag `0x8000`) exempts it.+Android then removes a force-stopped app's accessibility service from+`enabled_accessibility_services` for good, so a Home or key helper built on accessibility is gone+after the first standby. Notification listeners are rebound after a force-stop, accessibility+services are not. A real HOME app is simply started again on wake.++The first presses of Power also show a Chinese guide for the screen-off mode. It stops after+`settings.xiaoai.ui.max.count` (5) presses; `settings put global settings.xiaoai.ui.count 5`+skips it.++## ADB closes at every boot++`AdbService` starts with ADB on, then `com.xiaomi.mitv.settings` (`SettingsUtil`) writes+`adb_enabled=0` about four seconds after boot. Re-enable under Settings > Account & Security >+ADB debugging. `persist.adb.tcp.port` stays 5555, so turning it back on reopens the network port.++## Inputs++The passthrough channel URI the launcher sends is accepted but does not switch the source.+`com.xiaomi.mitv.tvplayer/.ExternalSourceActivity` with action `com.xiaomi.mitv.tvplayer.EXTSRC_PLAY`+and an integer extra `input` does, with the same numbering as the MiTV-MFTR0+([`xiaomi-mitv-mftr0-freeguy.txt`](xiaomi-mitv-mftr0-freeguy.txt)):++| Input | TvInputInfo ID | `input` |+|---|---|---|+| HDMI 1 | `com.mediatek.tvinput/.hdmi.HDMIInputService/HW5` | 23 |+| HDMI 2 | `com.mediatek.tvinput/.hdmi.HDMIInputService/HW6` | 24 |+| AV | `com.mediatek.tvinput/.composite.CompositeInputService/HW2` | 2 |++An HDMI-CEC device appears as an extra input (`.../HDMI200008`) whose parent is the port it is on.+HDMI 1 and 2 were checked by the TV input session (`dumpsys tv_input`); HDMI screenshots are empty.++## Wi-Fi 5 GHz++`ClientModeImpl.setDefaultCountryCode` in `wifi-service.jar` takes the Wi-Fi country code from+`Settings.Global service_region`, then `ro.mitv.region`, and falls back to `CN`. Both are empty on+this set, so the driver runs with `CN` and never sees 5 GHz networks on channels 100-144 (a router+on channel 104 was invisible; Xiaomi routers pick CN-legal channels, so they work). Fix:++```bash+"$PY" -I tools/tv.py 'settings put global service_region VN' # your country code+# then Wi-Fi off and on (or reboot); dumpsys wifi shows mDriverCountryCode+```++## Installing apps++- `com.android.packageinstaller` is Xiaomi's MiTVPackageInstaller, which has no activity for+ `android.content.pm.action.CONFIRM_INSTALL`. A store that commits a PackageInstaller session+ (Aptoide uses one for split APKs) waits at 80% forever. The adb shell can accept such a session+ with `IPackageInstaller.setPermissionsResult(sessionId, true)`. Stores that open the APK with+ `ACTION_VIEW` (MStore, Aptoide for single APKs) work normally.+- Third-party stores need "install unknown apps": `appops set <pkg> REQUEST_INSTALL_PACKAGES allow`.+- No Google services: the official YouTube TV app shows "device does not meet requirements" and an+ old Google voice search build gets HTTP 400 from the speech server. SmartTube and Stremio's+ Android TV build work.++## Language and keyboard++`framework-res`, TV Settings and Xiaomi Settings ship only English and Chinese. The shell holds+`CHANGE_CONFIGURATION`, so a small `app_process` tool calling+`IActivityManager.updatePersistentConfiguration` can set a locale list (for example `vi-VN,en-US`);+apps with that translation follow it and the system falls back to English, not Chinese. It+survived reboots (stored in `system_locales`).++The only IME is Sogou (`com.sohu.inputmethod.sogou.tv`). Install another keyboard first, select it+with `ime enable` / `ime set`, then disable Sogou. The selected IME survived the standby+force-stop.++## What the shell cannot do here++- `pm disable-user` on a component: `Shell cannot change component state for ... to 3`.+- `pm hide`: requires `MANAGE_USERS`.+- `pm uninstall -k --user 0` on a system app: `DELETE_FAILED_INTERNAL_ERROR`+ (`Attempt to delete unknown system package`).+- Persistent apps keep running when disabled (`com.xiaomi.mitv.upgrade`,+ `com.mediatek.TimeMeasurementAgent`); `am force-stop` does not stop them either.+- Every Xiaomi app runs as `android.uid.system`, so per-app network blocking is not possible;+ Private DNS (an ad-blocking resolver) is the only network-level filter.++## Remote buttons++Long-press Home opens Xiaomi Smart Home (`mLongPressOnHomeBehavior=3`), long-press Menu opens+the smart panel; both do nothing once those apps are disabled. Double-tap Home still opens the+recents panel from `com.xiaomi.mitv.systemui` (clear apps from there). The mic key sends no key+event; the Bluetooth service hands it to `com.xiaomi.voicecontrol` only.diff --git a/examples/README.md b/examples/README.mdindex efc67da78..087b46f9a 100644--- a/examples/README.md+++ b/examples/README.md@@ -142,6 +142,7 @@ on that firmware, grouped and commented. These are starting points: comment out| `xiaomi-mitv-aesp0/` | Xiaomi MiTV-AESP0 stick (aquaman, 1 GB) | Android TV 9 | No inputs; Home key sends ALL_APPS, needs `HOME_KEY_SERVICE=1`; Chromecast kept || `xiaomi-mitv-ansp0/` | Xiaomi MiTV-ANSP0 (小米电视5 Pro 65", jobs, Amlogic), China firmware 23.6.5.3226, 4 GB RAM | Android TV 9 (CN build) | Second CN-firmware Xiaomi, no Google apps: Mi analytics/push/cloud control, ad web container, shop plugin, promo reels, TV Manager, game SDK, preloaded apps, office-mode second home and voice off; updater kept; **keep PatchWall enabled** (disabling it leaves FallbackHome's black screen), set the new launcher as preferred home instead; inputs switch only with the vendor's `EXTSRC_PLAY` extra; ADB closes on every reboot; [more notes](../docs/devices/xiaomi-mitv-ansp0-jobs.txt) || `xiaomi-mitv-astp1/` | Xiaomi MiTV-ASTP1 (maverick), China firmware 2.40.641.0514.cn, 1 GB RAM, 720p | Android TV 9 (CN build) | First CN-firmware Xiaomi: no Google apps; stock launcher `com.mitv.tvhome` (pass `STOCK_LAUNCHER`); ADB closes on every reboot; Mi analytics/push/ads, shop plugin, TV Manager, updater off; casting and app store kept |+| `xiaomi-mitv-mteq0/` | Xiaomi TV EA Pro 55" (MiTV-MTEQ0, baymax, MediaTek), China firmware 23.6.26.4028 | Android TV 10 (CN build) | No Google apps; Mi analytics/push/cloud control, shop and pay, XiaoAI, casting and preloads off; HOME allowlist (the `com.ts.launcher` build works); standby force-stops third-party apps; ADB closes at boot; Wi-Fi country falls back to CN (5 GHz ch. 100-144 hidden, `service_region`); no CONFIRM_INSTALL so split-APK installs hang; Sogou is the only IME || `xiaomi-mitv-axfr1/` | Xiaomi MiTV-AXFR1 (rango, Amlogic, 1 GB), India | Android TV 11 | PatchWall, Mi analytics, sponsored rows, partner auto-installs, TV Manager; mirroring, OTA and unused streaming apps off by choice; Chromecast and voice kept; PatchWall's input popup is unused (input picker is Live TV's); custom HOME accepted, setupwraith does not claim HOME || `xiaomi-mitv-axso0/` | Xiaomi MiTV-AXSO0 (dangal; Mi TV 4C Pro 2019 / 4A Pro) | Android TV 9 | PatchWall, Glance ads, Mi TV+, Sensara, Mi analytics, MiLink; voice, Chromecast, unused streaming apps off by choice || `xiaomi-mitv-axso2/` | Xiaomi MiTV-AXSO2 (dangalUHD, India, 2 GB) | Android TV 9 | PatchWall, Mi TV+, Sensara, Mi analytics, TV Manager, updater, partner auto-installs, old partner app copies; voice, all casting and streaming apps kept; sign-in notice and storage notes |diff --git a/examples/xiaomi-mitv-mteq0/debloat.txt b/examples/xiaomi-mitv-mteq0/debloat.txtnew file mode 100644index 000000000..1ceec5285--- /dev/null+++ b/examples/xiaomi-mitv-mteq0/debloat.txt@@ -0,0 +1,112 @@+# Xiaomi TV EA Pro 55" (MiTV-MTEQ0, codename baymax; sold as L55MA-EP), China-market firmware 23.6.26.4028,+# Android 10 (SDK 29, QQ2A.200305.004.A1), MediaTek/MStar, 3840x2160 panel (Android reports a 1080p UI mode).+# Stock launcher: com.mitv.tvhome (HOME activity .MainActivityUserMode). Live TV / sources: com.xiaomi.mitv.tvplayer.+#+# Apply: TV_HOST=<tv ip> tools/disable.sh examples/xiaomi-mitv-mteq0/debloat.txt+# Undo: TV_HOST=<tv ip> tools/restore.sh examples/xiaomi-mitv-mteq0/debloat.txt com.mitv.tvhome+# Everything is DISABLED, not uninstalled. Comment out any line you want to keep.+# Used for a day with two reboots and several standby cycles; nothing broke that is not noted here.+#+# Notes from this firmware (details in docs/devices/xiaomi-mitv-mteq0-baymax.md):+# - Home: the framework only accepts system apps or allowlisted package names as HOME, like the+# MiTV-AETP0. The opt-in build -PlauncherApplicationId=com.ts.launcher (docs/devices/xiaomi-mitv-aetp0-dofus.md)+# was accepted here: HOME resolved to it, also after a reboot and after a force-stop like the one+# standby does. With the standard com.gathin.tvhome ID, disabling com.mitv.tvhome leaves+# FallbackHome (a black screen).+# - Network ADB closes at every boot: com.xiaomi.mitv.settings writes adb_enabled=0 a few seconds after+# boot. Re-enable it under Settings > Account & Security > ADB debugging.+# - Standby (power key) force-stops every non-system app after 2 s (MitvPowerManagerService ->+# killAllThirdApp) unless a cloud allowlist exempts it. Android then drops any accessibility service+# of those apps, so do not rely on an accessibility helper on this set.+# - com.xiaomi.mitv.upgrade and com.mediatek.TimeMeasurementAgent are persistent: the firmware starts them+# at boot even when disabled. Disabling still blocks their components; the processes stay.+# - Shell cannot disable single components, `pm hide` (no MANAGE_USERS) or `pm uninstall --user 0`+# (DELETE_FAILED_INTERNAL_ERROR) on this firmware, so whole-package disables are the only tool.+# - Wi-Fi 5 GHz: the Wi-Fi country code comes from Settings.Global service_region and falls back to CN,+# which hides 5 GHz networks on channels 100-144. `settings put global service_region <CC>` and a Wi-Fi+# off/on fixes it.+# - Xiaomi's package installer has no CONFIRM_INSTALL screen: stores that install split APKs through a+# PackageInstaller session (Aptoide) hang at 80%. Stores using ACTION_VIEW (single APKs) work.+# - No Google services: the official YouTube TV app refuses to run; SmartTube works.+# - Privacy toggles worth flipping as well: settings put secure allow_oaid_used 0 (OAID ad ID),+# settings put global individual_privacy_enabled 0 (personalised recommendations).++# Xiaomi telemetry, diagnostics and log upload+com.miui.analytics # installed into /data/app by com.mitv.tvhome+com.miui.tv.analytics+com.xiaomi.statistic+com.xiaomi.tvqs+com.xiaomi.mitv.healthdiagnosis+com.xiaomi.mitv.debug # DebugService: log collection+com.xiaomi.mitv.csi # satisfaction survey and privacy prompt+com.xiaomi.screenrecorder # screen capture for feedback uploads+com.xiaomi.android.TV.audio # audio debug tool+com.mediatek.TimeMeasurementAgent # persistent: keeps running after boot even when disabled+com.mstar.android.media.tests # media test cases++# Push, cloud control, ads and promoted content+com.xiaomi.mitv.tvpush.tvpushservice+com.mitv.cloudcontrol # cloud config; the HOME allowlist it downloaded stays on disk+com.xm.webcontent # web promos, Sentry+com.duokan.videodaily # video promos+com.mitv.screensaver # Xiaomi screensaver with pushed content+fusion.android.tv.demo # retail demo+com.xiaomi.gamecenter.sdk.service.mibox++# Shopping, payment and Mi account+com.xiaomi.mitv.shop+com.xiaomi.mitv.pay+com.xiaomi.mitv.payment+com.mipay.wallet.tv+com.xiaomi.account # Mi account; needed only for Xiaomi's paid content+com.xiaomi.account.auth++# Updates and app store+com.xiaomi.mitv.upgrade # OTA, persistent like TimeMeasurementAgent; re-enable to update+com.xiaomi.mitv.appstore++# Cleaners, panels and first-run setup+com.xiaomi.mitv.tvmanager # "TV Manager" cleaner, log reporter+com.xiaomi.mitv.smartpanel # long-press Menu panel+com.xiaomi.setupwizard # first-run setup only; does not claim HOME here++# Casting (off by choice)+com.xiaomi.miplay+com.xiaomi.mitv.smartshare+com.duokan.airkan.tvbox+com.xiaomi.wfdsinkhelperservice # Miracast sink++# Smart home / IoT+com.xiaomi.smarthome.tv # long-press Home opens it; nothing happens once disabled+com.xiaomi.mico.mqtt.service.application.tv+com.xiaomi.mi_connect_service++# XiaoAI voice assistant. The remote's mic key only reaches com.xiaomi.voicecontrol (no key event),+# so it does nothing once disabled; Google voice search cannot replace it without Google services.+com.xiaomi.voicecontrol+com.xiaomi.wakeupservice++# Preloaded apps (off by choice)+com.xiaomi.mimusic2+com.xiaomi.tweather+com.xiaomi.mitv.calendar+com.mitv.mivideoplayer+com.mitv.videoplayer+com.xiaomi.mitv.karaoke.service+com.xiaomi.mibox.lockscreen # child mode and privacy lock+com.xiaomi.mitv.handbook+com.xiaomi.mitv.legal.webview+com.mitv.alarmcenter+com.mitv.gallery+com.xiaomi.tv.gallery+com.xiaomi.mitv.mediaexplorer # USB media player+com.mitv.toolhouse++# The only keyboard on the set; it switches to Chinese input. Disable only after installing and+# selecting another IME (LeanKey Keyboard worked: ime enable / ime set), or text input is gone.+# com.sohu.inputmethod.sogou.tv++# Keep: com.xiaomi.mitv.tvplayer (HDMI/AV), com.xiaomi.mitv.settings (the only full settings UI, picture,+# sound, ADB), com.xiaomi.mitv.systemui (volume, recents on double-tap Home), com.xiaomi.mitv.providers.settings,+# mitv.service, every com.mediatek.* package (com.mediatek.backgrounddetection runs the USB debugging+# boot receiver).