Skip to content

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

Install scripts: with STOCK_LAUNCHER=none, the first start names the component only (#1274)

Gathin23d043b6f90e61
diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1
index df940f294..5cb61cb04 100644
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@ -77,7 +77,11 @@ Write-Host $out
if ($LASTEXITCODE -ne 0 -or "$out" -match 'Error') { throw 'could not set the new launcher as home; the stock launcher was left untouched' }
# Start the launcher on its own, before the stock Home is touched (see build-and-install.sh, #239):
# in the batch a failed start only prints an Error line and the stock launcher would be disabled anyway.
-$start = (& $py -I ..\tools\tv.py 'am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity') -join "`n"
+# With -StockLauncher none the stock launcher stays Home (stock_home_redirect): a MAIN+HOME start would make this
+# launcher the home process until a restart, and Android then blocks the stock launcher's button launches (#1274).
+$startCmd = if ($StockLauncher -eq 'none') { 'am start -W -n com.gathin.tvhome/.MainActivity' }
+ else { 'am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity' }
+$start = (& $py -I ..\tools\tv.py $startCmd) -join "`n"
Write-Host $start
if ($LASTEXITCODE -ne 0 -or $start -notmatch 'Status: ok' -or $start -match '(?m)^Error') { throw "the new launcher did not start (see above); $StockLauncher was left enabled" }
@(
diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.sh
index 2942e9fb7..f5d5a448e 100755
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@ -122,7 +122,15 @@ esac
# fails only prints an "Error:" line, and the stock launcher would be disabled anyway, leaving the TV
# with no usable Home (#239). "Status: ok" from `am start -W` means the activity really came up;
# the HOME resolution further down only names a component, it does not prove the activity starts.
-START_OUT=$("$PY" -I ../tools/tv.py 'am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity')
+# With STOCK_LAUNCHER=none the stock launcher stays Home (stock_home_redirect): a MAIN+HOME start would
+# make this launcher the home process until a restart, and Android then blocks the stock launcher's
+# remote-button launches (BAL_BLOCK, #1274). The component alone still proves the activity comes up.
+if [ "$STOCK_LAUNCHER" = none ]; then
+ START_CMD='am start -W -n com.gathin.tvhome/.MainActivity'
+else
+ START_CMD='am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity'
+fi
+START_OUT=$("$PY" -I ../tools/tv.py "$START_CMD")
echo "$START_OUT"
# Both halves matter: some builds answer "Status: ok" for a task that was merely brought to the
# front, and an activity that cannot start still prints "Error: Activity not started".