Skip to content

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

build-and-install: grant TCL's AUTO_START app-op and rebind a listed key service

sim7186c7c0b75b
diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1
index 46d578b37..383527feb 100644
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@ -95,7 +95,7 @@ function Enable-Service([string]$Name) {
$svc = "com.gathin.tvhome/.$Name"
# Through stdin: Windows PowerShell 5.1 drops the inner double quotes from a native argument, and the
# TV's shell then fails with "no closing quote" while the service stays off.
- ('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') |
+ ('cmd appops set com.gathin.tvhome AUTO_START allow 2>/dev/null; s=$(settings get secure enabled_accessibility_services); case "$s" in *' + $Name + '*) settings put secure enabled_accessibility_services ""; settings put secure accessibility_enabled 0; sleep 1; settings put secure enabled_accessibility_services "$s" ;; 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') |
& $py -I ..\tools\tv.py --batch
}
if ($InputKeyService) { Enable-Service 'InputKeyService' }
diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.sh
index 169977997..4ceba88a9 100755
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@ -152,9 +152,13 @@ esac
# It also handles input_key_keycodes and app_keys (config.xml or a theme; a YouTube button)
# 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)
+# TCL firmware (TclAppBoot) refuses to bind an app's accessibility service while the app is not running unless it
+# holds the AUTO_START app-op, so grant it first; other TVs do not know the op and ignore it. A service that is
+# already listed was refused while the APK was replaced, and binds again only once the list changes, so clear it,
+# switch accessibility off and write it back (as tools/theme.sh does).
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"
+ "$PY" -I ../tools/tv.py "cmd appops set com.gathin.tvhome AUTO_START allow 2>/dev/null; s=\$(settings get secure enabled_accessibility_services); case \"\$s\" in *$1*) settings put secure enabled_accessibility_services ''; settings put secure accessibility_enabled 0; sleep 1; settings put secure enabled_accessibility_services \"\$s\" ;; 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