Skip to content

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

Handler guard: only the two intents (VIEW on a channel, android.settings.SETTINGS)

VGS31937a6cb3f6
diff --git a/tools/check.py b/tools/check.py
index b95b2623f..c1dc5aa48 100644
--- a/tools/check.py
+++ b/tools/check.py
@@ -160,8 +160,7 @@ def handler_apps(dev):
Settings with, as two sets of package names, the same query disable.sh makes."""
q = "cmd package query-activities --brief"
inputs = recovery.shell(dev, f"{q} -a android.intent.action.VIEW -t vnd.android.cursor.item/channel")
- settings = (recovery.shell(dev, f"{q} -a android.settings.SETTINGS") + "\n"
- + recovery.shell(dev, f"{q} -a android.intent.action.MAIN -c android.intent.category.PREFERENCE"))
+ settings = recovery.shell(dev, f"{q} -a android.settings.SETTINGS")
names = lambda out: set(re.findall(r"^\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+)/", out, re.M))
return names(inputs), names(settings)
diff --git a/tools/disable.ps1 b/tools/disable.ps1
index aee727975..3d0308302 100644
--- a/tools/disable.ps1
+++ b/tools/disable.ps1
@@ -134,7 +134,7 @@ if (-not $env:TVINPUT_ALLOW -and $pkgs.Count -gt 0) {
if (-not $env:HANDLERS_ALLOW -and $pkgs.Count -gt 0) {
$q = 'cmd package query-activities --brief'
$ErrorActionPreference = 'Continue'
- $handlers = @(& $py -I (Join-Path $repo 'tools\tv.py') "$q -a android.intent.action.VIEW -t vnd.android.cursor.item/channel 2>/dev/null; echo ==; $q -a android.settings.SETTINGS 2>/dev/null; $q -a android.intent.action.MAIN -c android.intent.category.PREFERENCE 2>/dev/null; true" 2>$null)
+ $handlers = @(& $py -I (Join-Path $repo 'tools\tv.py') "$q -a android.intent.action.VIEW -t vnd.android.cursor.item/channel 2>/dev/null; echo ==; $q -a android.settings.SETTINGS 2>/dev/null; true" 2>$null)
$checked = $LASTEXITCODE -eq 0
$ErrorActionPreference = 'Stop'
if (-not $checked) {
diff --git a/tools/disable.sh b/tools/disable.sh
index 3594980c8..a43ce0c26 100755
--- a/tools/disable.sh
+++ b/tools/disable.sh
@@ -200,7 +200,7 @@ if [ -n "$PKGS" ] && [ -z "${HANDLERS_ALLOW:-}" ]; then
Q='cmd package query-activities --brief'
# The two lists are split at the "==" line; `; true` so a firmware without a match still answers.
if HANDLERS="$("$PY" -I tools/tv.py \
- "$Q -a android.intent.action.VIEW -t vnd.android.cursor.item/channel 2>/dev/null; echo ==; $Q -a android.settings.SETTINGS 2>/dev/null; $Q -a android.intent.action.MAIN -c android.intent.category.PREFERENCE 2>/dev/null; true" \
+ "$Q -a android.intent.action.VIEW -t vnd.android.cursor.item/channel 2>/dev/null; echo ==; $Q -a android.settings.SETTINGS 2>/dev/null; true" \
</dev/null 2>/dev/null | tr -d '\r')"; then
NAME_RE='s#^[[:space:]]*([A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z0-9_]+)+)/.*#\1#p'
INPUT_APPS="$(printf '%s\n' "$HANDLERS" | sed '/^==$/,$d' | sed -n -E "$NAME_RE" | sort -u)"