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.
Debloat waits for a running job too
jesse-agent-2328020bb494c32
diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.ktindex 520c712..d605645 100644--- a/app/src/main/java/app/tellyscope/MainActivity.kt+++ b/app/src/main/java/app/tellyscope/MainActivity.kt@@ -233,6 +233,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {tvMakers = listOfNotNull(state.selected?.brand, state.selected?.manufacturer).distinct(),tv = state.selected,tvApps = state.device.apps,+ busy = state.device.busy != null,)} else {DeviceTabsScreen(diff --git a/app/src/main/java/app/tellyscope/ui/ListsCard.kt b/app/src/main/java/app/tellyscope/ui/ListsCard.ktindex d1de0e9..17d4820 100644--- a/app/src/main/java/app/tellyscope/ui/ListsCard.kt+++ b/app/src/main/java/app/tellyscope/ui/ListsCard.kt@@ -98,6 +98,8 @@ fun DebloatScreen(tv: Device? = null,/** The TV's apps, to pick from by hand when no list fits it. */tvApps: List<AppInfo> = emptyList(),+ /** Something is running on this TV: Disable waits for it, like the Apps tab does. */+ busy: Boolean = false,) {val ready = lists as? Suggestions.Readyval devices = when (lists) {@@ -136,7 +138,7 @@ fun DebloatScreen(if (confirming && groups != null) {// The dialog's list is exactly what gets disabled.val apps = groups.flatMap { it.packages }.filter { it.pkg in ticked }- DisableDialog(apps, onDisable = { confirming = false; onDisable(apps.map { it.pkg }); back() }, onDismiss = { confirming = false })+ DisableDialog(apps, onDisable = { confirming = false; onDisable(apps.map { it.pkg }); back() }, onDismiss = { confirming = false }, enabled = !busy)}val use = { marked?.let { if (it != ready?.list?.id) { chosen = it; onPick(it) } }; searching = false }val keyboard = LocalSoftwareKeyboardController.current@@ -162,7 +164,7 @@ fun DebloatScreen(} else {Button(onClick = { confirming = true },- enabled = groups != null && ticked.isNotEmpty(),+ enabled = groups != null && ticked.isNotEmpty() && !busy,modifier = Modifier.fillMaxWidth(),) { Text("Disable ${ticked.size} ${if (ticked.size == 1) "app" else "apps"}") }}@@ -313,7 +315,7 @@ private fun MatchCard(kind: DeviceKind, name: String, detail: String, match: Mat}@Composable-internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismiss: () -> Unit) {+internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismiss: () -> Unit, enabled: Boolean = true) {AlertDialog(onDismissRequest = onDismiss,title = { Text("Disable ${apps.size} ${if (apps.size == 1) "app" else "apps"}?") },@@ -331,7 +333,7 @@ internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismi}}},- confirmButton = { Button(onClick = onDisable) { Text("Yes, disable them") } },+ confirmButton = { Button(onClick = onDisable, enabled = enabled) { Text("Yes, disable them") } },dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },)}diff --git a/app/src/test/java/app/tellyscope/BusyGatingTest.kt b/app/src/test/java/app/tellyscope/BusyGatingTest.ktindex b0de004..b7e91f0 100644--- a/app/src/test/java/app/tellyscope/BusyGatingTest.kt+++ b/app/src/test/java/app/tellyscope/BusyGatingTest.kt@@ -9,10 +9,16 @@ import androidx.compose.ui.test.onNodeWithTextimport androidx.compose.ui.test.performClickimport app.tellyscope.data.Actionimport app.tellyscope.data.AppInfo+import app.tellyscope.data.DeviceListimport app.tellyscope.data.HistoryEntry+import app.tellyscope.data.Suggested+import app.tellyscope.data.SuggestedGroup+import app.tellyscope.data.Suggestionsimport app.tellyscope.ui.AppRowimport app.tellyscope.ui.Copy+import app.tellyscope.ui.DebloatScreenimport app.tellyscope.ui.DeviceActions+import app.tellyscope.ui.DisableDialogimport app.tellyscope.ui.HistoryListimport org.junit.Assert.assertEqualsimport org.junit.Rule@@ -62,6 +68,31 @@ class BusyGatingTest {compose.onNodeWithText(Copy.undo(Action.Enable)).assertIsEnabled()}+ private val lists = Suggestions.Ready(+ null,+ DeviceList("test-tv", "Test TV", null, null, emptySet(), emptyList()),+ null,+ listOf(SuggestedGroup("Extras", listOf(Suggested(pkg, "Example", null, optional = false, ticked = true)))),+ emptyList(),+ )++ @Test fun debloatWaitsWhileTheTvIsBusy() {+ // A Disable started on the Apps tab is still running when Debloat opens.+ compose.setContent { DebloatScreen(lists, {}, {}, {}, busy = true) }+ compose.onNodeWithText("Disable 1 app").assertIsNotEnabled()+ }++ @Test fun debloatConfirmWaitsWhileTheTvIsBusy() {+ val apps = listOf(Suggested(pkg, "Example", null, optional = false, ticked = true))+ compose.setContent { DisableDialog(apps, onDisable = {}, onDismiss = {}, enabled = false) }+ compose.onNodeWithText("Yes, disable them").assertIsNotEnabled()+ }++ @Test fun idleDebloatStillWorks() {+ compose.setContent { DebloatScreen(lists, {}, {}, {}) }+ compose.onNodeWithText("Disable 1 app").assertIsEnabled()+ }+@Test fun launcherSwitchWithItsTargetGoneIsCancelled() {// "Set as default launcher" was asked, then the launcher was turned off in Debloat.var cancels = 0