Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.
Name apps in the disable confirm, protect updaters and Wi-Fi, split alpha signing
jesse-agent-362ecc76cbe8b6c
diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.ymlindex 110ac90..1ebebf7 100644--- a/.github/workflows/release-check.yml+++ b/.github/workflows/release-check.yml@@ -42,7 +42,8 @@ jobs:echo "::error::CHANGELOG.md has no '## $VERSION — YYYY-MM-DD' section"exit 1fi- LATEST=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//' | sort -V | tail -n 1)+ # Prod tags only: the glob alone matches v0.1.0-alpha.1, which sort -V ranks above v0.1.0.+ LATEST=$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^v//' | sort -V | tail -n 1)if [ -z "$LATEST" ]; thenecho "No release tag yet; $VERSION ($CODE) passes."exit 0diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 7307073..9b99e10 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -20,6 +20,9 @@ jobs:alpha:if: github.ref_type == 'tag' || github.ref == 'refs/heads/dev'runs-on: ubuntu-latest+ # Its own key, in its own Environment: an alpha can never update a prod install, and a dev+ # push never sees the prod key.+ environment: alphatimeout-minutes: 30permissions:contents: write@@ -68,21 +71,23 @@ jobs:- uses: gradle/actions/setup-gradle@v6+ # No fallback to the release key: without the alpha secrets the job fails.- name: Keystoreenv:- RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}+ ALPHA_KEYSTORE_BASE64: ${{ secrets.ALPHA_KEYSTORE_BASE64 }}run: |- if [ -z "$RELEASE_KEYSTORE_BASE64" ]; then- echo "::error::Repo secret RELEASE_KEYSTORE_BASE64 is not set; see CONTRIBUTING.md#releases"+ if [ -z "$ALPHA_KEYSTORE_BASE64" ]; then+ echo "::error::Secret ALPHA_KEYSTORE_BASE64 is not set in the alpha environment; see CONTRIBUTING.md#releases"exit 1fi- printf '%s' "$RELEASE_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"+ printf '%s' "$ALPHA_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/alpha.jks"+ # Gradle reads the RELEASE_* names for whichever key the job hands it.- name: Buildenv:- RELEASE_KEYSTORE: ${{ runner.temp }}/release.jks- RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}- RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}+ RELEASE_KEYSTORE: ${{ runner.temp }}/alpha.jks+ RELEASE_KEY_ALIAS: ${{ secrets.ALPHA_KEY_ALIAS }}+ RELEASE_KEY_PASSWORD: ${{ secrets.ALPHA_KEY_PASSWORD }}run: ./gradlew :app:assembleRelease -Ptellyscope.alpha=${{ steps.tag.outputs.n }} --console=plain- name: Alpha pre-release@@ -96,7 +101,8 @@ jobs:fiAPK="Tellyscope-$TAG.apk"cp app/build/outputs/apk/release/app-release.apk "$APK"- PREV=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)+ # The nearest tag before this commit, alpha or prod; a glob would find the tag just pushed.+ PREV=$(git describe --tags --abbrev=0 --match 'v*' "$GITHUB_SHA^" 2>/dev/null || true){echo "Alpha build $TAG from \`${GITHUB_SHA::7}\` on dev. Untested and may break; it installs as a separate app, \`app.tellyscope.alpha\`."echo@@ -112,6 +118,7 @@ jobs:prod:if: github.ref == 'refs/heads/main'runs-on: ubuntu-latest+ environment: releasetimeout-minutes: 30permissions:contents: write@@ -147,7 +154,7 @@ jobs:RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}run: |if [ -z "$RELEASE_KEYSTORE_BASE64" ]; then- echo "::error::Repo secret RELEASE_KEYSTORE_BASE64 is not set; see CONTRIBUTING.md#releases"+ echo "::error::Secret RELEASE_KEYSTORE_BASE64 is not set in the release environment; see CONTRIBUTING.md#releases"exit 1fiprintf '%s' "$RELEASE_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"@@ -168,7 +175,7 @@ jobs:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}V: ${{ steps.version.outputs.version }}run: |- PREV=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)+ PREV=$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)awk -v v="$V" '/^## / { if (on) exit; h = $0; sub(/^## v?/, "", h); split(h, a, /[ \t]/); on = (a[1] == v); next }ondiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a0a7b6b..35d1d1f 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -15,7 +15,7 @@ Thanks for helping! Tellyscope is in alpha, so the code and its structure are st- **Alpha:** every merge into `dev` publishes an alpha. CI builds `app.tellyscope.alpha`, which installs next to the release, and once the build passes it tags the commit `vX.Y.Z-alpha.N` and publishes a GitHub pre-release under that tag, with the APK named `Tellyscope-vX.Y.Z-alpha.N.apk`. `X.Y.Z` is the current `versionName`, and `N` is one past the highest alpha of that version. A failed build tags nothing. You can still put out an alpha by hand: tag a commit that is on `dev` and push the tag, for example `git tag v0.1.0-alpha.1 origin/dev && git push origin v0.1.0-alpha.1`. The tag's `X.Y.Z` must equal `versionName` in `app/build.gradle.kts`, and its commit must be on `dev`; otherwise the build fails and publishes nothing.- **Shipping:** a release is a pull request from `dev` into `main`, merged with a merge commit. It must raise `versionName` and `versionCode` in `app/build.gradle.kts` past the latest `v*` tag and turn the `## Unreleased` section of [CHANGELOG.md](CHANGELOG.md) into that version's section; CI refuses anything else. Merging it tags `vX.Y.Z` and publishes a GitHub release with the signed APK, notes from the changelog section and the commits since the previous tag.-- **Signing:** CI signs both builds from three repository secrets: `RELEASE_KEYSTORE_BASE64` (the keystore, base64-encoded), `RELEASE_KEY_ALIAS` and `RELEASE_KEY_PASSWORD`, which is both the store and the key password (keytool's PKCS12 default uses one for both). Only the maintainer holds the key; never commit a keystore. Local release builds are unsigned.+- **Signing:** alphas and releases are signed with two different keys, so an alpha can never install over the release app. Each key lives in its own GitHub Environment: `ALPHA_KEYSTORE_BASE64`, `ALPHA_KEY_ALIAS` and `ALPHA_KEY_PASSWORD` in `alpha`, which deploys only from `dev` and `v*-alpha.*` tags; `RELEASE_KEYSTORE_BASE64`, `RELEASE_KEY_ALIAS` and `RELEASE_KEY_PASSWORD` in `release`, which deploys only from `main`. `*_KEYSTORE_BASE64` is the keystore, base64-encoded, and `*_KEY_PASSWORD` is both the store and the key password (keytool's PKCS12 default uses one for both). A job with its secrets missing fails; it never falls back to the other key. Only the maintainer holds the keys; never commit a keystore. Local release builds are unsigned.## Debloat listsdiff --git a/README.md b/README.mdindex 36ea4a4..9905f62 100644--- a/README.md+++ b/README.md@@ -42,7 +42,7 @@ Debloating a TV can break it if done carelessly. Tellyscope is built around thes1. **Disable only, never uninstall.** Tellyscope uses `pm disable-user`, which is reversible from the app or with `pm enable`. It never runs `pm uninstall`, not even for the current user.2. **Record before changing.** Before the first change on a TV, Tellyscope notes which apps were already off, so **Restore everything** turns back on only what Tellyscope turned off. Every change goes into the TV's history with an Undo. The history lives on the phone and is deleted if you uninstall Tellyscope; a disabled app still shows in the Apps list with **Turn on**.-3. **Protected list.** Packages the TV needs to boot, update, show the home screen or accept input are on a protected list. Tellyscope refuses to stop or disable them, and there is no override in the app. If the TV doesn't say which app is its home screen, Tellyscope refuses to stop or disable anything. A TV's suggested list can protect more apps, never fewer.+3. **Protected list.** Packages the TV needs to boot, install its updates, stay on Wi-Fi, show web pages, show the home screen or accept input are on a protected list. Tellyscope refuses to stop or disable them, and there is no override in the app. If the TV doesn't say which app is its home screen, Tellyscope refuses to stop or disable anything. A TV's suggested list can protect more apps, never fewer.4. **No root, no exploits.** Only what ADB allows on a stock TV.5. **Nothing left on the TV.** To show real app names and icons, Tellyscope copies a small helper to `/data/local/tmp`, runs it once and deletes it. The helper only reads through PackageManager: no writes, no permissions, no network.diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Protected.kt b/adb/src/main/kotlin/app/tellyscope/adb/Protected.ktindex b36aee6..be977f1 100644--- a/adb/src/main/kotlin/app/tellyscope/adb/Protected.kt+++ b/adb/src/main/kotlin/app/tellyscope/adb/Protected.kt@@ -4,7 +4,7 @@ package app.tellyscope.adb/** Why a package may not be stopped or disabled. The UI shows the matching copy. */enum class ProtectedReason {- HOME_SCREEN, SYSTEM, SETTINGS, PLAY_SERVICES, KEYBOARD, TV_INPUTS_REMOTE, SETUP_WIZARD,+ HOME_SCREEN, SYSTEM, SETTINGS, PLAY_SERVICES, KEYBOARD, TV_INPUTS_REMOTE, SETUP_WIZARD, UPDATES,/** The TV didn't say which app is its home screen, so nothing is stopped or disabled. */UNKNOWN_HOME,@@ -37,10 +37,24 @@ object Protected {"com.android.webview" to ProtectedReason.SYSTEM,)+ /**+ * System updaters: `update`/`upgrade` anywhere, `ota` only as a whole name part or before+ * `update`, so `com.tcl.bootadservice` and `com.itwgame.mota` stay unprotected.+ */+ private val UPDATER = Regex("updat|upgrad|(^|\\.)(f|usb|remote|auth)?ota(\\.|$)|otaupdat")+/** Name fragments, checked in order; manufacturer names vary, so these match loosely. */private val PATTERNS: List<Pair<String, ProtectedReason>> = listOf("launcher" to ProtectedReason.HOME_SCREEN, // second guard behind the live home lookup"networkstack" to ProtectedReason.SYSTEM, // Wi-Fi and Ethernet setup; we'd cut our own link+ // Wi-Fi config, connectivity resources and their OEM overlays: same reason, and once Wi-Fi is+ // gone so is the ADB link an undo would need.+ "com.android.wifi" to ProtectedReason.SYSTEM,+ "com.google.android.wifi" to ProtectedReason.SYSTEM,+ "wifi.resources" to ProtectedReason.SYSTEM,+ "connectivity" to ProtectedReason.SYSTEM,+ // Chrome's shared library; WebView and Chrome stop loading without it.+ "trichromelibrary" to ProtectedReason.SYSTEM,"inputmethod" to ProtectedReason.KEYBOARD,"keyboard" to ProtectedReason.KEYBOARD,".ime" to ProtectedReason.KEYBOARD,@@ -64,6 +78,7 @@ object Protected {EXACT[pkg]?.let { return it }if (CORE.matches(pkg) && !CORE_OK.matches(pkg)) return ProtectedReason.SYSTEMval lower = pkg.lowercase()- return PATTERNS.firstOrNull { (fragment, _) -> fragment in lower }?.second+ PATTERNS.firstOrNull { (fragment, _) -> fragment in lower }?.let { return it.second }+ return if (UPDATER.containsMatchIn(lower)) ProtectedReason.UPDATES else null}}diff --git a/adb/src/test/kotlin/app/tellyscope/adb/ProtectedTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/ProtectedTest.ktindex 0efeae8..05bf4fe 100644--- a/adb/src/test/kotlin/app/tellyscope/adb/ProtectedTest.kt+++ b/adb/src/test/kotlin/app/tellyscope/adb/ProtectedTest.kt@@ -28,4 +28,27 @@ class ProtectedTest {assertNull(Protected.reason("com.google.android.tvrecommendations"))assertNull(Protected.reason("com.amazon.amazonvideo.livingroom"))}++ @Test fun updaters() {+ for (pkg in listOf(+ "com.droidlogic.updater", "com.xiaomi.mitv.updateservice", "com.sony.dtv.systemupdate",+ "com.xgimi.upgrade", "com.coocaa.os.upgrade", "com.amazon.tv.forcedotaupdater.v2",+ "com.amazon.device.software.ota", "com.xgimi.ota.accessories", "com.vt.tv.usbota",+ "com.apps.authota", "com.htc.htcotaupdate", "com.nvidia.ota",+ )) assertEquals(ProtectedReason.UPDATES, Protected.reason(pkg), pkg)+ // "ota" inside another word is not an updater.+ assertNull(Protected.reason("com.tcl.bootadservice"))+ assertNull(Protected.reason("com.itwgame.mota.nearme.gamecenter"))+ }++ @Test fun wifiAndSharedLibraries() {+ for (pkg in listOf(+ "com.android.wifi.resources", "com.google.android.wifi.resources", "com.android.wifi.resources.xiaomi",+ "com.android.connectivity.resources", "com.google.android.connectivity.resources",+ "com.google.android.trichromelibrary", "com.google.android.trichromelibrary_602614532",+ )) assertEquals(ProtectedReason.SYSTEM, Protected.reason(pkg), pkg)+ // Wi-Fi extras the lists turn off stay allowed.+ assertNull(Protected.reason("com.sony.dtv.networkapp.wifidirect"))+ assertNull(Protected.reason("com.amazon.wifilocker"))+ }}diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.ktindex d0a9319..8fbf50f 100644--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt@@ -486,6 +486,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {ProtectedReason.KEYBOARD -> "you'd lose the on-screen keyboard"ProtectedReason.TV_INPUTS_REMOTE -> "your remote or HDMI inputs could stop working"ProtectedReason.SETUP_WIZARD -> "the TV may get stuck on restart without it"+ ProtectedReason.UPDATES -> "the TV gets its updates through this"ProtectedReason.UNKNOWN_HOME -> "this TV didn't say which app is its home screen, so Tellyscope won't change anything"}}diff --git a/app/src/main/java/app/tellyscope/ui/ListsCard.kt b/app/src/main/java/app/tellyscope/ui/ListsCard.ktindex 14af2d4..d6314f7 100644--- a/app/src/main/java/app/tellyscope/ui/ListsCard.kt+++ b/app/src/main/java/app/tellyscope/ui/ListsCard.kt@@ -31,6 +31,7 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.unit.dpimport app.tellyscope.data.ListEntry+import app.tellyscope.data.Suggestedimport app.tellyscope.data.Suggestions/** Body of the "Suggested for this TV" section: the TV's list, cut down to what it has. */@@ -53,7 +54,11 @@ fun SuggestionsBlock(else -> emptyList()}if (picking) PickDialog(devices, onPick = { picking = false; onPick(it) }, onDismiss = { picking = false })- if (confirming) DisableDialog(ticked.size, onDisable = { confirming = false; onDisable(ticked.toList()) }, onDismiss = { confirming = false })+ if (confirming) {+ // The dialog's list is exactly what gets disabled.+ val chosen = (lists as? Suggestions.Ready)?.groups.orEmpty().flatMap { it.packages }.filter { it.pkg in ticked }+ DisableDialog(chosen, onDisable = { confirming = false; onDisable(chosen.map { it.pkg }) }, onDismiss = { confirming = false })+ }when (lists) {null -> Muted("Looking up this TV's list…")@@ -138,11 +143,24 @@ fun PickDialog(devices: List<ListEntry>, onPick: (String) -> Unit, onDismiss: ()}@Composable-private fun DisableDialog(count: Int, onDisable: () -> Unit, onDismiss: () -> Unit) {+internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismiss: () -> Unit) {AlertDialog(onDismissRequest = onDismiss,- title = { Text("Disable $count ${if (count == 1) "app" else "apps"}?") },- text = { Text("Each one is hidden and stops running. Nothing is deleted; every one shows in History, where you can turn it back on.") },+ title = { Text("Disable ${apps.size} ${if (apps.size == 1) "app" else "apps"}?") },+ text = {+ // Every name, so a list can't slip something in behind a count.+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Text("Each one is hidden and stops running. Nothing is deleted; every one shows in History, where you can turn it back on.")+ LazyColumn(Modifier.heightIn(max = 280.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {+ items(apps, key = { it.pkg }) { a ->+ Column {+ Text(a.label, style = MaterialTheme.typography.bodyLarge)+ Text(a.pkg, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ }+ }+ }+ }+ },confirmButton = { Button(onClick = onDisable) { Text("Yes, disable them") } },dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },)diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.ktindex 3e7aca7..b9ae44d 100644--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt@@ -32,10 +32,12 @@ import app.tellyscope.data.PickedAppimport app.tellyscope.data.ScanHitimport app.tellyscope.data.ScanKindimport app.tellyscope.data.ScanProgress+import app.tellyscope.data.Suggestedimport app.tellyscope.ui.DeviceActionsimport app.tellyscope.ui.DeviceScreenimport app.tellyscope.ui.Copyimport app.tellyscope.ui.DeviceUi+import app.tellyscope.ui.DisableDialogimport app.tellyscope.ui.ForgetDialogimport app.tellyscope.ui.FilesBlockimport app.tellyscope.ui.FilesUi@@ -323,4 +325,18 @@ class ScreenshotTest {}@Test fun reboot() = shot("15_reboot", screen = true) { RebootDialog({}, {}) }++ @Test fun disableSuggested() {+ val apps = listOf(+ Suggested("com.xgimi.assistant", "XGIMI Assistant", null, optional = false, ticked = true),+ Suggested("com.google.android.tvrecommendations", "TV Recommendations", null, optional = false, ticked = true),+ )+ shot("16_disable_suggested", screen = true) { DisableDialog(apps, {}, {}) }+ // Names, not just a count.+ compose.onNodeWithText("Disable 2 apps?").assertExists()+ for (a in apps) {+ compose.onNodeWithText(a.label).assertExists()+ compose.onNodeWithText(a.pkg).assertExists()+ }+ }}