Skip to content

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

examples/anker-nebula-d2426: the README gives the tools' own commands instead of the folder's scripts

Mazin Kanuga62676422031b
diff --git a/examples/anker-nebula-d2426/README.md b/examples/anker-nebula-d2426/README.md
index 73c647b9b..984d94bb3 100644
--- a/examples/anker-nebula-d2426/README.md
+++ b/examples/anker-nebula-d2426/README.md
@@ -27,8 +27,9 @@ A backup of the state before any change (package lists, getprop, all settings, H
## Undo everything
```bash
-examples/anker-nebula-d2426/restore.sh # re-enable all 17, stock Home back, screensaver back
-examples/anker-nebula-d2426/restore.sh --remove-launcher # same, and uninstall the new launcher
+tools/restore.sh examples/anker-nebula-d2426/debloat.txt com.google.android.tvlauncher # re-enable all 17, stock Home back
+tools/venv/bin/python -I tools/tv.py 'settings put secure screensaver_components com.google.android.backdrop/.Backdrop' # Ambient back
+tools/venv/bin/python -I tools/tv.py 'pm uninstall com.gathin.tvhome' # only to remove the new launcher too
```
## Re-enable one app
@@ -80,11 +81,16 @@ Delete `wallpaper.jpg` and push again for the plain black background. `themes/`
## Rebuild and reinstall the launcher
```bash
-examples/anker-nebula-d2426/build-and-install.sh
+STOCK_LAUNCHER=none launcher/build-and-install.sh
+tools/disable.sh examples/anker-nebula-d2426/debloat.txt
+tools/venv/bin/python -I tools/tv.py 'cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity'
+tools/theme.sh examples/anker-nebula-d2426
```
-It builds the APK, installs it, applies `debloat.txt` (which disables the stock home only once the new one can
-take over), makes the new launcher Home and pushes `config.json`.
+The first line builds and installs the launcher and leaves the stock home alone. If it fails, stop there: the
+list disables the stock home, which is only safe once the new one is installed. The list then disables the 17
+packages, the third line makes the new launcher Home and the last one pushes `config.json`. Press Home on the
+remote: if it does not land on the new launcher, undo as above.
## Notes from this projector
diff --git a/examples/anker-nebula-d2426/build-and-install.sh b/examples/anker-nebula-d2426/build-and-install.sh
deleted file mode 100755
index 65711d978..000000000
--- a/examples/anker-nebula-d2426/build-and-install.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-# Build the Apple TV style launcher, install it on the Nebula D2426, make it Home, apply the debloat list
-# (which disables the stock launcher only once the new one can take Home) and push this projector's dock config.
-#
-# TV_HOST=<projector ip> examples/anker-nebula-d2426/build-and-install.sh
-#
-# Needs: ADB on (Developer options > USB debugging, and network/Wireless debugging), JDK 17 or newer, the
-# Android SDK (Android Studio's default location is found), and tools/venv (see the main README).
-set -euo pipefail
-: "${TV_HOST:?set TV_HOST to the projector IP, e.g. TV_HOST=192.168.1.50 $0}"
-HERE="$(cd "$(dirname "$0")" && pwd)"
-ROOT="$(cd "$HERE/../.." && pwd)"
-export TV_HOST
-
-# launcher/build-and-install.sh looks for a JDK 17; any 17+ works, so fall back to the newest one here.
-if [ -z "${JAVA_HOME:-}" ] && [ -x /usr/libexec/java_home ]; then
- JAVA_HOME="$(/usr/libexec/java_home -v 17+ 2>/dev/null || true)"
- [ -n "$JAVA_HOME" ] && export JAVA_HOME
-fi
-
-# STOCK_LAUNCHER=none: the stock launcher is disabled by the debloat list below instead, so that
-# restore.sh records it and turns it back on.
-# While the stock launcher is still enabled it outranks the new one, so that script reports that Home did not
-# switch; that is expected on a first install. A failed build or install is not, so check the package is there.
-STOCK_LAUNCHER=none "$ROOT/launcher/build-and-install.sh" || true
-case "$("$ROOT/tools/venv/bin/python" -I "$ROOT/tools/tv.py" 'pm path com.gathin.tvhome')" in
- *package:*) ;;
- *) echo "ERROR: the launcher is not installed; nothing was disabled." >&2; exit 1 ;;
-esac
-
-"$ROOT/tools/disable.sh" "$HERE/debloat.txt"
-"$ROOT/tools/venv/bin/python" -I "$ROOT/tools/tv.py" \
- "cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity"
-"$ROOT/tools/theme.sh" "$HERE"
-
-HOME_NOW="$("$ROOT/tools/venv/bin/python" -I "$ROOT/tools/tv.py" \
- 'cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME' | tail -n 1 | tr -d '\r')"
-echo "Home resolves to: $HOME_NOW"
-case "$HOME_NOW" in
- com.gathin.tvhome/*) echo "Done. Press Home on the remote." ;;
- *) echo "ERROR: Home is not the new launcher; run examples/anker-nebula-d2426/restore.sh to undo." >&2; exit 1 ;;
-esac
-echo "Netflix here is the phone app: add it once from Home > App library (bottom pill) so the dock can show it."
diff --git a/examples/anker-nebula-d2426/restore.sh b/examples/anker-nebula-d2426/restore.sh
deleted file mode 100755
index 4ad23017b..000000000
--- a/examples/anker-nebula-d2426/restore.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-# Put the Nebula D2426 back the way it was before cleanyourtv (needs ADB on, like the setup did).
-#
-# TV_HOST=<projector ip> examples/anker-nebula-d2426/restore.sh # undo everything, keep the new launcher installed
-# TV_HOST=<projector ip> examples/anker-nebula-d2426/restore.sh --remove-launcher # ...and uninstall it too
-#
-# 1. Re-enables every package in debloat.txt (tools/restore.sh replays the state recorded before the first
-# disable, so anything that was already off stays off) and hands Home back to the stock launcher.
-# 2. Puts the Ambient screensaver back (it was com.google.android.backdrop/.Backdrop).
-set -euo pipefail
-: "${TV_HOST:?set TV_HOST to the projector IP, e.g. TV_HOST=192.168.1.50 $0}"
-HERE="$(cd "$(dirname "$0")" && pwd)"
-ROOT="$(cd "$HERE/../.." && pwd)"
-PY="$ROOT/tools/venv/bin/python"
-[ -x "$PY" ] || { echo "run: python3 -m venv tools/venv && tools/venv/bin/pip install -r tools/requirements.txt" >&2; exit 1; }
-tv() { "$PY" -I "$ROOT/tools/tv.py" "$@"; }
-
-"$ROOT/tools/restore.sh" "$HERE/debloat.txt" com.google.android.tvlauncher
-
-# One command per shell call: chained pm/settings commands can stop silently after the first.
-tv "settings put secure screensaver_components com.google.android.backdrop/.Backdrop"
-
-if [ "${1:-}" = "--remove-launcher" ]; then
- tv "pm uninstall com.gathin.tvhome"
-fi
-
-echo "Disabled packages now:"
-tv "pm list packages -d"
-echo "Home resolves to:"
-tv "cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.HOME" | tail -n 1
diff --git a/tests/test_doc_addresses.py b/tests/test_doc_addresses.py
index b27046513..9edccea49 100644
--- a/tests/test_doc_addresses.py
+++ b/tests/test_doc_addresses.py
@@ -99,9 +99,9 @@ class DocAddressesTest(unittest.TestCase):
def test_pages_are_read(self):
read = {path.relative_to(ROOT).as_posix() for path in pages(ROOT)}
for page in ("README.md", "docs/REMOTE.md", "examples/philips-google-tv-ta7/README.md",
- "examples/skyworth-swtv-24ae-4k-nf/debloat.txt",
- "examples/anker-nebula-d2426/restore.sh"):
+ "examples/skyworth-swtv-24ae-4k-nf/debloat.txt"):
self.assertIn(page, read)
+ self.assertIn(".sh", SUFFIXES, "a folder's own scripts are read too")
def test_no_page_gives_the_address_of_a_real_set(self):
self.assertEqual([], problems(ROOT, addresses),