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.
This commit is contained in:
Cristian Rojas committed 2026-10-22 06:26:54 -03:00
1 parent 4c55533a47
commit a18323b3fc
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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
```
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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" }
@(
+1 -1
View File
@@ -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".