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.
Move the list source to a new Settings screen; refuse userinfo, show the branch
jesse-agent-3628e51a7c1e088
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 663c5df..2eb1ec0 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -26,7 +26,7 @@ The per-TV lists behind **Suggested for this TV** live in the [tellyscope-device### Using your own lists-You don't have to trust ours. Fork tellyscope-devices, edit the lists in your fork, and keep `index.json` on schema 1 with each file's sha256 updated. Then in the app open **Debloat**, tap **Change** next to "Lists from …", and paste the raw address of the folder that holds `index.json`, for example `https://raw.githubusercontent.com/<you>/tellyscope-devices/main/`. Only HTTPS is accepted, and a source that doesn't serve a schema 1 index is refused without changing anything. Switching drops the cached lists. While your source is in use, the review step says where the list came from. The built-in protected list still wins over any list, and **Reset to default** goes back to tellyscope-devices.+You don't have to trust ours. Fork tellyscope-devices, edit the lists in your fork, and keep `index.json` on schema 1 with each file's sha256 updated. Then in the app open **Settings** (in the TV menu at the top), tap **Change** under **Debloat lists**, and paste the raw address of the folder that holds `index.json`, for example `https://raw.githubusercontent.com/<you>/tellyscope-devices/main/`. Only HTTPS is accepted, and a source that doesn't serve a schema 1 index is refused without changing anything. Switching drops the cached lists. While your source is in use, the review step says where the list came from. The built-in protected list still wins over any list, and **Reset to default** goes back to tellyscope-devices.## README screenshotsdiff --git a/README.md b/README.mdindex c17761a..0fc5a11 100644--- a/README.md+++ b/README.md@@ -72,7 +72,7 @@ Tellyscope is a phone app that talks to your Android TV, Google TV or Fire TV ov- **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.- **Another home screen.** With a second launcher such as Projectivy installed, its row in Apps offers **Make it your home screen**. 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.** Tellyscope matches your TV to a tested clean-up list (adapted from [cleanyourtv](https://github.com/Gathin23/cleanyourtv)) and says how many of its apps are still on. **Debloat** first asks which TV it is, with the match already chosen, then shows every app it will turn off. 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 Debloat at your own fork of them (see [CONTRIBUTING](CONTRIBUTING.md#using-your-own-lists)).+- **Debloat.** Tellyscope matches your TV to a tested clean-up list (adapted from [cleanyourtv](https://github.com/Gathin23/cleanyourtv)) and says how many of its apps are still on. **Debloat** first asks which TV it is, with the match already chosen, then shows every app it will turn off. 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.- **Install apps.** Pick an APK, several split APKs or an `.apks`/`.xapk`/`.apkm` bundle on your phone. Before installing, Tellyscope shows the app's name, version and size and says whether it's new, an update, a reinstall or an older version. It won't install an older version over a newer one unless you tick the box. If the TV refuses, you get the reason in plain words.- **Files.** Send a file from your phone into the TV's Download or Movies folder, or save one from there to your phone. A file with the same name gets a " (1)" instead of being overwritten, and a cancelled copy leaves nothing half-written behind.diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.ktindex 19e97b4..d8a8dd0 100644--- a/app/src/main/java/app/tellyscope/MainActivity.kt+++ b/app/src/main/java/app/tellyscope/MainActivity.kt@@ -44,6 +44,7 @@ import app.tellyscope.ui.PermissionScreenimport app.tellyscope.ui.RemoteActionsimport app.tellyscope.ui.RemoteScreenimport app.tellyscope.ui.ScanScreen+import app.tellyscope.ui.SettingsScreenimport app.tellyscope.ui.TellyscopeViewModelimport app.tellyscope.ui.theme.TellyscopeThemeimport kotlinx.coroutines.flow.StateFlow@@ -127,6 +128,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {var remote by rememberSaveable { mutableStateOf(false) }var advanced by rememberSaveable { mutableStateOf(false) }var debloat by rememberSaveable { mutableStateOf(false) }+ var settings by rememberSaveable { mutableStateOf(false) }// "*/*": file managers label .apks and .xapk bundles inconsistently, so a narrower type would grey them out.val pickApp = rememberLauncherForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) { vm.pickedApp(it) }@@ -137,7 +139,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {Snackbars(snackbar, vm.done, vm.notice, vm::doneShown, vm::noticeShown) { vm.undo(it.entry, it.deviceId) }// A newly connected TV becomes the selection; leave the add flow then, not on tap.- LaunchedEffect(state.selectedId) { adding = false; remote = false; advanced = false; debloat = false }+ LaunchedEffect(state.selectedId) { adding = false; remote = false; advanced = false; debloat = false; settings = false }if (state.selected == null || adding) {BackHandler(enabled = adding) { adding = false }@@ -166,6 +168,9 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {} else if (advanced) {BackHandler { advanced = false }AdvancedScreen(state, back = { advanced = false }, snackbar = snackbar)+ } else if (settings) {+ BackHandler { settings = false }+ SettingsScreen(state.listSource, onListSource = vm::setListSource, back = { settings = false }, snackbar = snackbar)} else if (debloat) {// Its own back handler steps back from the review to the model before leaving.DebloatScreen(@@ -175,7 +180,6 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {back = { debloat = false },snackbar = snackbar,source = state.listSource,- onSource = vm::setListSource,)} else {DeviceScreen(@@ -184,6 +188,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {actions = DeviceActions(select = vm::select,addDevice = { adding = true; vm.rescan() },+ settings = { settings = true },showOffline = vm::showOffline,query = vm::query,propose = vm::propose,diff --git a/app/src/main/java/app/tellyscope/data/DeviceLists.kt b/app/src/main/java/app/tellyscope/data/DeviceLists.ktindex f41067b..7cb0e43 100644--- a/app/src/main/java/app/tellyscope/data/DeviceLists.kt+++ b/app/src/main/java/app/tellyscope/data/DeviceLists.kt@@ -273,15 +273,23 @@ fun normalize(url: String): String? {} catch (_: java.net.URISyntaxException) {return null}- if (!parsed.scheme.equals("https", ignoreCase = true) || parsed.host.isNullOrEmpty() || parsed.query != null || parsed.fragment != null) return null+ if (!parsed.scheme.equals("https", ignoreCase = true) || parsed.host.isNullOrEmpty()) return null+ // A user:token would be saved and shown on screen.+ if (parsed.rawUserInfo != null || parsed.query != null || parsed.fragment != null) return nullreturn if (u.endsWith("/")) u else "$u/"}-/** How a source reads on screen: `github.com/owner/repo` for raw GitHub addresses, else host and path. */+/**+ * How a source reads on screen: `github.com/owner/repo` for raw GitHub addresses, with the branch+ * (and any folder) after it unless that is just `main`; else host and path.+ */fun sourceName(base: String): String {val rest = base.substringAfter("://").trimEnd('/')val raw = "raw.githubusercontent.com/"- return if (rest.startsWith(raw)) "github.com/" + rest.removePrefix(raw).split('/').take(2).joinToString("/") else rest+ if (!rest.startsWith(raw)) return rest+ val parts = rest.removePrefix(raw).split('/')+ val where = parts.drop(2).joinToString("/")+ return "github.com/" + parts.take(2).joinToString("/") + if (where == "main" || where.isEmpty()) "" else " ($where)"}private const val MAX_BYTES = 2 shl 20 // 2 MiB; the index is ~60 KBdiff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex 1e5a4d1..9292bf6 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -32,6 +32,7 @@ import androidx.compose.material.icons.filled.Closeimport androidx.compose.material.icons.filled.Deleteimport androidx.compose.material.icons.filled.Editimport androidx.compose.material.icons.filled.Info+import androidx.compose.material.icons.filled.Settingsimport androidx.compose.material.icons.filled.KeyboardArrowDownimport androidx.compose.material.icons.filled.Lockimport androidx.compose.material.icons.filled.Search@@ -95,6 +96,7 @@ import app.tellyscope.ui.theme.SmallNumberdata class DeviceActions(val select: (String) -> Unit = {},val addDevice: () -> Unit = {},+ val settings: () -> Unit = {},val showOffline: (Boolean) -> Unit = {},val query: (String) -> Unit = {},val propose: (String, Action) -> Unit = { _, _ -> },@@ -220,9 +222,7 @@ fun DeviceScreen(item {ActionTiles(actions,- // A source of the user's own that stopped answering must still be reachable to reset.- canDebloat = ui.lists is Suggestions.Pick || ui.lists is Suggestions.Ready ||- (ui.lists == Suggestions.Unavailable && state.listSource != null),+ canDebloat = ui.lists is Suggestions.Pick || ui.lists is Suggestions.Ready,disabling = ui.busy == DISABLING,)}@@ -449,6 +449,11 @@ private fun DevicePicker(state: UiState, actions: DeviceActions) {leadingIcon = { Icon(Icons.Default.Delete, null) },onClick = { open = false; forgetting = true },)+ DropdownMenuItem(+ text = { Text("Settings") },+ leadingIcon = { Icon(Icons.Default.Settings, null) },+ onClick = { open = false; actions.settings() },+ )DropdownMenuItem(text = { Text("About & licences") },leadingIcon = { Icon(Icons.Default.Info, null) },diff --git a/app/src/main/java/app/tellyscope/ui/ListsCard.kt b/app/src/main/java/app/tellyscope/ui/ListsCard.ktindex 2f4d091..a975aeb 100644--- a/app/src/main/java/app/tellyscope/ui/ListsCard.kt+++ b/app/src/main/java/app/tellyscope/ui/ListsCard.kt@@ -92,13 +92,10 @@ fun DebloatScreen(onDisable: (List<String>) -> Unit,back: () -> Unit,snackbar: SnackbarHostState = remember { SnackbarHostState() },- /** The user's own list source, null for the default. */+ /** The user's own list source, null for the default; set in Settings. */source: String? = null,- onSource: (String?) -> Unit = {},) {val ready = lists as? Suggestions.Ready- var editing by rememberSaveable { mutableStateOf(false) }- if (editing) SourceDialog(source, onSave = { editing = false; onSource(it) }, onDismiss = { editing = false })val devices = when (lists) {is Suggestions.Pick -> lists.devicesis Suggestions.Ready -> lists.devices@@ -174,15 +171,6 @@ fun DebloatScreen(singleLine = true,modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),)- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- Copy.listSource(source),- style = MaterialTheme.typography.bodySmall,- color = MaterialTheme.colorScheme.onSurfaceVariant,- modifier = Modifier.weight(1f),- )- TextButton(onClick = { editing = true }) { Text("Change") }- }// Empty while a picked list reloads, if they came back to change it.if (devices.isEmpty()) Muted("Loading the lists…")else if (shown.isEmpty()) Muted("No list matches \"${q.trim()}\".")@@ -280,29 +268,6 @@ internal fun DisableDialog(apps: List<Suggested>, onDisable: () -> Unit, onDismi)}-/** Edits the list source: an HTTPS folder holding `index.json`, or back to the default. */-@Composable-private fun SourceDialog(source: String?, onSave: (String?) -> Unit, onDismiss: () -> Unit) {- var url by rememberSaveable { mutableStateOf(source.orEmpty()) }- AlertDialog(- onDismissRequest = onDismiss,- title = { Text("Where the lists come from") },- text = {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(- "To use your own lists, fork tellyscope-devices, edit it, and paste the address of the folder that holds index.json, " +- "like https://raw.githubusercontent.com/you/tellyscope-devices/main/. Protected apps stay protected whatever a list says.",- style = MaterialTheme.typography.bodyMedium,- )- OutlinedTextField(url, { url = it }, placeholder = { Text("https://…") }, singleLine = true, modifier = Modifier.fillMaxWidth())- if (source != null) TextButton(onClick = { onSave(null) }) { Text("Reset to default") }- }- },- confirmButton = { Button(onClick = { onSave(url) }, enabled = url.isNotBlank()) { Text("Use these lists") } },- dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },- )-}-/** About and licences; [commit] is the cleanyourtv commit the downloaded lists were built from. */@Composablefun AboutDialog(commit: String?, onDismiss: () -> Unit) {diff --git a/app/src/main/java/app/tellyscope/ui/SettingsScreen.kt b/app/src/main/java/app/tellyscope/ui/SettingsScreen.ktnew file mode 100644index 0000000..2afeae0--- /dev/null+++ b/app/src/main/java/app/tellyscope/ui/SettingsScreen.kt@@ -0,0 +1,104 @@+// SPDX-License-Identifier: GPL-3.0-only++package app.tellyscope.ui++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowBack+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.Button+import androidx.compose.material3.Card+import androidx.compose.material3.CardDefaults+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.Scaffold+import androidx.compose.material3.SnackbarHost+import androidx.compose.material3.SnackbarHostState+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp++/** App-wide choices, not tied to one TV. */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun SettingsScreen(+ /** The user's own debloat-list source; null for tellyscope-devices. */+ listSource: String?,+ onListSource: (String?) -> Unit,+ back: () -> Unit,+ snackbar: SnackbarHostState = remember { SnackbarHostState() },+) {+ var editing by rememberSaveable { mutableStateOf(false) }+ if (editing) SourceDialog(listSource, onSave = { editing = false; onListSource(it) }, onDismiss = { editing = false })+ Scaffold(+ snackbarHost = { SnackbarHost(snackbar) },+ topBar = {+ TopAppBar(+ title = { Text("Settings") },+ navigationIcon = {+ IconButton(onClick = back) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back to the TV's page") }+ },+ )+ },+ ) { pad ->+ LazyColumn(+ Modifier.fillMaxSize().padding(pad),+ contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = 32.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ ) {+ item {+ Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)) {+ Column(Modifier.fillMaxWidth().padding(16.dp)) {+ Text("Debloat lists", style = MaterialTheme.typography.titleSmall)+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(Copy.listSource(listSource), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f))+ TextButton(onClick = { editing = true }) { Text("Change") }+ }+ }+ }+ }+ }+ }+}++/** Edits the list source: an HTTPS folder holding `index.json`, or back to the default. */+@Composable+private fun SourceDialog(source: String?, onSave: (String?) -> Unit, onDismiss: () -> Unit) {+ var url by rememberSaveable { mutableStateOf(source.orEmpty()) }+ AlertDialog(+ onDismissRequest = onDismiss,+ title = { Text("Where the lists come from") },+ text = {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Text(+ "To use your own lists, fork tellyscope-devices, edit it, and paste the address of the folder that holds index.json, " ++ "like https://raw.githubusercontent.com/you/tellyscope-devices/main/. Protected apps stay protected whatever a list says.",+ style = MaterialTheme.typography.bodyMedium,+ )+ OutlinedTextField(url, { url = it }, placeholder = { Text("https://…") }, singleLine = true, modifier = Modifier.fillMaxWidth())+ if (source != null) TextButton(onClick = { onSave(null) }) { Text("Reset to default") }+ }+ },+ confirmButton = { Button(onClick = { onSave(url) }, enabled = url.isNotBlank()) { Text("Use these lists") } },+ dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },+ )+}diff --git a/app/src/test/java/app/tellyscope/DeviceListsTest.kt b/app/src/test/java/app/tellyscope/DeviceListsTest.ktindex cfea303..c4af689 100644--- a/app/src/test/java/app/tellyscope/DeviceListsTest.kt+++ b/app/src/test/java/app/tellyscope/DeviceListsTest.kt@@ -232,7 +232,10 @@ class DeviceListsTest {assertNull(normalize("http://example.com/lists/"))assertNull(normalize("file:///sdcard/lists/"))assertNull(normalize("https://example.com/lists/?x=1"))+ assertNull(normalize("https://someone:[email protected]/someone/my-lists/main/"))assertEquals("github.com/someone/my-lists", sourceName(fork))+ assertEquals("github.com/someone/my-lists (test)", sourceName("https://raw.githubusercontent.com/someone/my-lists/test/"))+ assertEquals("github.com/someone/my-lists (main/tv)", sourceName("https://raw.githubusercontent.com/someone/my-lists/main/tv/"))assertEquals("example.com/lists", sourceName("https://example.com/lists/"))}}