Skip to content

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

Merge PR #40: Build: install a minified release APK and precompile it

Gathin23973f9cde1f84
diff --cc launcher/build-and-install.ps1
index 23e6d566f,684076b74..db2b9aad5
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@@ -41,7 -40,8 +41,8 @@@ Write-Host $ou
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 compile -m speed -f com.gathin.tvhome',
- '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 --cc launcher/build-and-install.sh
index 66d537252,30fc3f8b1..50ac208c1
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@@ -11,19 -12,7 +11,19 @@@ export PATH="$JAVA_HOME/bin:$PATH
PY=../tools/venv/bin/python
[ -x "$PY" ] || PY=../tools/venv/Scripts/python.exe
export MSYS_NO_PATHCONV=1
+# Which app owns Home differs by build (com.google.android.tvlauncher on Android TV,
+# com.google.android.apps.tv.launcherx on newer Google TV), so ask the TV instead of guessing.
+# Ignore an answer of our own launcher, left over from a previous run of this script.
+if [ -z "${STOCK_LAUNCHER:-}" ]; then
+ STOCK_LAUNCHER=$("$PY" -I ../tools/tv.py \
+ 'cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME' \
+ | tail -n 1 | cut -d/ -f1 || true)
+ case "$STOCK_LAUNCHER" in
+ com.gathin.tvhome | *[!a-zA-Z0-9._]* | "") STOCK_LAUNCHER=com.google.android.tvlauncher ;;
+ esac
+ echo "Stock launcher: $STOCK_LAUNCHER"
+fi
- APK=app/build/outputs/apk/debug/app-debug.apk
+ APK=app/build/outputs/apk/release/app-release.apk
"$PY" -I ../tools/b64push.py "$APK" /data/local/tmp/tvhome.apk
printf '%s\n' \
"pm install -r /data/local/tmp/tvhome.apk" \