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
PR #27 follow-up: Input-button service is opt-in (INPUT_KEY_SERVICE=1 / -InputKeyService)
Gathin232e51d3e52225
diff --git a/README.md b/README.mdindex 2f7690167..24ab73953 100644--- a/README.md+++ b/README.md@@ -86,8 +86,9 @@ A home screen that is yours again:- **A greeting, a large thin clock and the date**, set in[Outfit](https://fonts.google.com/specimen/Outfit).- **A matching Clock screensaver**, optional, that drifts around the screen so nothing burns in.-- **The remote's Input button keeps working.** On Google TV it was handled by the stock launcher;- a small accessibility service maps it (`KEYCODE_TV`) to the system input switcher, in any app.+- **The remote's Input button can keep working.** On Google TV the stock launcher handled it; an+ optional accessibility service maps it (`KEYCODE_TV`) to the system input switcher in any app.+ Install with `INPUT_KEY_SERVICE=1` to turn it on.And a TV that stops working against you: no sponsored rows, no "Discover" nags, no analyticsphoning home, no apps you never asked for.diff --git a/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java b/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.javaindex 0ebac190c..f3a684c68 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java@@ -10,7 +10,7 @@ import android.view.accessibility.AccessibilityEvent;* Maps the remote's Input button to the system input switcher, from any app. Remotes such as the Chromecast voice* remote send KEYCODE_TV for it; on Google TV the stock launcher handles that key, so with the stock launcher* disabled the button does nothing. Only KEYCODE_TV is consumed; every other key passes through untouched.- * build-and-install.sh enables it (settings secure enabled_accessibility_services).+ * Opt-in: INPUT_KEY_SERVICE=1 build-and-install.sh (or -InputKeyService on Windows) enables it.*/public class InputKeyService extends AccessibilityService {diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1index db2b9aad5..3bbfc5d8b 100644--- a/launcher/build-and-install.ps1+++ b/launcher/build-and-install.ps1@@ -3,9 +3,11 @@# 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 installparam([string]$TvHost = $env:TV_HOST,- [string]$StockLauncher = 'com.google.android.tvlauncher'+ [string]$StockLauncher = 'com.google.android.tvlauncher',+ [switch]$InputKeyService)$ErrorActionPreference = 'Stop'# Pipe plain UTF-8 to native commands; the default here prepends a BOM that corrupts the first command.@@ -45,4 +47,10 @@ if ("$out" -match 'Error') { throw 'could not set the new launcher as home; the'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' }Write-Host 'Installed. Press Home on the remote to see it.'diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.shindex 60c35cd63..ed621f671 100755--- a/launcher/build-and-install.sh+++ b/launcher/build-and-install.sh@@ -32,6 +32,15 @@ printf '%s\n' \"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 $STOCK_LAUNCHER" \- 's=$(settings get secure enabled_accessibility_services); case "$s" in *InputKeyService*) ;; null|"") settings put secure enabled_accessibility_services com.gathin.tvhome/.InputKeyService ;; *) settings put secure enabled_accessibility_services "$s:com.gathin.tvhome/.InputKeyService" ;; esac; settings put secure accessibility_enabled 1; echo input-button-enabled' \| "$PY" -I ../tools/tv.py --batch++# 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)+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; fiecho "Installed. Press Home on the remote to see it."