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 turns on the launcher's accessibility service

jesse-agent-2327f44c752985f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 12b7617..c240b7c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,9 @@ until this file has a section for its version.
## Unreleased
+- **Fixed:** On Fire TV, Make Home sets Projectivy as Home through its accessibility service. [#PR](../../pull/PR)
+- **Fixed:** The Projectivy install dialog on Fire TV closes when the install finishes. [#PR](../../pull/PR)
+
## 0.13.0 — 2026-10-29
- **Improved:** The Remote's dock is refined: it shows only the streaming buttons you pick. [#224](../../pull/224)
diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
index 1f3d8f0..e0d1055 100644
--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
@@ -544,7 +544,13 @@ class AdbDeviceSource(context: Context) : DeviceSource {
private suspend fun switchHome(deviceId: String, packageName: String, undoing: Long?, withService: Boolean): HistoryEntry {
fireHomes -= deviceId
val key = key(deviceId)
- return switchHome(Actions(session(deviceId)), packageName, withService, serviceLaunchers, ::labelOf, ::reasonText) { pkg, undo, previous ->
+ val actions = Actions(session(deviceId))
+ if (packageName in serviceLaunchers && (deviceKind(device(deviceId)) == DeviceKind.FireTv || 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)
+ }
+ }
+ return switchHome(actions, packageName, withService, serviceLaunchers, ::labelOf, ::reasonText) { pkg, undo, previous ->
book.record(key, System.currentTimeMillis(), Action.Home, pkg, labelOf(packageName), undo, undoing, previous)
}
}
@@ -1149,6 +1155,26 @@ internal suspend fun switchHome(
is HomeResult.Failed -> throw ActionFailed(r.output.ifEmpty { "the TV refused" }, r.details)
}
+/**
+ * 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.
+ */
+internal suspend fun fireServiceHome(
+ actions: Actions,
+ pkg: String,
+ withService: Boolean,
+ label: (String) -> String,
+ record: (previous: Map<String, String?>) -> HistoryEntry,
+): 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))
+}
+
/**
* 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
@@ -1177,6 +1203,11 @@ private fun serviceNotOn(app: String) =
/** Home moved, but the old launcher didn't close or [app] didn't open: [why] is [HandOffFailed.reason]. */
private fun notShown(app: String, why: String) = "$app is Home now, but $why"
+/** Fire OS, after No to the service: without it, Home can't open [app]. */
+private fun fireNeedsService(app: String) = "on Fire TV, Home can only open $app through its accessibility service, so nothing changed"
+
+private fun fireServiceNotOn(app: String) = "the TV didn't turn on $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/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.kt
index 4675efa..254e6ad 100644
--- a/app/src/main/java/app/tellyscope/ui/Copy.kt
+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt
@@ -140,6 +140,11 @@ object Copy {
if (service) append("\n\nNext, you choose whether to turn on its accessibility service.")
}
+ /** Fire OS: Amazon's launcher can't be turned off or replaced, so [app]'s accessibility service holds Home instead. */
+ fun explainFireHome(app: String, pkg: String, current: String) =
+ "Makes Home open $app ($pkg) through its accessibility service. Fire OS won't let $current be turned off or replaced, " +
+ "so it stays on and nothing else changes. Undo in History turns the service off.\n\nNext, you choose whether to turn on its accessibility service."
+
/** No default home and no launcher of the TV's own on: nothing is turned off, so Undo can only turn its service off. */
fun explainFirstHome(app: String, pkg: String, service: Boolean = false) = buildString {
append("Makes $app ($pkg) open when you press Home. The TV has no default home screen now, and nothing else is turned off.")
diff --git a/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt b/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt
index 5457789..b9808a1 100644
--- a/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt
+++ b/app/src/main/java/app/tellyscope/ui/HomeScreenCard.kt
@@ -98,7 +98,7 @@ fun HomeScreenBlock(ui: DeviceUi, actions: DeviceActions, fire: Boolean = false)
when (action) {
Action.Uninstall -> if (app != null) UninstallDialog(app, onUninstall = actions.confirm, onDismiss = actions.cancel, enabled = !locked)
Action.Home, Action.HomeBack -> if (app != null && homeMove(app, current) == action) {
- MakeHomeDialog(app, action, current, ui.apps, locked, actions)
+ MakeHomeDialog(app, action, current, ui.apps, locked, actions, fire)
} else {
// A switch whose target changed meanwhile (turned off in Debloat, say) has nothing left to ask.
LaunchedEffect(pkg, action) { actions.cancel() }
@@ -173,7 +173,7 @@ private fun LauncherRow(app: AppInfo, move: Action?, locked: Boolean, onMove: (A
* accessibility service gets its own yes for that next, never as a side effect of this one.
*/
@Composable
-private fun MakeHomeDialog(app: AppInfo, action: Action, current: AppInfo?, apps: List<AppInfo>, locked: Boolean, actions: DeviceActions) {
+private fun MakeHomeDialog(app: AppInfo, action: Action, current: AppInfo?, apps: List<AppInfo>, locked: Boolean, actions: DeviceActions, fire: Boolean) {
val replaced = homeLabel(apps, app)
val asks = action == Action.Home && app.homeService
var askService by remember(app.packageName) { mutableStateOf(false) }
@@ -188,6 +188,7 @@ private fun MakeHomeDialog(app: AppInfo, action: Action, current: AppInfo?, apps
val currentService = current != null && current.homeService && !current.homeServiceOff
val text = when {
action == Action.HomeBack && current != null -> Copy.explainLeave(app.label, off = !app.enabled, current.label, currentService, service = false)
+ fire && action == Action.Home && app.homeService && current != null -> Copy.explainFireHome(app.label, app.packageName, current.label)
current != null && !current.system -> Copy.explainLeave(app.label, off = false, current.label, currentService, app.homeService)
replaced != null && app.homeInstead != null -> Copy.explainReplace(app.label, replaced, app.homeInstead, app.homeService)
else -> Copy.explainFirstHome(app.label, app.packageName, app.homeService)
diff --git a/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt b/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt
index eb40ccd..7cdedcb 100644
--- a/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt
+++ b/app/src/main/java/app/tellyscope/ui/LauncherFlowUi.kt
@@ -258,7 +258,8 @@ fun LauncherScreen(
LauncherFlow.Step.Installed -> {
Hero(Icons.Default.Check, c.secondaryContainer, c.onSecondaryContainer)
val explain = if (app != null && current != null && app.homeInstead != null) {
- " " + Copy.explainHome(app.label, app.packageName, current, app.homeInstead, app.homeService)
+ " " + if (flow.fire != null) Copy.explainFireHome(app.label, app.packageName, current)
+ else Copy.explainHome(app.label, app.packageName, current, app.homeInstead, app.homeService)
} else {
""
}
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
index 69cca82..7882dc5 100644
--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
@@ -902,8 +902,9 @@ class TellyscopeViewModel(
return@launch setFire(id) { it.copy(step = FireInstall.Step.Refused, error = Copy.SIDELOAD_LOST) }
}
when (result) {
+ // The install dialog closes with it: Installing would keep it up, and Close and Cancel wait on that.
InstallResult.Done -> launcherInstalled(id, PROJECTIVY) { step ->
- updateDevice(id) { it.copy(launcher = it.launcher?.copy(step = step)) }
+ updateDevice(id) { it.copy(launcher = it.launcher?.copy(step = step, fire = FireInstall())) }
}
is InstallResult.Refused -> setFire(id) {
it.copy(step = FireInstall.Step.Refused, error = Copy.installRefused(result.reason, launcherName(PROJECTIVY)))
diff --git a/app/src/test/java/app/tellyscope/FireOsTest.kt b/app/src/test/java/app/tellyscope/FireOsTest.kt
index fb44c4d..fd4ea76 100644
--- a/app/src/test/java/app/tellyscope/FireOsTest.kt
+++ b/app/src/test/java/app/tellyscope/FireOsTest.kt
@@ -209,6 +209,8 @@ class FireOsTest {
runCurrent()
assertEquals(listOf(PROJECTIVY), source.installs.map { it.packageName })
assertEquals(LauncherFlow.Step.Installed, v.state.value.device.launcher?.step)
+ // The install dialog closed with it: left on Installing, it covered the switch and nothing could close it.
+ assertNull(v.state.value.device.launcher?.fire?.step)
}
@Test fun aWrongSignatureInstallsNothing() = with(test) {
diff --git a/app/src/test/java/app/tellyscope/HomeSwitchTest.kt b/app/src/test/java/app/tellyscope/HomeSwitchTest.kt
index 7e159cf..dedf083 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.Action
import app.tellyscope.data.ActionFailed
import app.tellyscope.data.HistoryBook
import app.tellyscope.data.HistoryEntry
+import app.tellyscope.data.fireServiceHome
+import app.tellyscope.data.firstHomeService
import app.tellyscope.data.switchHome
import app.tellyscope.data.undoHomeSwitch
import java.io.File
@@ -23,6 +25,7 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
+import org.junit.Assert.fail
import org.junit.Test
private const val TV_HOME = "com.google.android.tvlauncher"
@@ -185,4 +188,41 @@ class HomeSwitchTest {
val opened = tv.ran.indexOf(open(tv.activities.getValue(FLAUNCHER)))
assertTrue(tv.ran.toString(), off >= 0 && opened > off && tv.ran.indexOf(stop(PROJECTIVY)) > off)
}
+
+ private suspend fun fire(tv: LauncherTv, withService: Boolean = true): HistoryEntry =
+ fireServiceHome(Actions(tv), PROJECTIVY, withService, { it }) { previous ->
+ book.record("tv", 0, Action.Home, PROJECTIVY, PROJECTIVY, Action.Enable.takeIf { previous.isNotEmpty() }, previous = previous)
+ }
+
+ @Test fun onFireOsOnlyTheServiceGoesOnAndUndoTurnsItOff() = runTest {
+ val tv = LauncherTv(home = TV_HOME)
+ val entry = fire(tv)
+ assertEquals(listOf(PROJECTIVY_SERVICE), tv.services)
+ // Fire OS refuses both, so neither is tried: the TV's own launcher stays on and stays the default.
+ assertEquals(TV_HOME, tv.home)
+ assertTrue(TV_HOME in tv.enabled)
+ assertFalse(tv.ran.toString(), tv.ran.any { it.startsWith("pm disable-user") || it.startsWith("cmd package set-home-activity") })
+ assertEquals(emptyList<String>(), HistoryBook.leftDisabled(book.entries("tv")))
+ // A home with nothing replaced: its Undo is the service alone.
+ assertEquals(PROJECTIVY_SERVICE, entry.firstHomeService)
+ assertEquals(Action.Enable, entry.undo)
+ }
+
+ @Test fun onFireOsAServiceAlreadyOnChangesNothing() = runTest {
+ val tv = LauncherTv(home = TV_HOME).apply { services += PROJECTIVY_SERVICE }
+ val entry = fire(tv)
+ assertNull(entry.undo)
+ assertFalse(tv.ran.toString(), tv.ran.any { it.startsWith("settings put") })
+ }
+
+ @Test fun onFireOsNoToTheServiceChangesNothing() = runTest {
+ val tv = LauncherTv(home = TV_HOME)
+ try {
+ fire(tv, withService = false)
+ fail("expected a refusal")
+ } catch (_: IllegalStateException) {
+ }
+ assertTrue(tv.ran.toString(), tv.ran.isEmpty())
+ assertTrue(book.entries("tv").isEmpty())
+ }
}