Skip to content

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

Windows scripts: pass a component to set-home-activity (Android 9)

Narendra Rama35ca94f02e4
diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1
index eaab3dc74..23e6d566f 100644
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@ -35,12 +35,13 @@ if ($LASTEXITCODE -ne 0) { throw 'APK upload failed' }
$out = & $py -I ..\tools\tv.py 'pm install -r /data/local/tmp/tvhome.apk; rm -f /data/local/tmp/tvhome.apk'
Write-Host $out
if ("$out" -notmatch 'Success') { throw 'pm install failed; the stock launcher was left untouched' }
-$out = & $py -I ..\tools\tv.py 'cmd package set-home-activity --user 0 com.gathin.tvhome'
+# Android 9 only accepts a component here; Android 10+ also takes a bare package name.
+$out = & $py -I ..\tools\tv.py 'cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity'
Write-Host $out
if ("$out" -match 'Error') { throw 'could not set the new launcher as home; the stock launcher was left untouched' }
@(
'pm grant com.gathin.tvhome android.permission.ACCESS_FINE_LOCATION 2>/dev/null; echo location-granted',
- 'cmd package set-home-activity --user 0 com.gathin.tvhome',
+ 'cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity',
"pm disable-user --user 0 $StockLauncher"
) | & $py -I ..\tools\tv.py --batch
Write-Host 'Installed. Press Home on the remote to see it.'
diff --git a/tools/restore.ps1 b/tools/restore.ps1
index 8bcfc4a0f..f7a51f950 100644
--- a/tools/restore.ps1
+++ b/tools/restore.ps1
@@ -19,7 +19,8 @@ $env:TV_HOST = $TvHost
$pkgs = Get-Content $List | ForEach-Object { ($_ -replace '#.*$', '').Trim() } | Where-Object { $_ }
$cmds = @($pkgs | ForEach-Object { "pm enable $_" }) + @(
"pm enable $Stock",
- "cmd package set-home-activity --user 0 $Stock",
+ # resolve the stock HOME component on the TV (Android 9 needs pkg/activity, not just pkg)
+ ('cmd package set-home-activity --user 0 $(cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME ' + $Stock + ' | tail -n 1)'),
'settings put global window_animation_scale 1.0',
'settings put global transition_animation_scale 1.0',
'settings put global animator_duration_scale 1.0',