Skip to content

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 Make Home opens the launcher; test the reset's Undo

jesse-agent-232c97e5d419743
diff --git a/CHANGELOG.md b/CHANGELOG.md
index da637aa..f033da9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ until this file has a section for its version.
## Unreleased
+- **Fixed:** On Fire TV, making Projectivy Home now opens it straight away, without a Home press. [#263](../../pull/263)
- **Fixed:** On Fire TV, Reset TV now puts Amazon's launcher back when Projectivy holds Home, by turning its accessibility service off. Undo turns it back on. [#263](../../pull/263)
## 0.13.0 — 2026-10-29
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Actions.kt b/adb/src/main/kotlin/app/tellyscope/adb/Actions.kt
index a6d7bde..0dcb3f0 100644
--- a/adb/src/main/kotlin/app/tellyscope/adb/Actions.kt
+++ b/adb/src/main/kotlin/app/tellyscope/adb/Actions.kt
@@ -263,6 +263,9 @@ class Actions(private val shell: AdbShell) {
* Every enabled launcher, package to its home activity. Apps protected for another reason
* aren't launchers, though they may answer Home: TV Settings has a fallback home screen.
*/
+ /** [pkg]'s home activity, or null when it isn't an enabled launcher. */
+ suspend fun homeActivity(pkg: String): String? = launchers()[pkg]
+
private suspend fun launchers(): Map<String, String> = launchersIn(shell.shell(Commands.HOME_ACTIVITIES).output)
private fun launchersIn(brief: String): Map<String, String> =
diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
index 63fdc15..2c22688 100644
--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
@@ -807,10 +807,7 @@ class AdbDeviceSource(context: Context) : DeviceSource {
errors += "the TV kept ${labelOf(to.substringBefore('/'))} as the home screen"
} else p[ResetRecord.SERVICE]?.let { if (!actions.grant(it)) errors += serviceNotOn(name) }
}
- // Fire OS: Home never moved, only the service went off.
- if (p[ResetRecord.TO] == null) p[ResetRecord.SERVICE]?.let {
- if (!actions.grant(it)) errors += serviceNotOn(labelOf(it.substringBefore('/')))
- }
+ if (undoFireResetHome(actions, p) == false) errors += serviceNotOn(labelOf(p.getValue(ResetRecord.SERVICE).substringBefore('/')))
val ownHome = p[ResetRecord.TO]?.substringBefore('/')?.takeIf { homeLeft }
suspend fun each(pkgs: List<String>, change: suspend (String) -> Unit) = pkgs.filter { pkg ->
if (pkg == ownHome) return@filter true
@@ -1218,8 +1215,9 @@ internal suspend fun switchHome(
/**
* Fire OS's Home: it refuses to turn Amazon's launcher off and won't keep another default, but [pkg]'s
* accessibility service takes the Home key, and opens of Amazon's launcher, on its own. So only the
- * service goes on and Amazon's launcher stays as it is. Recorded as a home with nothing to replace:
- * "service" when this turned it on, so Undo turns it off and does nothing else.
+ * service goes on and Amazon's launcher stays as it is, then [pkg] opens, so the TV shows it without
+ * a Home press. Recorded as a home with nothing to replace: "service" when this turned it on, so
+ * Undo turns it off and does nothing else.
*/
internal suspend fun fireServiceHome(
actions: Actions,
@@ -1230,11 +1228,21 @@ internal suspend fun fireServiceHome(
): HistoryEntry {
if (!withService) throw IllegalStateException(fireNeedsService(label(pkg)))
val service = actions.homeService(pkg) ?: throw IllegalStateException("${label(pkg)} has no accessibility service")
- if (actions.serviceOn(service)) return record(emptyMap())
- if (!actions.grant(service)) throw IllegalStateException(fireServiceNotOn(label(pkg)))
- return record(mapOf("service" to service))
+ val previous = if (actions.serviceOn(service)) emptyMap()
+ else if (actions.grant(service)) mapOf("service" to service)
+ else throw IllegalStateException(fireServiceNotOn(label(pkg)))
+ // Amazon's launcher isn't stopped: it stays the default, and the service sends Home on from it.
+ val left = actions.homeActivity(pkg)?.let { actions.handOff(null, it) }
+ return record(previous).also { left?.let { throw ActionFailed(notShown(label(pkg), it.reason), it.output) } }
}
+/**
+ * Undo of a reset's Home on Fire OS, where Home never moved and only the launcher's service went
+ * off: [previous]'s service goes back on. Null when the reset recorded no such step.
+ */
+internal suspend fun undoFireResetHome(actions: Actions, previous: Map<String, String?>): Boolean? =
+ previous[ResetRecord.SERVICE]?.takeIf { previous[ResetRecord.TO] == null }?.let { actions.grant(it) }
+
/**
* 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.
diff --git a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt b/app/src/test/java/app/tellyscope/HomeSwitchTest.kt
index dfb75e8..c170c2c 100644
--- a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt
+++ b/app/src/test/java/app/tellyscope/HomeSwitchTest.kt
@@ -12,11 +12,13 @@ import app.tellyscope.data.Action
import app.tellyscope.data.ActionFailed
import app.tellyscope.data.HistoryBook
import app.tellyscope.data.HistoryEntry
+import app.tellyscope.data.ResetRecord
import app.tellyscope.data.fireHomeBack
import app.tellyscope.data.fireServiceHolder
import app.tellyscope.data.fireServiceHome
import app.tellyscope.data.firstHomeService
import app.tellyscope.data.switchHome
+import app.tellyscope.data.undoFireResetHome
import app.tellyscope.data.undoHomeSwitch
import java.io.File
import java.io.IOException
@@ -208,6 +210,8 @@ class HomeSwitchTest {
// A home with nothing replaced: its Undo is the service alone.
assertEquals(PROJECTIVY_SERVICE, entry.firstHomeService)
assertEquals(Action.Enable, entry.undo)
+ // Then Projectivy opens, so the TV shows it without a Home press.
+ assertTrue(tv.ran.toString(), tv.ran.any { it.startsWith("am start") && it.contains(tv.activities.getValue(PROJECTIVY)) })
}
@Test fun onFireOsAServiceAlreadyOnChangesNothing() = runTest {
@@ -249,4 +253,18 @@ class HomeSwitchTest {
fire(tv)
assertEquals(listOf(PROJECTIVY_SERVICE), tv.services)
}
+
+ @Test fun onFireOsUndoOfAResetTurnsTheServiceBackOn() = runTest {
+ val tv = LauncherTv(home = TV_HOME)
+ assertEquals(true, undoFireResetHome(Actions(tv), mapOf(ResetRecord.SERVICE to PROJECTIVY_SERVICE)))
+ assertEquals(listOf(PROJECTIVY_SERVICE), tv.services)
+ assertEquals(TV_HOME, tv.home)
+ }
+
+ @Test fun undoOfAResetThatMovedHomeLeavesTheServiceToItsOwnBranch() = runTest {
+ val tv = LauncherTv(home = TV_HOME)
+ val previous = mapOf(ResetRecord.TO to "$TV_HOME/.MainActivity", ResetRecord.SERVICE to PROJECTIVY_SERVICE)
+ assertNull(undoFireResetHome(Actions(tv), previous))
+ assertTrue(tv.ran.toString(), tv.ran.isEmpty())
+ }
}