Skip to content

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

MiTV-MOOR2: remote keys once launcherx is off; theme.sh rebinds the key services

Rafael Lima8b2f6232286f
diff --git a/examples/xiaomi-mitv-moor2/debloat.txt b/examples/xiaomi-mitv-moor2/debloat.txt
index 40027aba7..baf47b18d 100644
--- a/examples/xiaomi-mitv-moor2/debloat.txt
+++ b/examples/xiaomi-mitv-moor2/debloat.txt
@@ -30,6 +30,27 @@
# com.mediatek.tv.service core TV service
# com.mi.bluetooth remote + Bluetooth pairing
# com.google.android.tv.remote.service phone-as-remote pairing
+#
+# Second TV, same model and firmware (21 Oct 2026): the list went on the same way, except that
+# com.mitv.milinkservice and com.graymatrix.did (ZEE5) are not installed there; disable.sh skips them.
+# Nothing came back on after a reboot.
+#
+# Remote buttons once launcherx is disabled (that second TV; `dumpsys window policy` lists who gets
+# each global key, logcat shows what happens):
+# Settings KEYCODE_SETTINGS (176) goes to com.xiaomi.android.tvsetup.partnercustomizer, whose
+# GlobalKeyReceiver starts launcherx's .dashboard.DashboardActivity. With launcherx off that
+# throws ActivityNotFoundException; after a few presses Android marks the process "bad" and
+# drops every key it handles (176, 178 TV_INPUT, 192) until a reboot.
+# Fix: HOME_KEY_SERVICE=1 launcher/build-and-install.sh - it takes the Settings key first and
+# opens Settings, so the receiver never runs.
+# YouTube KEYCODE_BUTTON_3 (190) is routed to launcherx only, so it does nothing. Fix: add
+# 190:com.google.android.youtube.tv to app_keys in config.xml and install with
+# INPUT_KEY_SERVICE=1.
+# Input KEYCODE_TV_INPUT (178) also goes to partnercustomizer. INPUT_KEY_SERVICE=1 sends
+# com.android.tv.action.VIEW_INPUTS instead, which com.mitv.livetv/.input.SelectInputActivity
+# answers with the same input panel.
+# Xiaomi TV KEYCODE_BUTTON_5 (192), partnercustomizer again: it starts com.mitv.livetv, which reopens
+# the last input used (an HDMI port, not a tuner). Expected, no change needed.
# Xiaomi telemetry
com.miui.tv.analytics
diff --git a/tools/theme.sh b/tools/theme.sh
index 889a8b699..6472bf900 100755
--- a/tools/theme.sh
+++ b/tools/theme.sh
@@ -30,7 +30,9 @@ tv() { "$PY" -I tv.py "$@"; }
# back and switch accessibility on again as build-and-install does. Some TVs (TCL Smart TV Pro G03, Android 11)
# also keep the service in their "crashed" list after the force-stop and leave it unbound until accessibility
# itself goes off and on again, so switch it off with the list cleared and wait a second before writing back.
-RESTART="a=\$(settings get secure enabled_accessibility_services); am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; case \"\$a\" in *$PKG*) sleep 1; settings put secure enabled_accessibility_services ''; settings put secure accessibility_enabled 0; sleep 1; settings put secure enabled_accessibility_services \"\$a\"; settings put secure accessibility_enabled 1 ;; esac"
+# By then Android has already emptied the list and switched accessibility off (Xiaomi MiTV-MOOR2, Android 11), so
+# clearing it changed nothing and the services stayed crashed: write the list back first, so the clear is a change.
+RESTART="a=\$(settings get secure enabled_accessibility_services); am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; case \"\$a\" in *$PKG*) sleep 1; settings put secure enabled_accessibility_services \"\$a\"; settings put secure accessibility_enabled 1; sleep 1; settings put secure enabled_accessibility_services ''; settings put secure accessibility_enabled 0; sleep 1; settings put secure enabled_accessibility_services \"\$a\"; settings put secure accessibility_enabled 1 ;; esac"
# Some firmware (TCL G07, Android 11) locks the shell out of Android/data. Files are staged in
# /data/local/tmp and copied in, or written through the launcher's ThemeProvider when that is refused.