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.
Fire TV Home card: the launcher holding Home by its service is Current
jesse-agent-8213bc8f4b381a2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1c7fc96..e04c6ee 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,9 @@ until this file has a section for its version.## Unreleased- **Fixed:** On Fire TV, Remote buttons and Apps › Open now open the app. [#248](../../pull/248)+- **Fixed:** On Fire TV, the Home screen card shows Projectivy as Current once it holds Home. [#249](../../pull/249)+ - Switching back to Amazon's launcher turns Projectivy's accessibility service off.+ - Apps without a name of their own no longer show a class name.## 0.13.0 — 2026-10-29diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.ktindex 31ee5e1..782ce7d 100644--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt@@ -390,6 +390,8 @@ class AdbDeviceSource(context: Context) : DeviceSource {// Same key as history: a placeholder serial must not give two boxes one cache.val names = appNames.names(key(deviceId), listed, LabelHelper(session, helperDex)::describe)val keep = keep[key(deviceId)].orEmpty()+ // Fire OS keeps Amazon's launcher the default; a launcher whose service is on holds Home instead.+ val held = if (fireOs(deviceId, FIRE_TV_LAUNCHER in system)) Actions(shell).fireServiceHolder(serviceLaunchers)?.first else null// On a launcher the user added, offer the way back to the one it replaced.val own = homeOptions?.let { builtIns(system, disabled, it) }.orEmpty()val back = homeOptions?.current?.takeIf { it !in system }@@ -422,7 +424,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {version = "",icon = name.icon,removable = p.name in userInstalled,- home = p.name == homeOptions?.takeIf { it.default }?.current,+ home = if (held != null) p.name == held else p.name == homeOptions?.takeIf { it.default }?.current,listedLauncher = SharedLists.launchers.any { it.pkg == p.name },homeInstead = homeOptions?.takeIf { p.name in it.others }?.current,homeFirst = homeOptions?.takeIf { it.current == null && p.name in it.others } != null,@@ -545,7 +547,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {fireHomes -= deviceIdval key = key(deviceId)val actions = Actions(session(deviceId))- if (packageName in serviceLaunchers && (deviceKind(device(deviceId)) == DeviceKind.FireTv || actions.installed(FIRE_TV_LAUNCHER))) {+ if (packageName in serviceLaunchers && fireOs(deviceId, actions.installed(FIRE_TV_LAUNCHER))) {return fireServiceHome(actions, packageName, withService, ::labelOf) { previous ->book.record(key, System.currentTimeMillis(), Action.Home, packageName, labelOf(packageName), Action.Enable.takeIf { previous.isNotEmpty() }, undoing, previous)}@@ -557,6 +559,9 @@ class AdbDeviceSource(context: Context) : DeviceSource {private fun labelOf(pkg: String) = labels[pkg] ?: AppNames.fallback(pkg)+ /** A Fire TV by its model, or any TV with Amazon's launcher: [amazonLauncher] says whether it has one. */+ private fun fireOs(deviceId: String, amazonLauncher: Boolean) = amazonLauncher || deviceKind(device(deviceId)) == DeviceKind.FireTv+/** Undo of a first home: [launcher] stays Home, as there's none to go back to; its [service] goes off. */private suspend fun firstHomeServiceOff(deviceId: String, launcher: String, service: String, undoing: Long): HistoryEntry {val label = labelOf(launcher)@@ -593,6 +598,14 @@ class AdbDeviceSource(context: Context) : DeviceSource {val system = Parsers.packages(shell.shell("pm list packages -s").output).map { it.name }.toSet()val disabled = Parsers.packages(shell.shell("pm list packages -d").output).map { it.name }.toSet()val nothing = "there's no home screen to switch back to"+ if (fireOs(deviceId, FIRE_TV_LAUNCHER in system)) Actions(shell).fireServiceHolder(serviceLaunchers)?.let { held ->+ val (added, _) = held+ // Reverses the Make Home that turned the service on, so Restore leaves it alone.+ val home = undoing ?: book.entries(key).filter { it.action == Action.Home && it.undoneAt == null && it.firstHomeService != null && it.packageName == added }.maxByOrNull { it.id }?.id+ return fireHomeBack(Actions(shell), held, ::labelOf) { to, previous ->+ book.record(key, System.currentTimeMillis(), Action.HomeBack, added, to?.let(::labelOf) ?: labelOf(FIRE_TV_LAUNCHER), Action.Home, home, previous)+ }+ }val options = Actions(shell).homeOptions() ?: throw IllegalStateException(nothing)val added = options.current?.takeIf { it !in system } ?: throw IllegalStateException(nothing)val own = builtIns(system, disabled, options)@@ -1177,6 +1190,38 @@ internal suspend fun fireServiceHome(return record(mapOf("service" to service))}+/**+ * On Fire OS, the launcher of [launchers] whose accessibility service is on, and that service: it+ * holds Home there while Amazon's launcher stays the default ([fireServiceHome]). Null when none is.+ */+internal suspend fun Actions.fireServiceHolder(launchers: Collection<String>): Pair<String, String>? {+ for (pkg in launchers) {+ val service = homeService(pkg) ?: continue+ if (serviceOn(service)) return pkg to service+ }+ return null+}++/**+ * Fire OS's way back to Amazon's launcher: [held]'s service, from [fireServiceHolder], goes off, so+ * Home opens the default again, and the TV shows it. [record] gets the home activity and "service";+ * its Undo, a Make Home, turns the service back on.+ */+internal suspend fun fireHomeBack(+ actions: Actions,+ held: Pair<String, String>,+ label: (String) -> String,+ record: (to: String?, previous: Map<String, String?>) -> HistoryEntry,+): HistoryEntry {+ val (pkg, service) = held+ if (!actions.setService(service, false)) throw IllegalStateException(fireServiceNotOff(label(pkg)))+ val to = actions.currentHome()+ val left = to?.let { actions.handOff(pkg, it) }+ return record(to?.substringBefore('/'), mapOf("service" to service)).also {+ left?.let { throw ActionFailed(notShown(label(to!!.substringBefore('/')), it.reason), it.output) }+ }+}+/*** Turns accessibility [service] on, only for a launcher in [ACCESSIBILITY_LAUNCHERS]. Every path that* turns one on comes here, so neither a fetched list nor a saved record can name another; false@@ -1210,6 +1255,8 @@ private fun fireNeedsService(app: String) = "on Fire TV, Home can only open $appprivate fun fireServiceNotOn(app: String) = "the TV didn't turn on $app's accessibility service, so nothing changed"+private fun fireServiceNotOff(app: String) = "the TV didn't turn off $app's accessibility service, so nothing changed"+private fun serviceNotOff(app: String) ="switched back, but $app's accessibility service is still on. Turn it off in the TV's Settings → Accessibility"diff --git a/app/src/main/java/app/tellyscope/data/AppNames.kt b/app/src/main/java/app/tellyscope/data/AppNames.ktindex fa9f122..30eb1b2 100644--- a/app/src/main/java/app/tellyscope/data/AppNames.kt+++ b/app/src/main/java/app/tellyscope/data/AppNames.kt@@ -72,7 +72,7 @@ class AppNames(private val dir: File) {}}packages.associate { p ->- p.name to (cache[p.name]?.let { AppName(it.label, it.iconPng, it.tileColor, it.tileAccent) } ?: AppName(fallback(p.name), null))+ p.name to (cache[p.name]?.let { AppName(named(p.name, it.label), it.iconPng, it.tileColor, it.tileAccent) } ?: AppName(fallback(p.name), null))}}@@ -83,6 +83,13 @@ class AppNames(private val dir: File) {*/fun fallback(pkg: String): String = SharedLists.labels[pkg] ?: humanise(pkg)+ /**+ * [label], unless it's the package or one of its classes, which Android reports for an app+ * with no label of its own (`com.amazon.firehomestarter.FireHomeStarterApplication`).+ */+ fun named(pkg: String, label: String): String =+ if (label == pkg || label.startsWith("$pkg.")) fallback(pkg) else label+/** What native daemons and system uids are listed as, in place of an app name. */const val SYSTEM = "Android system"diff --git a/app/src/test/java/app/tellyscope/AppNamesTest.kt b/app/src/test/java/app/tellyscope/AppNamesTest.ktindex c2572bd..9f8ecfc 100644--- a/app/src/test/java/app/tellyscope/AppNamesTest.kt+++ b/app/src/test/java/app/tellyscope/AppNamesTest.kt@@ -64,6 +64,12 @@ class AppNamesTest {assertEquals("Spotifytv", AppNames.fallback("com.spotify.spotifytv")) // maker already in the name}+ @Test fun aClassNameInPlaceOfALabelIsHumanised() {+ assertEquals("Amazon Firehomestarter", AppNames.named("com.amazon.firehomestarter", "com.amazon.firehomestarter.FireHomeStarterApplication"))+ assertEquals("Example Weatherbox", AppNames.named("com.example.weatherbox", "com.example.weatherbox"))+ assertEquals("Fire TV Home", AppNames.named("com.amazon.tv.launcher", "Fire TV Home"))+ }+@Test fun fallbackWhenTheHelperFails() = runBlocking {val helper = Helper(fail = true)val appNames = AppNames(tmp.root)diff --git a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt b/app/src/test/java/app/tellyscope/HomeSwitchTest.ktindex 666d7f8..dfb75e8 100644--- a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt+++ b/app/src/test/java/app/tellyscope/HomeSwitchTest.kt@@ -12,6 +12,8 @@ import app.tellyscope.data.Actionimport app.tellyscope.data.ActionFailedimport app.tellyscope.data.HistoryBookimport app.tellyscope.data.HistoryEntry+import app.tellyscope.data.fireHomeBack+import app.tellyscope.data.fireServiceHolderimport app.tellyscope.data.fireServiceHomeimport app.tellyscope.data.firstHomeServiceimport app.tellyscope.data.switchHome@@ -225,4 +227,26 @@ class HomeSwitchTest {assertTrue(tv.ran.toString(), tv.ran.isEmpty())assertTrue(book.entries("tv").isEmpty())}++ @Test fun onFireOsTheLauncherWhoseServiceIsOnHoldsHome() = runTest {+ val tv = LauncherTv(home = TV_HOME)+ assertNull(Actions(tv).fireServiceHolder(listOf(FLAUNCHER, PROJECTIVY)))+ tv.services += PROJECTIVY_SERVICE+ assertEquals(PROJECTIVY to PROJECTIVY_SERVICE, Actions(tv).fireServiceHolder(listOf(FLAUNCHER, PROJECTIVY)))+ }++ @Test fun onFireOsGoingBackTurnsTheServiceOffAndItsUndoOn() = runTest {+ val tv = LauncherTv(home = TV_HOME).apply { services += PROJECTIVY_SERVICE }+ val back = fireHomeBack(Actions(tv), PROJECTIVY to PROJECTIVY_SERVICE, { it }) { to, previous ->+ book.record("tv", 0, Action.HomeBack, PROJECTIVY, to ?: "", Action.Home, previous = previous)+ }+ assertTrue(tv.services.isEmpty())+ assertEquals(TV_HOME, back.label)+ assertEquals(mapOf("service" to PROJECTIVY_SERVICE), back.previous)+ // The default never moved: Home only opens the TV's own, which is on screen now.+ assertEquals(TV_HOME, tv.home)+ assertTrue(tv.ran.toString(), tv.ran.any { it.contains(tv.activities.getValue(TV_HOME)) && it.startsWith("am start") })+ fire(tv)+ assertEquals(listOf(PROJECTIVY_SERVICE), tv.services)+ }}