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.
Reset TV: read the apps and the list again afterwards
jesse-agent-821470df510e613
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4053409..9aadb4a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,7 @@ until this file has a section for its version.- On short phones, mute and volume move beside the D-pad; while typing, the D-pad shrinks to fit.- **Fixed:** Turning on an app the TV switched off says why, not a raw error. [#205](../../pull/205)- **Fixed:** Make home and Reset TV go straight to the new home screen. [#208](../../pull/208)+- **Fixed:** After Reset TV, Debloat counts and lists the apps it turned back on. [#209](../../pull/209)## 0.12.0 — 2026-10-28diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.ktindex f0f0360..83236ed 100644--- a/app/src/main/java/app/tellyscope/ui/Copy.kt+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt@@ -621,6 +621,7 @@ object Copy {ResetPart.Home -> "Making ${home ?: "the TV's own launcher"} the home screen."} + " Keep the TV on and connected."const val RESETTING = "Resetting…"+ const val RESET_APPS_STALE = "Reset done, but the app list didn't refresh. Open the TV again to see it."const val RESET_BUTTON = "Reset TV"const val RESET_DONE = "TV reset to how it shipped"diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex 6a52828..8f009f1 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -1627,7 +1627,10 @@ class TellyscopeViewModel(todo.bringBack.map { ResetFailure(ResetPart.BringBack, it, why) } +listOfNotNull(todo.home?.let { ResetFailure(ResetPart.Home, null, why) })}- val apps = runCatching { source.apps(id) }.getOrNull()+ // Read again what Reset changed, as opening the TV does: the apps, then the list from them,+ // so the Debloat tile counts what came back on. A failed read is tried once more, then said.+ val apps = runCatching { source.apps(id) }.recoverCatching { source.apps(id) }.getOrNull()+ if (apps == null) _notice.value = Copy.RESET_APPS_STALEval history = source.history(id)updateDevice(id) { d ->d.copy(@@ -1635,6 +1638,7 @@ class TellyscopeViewModel(reset = d.reset?.copy(running = null, progress = null, ran = true, failed = failed, entry = entry ?: ui.entry),)}+ if (apps != null) loadLists(id) { apps }}}diff --git a/app/src/test/java/app/tellyscope/ResetReloadTest.kt b/app/src/test/java/app/tellyscope/ResetReloadTest.ktnew file mode 100644index 0000000..9803655--- /dev/null+++ b/app/src/test/java/app/tellyscope/ResetReloadTest.kt@@ -0,0 +1,128 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope++import androidx.lifecycle.viewModelScope+import app.tellyscope.data.AppInfo+import app.tellyscope.data.Device+import app.tellyscope.data.DeviceList+import app.tellyscope.data.DeviceSource+import app.tellyscope.data.DeviceState+import app.tellyscope.data.FakeDeviceSource+import app.tellyscope.data.ListGroup+import app.tellyscope.data.ListPackage+import app.tellyscope.data.ResetApp+import app.tellyscope.data.ResetFailure+import app.tellyscope.data.ResetPlan+import app.tellyscope.data.ResetProgress+import app.tellyscope.data.ScanHit+import app.tellyscope.data.ScanKind+import app.tellyscope.data.Snapshot+import app.tellyscope.data.Suggestions+import app.tellyscope.data.suggest+import app.tellyscope.ui.Copy+import app.tellyscope.ui.TellyscopeViewModel+import app.tellyscope.ui.debloatState+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.ExperimentalCoroutinesApi+import kotlinx.coroutines.cancel+import kotlinx.coroutines.flow.Flow+import kotlinx.coroutines.flow.emptyFlow+import kotlinx.coroutines.test.StandardTestDispatcher+import kotlinx.coroutines.test.TestScope+import kotlinx.coroutines.test.resetMain+import kotlinx.coroutines.test.runCurrent+import kotlinx.coroutines.test.setMain+import org.junit.After+import org.junit.Assert.assertEquals+import org.junit.Assert.assertNull+import org.junit.Before+import org.junit.Test++private const val JUNK = "com.acme.junk"++/** A debloated TV: [JUNK], on its list, is off until Reset turns it back on. */+private class DebloatedTv : DeviceSource by FakeDeviceSource(FakeDeviceSource.Scenario.Empty, clock = { 0L }) {+ var on = false+ /** App reads that throw before one answers, as a TV busy after Reset can. */+ var failReads = 0+ private val list = DeviceList("tv", "TV", null, 30, emptySet(), listOf(ListGroup("Junk", listOf(ListPackage(JUNK, null, false)))))++ override suspend fun known() = listOf(Device("tv", ScanHit("tv", 5555, ScanKind.Classic, "tv", null), DeviceState.Online, null, null, null, 0L))++ override fun live(deviceId: String): Flow<Snapshot> = emptyFlow()++ override suspend fun apps(deviceId: String): List<AppInfo> {+ if (failReads > 0) {+ failReads--+ throw IllegalStateException("the TV didn't answer")+ }+ return listOf(AppInfo(JUNK, "Junk", null, true, on, null, ""))+ }++ override suspend fun suggestions(deviceId: String, apps: suspend () -> List<AppInfo>): Suggestions =+ Suggestions.Ready(null, list, 30, suggest(list, apps(), 30), emptyList())++ override suspend fun resetPlan(deviceId: String) = ResetPlan(turnOn = listOf(ResetApp(JUNK, "Junk")))++ override suspend fun reset(deviceId: String, plan: ResetPlan, into: Long?, onProgress: (ResetProgress) -> Unit): Pair<Long?, List<ResetFailure>> {+ on = true+ return 1L to emptyList()+ }+}++@OptIn(ExperimentalCoroutinesApi::class)+class ResetReloadTest {+ private val dispatcher = StandardTestDispatcher()+ private val test = TestScope(dispatcher)+ private val source = DebloatedTv()+ private lateinit var vm: TellyscopeViewModel++ @Before fun setUp() = Dispatchers.setMain(dispatcher)++ @After fun tearDown() {+ vm.viewModelScope.cancel()+ Dispatchers.resetMain()+ }++ private fun TestScope.reset() {+ vm = TellyscopeViewModel(source, clock = { 0L })+ runCurrent()+ assertEquals(0, debloatState(vm.state.value.device).count)+ vm.openReset()+ runCurrent()+ vm.runReset()+ runCurrent()+ }++ @Test fun anAppResetTurnedOnIsReadyToDebloatAgain() = with(test) {+ reset()+ val page = vm.state.value.device+ assertEquals(1, debloatState(page).count)+ // The Debloat sheet lists it too: the list is worked out again from the new app list.+ assertEquals(listOf(JUNK), (page.lists as Suggestions.Ready).groups.flatMap { g -> g.packages.map { it.pkg } })+ }++ @Test fun aReadThatFailsOnceIsTriedAgain() = with(test) {+ vm = TellyscopeViewModel(source, clock = { 0L })+ runCurrent()+ vm.openReset()+ runCurrent()+ source.failReads = 1+ vm.runReset()+ runCurrent()+ assertEquals(1, debloatState(vm.state.value.device).count)+ assertNull(vm.notice.value)+ }++ @Test fun aReadThatKeepsFailingSaysSo() = with(test) {+ vm = TellyscopeViewModel(source, clock = { 0L })+ runCurrent()+ vm.openReset()+ runCurrent()+ source.failReads = 2+ vm.runReset()+ runCurrent()+ assertEquals(Copy.RESET_APPS_STALE, vm.notice.value)+ }+}