From a18323b3fca550c6ddf7dd5bfa95e264a0ef0b64 Mon Sep 17 00:00:00 2001 From: Cristian Rojas <20193616+cristianrojas07@users.noreply.github.com> Date: Thu, 22 Oct 2026 06:26:54 -0300 Subject: [PATCH] Start Home with the HOME action and category in the install scripts (#888) am start -n alone is not a home launch, so Android opened a standard MainActivity task and the next Home press added the real home one beside it. With -a MAIN -c HOME the task is type=home, -W still reports the cold start, and the launcher no longer has to be the default Home for it. --- docs/devices/sony-x9000h-cn.md | 2 +- examples/tcl-43c645/build-and-install.sh | 2 +- launcher/build-and-install.ps1 | 2 +- launcher/build-and-install.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/devices/sony-x9000h-cn.md b/docs/devices/sony-x9000h-cn.md index b55101ee..84e17eff 100644 --- a/docs/devices/sony-x9000h-cn.md +++ b/docs/devices/sony-x9000h-cn.md @@ -41,7 +41,7 @@ was therefore built from main and installed with: ```sh adb install -r launcher/app/build/outputs/apk/release/app-release.apk -adb shell am start -W -n com.gathin.tvhome/.MainActivity # Status: ok, cold start 926 ms +adb shell am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity # Status: ok, cold start 926 ms adb shell cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity ``` diff --git a/examples/tcl-43c645/build-and-install.sh b/examples/tcl-43c645/build-and-install.sh index a9756aae..c1cd15d4 100755 --- a/examples/tcl-43c645/build-and-install.sh +++ b/examples/tcl-43c645/build-and-install.sh @@ -37,7 +37,7 @@ $A shell mkdir -p "$DIR" $A push ../examples/tcl-43c645/config.json "$DIR/config.json" >/dev/null $A shell "printf '%s' $(date +%s) > $DIR/theme_revision" -START=$($A shell am start -W -n com.gathin.tvhome/.MainActivity | tr -d '\r') +START=$($A shell am start -W -a android.intent.action.MAIN -c android.intent.category.HOME -n com.gathin.tvhome/.MainActivity | tr -d '\r') echo "$START" | grep -q 'Status: ok' || { echo "launcher did not start, Home left as it was" >&2; exit 1; } $A shell pm grant com.gathin.tvhome android.permission.ACCESS_FINE_LOCATION diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1 index 27fb94bc..d893da97 100644 --- a/launcher/build-and-install.ps1 +++ b/launcher/build-and-install.ps1 @@ -71,7 +71,7 @@ Write-Host $out if ("$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 -n com.gathin.tvhome/.MainActivity') -join "`n" +$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" Write-Host $start if ($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 5b4e12de..5e187a5f 100755 --- a/launcher/build-and-install.sh +++ b/launcher/build-and-install.sh @@ -107,7 +107,7 @@ 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 -n com.gathin.tvhome/.MainActivity') +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') 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".