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.
Split Apps into Running, Installed and Built-in tabs
jesse-agent-2321ed10918cda5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3f6386c..97d5e4c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@ until this file has a section for its version.- **Improved:** Debloat finds your TV's list itself, or its maker's, or lets you pick. [#70](../../pull/70)- **Improved:** The TV tops every tab and folds into the bar as you scroll. [#71](../../pull/71)+- **Improved:** Apps splits into Running, Installed and Built-in tabs, with the apps the TV needs folded under System. [#72](../../pull/72)## 0.5.0 — 2026-10-24diff --git a/README.md b/README.mdindex c9243a0..b89d4fa 100644--- a/README.md+++ b/README.md@@ -70,7 +70,7 @@ Tellyscope needs a phone on Android 8.0 or newer, on the same Wi-Fi as the TV, a- **Small and private.** Under 3 MB. No ads, no tracking, no accounts. It makes two internet requests: one fetches the debloat lists from this project's GitHub, or from your own fork if you point it there; the other asks GitHub every 30 minutes whether a newer version is out, and you can turn it off in Settings. Everything else stays on your Wi-Fi. Turning on Private DNS changes where the *TV* looks up addresses, not what the app sends.- **Reversible.** Apps that came with the TV are only ever disabled, never uninstalled, so nothing is deleted. Apps you installed yourself can also be uninstalled, after a confirm that says it can't be undone. Every change goes into History, all but Uninstall with an Undo, and **Restore everything** turns back on all it turned off.-- **Protected list.** Apps the TV needs to start, update, stay on Wi-Fi, show its home screen or take input can't be stopped or disabled. They sit in their own **Can't be changed** section under Apps. There is no override.+- **Protected list.** Apps the TV needs to start, update, stay on Wi-Fi, show its home screen or take input can't be stopped or disabled. They sit in their own **System** section under Apps. There is no override.- **You see it first.** Debloat shows every app it will turn off, and the confirm names each one before anything runs.The full rules are under [Safety rules](#safety-rules).@@ -84,7 +84,7 @@ Tellyscope is a phone app that talks to your Android TV, Google TV or Fire TV ov- **How it's doing.** Every tab of a TV's page opens with the TV itself: its name, maker and model, and a one-line summary such as "Running fine" or "Storage almost full". Scroll, and it folds into the top bar as a small icon, the name and a Connected or Offline badge. On Overview, below that is a chip per TV to switch between them, then a **+ Device** chip. Then comes free space as a bar, with CPU, RAM, temperature and network speed. When a TV is offline, it shows the storage from the last time Tellyscope saw it. Its address and how long it's been on are under Advanced.- **The main jobs up front.** Big **Install app**, **Debloat** and **Send file** tiles sit right under the vitals. Debloat shows a count while the TV's list still has apps on, or while apps Tellyscope turned off are back on, often after a TV update. When there's nothing left, it opens Apps instead. Under **Suggested for this TV**, one line says how many of the list's apps are off. If any came back on, a red line says so. Below that are the TV's Android version, when it last updated, and **Check for updates**, which opens the TV's own update screen. The Apps tab has an **Install app** button, and Files has **Upload files**.- **Advanced.** Every number in one place: memory, storage, CPU, temperature, uptime and screen state, CPU and RAM by app, processes, network and data used, and the TV's address.-- **Apps.** Every app on the TV with its real name and icon. Stop, disable or turn back on any app that isn't protected; each button says what it will do and asks first. Apps you installed yourself also offer **Uninstall**, which asks in a dialog that names the app and says it can't be undone. Protected apps are folded into their own **Can't be changed** section below the list.+- **Apps.** Every app on the TV with its real name and icon, in three tabs: **Running** (what's using memory now), **Installed** (only the apps you put on the TV) and **Built-in** (what came with it). Stop, disable or turn back on any app that isn't protected; each button says what it will do and asks first. Apps you installed yourself also offer **Uninstall**, which asks in a dialog that names the app and says it can't be undone. On Running and Built-in, the protected apps sit last under **System**, which folds away with a tap and stays folded until you open it again. Search looks through every app.- **Another home screen.** With a second launcher such as Projectivy installed, its row in Apps offers **Set as default launcher**. Tellyscope makes it Home, checks that Home really opens it, and only then disables the old launcher, so the TV can't switch back by itself. One Undo in History turns the old launcher back on and makes it Home again. On Google TV, the Apps row and the Live tab are part of the old launcher and go with it.- **Debloat.** It finds your TV among 230+ tested clean-up lists (adapted from [cleanyourtv](https://github.com/Gathin23/cleanyourtv)) and opens on every app it will turn off, with the model on top. With no list for the model, it shows apps from the maker's other lists, none ticked. With none for the maker either, you tick the TV's own apps by hand; the ones it needs aren't shown. **Not this TV?** searches every list. Your pick is remembered, and the TV's page then says how many of the list's apps are still on. Apps are pre-ticked only when the TV runs the Android version the list was tested on; untick anything you use, and you confirm before anything is disabled. If you'd rather not trust our lists, point the app at your own fork of them in Settings (see [CONTRIBUTING](CONTRIBUTING.md#using-your-own-lists)).- **History.** Every change is listed with an Undo, and **Restore everything** turns back on what Tellyscope turned off. Undoing a **Turn on** asks first, since it disables the app again. History is kept per TV, across restarts.diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.ktindex d1a9928..31a0fa1 100644--- a/app/src/main/java/app/tellyscope/MainActivity.kt+++ b/app/src/main/java/app/tellyscope/MainActivity.kt@@ -39,6 +39,7 @@ import app.tellyscope.adb.Connectorimport app.tellyscope.data.AdbDeviceSourceimport app.tellyscope.data.AndroidPhoneStorageimport app.tellyscope.data.FakeDeviceSource+import app.tellyscope.data.FoldBookimport app.tellyscope.data.UpdateCheckimport app.tellyscope.ui.AdvancedScreenimport app.tellyscope.ui.Copy@@ -91,6 +92,7 @@ class MainActivity : ComponentActivity() {scenario?.let(::FakeDeviceSource) ?: AdbDeviceSource(applicationContext),AndroidPhoneStorage(applicationContext),updates = if (scenario != null) null else updateCheck(),+ folds = FoldBook(File(filesDir, "folds.properties")),)}},@@ -268,6 +270,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {screenshot = { saveScreenshot.launch(Copy.screenshotName(System.currentTimeMillis())) },answerRequest = vm::answerRequest,dismissRequest = vm::dismissRequest,+ foldSystem = vm::foldSystem,),)}diff --git a/app/src/main/java/app/tellyscope/data/FoldBook.kt b/app/src/main/java/app/tellyscope/data/FoldBook.ktnew file mode 100644index 0000000..2e30c30--- /dev/null+++ b/app/src/main/java/app/tellyscope/data/FoldBook.kt@@ -0,0 +1,28 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope.data++import java.io.File+import java.util.Properties++/**+ * Which Apps tabs have their System section folded, kept in [file] so a fold the user chose+ * stays across restarts until they open it again. Unfolded until told otherwise.+ */+class FoldBook(private val file: File) {+ @Synchronized+ fun folded(): Set<String> = props().let { p -> p.stringPropertyNames().filter { p.getProperty(it) == "true" }.toSet() }++ @Synchronized+ fun set(tab: String, folded: Boolean) {+ val p = props().apply { if (folded) setProperty(tab, "true") else remove(tab) }+ runCatching {+ file.parentFile?.mkdirs()+ file.outputStream().use { p.store(it, null) }+ }+ }++ private fun props() = Properties().apply {+ runCatching { file.takeIf { it.exists() }?.inputStream()?.use(::load) }+ }+}diff --git a/app/src/main/java/app/tellyscope/ui/AppsTabs.kt b/app/src/main/java/app/tellyscope/ui/AppsTabs.ktnew file mode 100644index 0000000..de22b72--- /dev/null+++ b/app/src/main/java/app/tellyscope/ui/AppsTabs.kt@@ -0,0 +1,90 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope.ui++import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.KeyboardArrowDown+import androidx.compose.material.icons.filled.KeyboardArrowUp+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.PrimaryTabRow+import androidx.compose.material3.Tab+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.layout.layout+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.dp+import app.tellyscope.data.AppInfo+import app.tellyscope.data.Proc++/** The Apps tab's own tabs: what's running now, what the user installed, and what came with the TV. */+enum class AppsTab(val label: String) { Running("Running"), Installed("Installed"), BuiltIn("Built-in") }++/** One Apps tab's list: the apps the user can change, then the [system] ones they can't, under their own header. */+data class AppsSplit(val apps: List<AppInfo>, val system: List<AppInfo>)++/** Locked, as [AppRow] shows it: protected, and not offered as the new home screen. */+private fun locked(app: AppInfo, all: List<AppInfo>) =+ app.protectedReason != null && (app.homeInstead == null || !app.enabled || homeLabel(all, app) == null)++/**+ * Splits the TV's apps for [tab]. Running: apps using RAM now. Installed: the user's own apps,+ * all in one list, a locked home screen keeping its lock. Built-in: what came with the TV.+ * Running and Built-in put the apps the user can't change last, in [AppsSplit.system].+ */+internal fun splitApps(apps: List<AppInfo>, procs: List<Proc>, tab: AppsTab): AppsSplit {+ val running = procs.filter { it.ramMb > 0 }.mapNotNull { it.packageName }.toSet()+ val shown = when (tab) {+ AppsTab.Running -> apps.filter { it.packageName in running }+ AppsTab.Installed -> apps.filter { !it.system }+ AppsTab.BuiltIn -> apps.filter { it.system }+ }.sortedWith(compareBy({ locked(it, apps) }, { !it.enabled }, { it.system }, { it.label }))+ if (tab == AppsTab.Installed) return AppsSplit(shown, emptyList())+ val (system, rest) = shown.partition { locked(it, apps) }+ return AppsSplit(rest, system)+}++/** The three tabs, edge to edge across the list's side padding, pinned under the bar once the hero has folded. */+@Composable+internal fun AppsTabRow(tab: AppsTab, color: Color, inset: Dp, onTab: (AppsTab) -> Unit) {+ PrimaryTabRow(+ selectedTabIndex = tab.ordinal,+ containerColor = color,+ modifier = Modifier.layout { m, c ->+ val side = inset.roundToPx()+ val p = m.measure(c.copy(minWidth = c.maxWidth + 2 * side, maxWidth = c.maxWidth + 2 * side))+ layout(c.maxWidth, p.height) { p.place(-side, 0) }+ },+ ) {+ AppsTab.entries.forEach { t ->+ Tab(selected = tab == t, onClick = { onTab(t) }, text = { Text(t.label) })+ }+ }+}++/** "System (N)" over the apps the TV needs; tapping it folds the list away or opens it again. */+@Composable+internal fun SystemHeader(count: Int, folded: Boolean, onFold: (Boolean) -> Unit) {+ Row(+ Modifier.fillMaxWidth().clip(MaterialTheme.shapes.large).clickable { onFold(!folded) }.padding(vertical = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(Modifier.weight(1f)) {+ Text("${Copy.SYSTEM} ($count)", style = MaterialTheme.typography.titleSmall)+ Text(Copy.SYSTEM_WHY, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)+ }+ Icon(+ if (folded) Icons.Default.KeyboardArrowDown else Icons.Default.KeyboardArrowUp,+ contentDescription = if (folded) "Show system apps" else "Hide system apps",+ )+ }+}diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.ktindex 0a27ef7..fe5d461 100644--- a/app/src/main/java/app/tellyscope/ui/Copy.kt+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt@@ -148,7 +148,9 @@ object Copy {fun uninstallTitle(app: String) = "Uninstall $app?"- const val CANT_CHANGE = "Can't be changed"+ /** The Apps tabs' header over the apps the TV needs, and why they're apart. */+ const val SYSTEM = "System"+ const val SYSTEM_WHY = "Needed by the TV · can't be changed"const val ANDROID_SYSTEM = AppNames.SYSTEMdiff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex 2051bee..b559996 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -107,6 +107,8 @@ data class DeviceActions(val answerRequest: (allow: Boolean, always: Boolean) -> Unit = { _, _ -> },/** Hides that prompt on the phone without answering it; the TV keeps asking. */val dismissRequest: () -> Unit = {},+ /** Folds an Apps tab's System section away, or opens it; remembered across restarts. */+ val foldSystem: (AppsTab, Boolean) -> Unit = { _, _ -> },)/** Off while the remote is made faster: the device page hides its Remote button. */diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.ktindex 9d1eb3c..08c776b 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt@@ -4,6 +4,7 @@package app.tellyscope.ui+import androidx.compose.foundation.ExperimentalFoundationApiimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column@@ -44,11 +45,8 @@ import androidx.compose.material3.ListItemDefaultsimport androidx.compose.material3.MaterialShapesimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Scaffold-import androidx.compose.material3.SegmentedButton-import androidx.compose.material3.SegmentedButtonDefaultsimport androidx.compose.material3.ShortNavigationBarimport androidx.compose.material3.ShortNavigationBarItem-import androidx.compose.material3.SingleChoiceSegmentedButtonRowimport androidx.compose.material3.SnackbarHostimport androidx.compose.material3.SnackbarHostStateimport androidx.compose.material3.Text@@ -79,10 +77,10 @@ import androidx.compose.ui.graphics.vector.PathParserimport androidx.compose.ui.text.SpanStyleimport androidx.compose.ui.text.buildAnnotatedStringimport androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.text.withStyleimport androidx.compose.ui.unit.dpimport app.tellyscope.data.Action+import app.tellyscope.data.AppInfoimport app.tellyscope.data.DeviceStateimport app.tellyscope.data.Snapshotimport app.tellyscope.data.Suggestions@@ -118,7 +116,7 @@ private fun TvTab.icon() = when (this) {* Every tab leads with the TV itself, big and centred, Overview with a chip per TV to switch; scrolling* folds it into the app bar. Search (Apps only) and the overflow sit on the right.*/-@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class, ExperimentalFoundationApi::class)@Composablefun DeviceTabsScreen(state: UiState,@@ -130,7 +128,7 @@ fun DeviceTabsScreen(val ui = state.devicevar tab by rememberSaveable { mutableStateOf(startTab) }var searching by rememberSaveable { mutableStateOf(false) }- var onlyLocked by rememberSaveable { mutableStateOf(false) }+ var appsTab by rememberSaveable { mutableStateOf(AppsTab.Running) }val q = state.query.trim().lowercase()val offline = device.state != DeviceState.Onlineval list = rememberLazyListState()@@ -265,16 +263,30 @@ fun DeviceTabsScreen(item { AndroidCard(state, snap, offline, onUpdates = actions.checkUpdates) }}TvTab.Apps -> {- val locked = ui.apps.count { it.protectedReason != null }- item(key = "filter") { AppsFilter(ui.apps.size - locked, locked, onlyLocked) { onlyLocked = it } }- val shown = ui.apps- .filter { q.isEmpty() || it.label.lowercase().contains(q) || it.packageName.contains(q) }- // A search looks through every app; the switch only narrows the plain list.- .filter { q.isNotEmpty() || (it.protectedReason != null) == onlyLocked }- .sortedWith(compareBy({ !it.enabled }, { it.system }, { it.label }))- if (shown.isEmpty()) item { EmptyLine(q) }- items(shown, key = { it.packageName }) { app ->- AppRow(app, snap?.procs.orEmpty(), ui.pending, ui.busy == app.packageName, actions, homeLabel(ui.apps, app))+ val procs = snap?.procs.orEmpty()+ fun rows(apps: List<AppInfo>) = items(apps, key = { it.packageName }) { app ->+ AppRow(app, procs, ui.pending, ui.busy == app.packageName, actions, homeLabel(ui.apps, app))+ }+ if (q.isNotEmpty()) {+ // A search looks through every app, whichever tab it's on.+ val found = ui.apps+ .filter { it.label.lowercase().contains(q) || it.packageName.contains(q) }+ .sortedWith(compareBy({ !it.enabled }, { it.system }, { it.label }))+ if (found.isEmpty()) item { EmptyLine(q) }+ rows(found)+ } else {+ // Pinned under the bar once the hero has folded into it.+ stickyHeader(key = "appsTabs") {+ AppsTabRow(appsTab, lerp(MaterialTheme.colorScheme.surface, MaterialTheme.colorScheme.surfaceContainer, collapse), inset = 16.dp) { appsTab = it }+ }+ val split = splitApps(ui.apps, procs, appsTab)+ if (split.apps.isEmpty() && split.system.isEmpty()) item { EmptyLine(q) }+ rows(split.apps)+ if (split.system.isNotEmpty()) {+ val folded = appsTab in state.foldedSystem+ item(key = "system") { SystemHeader(split.system.size, folded) { actions.foldSystem(appsTab, it) } }+ if (!folded) rows(split.system)+ }}}TvTab.Files -> {@@ -300,20 +312,6 @@ fun DeviceTabsScreen(}}-/** Apps the user can change by default; the switch's other side shows the ones Tellyscope protects. */-@Composable-private fun AppsFilter(changeable: Int, locked: Int, onlyLocked: Boolean, onChange: (Boolean) -> Unit) {- SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {- listOf(false to "Changeable ($changeable)", true to "${Copy.CANT_CHANGE} ($locked)").forEachIndexed { i, (side, label) ->- SegmentedButton(- selected = onlyLocked == side,- onClick = { onChange(side) },- shape = SegmentedButtonDefaults.itemShape(i, 2),- ) { Text(label, maxLines = 1, overflow = TextOverflow.Ellipsis) }- }- }-}-/** A titled card for a tab's block, not folded: each tab has room for it. */@Composableprivate fun Panel(title: String, body: @Composable () -> Unit) {diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.ktindex 809f09c..4d79aa3 100644--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt@@ -36,6 +36,7 @@ import app.tellyscope.data.Suggestionsimport app.tellyscope.data.TvSettingsimport app.tellyscope.data.TvTweaksimport app.tellyscope.data.Update+import app.tellyscope.data.FoldBookimport app.tellyscope.data.UpdateCheckimport kotlinx.coroutines.CancellationExceptionimport kotlinx.coroutines.Dispatchers@@ -135,6 +136,8 @@ data class UiState(val alphaBuild: Boolean = false,/** A newer release to offer; cleared once the user answers. */val update: Update? = null,+ /** The Apps tabs whose System section the user folded away. */+ val foldedSystem: Set<AppsTab> = emptySet(),) {val selected: Device? get() = devices.firstOrNull { it.id == selectedId }}@@ -164,6 +167,7 @@ class TellyscopeViewModel(private val allowTimeoutMs: Long = 60_000,private val clock: () -> Long = System::currentTimeMillis,private val updates: UpdateCheck? = null,+ private val folds: FoldBook? = null,) : ViewModel() {private val _state = MutableStateFlow(UiState(now = clock()))@@ -213,6 +217,12 @@ class TellyscopeViewModel(updates?.let { u ->viewModelScope.launch(Dispatchers.IO) { _state.update { it.copy(checkUpdates = u.enabled, alphaBuild = u.alpha) } }}+ folds?.let { f ->+ viewModelScope.launch(Dispatchers.IO) {+ val folded = f.folded().mapNotNull { name -> AppsTab.entries.firstOrNull { it.name == name } }.toSet()+ _state.update { it.copy(foldedSystem = folded) }+ }+ }rescan()viewModelScope.launch {// Off Wi-Fi a scan has nothing to sweep; start over the moment the phone joins one.@@ -818,6 +828,12 @@ class TellyscopeViewModel(viewModelScope.launch(Dispatchers.IO) { updates?.skip(version) }}+ /** Folds or opens [tab]'s System section, and keeps it that way across restarts. */+ fun foldSystem(tab: AppsTab, folded: Boolean) {+ _state.update { it.copy(foldedSystem = if (folded) it.foldedSystem + tab else it.foldedSystem - tab) }+ viewModelScope.launch(Dispatchers.IO) { folds?.set(tab.name, folded) }+ }+fun setCheckUpdates(on: Boolean) {val u = updates ?: return_state.update { it.copy(checkUpdates = on) }diff --git a/app/src/test/java/app/tellyscope/AppsTabsTest.kt b/app/src/test/java/app/tellyscope/AppsTabsTest.ktnew file mode 100644index 0000000..6e690d1--- /dev/null+++ b/app/src/test/java/app/tellyscope/AppsTabsTest.kt@@ -0,0 +1,69 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope++import app.tellyscope.data.AppInfo+import app.tellyscope.data.FoldBook+import app.tellyscope.data.Proc+import app.tellyscope.ui.AppsTab+import app.tellyscope.ui.splitApps+import org.junit.Assert.assertEquals+import org.junit.Rule+import org.junit.Test+import org.junit.rules.TemporaryFolder++class AppsTabsTest {+ @get:Rule val tmp = TemporaryFolder()++ private fun app(pkg: String, system: Boolean, locked: String? = null, home: String? = null) =+ AppInfo(pkg, pkg.substringAfterLast('.').replaceFirstChar { it.uppercase() }, null, system, true, locked, "1", homeInstead = home)++ private val launcher = app("com.tv.launcher", system = true, locked = "this is your home screen")+ private val apps = listOf(+ app("org.mine.jellyfin", system = false),+ app("org.mine.netflix", system = false),+ app("org.mine.projectivy", system = false, locked = "this is your home screen"),+ app("com.maker.assistant", system = true),+ app("com.maker.ota", system = true),+ app("com.android.systemui", system = true, locked = "the TV needs this to draw the screen"),+ app("com.google.android.gms", system = true, locked = "most apps stop working without it"),+ // A launcher that's protected by name but offered as the new home screen stays changeable.+ app("org.other.home", system = false, locked = "launcher", home = launcher.packageName),+ launcher,+ )+ private fun proc(pkg: String, ram: Int = 50) = Proc(1, pkg, pkg, 1.0, ram)+ private val procs = listOf(proc("org.mine.jellyfin"), proc("com.maker.assistant"), proc("com.android.systemui"), proc("com.maker.ota", ram = 0))++ private fun names(l: List<AppInfo>) = l.map { it.packageName.substringAfterLast('.') }++ @Test fun `running holds the apps using RAM, the user's first, the ones the TV needs under System`() {+ val split = splitApps(apps, procs, AppsTab.Running)+ assertEquals(listOf("jellyfin", "assistant"), names(split.apps))+ assertEquals(listOf("systemui"), names(split.system))+ }++ @Test fun `installed holds only the user's own apps, a locked home screen among them with no System part`() {+ val split = splitApps(apps, procs, AppsTab.Installed)+ assertEquals(listOf("home", "jellyfin", "netflix", "projectivy"), names(split.apps))+ assertEquals(emptyList<String>(), names(split.system))+ }++ @Test fun `built-in puts the maker's extras first, then what the TV needs`() {+ val split = splitApps(apps, procs, AppsTab.BuiltIn)+ assertEquals(listOf("assistant", "ota"), names(split.apps))+ assertEquals(listOf("gms", "launcher", "systemui"), names(split.system))+ }++ @Test fun `a fold is kept per tab across restarts, until it is opened again`() {+ val file = tmp.root.resolve("folds.properties")+ FoldBook(file).set(AppsTab.Running.name, true)+ FoldBook(file).set(AppsTab.BuiltIn.name, true)+ assertEquals(setOf("Running", "BuiltIn"), FoldBook(file).folded())+ FoldBook(file).set(AppsTab.Running.name, false)+ assertEquals(setOf("BuiltIn"), FoldBook(file).folded())+ }++ @Test fun `nothing is folded before the user folds it`() {+ assertEquals(emptySet<String>(), FoldBook(tmp.root.resolve("none.properties")).folded())+ }+}diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.ktindex e782ffc..4a4a52d 100644--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt@@ -15,7 +15,6 @@ import androidx.compose.ui.test.junit4.v2.createComposeRuleimport androidx.compose.ui.test.assertIsEnabledimport androidx.compose.ui.test.assertIsNotDisplayedimport androidx.compose.ui.test.assertIsNotEnabled-import androidx.compose.ui.test.assertIsSelectedimport androidx.compose.ui.test.onNodeWithContentDescriptionimport androidx.compose.ui.test.onNodeWithTextimport androidx.compose.ui.test.onAllNodesWithText@@ -50,8 +49,10 @@ import app.tellyscope.data.ScanKindimport app.tellyscope.data.ScanProgressimport app.tellyscope.data.Suggestedimport app.tellyscope.data.SuggestedGroup+import app.tellyscope.data.Procimport app.tellyscope.data.Suggestionsimport app.tellyscope.ui.AdvancedScreen+import app.tellyscope.ui.AppsTabimport app.tellyscope.ui.ConnectScreenimport app.tellyscope.ui.DebloatScreenimport app.tellyscope.ui.DeviceActions@@ -302,6 +303,34 @@ class ScreenshotTest {}@Test fun md3_apps() { shot("64_md3_apps") { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Apps) } }@Test fun md3_apps_dark() { shot("64_md3_apps", dark = true) { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Apps) } }+ // The Apps tab's own tabs: what came with the TV, and only what the user installed.+ private fun appsTab(name: String, dark: Boolean, label: String, state: () -> UiState = ::md3State) =+ shot(name, dark, before = { compose.onNodeWithText(label).performClick(); Unit }) { DeviceTabsScreen(state(), DeviceActions(), startTab = TvTab.Apps) }+ @Test fun md3_apps_installed() = appsTab("69_md3_apps_installed", false, "Installed")+ @Test fun md3_apps_installed_dark() = appsTab("69_md3_apps_installed", true, "Installed")+ @Test fun md3_apps_builtin() = appsTab("70_md3_apps_builtin", false, "Built-in")+ @Test fun md3_apps_builtin_dark() = appsTab("70_md3_apps_builtin", true, "Built-in")+ @Test fun md3_apps_offline() { shot("71_md3_apps_offline") { DeviceTabsScreen(offlineMd3(), DeviceActions(), startTab = TvTab.Apps) } }+ @Test fun md3_apps_offline_dark() { shot("71_md3_apps_offline", dark = true) { DeviceTabsScreen(offlineMd3(), DeviceActions(), startTab = TvTab.Apps) } }+ // Folded, the System header stays with its count and the protected apps go.+ private fun foldedBuiltIn() = md3State().copy(foldedSystem = setOf(AppsTab.BuiltIn))+ @Test fun md3_apps_builtin_folded() = appsTab("72_md3_apps_builtin_folded", false, "Built-in", ::foldedBuiltIn)+ @Test fun md3_apps_builtin_folded_dark() {+ appsTab("72_md3_apps_builtin_folded", true, "Built-in", ::foldedBuiltIn)+ compose.onNodeWithText("System UI").assertDoesNotExist()+ }+ @Test fun systemHeaderFoldsItsTab() {+ var folded: Pair<AppsTab, Boolean>? = null+ compose.mainClock.autoAdvance = false+ compose.setContent { TellyscopeTheme(dynamic = false) { DeviceTabsScreen(md3State(), DeviceActions(foldSystem = { t, f -> folded = t to f }), startTab = TvTab.Apps) } }+ compose.mainClock.advanceTimeBy(1_000)+ compose.onNodeWithText("Built-in").performClick()+ compose.mainClock.advanceTimeBy(1_000)+ compose.onNode(hasScrollAction()).performScrollToNode(hasText(Copy.SYSTEM_WHY))+ compose.onNodeWithText(Copy.SYSTEM_WHY).performClick()+ compose.mainClock.advanceTimeBy(1_000)+ assertEquals(AppsTab.BuiltIn to true, folded)+ }@Test fun md3_files() { shot("65_md3_files") { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Files) } }@Test fun md3_files_dark() { shot("65_md3_files", dark = true) { DeviceTabsScreen(md3State(), DeviceActions(), startTab = TvTab.Files) } }// Nothing came back: the TV still has off what Tellyscope turned off.@@ -455,37 +484,47 @@ class ScreenshotTest {compose.onNodeWithText(label).performClick()compose.mainClock.advanceTimeBy(1_000)}- shot("26_apps_uninstall_offered", screen = true, before = { tap("Netflix"); tap("XGIMI Assistant"); Unit }) {+ shot("26_apps_uninstall_offered", screen = true, before = { tap("Installed"); tap("Netflix"); Unit }) {DeviceTabsScreen(deviceState(), DeviceActions(propose = { pkg, a -> proposed += pkg to a }), startTab = TvTab.Apps)}// Netflix was installed by the user; XGIMI Assistant came with the TV and only gets Disable.compose.onAllNodesWithText("Uninstall").assertCountEquals(1)compose.onNodeWithText("Uninstall").performClick()assertEquals(listOf("com.netflix.ninja" to Action.Uninstall), proposed)+ tap("Built-in"); tap("XGIMI Assistant")+ compose.onNodeWithText("Disable").assertExists()+ compose.onAllNodesWithText("Uninstall").assertCountEquals(0)}@Test fun apps_uninstallAsksInADialog() {val state = deviceState { copy(pending = "com.netflix.ninja" to Action.Uninstall) }- shot("27_apps_uninstall_confirm", screen = true) { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }+ // Netflix isn't running, so it's under Installed.+ shot("27_apps_uninstall_confirm", screen = true, before = { compose.onNodeWithText("Installed").performClick(); Unit }) { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }compose.onNodeWithText("Uninstall Netflix?").assertExists()compose.onNodeWithText("can't be undone", substring = true).assertExists()compose.onNodeWithText("Yes, uninstall it").assertExists()}@Config(qualifiers = "w411dp-h2600dp-xxhdpi")- @Test fun apps_protectedAreFoldedAway() {- shot("28_apps_protected_folded", screen = true) { DeviceTabsScreen(deviceState(), DeviceActions(), startTab = TvTab.Apps) }- compose.onNodeWithText("Changeable", substring = true).assertIsSelected()- compose.onNodeWithText("System UI").assertDoesNotExist()- compose.onNodeWithText("Can't be changed", substring = true).performClick()- compose.mainClock.advanceTimeBy(1_000)+ @Test fun apps_systemFoldsAway() {+ // Running opens with the protected apps under System, unfolded.+ shot("28_apps_system", screen = true) { DeviceTabsScreen(deviceState(), DeviceActions(), startTab = TvTab.Apps) }compose.onNodeWithText("System UI").assertExists()}+ // A fold the user chose hides them, header and count still there.+ @Config(qualifiers = "w411dp-h2600dp-xxhdpi")+ @Test fun apps_foldedSystemStaysFolded() {+ val state = deviceState().copy(foldedSystem = setOf(AppsTab.Running))+ shot("28_apps_system_folded", screen = true) { DeviceTabsScreen(state, DeviceActions(), startTab = TvTab.Apps) }+ compose.onNodeWithText("${Copy.SYSTEM} (", substring = true).assertExists()+ compose.onNodeWithText("System UI").assertDoesNotExist()+ }- /** A real TV's app list: no per-process stats yet, so the apps sit right under the stat grid. */+ /** A real TV's app list, every app running so all of them show under Running. */private fun appsState(apps: List<AppInfo>): UiState {val base = deviceState()- return base.copy(device = base.device.copy(snapshot = base.device.snapshot?.copy(procs = emptyList()), apps = apps))+ val procs = apps.mapIndexed { i, a -> Proc(3000 + i, a.packageName, a.packageName, 1.0, 64) }+ return base.copy(device = base.device.copy(snapshot = base.device.snapshot?.copy(procs = procs), apps = apps))}private val tvApps = listOf(