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
Make the repo generic: examples, configurable launcher, contributing guide
Gathin238eed5c774834
diff --git a/.gitignore b/.gitignoreindex 671b73bb3..b2a165599 100644--- a/.gitignore+++ b/.gitignore@@ -5,7 +5,6 @@ launcher/.gradle/launcher/build/launcher/app/build/launcher/local.properties-# device identifiers (serial, android_id, device names) stay local-backup/getprop.txt-backup/settings.txt+# your own TV's dumps (serial, android_id, device names) stay local+backup/.DS_Storediff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 000000000..10901f9ac--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,61 @@+# Contributing++Thanks for helping more TVs lose their ads. Three kinds of contributions are especially welcome.++## 1. Add your TV model++Every brand ships different bloat. If you ran the prompt (or did it by hand) on a TV that isn't in+`examples/`, add it:++1. Create `examples/<brand>-<model>/debloat.txt`. Copy the format from+ `examples/xiaomi-mi-tv-4a/debloat.txt`: one package per line, grouped with a comment that says+ what the group is, and a trailing comment on anything non-obvious ("re-enable for firmware+ updates", "needed for HDMI-CEC", etc.).+2. Put the exact model name, Android version and firmware build in the header so people can tell+ whether it matches theirs. `tools/tv.py --probe` prints all three.+3. Only list packages you have actually disabled and lived with for a few days. Note anything that+ broke and what you re-enabled.+4. Add a row to `examples/README.md`.+5. If your TV's Live TV app or stock launcher has a different package name, say so in the header;+ `tools/restore.sh` and `launcher/build-and-install.sh` accept them as arguments.++Never list packages to *uninstall*. Everything in this repo disables with `pm disable-user`, which+is reversible from the TV's own settings if the tools are gone.++## 2. Improve the launcher++The launcher lives in `launcher/` and is deliberately small: plain Java, AndroidX RecyclerView and+DynamicAnimation, no Kotlin, no Compose, no network. It targets TVs with 1 GB of RAM, so:++- No blur, no video backgrounds, no polling, no background services.+- Anything that depends on a specific TV goes in `app/src/main/res/values/config.xml`, not in code.+- Keep D-pad navigation deterministic. Test Up/Down/Left/Right from every edge.+- Verify on a real TV, not only the emulator. The easiest way is remote key injection plus a+ screenshot: `tools/tv.py 'input keyevent KEYCODE_DPAD_DOWN; screencap -p /sdcard/s.png'` then+ `tools/tv.py --pull /sdcard/s.png s.png`. Include a screenshot in your pull request.++Build with `TV_HOST=<ip> launcher/build-and-install.sh` (JDK 17, Android SDK platform 34 and+build-tools 34.0.0; on macOS `brew install openjdk@17 android-commandlinetools` then+`sdkmanager "platforms;android-34" "build-tools;34.0.0"`).++Ideas that fit the direction: an idle screensaver with clock and ambient colour, per-TV icon packs+for apps without banners, a settings screen to edit the dock from the TV, localisation.+Ideas that don't: recommendation rows, content feeds, ads, telemetry.++## 3. Improve the prompt and tools++`PROMPT.md` is what most people will actually use. If your assistant got stuck somewhere, the fix+usually belongs in the prompt as one extra sentence, not in a script. Keep it brand-neutral; put+brand-specific knowledge in `examples/`.++`tools/tv.py` and `tools/b64push.py` exist because the stock `adb` is blocked on recent macOS. If+you find a cleaner workaround, open an issue first.++## Pull requests++- One topic per PR. Small is fine.+- Say which TV you tested on.+- No new dependencies in the launcher without discussing it in an issue.+- Be kind in reviews. Most contributors here are doing this for their parents.++By contributing you agree your work is released under the repo's MIT licence.diff --git a/PROMPT.md b/PROMPT.mdindex 977125ec7..15c1430f8 100644--- a/PROMPT.md+++ b/PROMPT.md@@ -1,8 +1,10 @@# The prompt-Paste this into Claude Code on a Mac or Linux machine that is on the same Wi-Fi as the TV.-Works on Android TV / Google TV sets (Xiaomi, TCL, Hisense, Sony, OnePlus, Realme and most others).-It will not work on Samsung Tizen, LG webOS or Fire TV without changes.+Paste this into Claude Code (or another coding assistant with shell access) on a computer that is+on the same Wi-Fi as the TV. Works on Android TV / Google TV sets (Xiaomi, TCL, Hisense, Sony,+OnePlus, Realme, Nvidia Shield and most others). It will not work on Samsung Tizen, LG webOS or+Fire TV. If you cloned this repo, mention that: the assistant can reuse `tools/` and `launcher/`+instead of writing them from scratch, and only needs to edit `launcher/.../values/config.xml`.Before you start, on the TV: Settings → Device Preferences → About → press OK on "Build" 7 times,then go back → Developer options → turn on USB debugging (and Network/ADB debugging if your TVdiff --git a/README.md b/README.mdindex 83c6d0c09..e17c46627 100644--- a/README.md+++ b/README.md@@ -1,96 +1,102 @@# tv-vibehack-Debloating a Xiaomi Mi TV 4A (`MiTV-MOOQ1`, codename `tarzan`, Android TV 10) over ADB, and-replacing its launcher with a tiny custom one. Everything here was done in one afternoon with-Claude Code talking to the real TV. The prompt to reproduce it on your own Android TV is in-[`PROMPT.md`](PROMPT.md).+**Your TV, minus the ads.** Debloat any Android TV / Google TV over ADB and give it a clean,+tvOS-inspired launcher. Hand the prompt to Claude Code or any coding assistant, answer a few+questions about which apps you use, and it does the rest on the real TV.-| Before | After |+| Stock home screen | After ||---|---|-|  |  |+|  |  |-## What was done (2026-10-17)+Everything is reversible: packages are disabled, never uninstalled, and a restore script puts the+stock launcher back.-- Disabled 25 packages: Xiaomi analytics, PatchWall and its content rows, SmartShare, MiLink,- TV Manager, the update service, Alexa bridge, Mi Music, Play Games, Duo, demo apps and two- unused streaming apps. Full list with reasons in `debloat.txt`.-- Uninstalled TV Bro browser at the user's request.-- Replaced the Google TV launcher with a custom home screen (`launcher/`), see below.-- Halved system animation durations.-- Kept: Netflix, Prime Video, Hotstar, SonyLIV, Zee5, Aha, Roja, YouTube, Google Assistant,- Chromecast, Miracast, Mi media player.+## Quick start-Apart from TV Bro nothing was uninstalled; `./restore.sh` re-enables the disabled apps and the-stock launcher.+1. On the TV: Settings → Device Preferences → About → press OK on **Build** seven times → back →+ Developer options → turn on **USB debugging** (and Network/ADB debugging if your TV shows it).+ Keep the TV on and on the same Wi-Fi as your computer.+2. Open Claude Code (or your assistant of choice) on your computer and paste the prompt from+ [`PROMPT.md`](PROMPT.md), filling in your TV model.+3. Accept the "Allow USB debugging?" prompt on the TV when told to, then answer the checklist+ questions (which apps you use, which four go in the dock).-## The launcher (`launcher/`)+That's it. The assistant backs up, debloats, builds and installs the launcher, and verifies each+step with screenshots from the TV. If you'd rather do it by hand, the pieces are below.-A tvOS-style Android TV home screen, package `com.gathin.tvhome`:+## What's in the repo++| Path | What it is |+|---|---|+| [`PROMPT.md`](PROMPT.md) | The prompt. Brand-neutral; the assistant discovers your TV's bloat. |+| [`launcher/`](launcher/) | The tvOS-style launcher. Edit `app/src/main/res/values/config.xml` for your dock, hidden apps and Live TV package, then run `build-and-install.sh`. |+| [`tools/tv.py`](tools/tv.py) | Pure-Python ADB client (shell, batch, push, pull). Works where the stock `adb` is blocked. |+| [`tools/b64push.py`](tools/b64push.py) | Uploads larger files (APKs) as base64 chunks with an md5 check. |+| [`tools/disable.sh`](tools/disable.sh), [`tools/restore.sh`](tools/restore.sh) | Apply or undo a debloat list. |+| [`examples/`](examples/) | Per-TV debloat lists. Add yours, see [CONTRIBUTING.md](CONTRIBUTING.md). |++## The launcher++A small native Android TV home screen (`com.gathin.tvhome`), built for sets with 1 GB of RAM:- Pitch-black background, like Apple TV 4K.-- Top left: greeting, a large light clock with AM/PM and the date, set in the Outfit typeface- (`res/font/outfit.ttf`, SIL Open Font License, from Google Fonts).-- Top right, frosted glass pills: **Inputs** (opens a glass dropdown under the pill listing- HDMI 1-3, AV and Live TV with icons; a port that reports a definite connected/disconnected- state shows it; selection switches via the TV input framework), **Wi-Fi** (shows the connected- network name, opens network settings) and **Settings**. Reading the network name needs location permission on Android 10; the install- script grants it over adb.-- A pinned dock row at the bottom of the screen inside a lighter rounded band: Netflix, Prime- Video, YouTube, JioHotstar (order in `FAVOURITES` in `AppAdapter.java`). The shelf above shows- the focused dock app's name in large type with an ambient glow in a colour sampled from its- banner. Pressing Down scrolls the dock up and reveals the remaining apps alphabetically, 4 per- row; Up brings the dock back down.-- One floating "liquid glass" highlight (`GlassView`) springs from tile to tile with a soft- overshoot instead of per-tile borders; the focused tile also scales up and, outside the dock,- shows its name underneath. Tiles animate in with a stagger.-- Up/Down move exactly one row; Up from the dock goes to the top bar. Click launches, long-press- opens the app's info page. The last focused tile is remembered when you come back.- Live TV and Mi Gallery are hidden (edit `HIDDEN` in `AppAdapter.java`).--Build and install (needs JDK 17, Gradle and Android command-line tools from Homebrew, plus the-Python venv under `tools/`):+- A dock at the bottom in a lighter rounded band with the four apps you choose. The shelf above+ shows the focused dock app's name in large type with an ambient glow sampled from its banner.+ Press Down and the dock slides up to reveal the rest of your apps in a grid.+- One translucent glass highlight springs from tile to tile. The focused tile lifts and shows its+ name.+- Frosted pills top right: **Inputs** (a dropdown of HDMI ports, AV and Live TV), **Wi-Fi**+ (shows the network name) and **Settings**. Greeting, a large thin clock and the date top left,+ set in [Outfit](https://fonts.google.com/specimen/Outfit).+- Deterministic D-pad navigation, last focused tile remembered, staggered entrance animation.+ No blur, no 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):+dock order, hidden apps, Live TV package and columns. Build and install with```bash-launcher/build-and-install.sh+TV_HOST=192.168.1.50 launcher/build-and-install.sh```-Projectivy Launcher was tried first and dropped because custom wallpapers are a paid feature.+Needs JDK 17 and the Android SDK (platform 34, build-tools 34.0.0). On macOS:+`brew install openjdk@17 android-commandlinetools && sdkmanager "platforms;android-34" "build-tools;34.0.0"`.-## Talking to the TV--The stock `adb` binary is blocked by macOS "Local Network" privacy (it fails with-`No route to host` even though the port is open). `tools/tv.py` is a pure-Python ADB client-that works around this.+## Talking to the TV by hand```bashpython3 -m venv tools/venv && tools/venv/bin/pip install -r tools/requirements.txt-tools/venv/bin/python -I tools/tv.py --probe # device info-tools/venv/bin/python -I tools/tv.py 'pm list packages -d' # one command-printf 'cmd1\ncmd2\n' | tools/venv/bin/python -I tools/tv.py --batch # many commands, one connection-tools/venv/bin/python -I tools/tv.py --pull /sdcard/screen.png screen.png-tools/venv/bin/python -I tools/b64push.py local.apk /data/local/tmp/x.apk # file upload+export TV_HOST=192.168.1.50 # your TV's IP+tools/venv/bin/python -I tools/tv.py --probe # model, Android version, firmware+tools/venv/bin/python -I tools/tv.py 'pm list packages' # one command+printf 'cmd1\ncmd2\n' | tools/venv/bin/python -I tools/tv.py --batch+tools/disable.sh examples/xiaomi-mi-tv-4a/debloat.txt # apply a list+tools/restore.sh examples/xiaomi-mi-tv-4a/debloat.txt # undo it, restore stock launcher```-`--push` in tv.py only works for files under about 64 KB on this TV; `b64push.py` sends larger-files as base64 chunks over the shell and verifies the md5.+### Gotchas we hit-The TV IP defaults to `192.168.0.131`; override with `TV_HOST=...`. USB debugging must be on-(Settings → Device Preferences → About → tap Build 7 times → Developer options). On this model-there is no separate wireless-debugging toggle; USB debugging opens network ADB on port 5555.-The first connection shows an "Allow USB debugging?" prompt on the TV. The RSA key lives in-`tools/adbkey/` (git-ignored).+- **macOS: `adb connect` says "No route to host"** while the port is clearly open. Recent macOS+ treats the Google-signed `adb` as its own app under Local Network privacy and silently blocks it.+ `tools/tv.py` avoids the binary entirely.+- **No "wireless debugging" toggle** on some TVs (Xiaomi among them). USB debugging alone opens+ network ADB on port 5555.+- **Chained `pm` commands** (`pm disable a; pm disable b`) may silently stop after the first. Run+ one per shell call; `--batch` does this.+- **Large pushes hang** through the Python client. Use `tools/b64push.py` for APKs.+- **Disable the stock launcher only after the new one is installed**, or the Home button lands on+ a factory test app.+- **Third-party launchers** often charge for basics like a custom wallpaper. Hence `launcher/`.-## Re-enable a single app+## Supported TVs-```bash-tools/venv/bin/python -I tools/tv.py 'pm enable com.xiaomi.mitv.updateservice'-```+Anything running Android TV or Google TV: Xiaomi/Redmi, TCL, Hisense, Sony, OnePlus, Realme,+Nvidia Shield and most others. Not Samsung Tizen, LG webOS or Amazon Fire TV (different OS, no ADB+launcher replacement). Tested so far on the models in [`examples/`](examples/).-## Backups+## Contributing-`backup/` holds the full package list captured before any change, plus the disabled lists before-and after. The raw `getprop` and `settings` dumps are kept locally only (git-ignored) because they-contain device identifiers.+Add your TV's debloat list, improve the launcher, or sharpen the prompt. See+[CONTRIBUTING.md](CONTRIBUTING.md).## Licencediff --git a/backup/packages-all.txt b/backup/packages-all.txtdeleted file mode 100644index c17a68467..000000000--- a/backup/packages-all.txt+++ /dev/null@@ -1,130 +0,0 @@-package:/system/app/TvService/TvService.apk=mitv.service-package:/system/priv-app/CtsShimPrivPrebuilt/CtsShimPrivPrebuilt.apk=com.android.cts.priv.ctsshim-package:/system/priv-app/MiTvSetupCustomizer/MiTvSetupCustomizer.apk=com.xiaomi.android.tvsetup.partnercustomizer-package:/system/priv-app/GoogleExtServices/GoogleExtServices.apk=com.google.android.ext.services-package:/data/app/com.google.android.apps.mediashell-vY-i31ppdqzVmRbUqV6WDA==/base.apk=com.google.android.apps.mediashell-package:/data/app/com.google.android.katniss-_AIYua_SQVThwIbDzfz72A==/base.apk=com.google.android.katniss-package:/system/priv-app/DynamicSystemInstallationService/DynamicSystemInstallationService.apk=com.android.dynsystem-package:/system/app/Factory/Factory.apk=com.duokan.factorytest-package:/system/priv-app/CalendarProvider/CalendarProvider.apk=com.android.providers.calendar-package:/system/priv-app/TvSettingsPlus/TvSettingsPlus.apk=com.android.tv.settings-package:/system/priv-app/MediaProvider/MediaProvider.apk=com.android.providers.media-package:/system/product/priv-app/GoogleOneTimeInitializer/GoogleOneTimeInitializer.apk=com.google.android.onetimeinitializer-package:/system/app/GoogleExtShared/GoogleExtShared.apk=com.google.android.ext.shared-package:/system/priv-app/TvLock/TvLock.apk=com.mitv.tvlock-package:/system/priv-app/ExternalStorageProvider/ExternalStorageProvider.apk=com.android.externalstorage-package:/system/app/HTMLViewer/HTMLViewer.apk=com.android.htmlviewer-package:/system/app/CompanionDeviceManager/CompanionDeviceManager.apk=com.android.companiondevicemanager-package:/system/priv-app/DownloadProvider/DownloadProvider.apk=com.android.providers.downloads-package:/data/app/com.phlox.tvwebbrowser-KtWubY34PvaQWnZV_ZDcpw==/base.apk=com.phlox.tvwebbrowser-package:/system/priv-app/TvProvider/TvProvider.apk=com.android.providers.tv-package:/product/overlay/Bluetooth__auto_generated_rro_product.apk=com.android.bluetooth.auto_generated_rro_product__-package:/system/priv-app/InProcessNetworkStack/InProcessNetworkStack.apk=com.android.networkstack.inprocess-package:/system/app/FloatingFrame/FloatingFrame.apk=com.xiaomi.floatingframe-package:/data/app/com.google.android.backdrop-siiFkpbGrskrcjK_FoUNZg==/base.apk=com.google.android.backdrop-package:/system/priv-app/MtkTvInput/MtkTvInput.apk=com.mediatek.tvinput-package:/data/app/com.aha.mitv-stMfbRJhGahz2Tam-XCt9w==/base.apk=com.aha.mitv-package:/system/priv-app/LiveTVSetupWizard/LiveTVSetupWizard.apk=com.mediatek.wwtv.setupwizard-package:/data/app/com.google.android.tungsten.setupwraith-YEEV62_MZfarWXuo86GpYw==/base.apk=com.google.android.tungsten.setupwraith-package:/data/app/com.xm.webcontent-UwVDN044EohtV70A9GgEHg==/base.apk=com.xm.webcontent-package:/data/app/com.android.vending-sjOtKvHjonIboRKwyznfHw==/base.apk=com.android.vending-package:/system/app/PacProcessor/PacProcessor.apk=com.android.pacprocessor-package:/system/product/app/ModuleMetadata/ModuleMetadata.apk=com.android.modulemetadata-package:/system/app/CertInstaller/CertInstaller.apk=com.android.certinstaller-package:/data/app/com.google.android.marvin.talkback-Ys4GLWmgmIML8VbcerQZAw==/base.apk=com.google.android.marvin.talkback-package:/data/app/com.xiaomi.amazon.alexa-jJLWfcUzVRazWcGRqB7U7A==/base.apk=com.xiaomi.amazon.alexa-package:/system/framework/framework-res.apk=android-package:/data/app/com.sonyliv-ioQn9EUNNfWBKpmXQ4jMjQ==/base.apk=com.sonyliv-package:/data/app/com.ipcloud.ashokadigital-OyphJ_7PgY1anEXDzUBUYg==/base.apk=com.ipcloud.ashokadigital-package:/data/app/com.mitv.tvhome.atv-yQRhufXr48tENEYSVvYVLQ==/base.apk=com.mitv.tvhome.atv-package:/system/priv-app/BackupRestoreConfirmation/BackupRestoreConfirmation.apk=com.android.backupconfirm-package:/data/app/android.autoinstalls.config.xiaomi.amelie-coYQp4eu4PLA5kOeoqNARg==/base.apk=android.autoinstalls.config.xiaomi.amelie-package:/system/priv-app/StatementService/StatementService.apk=com.android.statementservice-package:/data/app/in.startv.hotstar-9Z-s2-X3_Agw8blMfdFixw==/base.apk=in.startv.hotstar-package:/data/app/com.google.android.apps.tachyon-P5g1WMyA4yGW72pTKjfiIw==/base.apk=com.google.android.apps.tachyon-package:/system/product/priv-app/SettingsIntelligence/SettingsIntelligence.apk=com.android.settings.intelligence-package:/system/priv-app/TVMediaExplorer/TVMediaExplorer.apk=com.xiaomi.mitv.mediaexplorer-package:/system/priv-app/GooglePermissionController/GooglePermissionController.apk=com.google.android.permissioncontroller-package:/system/product/app/MediatekFactory/MediatekFactory.apk=mediatek.factorymenu.ui-package:/data/app/com.amazon.amazonvideo.livingroom-huCpYw3FPsnSaZ8Sr5JkvA==/base.apk=com.amazon.amazonvideo.livingroom-package:/system/priv-app/SettingsProvider/SettingsProvider.apk=com.android.providers.settings-package:/system/priv-app/SharedStorageBackup/SharedStorageBackup.apk=com.android.sharedstoragebackup-package:/system/app/PrintSpooler/PrintSpooler.apk=com.android.printspooler-package:/data/app/com.xiaomi.mitv.updateservice-x7HxCAMWHvLOQUGHt6eJ7A==/base.apk=com.xiaomi.mitv.updateservice-package:/data/app/com.mitv.videoplayer-wxPNbE9ggqMF1_kDuab5Uw==/base.apk=com.mitv.videoplayer-package:/system/app/BasicDreams/BasicDreams.apk=com.android.dreams.basic-package:/product/overlay/SettingsProvider__auto_generated_rro_product.apk=com.android.providers.settings.auto_generated_rro_product__-package:/system/app/SecureElement/SecureElement.apk=com.android.se-package:/system/product/app/VendorDisclaimer/VendorDisclaimer.apk=com.mstar.android.tv.disclaimercustomization-package:/system/priv-app/InputDevices/InputDevices.apk=com.android.inputdevices-package:/data/app/ahaflix.tv-1hbK9zpa2y7_FGgREOH7Aw==/base.apk=ahaflix.tv-package:/data/app/com.google.android.tvrecommendations-n4urKKNNGKq3WniSdlLa1w==/base.apk=com.google.android.tvrecommendations-package:/system/product/priv-app/RecommendationsService/RecommendationsService.apk=com.google.android.leanbacklauncher.recommendations-package:/system/product/priv-app/RetailDisplay/RetailDisplay.apk=fusion.android.tv.demo-package:/data/app/com.roja.rojadigital-qysOhjzYqFUvuUEay2DXCg==/base.apk=com.roja.rojadigital-package:/system/priv-app/MiTVMultiCast_india/MiTVMultiCast_india.apk=com.xiaomi.mitv.smartshare-package:/vendor/overlay/Bluetooth__auto_generated_rro_vendor.apk=com.android.bluetooth.auto_generated_rro_vendor__-package:/system/priv-app/TVMusic/TVMusic.apk=com.xiaomi.mimusic2-package:/vendor/overlay/SettingsProvider__auto_generated_rro_vendor.apk=com.android.providers.settings.auto_generated_rro_vendor__-package:/data/app/com.google.android.tvlauncher-1ZmGxfuK2CLV_1LAx5ApfA==/base.apk=com.google.android.tvlauncher-package:/data/app/com.google.android.webview-grDgJCGmxwmRm50g_aMSfg==/base.apk=com.google.android.webview-package:/system/product/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk=com.google.android.syncadapters.contacts-package:/system/app/KeyChain/KeyChain.apk=com.android.keychain-package:/data/app/com.google.android.youtube.tvmusic-am-xTEJh2MpIWozn-AwfFQ==/base.apk=com.google.android.youtube.tvmusic-package:/system/product/app/FactoryCommandService/FactoryCommandService.apk=com.mediatek.tv.factory-package:/system/app/BootAppSplashScreen/BootAppSplashScreen.apk=com.google.android.boot.appsplashscreen-package:/system/priv-app/GooglePackageInstaller/GooglePackageInstaller.apk=com.google.android.packageinstaller-package:/system/product/app/HotKeyDispatcher/HotKeyDispatcher.apk=com.mediatek.hotkey.dispatcher-package:/system/app/mitv-framework-res/mitv-framework-res.apk=com.xiaomi.mitv.res-package:/data/app/com.google.android.gms-I8a-_UJKgTHwlUkJaly4Bw==/base.apk=com.google.android.gms-package:/system/product/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk=com.google.android.gsf-package:/data/app/com.google.android.tts-0AeyKVZuIW63-Q8yqRJGLg==/base.apk=com.google.android.tts-package:/system/product/priv-app/GooglePartnerSetup/GooglePartnerSetup.apk=com.google.android.partnersetup-package:/system/priv-app/LocalTransport/LocalTransport.apk=com.android.localtransport-package:/data/app/com.google.android.videos-AX4MCzyFu9SlAdyzapQKpQ==/base.apk=com.google.android.videos-package:/system/app/milegal/milegal.apk=com.xiaomo.tv.milegal-package:/data/app/com.xiaomitv.sonyliv-Ks9IrS-x_mfM0VanYTtZoA==/base.apk=com.xiaomitv.sonyliv-package:/data/app/com.graymatrix.did-rmkorUfvTGwqSUWTwCpBQQ==/base.apk=com.graymatrix.did-package:/system/priv-app/ProxyHandler/ProxyHandler.apk=com.android.proxyhandler-package:/system/product/app/VendorWebView/VendorWebView.apk=com.mediatek.wwtv.webview-package:/data/app/com.mitv.tvhome.mitvplus-FKBmF1mW9VdeDt9_Tm8MuQ==/base.apk=com.mitv.tvhome.mitvplus-package:/product/overlay/ContactsProvider__auto_generated_rro_product.apk=com.android.providers.contacts.auto_generated_rro_product__-package:/system/product/priv-app/GoogleFeedback/GoogleFeedback.apk=com.google.android.feedback-package:/system/product/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk=com.google.android.syncadapters.calendar-package:/system/product/app/MNetflixObserver/MNetflixObserver.apk=com.mstar.netflixobserver-package:/system/product/app/BugReportSender/BugReportSender.apk=com.google.android.tv.bugreportsender-package:/system/priv-app/LiveTV/LiveTV.apk=com.mediatek.wwtv.tvcenter-package:/system/priv-app/MiTVGallery/MiTVGallery.apk=com.mitv.gallery-package:/system/app/MiTVBiAnalytics/MiTVBiAnalytics.apk=com.miui.tv.analytics-package:/system/product/priv-app/LeanbackLauncher/LeanbackLauncher.apk=com.google.android.leanbacklauncher-package:/system/app/WfdSinkHelper/WfdSinkHelper.apk=com.xiaomi.wfdsinkhelperservice-package:/system/priv-app/PlatformNetworkPermissionConfig/PlatformNetworkPermissionConfig.apk=com.android.networkstack.permissionconfig-package:/system/app/MiTVStat/MiTVStat.apk=com.xiaomi.statistic-package:/system/priv-app/Arbitratorservice/Arbitratorservice.apk=com.mediatek.tvinputservice.arbitratorservice-package:/data/app/com.neotv.app-plN0l4kmkjv3CrBYd1_lUw==/base.apk=com.neotv.app-package:/system/product/priv-app/SssAuthbridgePrebuilt/SssAuthbridgePrebuilt.apk=com.google.android.sss.authbridge-package:/system/app/CtsShimPrebuilt/CtsShimPrebuilt.apk=com.android.cts.ctsshim-package:/system/app/MtkNetworkMonitorService/MtkNetworkMonitorService.apk=com.mediatek.network-package:/data/app/com.google.android.youtube.tv-rfAYM5PZMIrnzCq87r84Sw==/base.apk=com.google.android.youtube.tv-package:/system/priv-app/VpnDialogs/VpnDialogs.apk=com.android.vpndialogs-package:/system/product/app/FrameworkPackageStubs/FrameworkPackageStubs.apk=com.google.android.tv.frameworkpackagestubs-package:/system/priv-app/Shell/Shell.apk=com.android.shell-package:/system/app/WallpaperBackup/WallpaperBackup.apk=com.android.wallpaperbackup-package:/system/priv-app/MiLink/MiLink.apk=com.mitv.milinkservice-package:/system/priv-app/UserDictionaryProvider/UserDictionaryProvider.apk=com.android.providers.userdictionary-package:/data/app/com.google.android.tv.remote.service-fsadzAGh5A-fKHQp9UZFEA==/base.apk=com.google.android.tv.remote.service-package:/system/priv-app/FusedLocation/FusedLocation.apk=com.android.location.fused-package:/system/product/app/DeskClock/DeskClock.apk=com.android.deskclock-package:/system/priv-app/SystemUI/SystemUI.apk=com.android.systemui-package:/system/priv-app/MiTVDream/MiTVDream.apk=com.mitv.dream-package:/system/product/app/mtktvapi_agent/mtktvapi_agent.apk=com.mediatek.tv.agent-package:/data/app/com.mitv.tvhome.michannel-c5rl4mJVTVWgDtBqaRBP1Q==/base.apk=com.mitv.tvhome.michannel-package:/product/overlay/framework-res__auto_generated_rro_product.apk=android.auto_generated_rro_product__-package:/data/app/com.google.android.play.games-Ei4qRhPoFffDtiCa8HO7MQ==/base.apk=com.google.android.play.games-package:/data/app/com.netflix.ninja-nTJ3URmSaFLn0FHN5DlAYA==/base.apk=com.netflix.ninja-package:/system/app/Bluetooth/Bluetooth.apk=com.android.bluetooth-package:/system/priv-app/ContactsProvider/ContactsProvider.apk=com.android.providers.contacts-package:/system/app/PlatformCaptivePortalLogin/PlatformCaptivePortalLogin.apk=com.android.captiveportallogin-package:/data/app/com.google.android.inputmethod.latin-VYj3BDC_o7G01cku8qT2Sg==/base.apk=com.google.android.inputmethod.latin-package:/vendor/overlay/framework-res__auto_generated_rro_vendor.apk=android.auto_generated_rro_vendor__-package:/system/priv-app/TVManager/TVManager.apk=com.xiaomi.mitv.tvmanagerdiff --git a/backup/packages-disabled-after.txt b/backup/packages-disabled-after.txtdeleted file mode 100644index 10c4c67b8..000000000--- a/backup/packages-disabled-after.txt+++ /dev/null@@ -1,25 +0,0 @@-package:com.xiaomi.floatingframe-package:com.xm.webcontent-package:com.xiaomi.amazon.alexa-package:com.ipcloud.ashokadigital-package:com.mitv.tvhome.atv-package:android.autoinstalls.config.xiaomi.amelie-package:com.google.android.apps.tachyon-package:com.xiaomi.mitv.updateservice-package:com.google.android.tvrecommendations-package:com.google.android.leanbacklauncher.recommendations-package:fusion.android.tv.demo-package:com.xiaomi.mitv.smartshare-package:com.xiaomi.mimusic2-package:com.google.android.tvlauncher-package:com.google.android.youtube.tvmusic-package:com.google.android.videos-package:com.mitv.tvhome.mitvplus-package:com.google.android.feedback-package:com.miui.tv.analytics-package:com.xiaomi.statistic-package:com.neotv.app-package:com.mitv.milinkservice-package:com.mitv.tvhome.michannel-package:com.google.android.play.games-package:com.xiaomi.mitv.tvmanagerdiff --git a/backup/packages-disabled-before.txt b/backup/packages-disabled-before.txtdeleted file mode 100644index 907df3feb..000000000--- a/backup/packages-disabled-before.txt+++ /dev/null@@ -1,2 +0,0 @@-package:com.google.android.youtube.tvmusic-package:com.google.android.videosdiff --git a/backup/packages-enabled-before.txt b/backup/packages-enabled-before.txtdeleted file mode 100644index 24e8d315c..000000000--- a/backup/packages-enabled-before.txt+++ /dev/null@@ -1,128 +0,0 @@-package:mitv.service-package:com.android.cts.priv.ctsshim-package:com.xiaomi.android.tvsetup.partnercustomizer-package:com.google.android.ext.services-package:com.google.android.apps.mediashell-package:com.google.android.katniss-package:com.android.dynsystem-package:com.duokan.factorytest-package:com.android.providers.calendar-package:com.android.tv.settings-package:com.android.providers.media-package:com.google.android.onetimeinitializer-package:com.google.android.ext.shared-package:com.mitv.tvlock-package:com.android.externalstorage-package:com.android.htmlviewer-package:com.android.companiondevicemanager-package:com.android.providers.downloads-package:com.phlox.tvwebbrowser-package:com.android.providers.tv-package:com.android.bluetooth.auto_generated_rro_product__-package:com.android.networkstack.inprocess-package:com.xiaomi.floatingframe-package:com.google.android.backdrop-package:com.mediatek.tvinput-package:com.aha.mitv-package:com.mediatek.wwtv.setupwizard-package:com.google.android.tungsten.setupwraith-package:com.xm.webcontent-package:com.android.vending-package:com.android.pacprocessor-package:com.android.modulemetadata-package:com.android.certinstaller-package:com.google.android.marvin.talkback-package:com.xiaomi.amazon.alexa-package:android-package:com.sonyliv-package:com.ipcloud.ashokadigital-package:com.mitv.tvhome.atv-package:com.android.backupconfirm-package:android.autoinstalls.config.xiaomi.amelie-package:com.android.statementservice-package:in.startv.hotstar-package:com.google.android.apps.tachyon-package:com.android.settings.intelligence-package:com.xiaomi.mitv.mediaexplorer-package:com.google.android.permissioncontroller-package:mediatek.factorymenu.ui-package:com.amazon.amazonvideo.livingroom-package:com.android.providers.settings-package:com.android.sharedstoragebackup-package:com.android.printspooler-package:com.xiaomi.mitv.updateservice-package:com.mitv.videoplayer-package:com.android.dreams.basic-package:com.android.providers.settings.auto_generated_rro_product__-package:com.android.se-package:com.mstar.android.tv.disclaimercustomization-package:com.android.inputdevices-package:ahaflix.tv-package:com.google.android.tvrecommendations-package:com.google.android.leanbacklauncher.recommendations-package:fusion.android.tv.demo-package:com.roja.rojadigital-package:com.xiaomi.mitv.smartshare-package:com.android.bluetooth.auto_generated_rro_vendor__-package:com.xiaomi.mimusic2-package:com.android.providers.settings.auto_generated_rro_vendor__-package:com.google.android.tvlauncher-package:com.google.android.webview-package:com.google.android.syncadapters.contacts-package:com.android.keychain-package:com.mediatek.tv.factory-package:com.google.android.boot.appsplashscreen-package:com.google.android.packageinstaller-package:com.mediatek.hotkey.dispatcher-package:com.xiaomi.mitv.res-package:com.google.android.gms-package:com.google.android.gsf-package:com.google.android.tts-package:com.google.android.partnersetup-package:com.android.localtransport-package:com.xiaomo.tv.milegal-package:com.xiaomitv.sonyliv-package:com.graymatrix.did-package:com.android.proxyhandler-package:com.mediatek.wwtv.webview-package:com.mitv.tvhome.mitvplus-package:com.android.providers.contacts.auto_generated_rro_product__-package:com.google.android.feedback-package:com.google.android.syncadapters.calendar-package:com.mstar.netflixobserver-package:com.google.android.tv.bugreportsender-package:com.mediatek.wwtv.tvcenter-package:com.mitv.gallery-package:com.miui.tv.analytics-package:com.google.android.leanbacklauncher-package:com.xiaomi.wfdsinkhelperservice-package:com.android.networkstack.permissionconfig-package:com.xiaomi.statistic-package:com.mediatek.tvinputservice.arbitratorservice-package:com.neotv.app-package:com.google.android.sss.authbridge-package:com.android.cts.ctsshim-package:com.mediatek.network-package:com.google.android.youtube.tv-package:com.android.vpndialogs-package:com.google.android.tv.frameworkpackagestubs-package:com.android.shell-package:com.android.wallpaperbackup-package:com.mitv.milinkservice-package:com.android.providers.userdictionary-package:com.google.android.tv.remote.service-package:com.android.location.fused-package:com.android.deskclock-package:com.android.systemui-package:com.mitv.dream-package:com.mediatek.tv.agent-package:com.mitv.tvhome.michannel-package:android.auto_generated_rro_product__-package:com.google.android.play.games-package:com.netflix.ninja-package:com.android.bluetooth-package:com.android.providers.contacts-package:com.android.captiveportallogin-package:com.google.android.inputmethod.latin-package:android.auto_generated_rro_vendor__-package:com.xiaomi.mitv.tvmanagerdiff --git a/backup/packages-user.txt b/backup/packages-user.txtdeleted file mode 100644index 932a17213..000000000--- a/backup/packages-user.txt+++ /dev/null@@ -1,13 +0,0 @@-package:com.phlox.tvwebbrowser-package:com.aha.mitv-package:com.xiaomi.amazon.alexa-package:com.sonyliv-package:com.ipcloud.ashokadigital-package:in.startv.hotstar-package:com.google.android.apps.tachyon-package:ahaflix.tv-package:com.roja.rojadigital-package:com.xiaomitv.sonyliv-package:com.graymatrix.did-package:com.mitv.tvhome.mitvplus-package:com.neotv.appdiff --git a/debloat.txt b/debloat.txtdeleted file mode 100644index 0f9b04130..000000000--- a/debloat.txt+++ /dev/null@@ -1,36 +0,0 @@-# Packages disabled on the Mi TV (MiTV-MOOQ1, Android TV 10) on 2026-10-17.-# Applied with: tools/tv.py --batch < debloat.txt (after prefixing each line with "pm disable-user --user 0 ")-# Everything here is DISABLED, not uninstalled. Reverse any line with: pm enable <package>--# Xiaomi telemetry-com.miui.tv.analytics-com.xiaomi.statistic--# PatchWall + Mi content rows-com.mitv.tvhome.atv-com.mitv.tvhome.michannel-com.mitv.tvhome.mitvplus-com.xm.webcontent-com.xiaomi.floatingframe--# Xiaomi background services-com.xiaomi.mitv.tvmanager-com.xiaomi.mitv.smartshare-com.mitv.milinkservice-com.xiaomi.mitv.updateservice # re-enable to check for firmware updates-com.xiaomi.amazon.alexa-android.autoinstalls.config.xiaomi.amelie--# Preloaded apps not used-com.xiaomi.mimusic2-com.google.android.play.games-com.google.android.feedback-com.google.android.apps.tachyon # Google Duo-fusion.android.tv.demo-com.ipcloud.ashokadigital-com.neotv.app--# Google TV launcher, replaced by the custom launcher in launcher/ (com.gathin.tvhome)-com.google.android.tvlauncher-com.google.android.tvrecommendations-com.google.android.leanbacklauncher.recommendationsdiff --git a/examples/README.md b/examples/README.mdnew file mode 100644index 000000000..c643286e9--- /dev/null+++ b/examples/README.md@@ -0,0 +1,11 @@+# Examples++One folder per TV model, each with a `debloat.txt` listing the packages that are safe to disable+on that firmware, grouped and commented. These are starting points: comment out anything you use.++| Folder | TV | OS | Notes |+|---|---|---|---|+| `xiaomi-mi-tv-4a/` | Xiaomi Mi TV 4A (MiTV-MOOQ1) | Android TV 10 | PatchWall, Mi analytics, SmartShare, MiLink |++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 --git a/examples/xiaomi-mi-tv-4a/debloat.txt b/examples/xiaomi-mi-tv-4a/debloat.txtnew file mode 100644index 000000000..3f31d8b11--- /dev/null+++ b/examples/xiaomi-mi-tv-4a/debloat.txt@@ -0,0 +1,37 @@+# Xiaomi Mi TV 4A (MiTV-MOOQ1, codename tarzan), Android TV 10, firmware QTG3.200305.006.2591+# Also a good starting point for other Xiaomi/Redmi Android TVs with PatchWall.+#+# Apply: TV_HOST=<tv ip> tools/disable.sh examples/xiaomi-mi-tv-4a/debloat.txt+# Undo: TV_HOST=<tv ip> tools/restore.sh examples/xiaomi-mi-tv-4a/debloat.txt+# Everything is DISABLED, not uninstalled. Comment out any line you want to keep.++# Xiaomi telemetry+com.miui.tv.analytics+com.xiaomi.statistic++# PatchWall and Mi content rows / promos+com.mitv.tvhome.atv+com.mitv.tvhome.michannel+com.mitv.tvhome.mitvplus+com.xm.webcontent+com.xiaomi.floatingframe++# Xiaomi background services+com.xiaomi.mitv.tvmanager # "TV Manager" cleaner app+com.xiaomi.mitv.smartshare+com.mitv.milinkservice # Mi cast, Chromecast still works+com.xiaomi.mitv.updateservice # re-enable to check for firmware updates+com.xiaomi.amazon.alexa # Alexa bridge+android.autoinstalls.config.xiaomi.amelie++# Preloaded apps nobody asked for+com.xiaomi.mimusic2+com.google.android.play.games+com.google.android.feedback+com.google.android.apps.tachyon # Google Duo+fusion.android.tv.demo++# Stock Google TV launcher and its recommendation services, replaced by launcher/+com.google.android.tvlauncher+com.google.android.tvrecommendations+com.google.android.leanbacklauncher.recommendationsdiff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.javaindex 19c65ba12..2e7abf3ae 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java@@ -64,31 +64,23 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {}}- /** Dock order, tvOS style top row. */- static final List<String> FAVOURITES = Arrays.asList(- "com.netflix.ninja",- "com.amazon.amazonvideo.livingroom",- "com.google.android.youtube.tv",- "in.startv.hotstar"- );-- /** Apps that have their own button on the home screen or are not wanted as tiles. */- private static final Set<String> HIDDEN = new HashSet<>(Arrays.asList(- "com.mediatek.wwtv.tvcenter", // Live TV: reachable via the Inputs button- "com.mitv.gallery" // Mi Gallery- ));-static final float FOCUS_SCALE = 1.10f;private final Context ctx;private final TileListener listener;private final int dockSize;+ /** Dock order (res/values/config.xml, dock_apps). */+ private final List<String> favourites;+ /** Never shown as tiles (res/values/config.xml, hidden_apps). */+ private final Set<String> hidden;private final List<Entry> items = new ArrayList<>();AppAdapter(Context ctx, TileListener listener, int dockSize) {this.ctx = ctx;this.listener = listener;this.dockSize = dockSize;+ this.favourites = Arrays.asList(ctx.getResources().getStringArray(R.array.dock_apps));+ this.hidden = new HashSet<>(Arrays.asList(ctx.getResources().getStringArray(R.array.hidden_apps)));}void reload() {@@ -99,7 +91,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {for (ResolveInfo ri : found) {if (ri.activityInfo == null) continue;String pkg = ri.activityInfo.packageName;- if (pkg.equals(ctx.getPackageName()) || HIDDEN.contains(pkg)) continue;+ if (pkg.equals(ctx.getPackageName()) || hidden.contains(pkg)) continue;Drawable banner = ri.activityInfo.loadBanner(pm);if (banner == null) banner = ri.activityInfo.applicationInfo.loadBanner(pm);Drawable icon = ri.loadIcon(pm);@@ -107,7 +99,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {fresh.add(new Entry(label, new ComponentName(pkg, ri.activityInfo.name), banner, icon));}Collections.sort(fresh, (a, b) -> {- int fa = FAVOURITES.indexOf(a.pkg), fb = FAVOURITES.indexOf(b.pkg);+ int fa = favourites.indexOf(a.pkg), fb = favourites.indexOf(b.pkg);if (fa >= 0 || fb >= 0) {if (fa < 0) return 1;if (fb < 0) return -1;diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex 9c711cada..0732c3a65 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -50,9 +50,10 @@ import java.util.List;*/public class MainActivity extends Activity implements AppAdapter.TileListener {- static final int COLUMNS = 4;- private static final String LIVE_TV_PKG = "com.mediatek.wwtv.tvcenter";+ /** Tiles per row and dock slots (res/values/config.xml, columns). Set in onCreate. */+ static int COLUMNS = 4;private static final long MINUTE_MS = 60_000L;+ private String liveTvPkg;private AppAdapter adapter;private RecyclerView grid;@@ -86,6 +87,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);density = getResources().getDisplayMetrics().density;+ COLUMNS = Math.max(1, getResources().getInteger(R.integer.columns));+ liveTvPkg = getString(R.string.live_tv_package).trim();root = findViewById(R.id.root);glass = findViewById(R.id.glass);@@ -424,7 +427,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {TvContract.buildChannelUriForPassthroughInput(id), "vnd.android.cursor.item/channel")));}}- Intent liveTv = getPackageManager().getLeanbackLaunchIntentForPackage(LIVE_TV_PKG);+ Intent liveTv = liveTvPkg.isEmpty() ? null : getPackageManager().getLeanbackLaunchIntentForPackage(liveTvPkg);if (liveTv != null) {if (rows.getChildCount() > 0) addSeparator(rows);addInputRow(rows, popup, R.drawable.ic_livetv, getString(R.string.live_tv), -1, () -> open(liveTv));diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlnew file mode 100644index 000000000..c3dd51ca8--- /dev/null+++ b/launcher/app/src/main/res/values/config.xml@@ -0,0 +1,27 @@+<?xml version="1.0" encoding="utf-8"?>+<!--+ Launcher configuration. Edit this file, then run launcher/build-and-install.sh.+ Package names: on the TV run `pm list packages` (tools/tv.py 'pm list packages').+-->+<resources>++ <!-- Apps pinned to the dock row at the bottom, in this order. Missing apps are skipped. -->+ <string-array name="dock_apps">+ <item>com.netflix.ninja</item>+ <item>com.amazon.amazonvideo.livingroom</item>+ <item>com.google.android.youtube.tv</item>+ <item>in.startv.hotstar</item>+ </string-array>++ <!-- Apps never shown as tiles (e.g. the Live TV app, which the Inputs menu already covers). -->+ <string-array name="hidden_apps">+ <item>com.mediatek.wwtv.tvcenter</item>+ <item>com.mitv.gallery</item>+ </string-array>++ <!-- 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>++ <!-- Tiles per row in the grid; the dock always has this many slots. -->+ <integer name="columns">4</integer>+</resources>diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.shindex 5d559c89e..00fbbe8e6 100755--- a/launcher/build-and-install.sh+++ b/launcher/build-and-install.sh@@ -2,8 +2,10 @@# Build the launcher APK and install it on the TV as the default home screen.set -euo pipefailcd "$(dirname "$0")"-export JAVA_HOME=/opt/homebrew/opt/openjdk@17-export ANDROID_HOME=/opt/homebrew/share/android-commandlinetools+: "${TV_HOST:?set TV_HOST to the TV IP address, e.g. TV_HOST=192.168.1.50 $0}"+STOCK_LAUNCHER="${STOCK_LAUNCHER:-com.google.android.tvlauncher}"+export JAVA_HOME="${JAVA_HOME:-/opt/homebrew/opt/openjdk@17}"+export ANDROID_HOME="${ANDROID_HOME:-/opt/homebrew/share/android-commandlinetools}"export PATH="$JAVA_HOME/bin:$PATH"[ -f local.properties ] || echo "sdk.dir=$ANDROID_HOME" > local.properties./gradlew assembleDebug -q --console=plain@@ -15,6 +17,6 @@ printf '%s\n' \"rm -f /data/local/tmp/tvhome.apk" \"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" \- "pm disable-user --user 0 com.google.android.tvlauncher" \- "input keyevent KEYCODE_HOME" \+ "pm disable-user --user 0 $STOCK_LAUNCHER" \| "$PY" -I ../tools/tv.py --batch+echo "Installed. Press Home on the remote to see it."diff --git a/restore.sh b/restore.shdeleted file mode 100755index d7e5e4a01..000000000--- a/restore.sh+++ /dev/null@@ -1,14 +0,0 @@-#!/usr/bin/env bash-# Undo the debloat: re-enable every package listed in debloat.txt and restore the Google TV launcher.-# Usage: ./restore.sh (needs tools/venv, see README.md)-set -euo pipefail-cd "$(dirname "$0")"-PY=tools/venv/bin/python-{- grep -vE '^\s*(#|$)' debloat.txt | sed -E 's/\s+#.*$//' | awk '{print "pm enable " $1}'- echo "cmd package set-home-activity --user 0 com.google.android.tvlauncher"- echo "settings put global window_animation_scale 1.0"- echo "settings put global transition_animation_scale 1.0"- echo "settings put global animator_duration_scale 1.0"- echo "pm list packages -d"-} | "$PY" -I tools/tv.py --batchdiff --git a/tools/disable.sh b/tools/disable.shnew file mode 100755index 000000000..30c88300d--- /dev/null+++ b/tools/disable.sh@@ -0,0 +1,14 @@+#!/usr/bin/env bash+# Disable every package listed in a debloat file on the TV (one package per line, # comments allowed).+# Packages are disabled for user 0, never uninstalled. Undo with tools/restore.sh <same file>.+#+# Usage: TV_HOST=192.168.1.50 tools/disable.sh examples/xiaomi-mi-tv-4a/debloat.txt+set -euo pipefail+cd "$(dirname "$0")/.."+LIST="${1:?usage: disable.sh <debloat list>}"+PY=tools/venv/bin/python+[ -x "$PY" ] || { echo "run: python3 -m venv tools/venv && tools/venv/bin/pip install -r tools/requirements.txt"; exit 1; }+{+ grep -vE '^\s*(#|$)' "$LIST" | sed -E 's/\s+#.*$//' | awk '{print "pm disable-user --user 0 " $1}'+ echo "pm list packages -d"+} | "$PY" -I tools/tv.py --batchdiff --git a/tools/restore.sh b/tools/restore.shnew file mode 100755index 000000000..858304fda--- /dev/null+++ b/tools/restore.sh@@ -0,0 +1,19 @@+#!/usr/bin/env bash+# Re-enable every package listed in a debloat file, restore the stock launcher as home and reset+# animation scales. Pass the same list you used with tools/disable.sh.+#+# Usage: TV_HOST=192.168.1.50 tools/restore.sh examples/xiaomi-mi-tv-4a/debloat.txt [stock.launcher.package]+set -euo pipefail+cd "$(dirname "$0")/.."+LIST="${1:?usage: restore.sh <debloat list> [stock launcher package]}"+STOCK="${2:-com.google.android.tvlauncher}"+PY=tools/venv/bin/python+{+ grep -vE '^\s*(#|$)' "$LIST" | sed -E 's/\s+#.*$//' | awk '{print "pm enable " $1}'+ echo "pm enable $STOCK"+ echo "cmd package set-home-activity --user 0 $STOCK"+ echo "settings put global window_animation_scale 1.0"+ echo "settings put global transition_animation_scale 1.0"+ echo "settings put global animator_duration_scale 1.0"+ echo "pm list packages -d"+} | "$PY" -I tools/tv.py --batchdiff --git a/tools/tv.py b/tools/tv.pyindex 3060d8f28..6336f3cc6 100644--- a/tools/tv.py+++ b/tools/tv.py@@ -1,8 +1,12 @@#!/usr/bin/env python3-"""Minimal ADB-over-TCP shell runner for the Mi TV using adb_shell (no adb binary needed).+"""Minimal ADB-over-TCP client for an Android TV using adb_shell (no adb binary needed).-Usage: tv.py <shell command...>- tv.py --probe (connect + print model/android version)+Set TV_HOST to the TV's IP. Usage:+ tv.py --probe connect and print model / Android version+ tv.py <shell command...> run one shell command+ tv.py --batch < commands.txt one command per line, same connection+ tv.py --push <local> <remote> small files only (see b64push.py for larger ones)+ tv.py --pull <remote> <local>"""import osimport sys@@ -11,8 +15,11 @@ from adb_shell.adb_device import AdbDeviceTcpfrom adb_shell.auth.keygen import keygenfrom adb_shell.auth.sign_pythonrsa import PythonRSASigner-HOST = os.environ.get("TV_HOST", "192.168.0.131")-PORT = 5555+HOST = os.environ.get("TV_HOST")+PORT = int(os.environ.get("TV_PORT", "5555"))+if not HOST:+ sys.exit("Set TV_HOST to your TV's IP address, e.g. TV_HOST=192.168.1.50 tools/tv.py --probe\n"+ "(find it under Settings → Network, or look for the TV in `arp -a`)")KEYDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "adbkey")KEY = os.path.join(KEYDIR, "adbkey")