Skip to content

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

Merge PR #1438: TROUBLESHOOTING: Private DNS goes around a router that routes by domain

Gathin23d1e2392bcc7b
diff --cc docs/TROUBLESHOOTING.md
index d4efeb6eb,99090d6b9..2781c8a31
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@@ -804,57 -782,31 +804,86 @@@ own: installed, opened, usable with th
Reaching the login screen is not playback. Quote the app's full error code (Netflix's `UI-800-3`,
for example) rather than "doesn't work", since that is what the app's own help pages look up (#1008).
+## Xiaomi CN firmware: Settings freezes or crashes after the debloat
+
+On China-market Xiaomi firmware the settings app is Xiaomi's own (`com.xiaomi.mitv.settings`), and it
+reads the TV's hardware configuration from the `TvService` system service that `mitv.service` registers.
+Disable that package and Settings breaks while everything else on the TV keeps working: opening it
+freezes for 20-30 s and drops back to Home (an ANR, not a reboot), and pressing Down twice from the
+first page, Network -> Display -> Sound, crashes it outright. Seen on a MiTV-ASTP0 (`mulan`, Android 9,
+SDK 28, Amlogic/droidlogic, 1.5 GB RAM; the version string says HyperOS 2, the base is still Android 9)
+in [issue #1310](https://github.com/Gathin23/cleanyourtv/issues/1310), whose report could not quote
+`ro.build.display.id`: that firmware closes network ADB on every reboot.
+
+The crash log names the cause:
+
+```sh
+tools/tv.py "logcat -b events -d | grep am_crash"
+# java.lang.NumberFormatException, For input string: "NULL" <- SoundView.init, Integer.valueOf
+```
+
+`SoundView.init` parses a value it got from `mitv.common.ConfigurationManager` with no guard, and with
+the service gone that manager retries ten times half a second apart, gives up and hands back the literal
+string `NULL`:
+
+```
+ConfigurationManager: getService() 0..9, service = null
+ConfigurationManagerDefaultImpl: service null return
+```
+
+So it is neither the Settings app nor the debloat in general. `mitv.service` is `/system/app/TvService`,
+a PERSISTENT app whose `TvApplication.onCreate` starts `TvServer`, the thing that registers the service:
+
+```sh
+tools/tv.py "service list | grep -i tvservice" # TvService: [mitv.internal.ITvService]
+```
+
+Keep the package. Every settings page that reads a hardware value then stalls about 5 s, and the one
+page that parses the answer crashes. The China-market lists here already say not to touch it; this is
+why.
+
+**Re-enabling the package on its own does not bring Settings back.** The service is registered at boot
+and the disabled package's PERSISTENT process starts anyway, so nothing looks different after
+`pm enable` and it is easy to conclude the debloat was innocent - the reporter lost a day to exactly
+that. Start the service by hand instead:
+
+```sh
+tools/tv.py "pm enable mitv.service"
+tools/tv.py "am startservice -n mitv.service/.TvServer"
+tools/tv.py "service list | grep -i tvservice" # expect: TvService: [mitv.internal.ITvService]
+```
+
+A restart registers it too, and on that firmware the restart also turns network ADB off while the switch
+that turns it back on sits inside the Settings app that is broken: have ADB open before the reboot, or
+count on reaching Settings by hand. `examples/xiaomi-mitv-aesp0` is the one list here that disables the
+package (its second set, in daily use since 21 Oct 2026); carrying that line to a set whose settings app
+is Xiaomi's takes Settings with it.
++
+ ## The router's domain rules stop applying to the TV after Private DNS
+
+ Private DNS in hostname mode sends every lookup over DNS-over-TLS straight to the resolver, past the
+ router's own DNS. A router that filters or routes traffic by domain through its resolver - podkop and its
+ forks on OpenWrt, mihomo/Clash in fake-IP mode, a VPN subscription with domain lists, Pi-hole or AdGuard
+ Home - then never sees the TV's lookups, and its rules stop applying to the TV without any error. On a TCL
+ Smart TV Pro (G05, Android 11, `AR2101`/`AR28`) behind such a router, with `dns.adguard-dns.com` in
+ hostname mode, the TV got real addresses instead of the router's fake-IP range (198.18.0.0/15), so traffic
+ the router would have sent through its tunnel went out directly: services that only work through that
+ route broke or slowed down, and the resolver itself answered `127.0.0.1` for `api.themoviedb.org` (#1385).
+
+ To tell, compare the address the TV gets with the router's answer for the same host:
+
+ ```sh
+ tools/tv.py 'ping -c1 -W1 <host>' # the first line shows the address the TV resolved
+ nslookup <host> <router ip> # on the computer: what the router answers
+ ```
+
+ A fake-IP or other router-made answer next to a real address on the TV means Private DNS is going around
+ the router. Then either set the mode back, so the TV asks the router again, and block ads on the router
+ instead (most of these setups can):
+
+ ```sh
+ tools/tv.py 'settings put global private_dns_mode opportunistic'
+ ```
+
+ or keep Private DNS and accept that the router's domain rules no longer cover the TV. Write down which one
+ you chose, so the next "this one service is slow on the TV" does not start from scratch.