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.
Stop the install watch after ten minutes; note the sign-in screen case
jesse-agent-2324d1b9975d23f
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex c266808..9aa53cf 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -271,6 +271,9 @@ const val ANSWERING = "request"/** How often Install a home screen asks the TV whether the launcher is in yet. */const val STORE_POLL_MS = 3_000L+/** How long it keeps asking before it says the launcher didn't arrive. */+const val STORE_WAIT_MS = 10 * 60_000L+/** Where a removal ends, from the re-read after it: never Done on a guess. */fun outcome(access: TvAccess?): Removal = when {access?.connected == null || access.allowed == null -> Removal(Removal.Step.Unconfirmed)@@ -675,7 +678,11 @@ class TellyscopeViewModel(/*** Opens the Play Store on the TV at [pkg]'s page, then checks every few seconds whether it's* installed, or the Store has closed without it. Where the Store didn't open, it keeps- * checking while the user searches by hand.+ * checking while the user searches by hand. After [STORE_WAIT_MS] without it, it stops at [LauncherFlow.Step.Left].+ *+ * Known: a Google sign-in or consent screen inside the Store runs as another app+ * (com.google.android.gms), so it can read as leaving the Store and end the wait early.+ * Open Store again recovers.*/fun installLauncher(pkg: String) {val id = _state.value.selectedId ?: return@@ -692,14 +699,14 @@ class TellyscopeViewModel(}if (!opened) step(LauncherFlow.Step.NoStore)var seen = opened- while (true) {+ repeat((STORE_WAIT_MS / STORE_POLL_MS).toInt()) {delay(STORE_POLL_MS)val now = try {source.storeState(id, pkg)} catch (e: CancellationException) {throw e} catch (_: Exception) {- continue // a dropped read: the next one tells+ return@repeat // a dropped read: the next one tells}when (now) {StoreState.Installed -> {@@ -727,6 +734,7 @@ class TellyscopeViewModel(}}}+ step(LauncherFlow.Step.Left)}}diff --git a/app/src/test/java/app/tellyscope/LauncherFlowTest.kt b/app/src/test/java/app/tellyscope/LauncherFlowTest.ktindex c654631..6caf853 100644--- a/app/src/test/java/app/tellyscope/LauncherFlowTest.kt+++ b/app/src/test/java/app/tellyscope/LauncherFlowTest.kt@@ -25,6 +25,7 @@ import app.tellyscope.ui.LauncherFlowimport app.tellyscope.ui.LauncherScreenimport app.tellyscope.ui.PLAY_STOREimport app.tellyscope.ui.STORE_POLL_MS+import app.tellyscope.ui.STORE_WAIT_MSimport app.tellyscope.ui.TellyscopeViewModelimport app.tellyscope.ui.offerLauncherimport kotlinx.coroutines.Dispatchers@@ -160,6 +161,19 @@ class LauncherFlowTest {assertEquals(LauncherFlow.Step.Installed, step)}+ @Test fun aStoreNeverOpenedStopsWaitingAfterTenMinutes() = with(test) {+ source.opens = false+ source.states = ArrayDeque(List(1_000) { StoreState.Elsewhere })+ started().installLauncher(PROJECTIVY)+ advanceTimeBy(STORE_WAIT_MS - STORE_POLL_MS)+ assertEquals(LauncherFlow.Step.NoStore, step)+ advanceTimeBy(STORE_POLL_MS + 1)+ assertEquals(LauncherFlow.Step.Left, step)+ val left = source.states.size+ advanceTimeBy(10 * STORE_POLL_MS)+ assertEquals(left, source.states.size) // stopped asking+ }+@Test fun notNowAfterTheInstallSaysWhereToSwitchLater() = with(test) {source.states = ArrayDeque(listOf(StoreState.Installed))started().installLauncher(PROJECTIVY)