Skip to content

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

Merge PR #83: Add Xiaomi MiTV-AESP0 TV stick: debloat list, Home-key fix, stick launcher options

Gathin233e8fefe3fbe3
diff --cc README.md
index 24ab73953,8a5fb6335..80985b864
--- a/README.md
+++ b/README.md
@@@ -111,9 -102,7 +111,10 @@@ Lists that people have tested and contr
| TCL 55" 4K Google TV, 2023 (G10) | Google TV 12 |
| SANYO ATV R2 | Android TV 9 |
| OnePlus TV (D00) | Google TV 14 |
+| Sony BRAVIA XBR-65X900E (2017) | Android TV 9 |
+| NVIDIA SHIELD TV Pro 2019 (P2897) | Android TV 11 |
+| Xiaomi MiTV-MOOR2 (venom) | Google TV 11 |
+ | Xiaomi MiTV-AESP0 (TV stick) | Android TV 9 |
Your TV not here? The prompt works regardless, it discovers the bloat itself. If you add your
list afterwards, the next person with your model skips that step. See
@@@ -164,11 -153,9 +165,13 @@@ AndroidX RecyclerView and nothing heavi
video, no network, no background services.
**Configure** it in [`launcher/app/src/main/res/values/config.xml`](launcher/app/src/main/res/values/config.xml):
- the dock order, apps to hide, your TV's Live TV package, and the number of columns.
-the dock order, apps to hide, your TV's Live TV package, the number of columns, whether to show
-the Inputs button (`show_inputs`, off for sticks and boxes) and how many grid rows stay visible
-under the dock (`rows_below_dock`).
++the dock order, apps to hide, your TV's Live TV package, the number of columns, and how many grid
++rows stay visible under the dock (`rows_below_dock`). The Inputs button hides itself on sticks and
++boxes that have no HDMI or tuner.
+
+**Language** follows the TV: English, German, Spanish, Catalan and Simplified Chinese so far. If your
+TV doesn't offer yours system-wide, Android 13 and later can set it for the launcher alone, e.g. Catalan:
+`tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales ca'`.
**Build and install** with one command:
diff --cc examples/README.md
index e613867ca,9f93e5b4f..857e9aa87
--- a/examples/README.md
+++ b/examples/README.md
@@@ -8,18 -8,9 +8,19 @@@ on that firmware, grouped and commented
| `xiaomi-mi-tv-4a/` | Xiaomi Mi TV 4A (MiTV-MOOQ1) | Android TV 10 | PatchWall, Mi analytics, SmartShare, MiLink |
| `tcl-g10-google-tv/` | TCL 55" 4K Google TV, 2023 (G10, G10_4K_US_NF) | Google TV 12 | TCL TV+, TCL Live, store demo, smartlink installer |
| `xiaomi-mitv-axso0/` | Xiaomi MiTV-AXSO0 (dangal) | Android TV 9 | PatchWall, Mi analytics, MiLink; voice, Chromecast, unused streaming apps off by choice |
+| `xiaomi-mi-box-s/` | Xiaomi Mi Box S (MIBOX4, oneday), streaming box | Android TV 9 | PatchWall, Mi analytics, Alphonso ad tracking, MiLink; voice, casting, phone remote off by choice |
| `sanyo-atv-r2/` | SANYO ATV R2 (SCBC, Realtek RTD285O) | Android TV 9 | S-Channels, E-SHOW demo, Vewd, TV Booster, SANYO OTA |
| `oneplus-tv-dubai/` | OnePlus TV (D00, Dubai) | Google TV 14 | HeyTap/OnePlus extras, OnePlus Connect, Smart Home |
+| `benq-e55-735/` | BenQ E55-735 (Changhong AI PONT, DVB96BQ) | Google TV 14 | Homwee store/help, Anoki ACR, Google TV recommendations; wireless-debugging pairing, setupwraith, deep-standby notes |
+| `hisense-smarttv-4k-ffm/` | Hisense SmartTV 4K FFM (huangshan, MediaTek) | Android TV 10 | ACR (evservice), VIDAA preload, store/hotel mode, OTA; smartsense must stay enabled |
+| `tcl-65c725/` | TCL 65C725 (Smart TV Pro, BeyondTV4) | Android TV 11 | TCL analytics/promos, Google recommendation rows; voice off, OTA off by choice |
+| `sony-bravia-4k-ur2/` | Sony BRAVIA 4K UR2 (BRAVIA_UR2_4K, MediaTek) | Android TV 10 | Samba TV, Sony promos/Select, demo mode; Assistant, Chromecast, unused streaming apps off by choice |
+| `xiaomi-mitv-mooq0/` | Xiaomi Mi TV (MiTV-MOOQ0, croods) | Android TV 10 | PatchWall, Mi analytics, MiChannel, TV Manager, Alexa bridge; factory test app also claims HOME |
+| `sony-xbr-x900e/` | Sony BRAVIA XBR-65X900E (2017, BRAVIA_ATV2) | Android TV 9 | Samba TV ACR, Sony Select, My BRAVIA promos, Discover, device agents; Chromecast, DLNA, mirroring off by choice |
+| `tcl-beyondtv/` | TCL BeyondTV (India) | Android TV 9 | TCL analytics, content feed, TCL app store, Google recommendation rows; Jio/Airtel/Hotstar apps untouched |
+| `nvidia-shield-tv-pro-2019/` | NVIDIA SHIELD TV Pro 2019 (P2897, mdarcy) | Android TV 11 | NVIDIA telemetry, GameStream leftovers, sponsored rows, partner auto-installs |
+| `xiaomi-mitv-moor2/` | Xiaomi MiTV-MOOR2 (venom, MediaTek) | Google TV 11 | Mi ad row and PatchWall, Mi analytics, MiLink, store demo; setup wizard off so a third-party launcher can own Home |
+ | `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 |
To add your TV, see [CONTRIBUTING.md](../CONTRIBUTING.md). The quickest way to get a list is to
run the prompt in [PROMPT.md](../PROMPT.md) and copy the packages your assistant disabled.
diff --cc examples/xiaomi-mitv-aesp0/debloat.txt
index 000000000,7843d9675..30ae09f5d
mode 000000,100644..100644
--- a/examples/xiaomi-mitv-aesp0/debloat.txt
+++ b/examples/xiaomi-mitv-aesp0/debloat.txt
@@@ -1,0 -1,40 +1,40 @@@
+ # Xiaomi MiTV-AESP0 (codename aquaman), Android TV 9 (SDK 28), firmware PI.2055.
+ # Stock launcher: com.google.android.tvlauncher (disabled by launcher/build-and-install.sh).
+ # Live TV app: none (no tuner/HDMI inputs); com.google.android.tv is Live Channels.
+ #
+ # Apply: TV_HOST=<tv ip> tools/disable.sh examples/xiaomi-mitv-aesp0/debloat.txt
+ # Undo: TV_HOST=<tv ip> tools/restore.sh examples/xiaomi-mitv-aesp0/debloat.txt
+ # Everything is DISABLED, not uninstalled. Comment out any line you want to keep.
+ #
+ # Notes from this firmware:
+ # - Default IME is already Gboard, so the Mi TV 4A missing-keyboard quirk doesn't apply.
+ # - The remote's Home button sends KEYCODE_ALL_APPS (284), not HOME. Android 9 sends that key only
+ # to the system launcher, so with tvlauncher disabled Home does nothing. Fix: install with
+ # HOME_KEY_SERVICE=1 TV_HOST=<tv ip> launcher/build-and-install.sh
+ # which enables the launcher's HomeKeyService. Android switches it off on every reinstall,
+ # so always pass HOME_KEY_SERVICE=1.
+ # `input keyevent 284` over adb skips the accessibility filter; test with the real remote.
-# - No HDMI/AV inputs: set show_inputs to false in launcher config.xml.
++# - No HDMI/AV inputs: the launcher hides its Inputs pill by itself on this stick.
+ # - Kept on this set: voice assistant (katniss/pumpkin), Chromecast (mediashell),
+ # Mi Cast (com.mitv.milinkservice) and firmware updates (com.xiaomi.mitv.updateservice).
+
+ # Xiaomi + Google telemetry
+ com.miui.tv.analytics
+ com.google.android.feedback
+ com.google.android.tv.bugreportsender
+ tv.alphonso.alphonso_eula # Alphonso automatic content recognition (viewing tracking)
+
+ # PatchWall, content rows, sponsored rows
+ com.mitv.tvhome.atv
+ com.mitv.tvhome.michannel
+ com.xm.webcontent
+ com.google.android.tvrecommendations
+ android.autoinstalls.config.xiaomi.mibox3 # Play auto-install of partner apps
+ android.autoinstalls.config.xioami.mibox3 # same, misspelled duplicate (sic, "xioami")
+
+ # Preloaded apps
+ com.dazn
+ com.nousguide.android.rbtv # Red Bull TV
+ com.google.android.apps.tachyon # Google Duo
+ com.google.android.play.games
+ com.tcl.browser
diff --cc launcher/app/src/main/AndroidManifest.xml
index 9e4c482ae,159e7eeca..6c35fd86e
--- a/launcher/app/src/main/AndroidManifest.xml
+++ b/launcher/app/src/main/AndroidManifest.xml
@@@ -41,19 -30,22 +41,33 @@@
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
+ <!-- Listed in the TV's own app list, so it can be opened from the stock home screen too. -->
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
+ </intent-filter>
</activity>
- <!-- Home button for remotes that send KEYCODE_ALL_APPS (Xiaomi). Enabled over adb by
+ <activity
+ android:name=".HomeSettingsActivity"
+ android:exported="false"
+ android:taskAffinity=""
+ android:excludeFromRecents="true"
+ android:theme="@android:style/Theme.NoDisplay" />
++ <!-- Home button for remotes that send KEYCODE_ALL_APPS (Xiaomi). Opt-in: HOME_KEY_SERVICE=1
+ build-and-install.sh; see HomeKeyService. -->
+ <service
+ android:name=".HomeKeyService"
+ android:label="@string/home_key_name"
+ android:exported="true"
+ android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
+ <intent-filter>
+ <action android:name="android.accessibilityservice.AccessibilityService" />
+ </intent-filter>
+ <meta-data
+ android:name="android.accessibilityservice"
+ android:resource="@xml/home_key_service" />
+ </service>
<!-- Screensaver: pick it in Settings, or `settings put secure screensaver_components
com.gathin.tvhome/.ClockDream` over adb. -->
diff --cc launcher/app/src/main/res/values/config.xml
index 7b1d8690c,1cac4d276..01750dda1
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@@ -22,12 -22,11 +22,14 @@@
<!-- The TV's Live TV / tuner app, offered at the end of the Inputs menu. Leave empty to omit. -->
<string name="live_tv_package" translatable="false">com.mediatek.wwtv.tvcenter</string>
- <!-- Show the Inputs pill (HDMI / AV / Live TV). Turn off on sticks and boxes without inputs. -->
- <bool name="show_inputs">true</bool>
-
+ <!-- Show the Solar Hijri (Shamsi) date used in Iran and Afghanistan, e.g. "27 Mehr 1405", above the
+ Gregorian date. -->
+ <bool name="shamsi_date">false</bool>
+ <!-- Optional VPN app the network pill opens (hold the pill for Wi-Fi settings), e.g. the package of the
+ VPN you use. Empty: the pill opens Wi-Fi settings. The VPN badge shows for any VPN either way. -->
+ <string name="vpn_app" translatable="false"></string>
+ <!-- Grid rows left visible under the dock on the home screen. 0 = dock sits at the very bottom. -->
+ <integer name="rows_below_dock">0</integer>
<!-- Tiles per row in the grid; the dock always has this many slots. -->
<integer name="columns">4</integer>
diff --cc launcher/app/src/main/res/values/strings.xml
index a36caed1e,7b011b117..c2a91674a
--- a/launcher/app/src/main/res/values/strings.xml
+++ b/launcher/app/src/main/res/values/strings.xml
@@@ -20,8 -20,6 +20,10 @@@
<string name="cant_open">Can\'t open %1$s</string>
<string name="date_format">EEEE d MMMM</string>
<string name="dream_name">Clock</string>
+ <string name="vpn">VPN</string>
+ <string name="home_settings">Default home</string>
+ <string name="home_settings_help">Choose a home screen in system settings, then press Home.</string>
+ <string name="input_key_service_description">Opens the input switcher when the remote\'s Input button is pressed.</string>
+ <string name="home_key_name">Home button</string>
+ <string name="home_key_description">Makes the remote\'s Home button open this launcher.</string>
</resources>
diff --cc launcher/build-and-install.ps1
index 3bbfc5d8b,eaab3dc74..14c2a8372
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@@ -3,11 -3,9 +3,13 @@@
# JAVA_HOME / ANDROID_HOME are set.
#
# Usage: launcher\build-and-install.ps1 -TvHost 192.168.1.50 [-StockLauncher com.google.android.tvlauncher]
+# [-InputKeyService] remote's Input button opens the input switcher (Google TV); re-pass on every install
++# [-HomeKeyService] remotes whose Home button sends KEYCODE_ALL_APPS (Xiaomi sticks)
param(
[string]$TvHost = $env:TV_HOST,
- [string]$StockLauncher = 'com.google.android.tvlauncher'
+ [string]$StockLauncher = 'com.google.android.tvlauncher',
- [switch]$InputKeyService
++ [switch]$InputKeyService,
++ [switch]$HomeKeyService
)
$ErrorActionPreference = 'Stop'
# Pipe plain UTF-8 to native commands; the default here prepends a BOM that corrupts the first command.
@@@ -43,14 -40,7 +45,15 @@@ Write-Host $ou
if ("$out" -match 'Error') { throw 'could not set the new launcher as home; the stock launcher was left untouched' }
@(
'pm grant com.gathin.tvhome android.permission.ACCESS_FINE_LOCATION 2>/dev/null; echo location-granted',
- 'cmd package set-home-activity --user 0 com.gathin.tvhome',
+ 'cmd package compile -m speed -f com.gathin.tvhome',
+ 'cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity',
"pm disable-user --user 0 $StockLauncher"
) | & $py -I ..\tools\tv.py --batch
+# Optional accessibility services, appended to enabled_accessibility_services without dropping others.
+function Enable-Service([string]$Name) {
+ $svc = "com.gathin.tvhome/.$Name"
+ & $py -I ..\tools\tv.py ('s=$(settings get secure enabled_accessibility_services); case "$s" in *' + $Name + '*) ;; null|"") settings put secure enabled_accessibility_services ' + $svc + ' ;; *) settings put secure enabled_accessibility_services "$s:' + $svc + '" ;; esac; settings put secure accessibility_enabled 1; echo ' + $Name + ' enabled')
+}
+if ($InputKeyService) { Enable-Service 'InputKeyService' }
++if ($HomeKeyService) { Enable-Service 'HomeKeyService' }
Write-Host 'Installed. Press Home on the remote to see it.'
diff --cc launcher/build-and-install.sh
index ed621f671,a22592152..fcfa413f6
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@@ -33,14 -21,12 +33,17 @@@ printf '%s\n'
"cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity" \
"pm disable-user --user 0 $STOCK_LAUNCHER" \
| "$PY" -I ../tools/tv.py --batch
-# Remotes whose Home button sends KEYCODE_ALL_APPS (Xiaomi) need HomeKeyService. Android turns
-# accessibility services off when their app is reinstalled, so re-enable it after every install.
-if [ "${HOME_KEY_SERVICE:-0}" = 1 ]; then
- printf '%s\n' \
- "settings put secure enabled_accessibility_services com.gathin.tvhome/.HomeKeyService" \
- "settings put secure accessibility_enabled 1" \
- | "$PY" -I ../tools/tv.py --batch
-fi
+
+# Optional accessibility services. Off unless asked for, and Android switches them off again on
+# every reinstall, so pass the flag each time you run this script.
+# INPUT_KEY_SERVICE=1 the remote's Input button (KEYCODE_TV) opens the input switcher from any
+# app; Google TV needs this once the stock launcher is gone (InputKeyService)
++# HOME_KEY_SERVICE=1 remotes whose Home button sends KEYCODE_ALL_APPS instead of HOME, e.g. Xiaomi
++# sticks: the key is routed to the launcher (HomeKeyService)
+enable_service() { # appends to enabled_accessibility_services without dropping other services
+ svc=com.gathin.tvhome/.$1
+ "$PY" -I ../tools/tv.py "s=\$(settings get secure enabled_accessibility_services); case \"\$s\" in *$1*) ;; null|'') settings put secure enabled_accessibility_services $svc ;; *) settings put secure enabled_accessibility_services \"\$s:$svc\" ;; esac; settings put secure accessibility_enabled 1; echo $1 enabled"
+}
+if [ "${INPUT_KEY_SERVICE:-0}" = 1 ]; then enable_service InputKeyService; fi
++if [ "${HOME_KEY_SERVICE:-0}" = 1 ]; then enable_service HomeKeyService; fi
echo "Installed. Press Home on the remote to see it."