Skip to content

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.

Show a TV, projector or streaming-stick icon for each device

jesse-agent-2321a6efdca4dca
diff --git a/NOTICE b/NOTICE
index 0143b30..30147d1 100644
--- a/NOTICE
+++ b/NOTICE
@@ -18,6 +18,12 @@ License: GNU General Public License v3.0
Used as a library (via Kadb): SPAKE2 key exchange for Android 11+ wireless
debugging pairing.
+--------------------------------------------------------------------------------
+Material Icons — https://github.com/google/material-design-icons
+License: Apache License 2.0
+The TV and HDMI (streaming stick) device icons use the path data of the
+"tv" and "settings_input_hdmi" icons.
+
--------------------------------------------------------------------------------
cleanyourtv — https://github.com/Gathin23/cleanyourtv
License: MIT, Copyright (c) 2026 Gathin
diff --git a/app/src/main/java/app/tellyscope/data/DeviceKind.kt b/app/src/main/java/app/tellyscope/data/DeviceKind.kt
new file mode 100644
index 0000000..19521c1
--- /dev/null
+++ b/app/src/main/java/app/tellyscope/data/DeviceKind.kt
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-3.0-only
+
+package app.tellyscope.data
+
+/** What sort of box a TV is, for its icon. A guess from what the TV and the network report. */
+enum class DeviceKind { Tv, Projector, Stick }
+
+/** Makers whose Android devices are all projectors. */
+private val PROJECTOR_MAKERS = setOf("xgimi", "nebula", "dangbei", "formovie")
+
+/** Streaming sticks and boxes, by model name. Fire TV models all start with AFT (AFTMM, AFTKA). */
+private val STICK = Regex("^aft|chromecast|stick|streamer|shield", RegexOption.IGNORE_CASE)
+
+/** Projector makers or "projector" in a name, then sticks and boxes; anything else is a TV. */
+fun deviceKind(d: Device): DeviceKind {
+ val words = listOfNotNull(d.manufacturer, d.hit.maker).flatMap { it.lowercase().split(Regex("[^a-z]+")) }
+ val names = listOfNotNull(d.model, d.hit.hostname)
+ return when {
+ words.any { it in PROJECTOR_MAKERS } || names.any { "projector" in it.lowercase() } -> DeviceKind.Projector
+ names.any { STICK.containsMatchIn(it) } -> DeviceKind.Stick
+ else -> DeviceKind.Tv
+ }
+}
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt b/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt
new file mode 100644
index 0000000..cd9c41d
--- /dev/null
+++ b/app/src/main/java/app/tellyscope/ui/DeviceIcons.kt
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-3.0-only
+// Tv and Stick are the Material Icons "tv" and "settings_input_hdmi" (Apache-2.0), see NOTICE.
+
+package app.tellyscope.ui
+
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.PathFillType
+import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.graphics.vector.PathParser
+import androidx.compose.ui.unit.dp
+import app.tellyscope.data.DeviceKind
+
+/** Generic device shapes in the Material style; no maker's logo or artwork. */
+object DeviceIcons {
+ private const val TV =
+ "M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2zm0 14H3V5h18v12z"
+ private const val STICK =
+ "M18 7V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v3H5v6l3 6v3h8v-3l3-6V7h-1zM8 4h8v3h-2V5h-1v2h-2V5h-1v2H8V4z"
+
+ /** A box with a lens on the right and two feet; Material has no projector icon. */
+ private const val PROJECTOR =
+ "M4 6h16c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2z" +
+ "M16 8.5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 1 0 0-7z" +
+ "M16 10.5a1.5 1.5 0 1 1 0 3a1.5 1.5 0 1 1 0-3z" +
+ "M5 9h5v1.5H5z M5 12h5v1.5H5z M4 18h3v1.5H4z M17 18h3v1.5h-3z"
+
+ val Tv = icon("Tv", TV)
+ val Stick = icon("Stick", STICK)
+ val Projector = icon("Projector", PROJECTOR)
+
+ fun of(kind: DeviceKind) = when (kind) {
+ DeviceKind.Tv -> Tv
+ DeviceKind.Projector -> Projector
+ DeviceKind.Stick -> Stick
+ }
+
+ private fun icon(name: String, path: String) = ImageVector.Builder(name, 24.dp, 24.dp, 24f, 24f)
+ .addPath(PathParser().parsePathString(path).toNodes(), pathFillType = PathFillType.EvenOdd, fill = SolidColor(Color.Black))
+ .build()
+}
+
+/** Screen-reader name for the icon. */
+fun DeviceKind.word() = when (this) {
+ DeviceKind.Tv -> "TV"
+ DeviceKind.Projector -> "Projector"
+ DeviceKind.Stick -> "Streaming device"
+}
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
index 2e97b4e..57b63ba 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
@@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.shape.CircleShape
@@ -91,6 +90,7 @@ import app.tellyscope.data.NetworkInfo
import app.tellyscope.data.Proc
import app.tellyscope.data.Snapshot
import app.tellyscope.data.Suggestions
+import app.tellyscope.data.deviceKind
import app.tellyscope.ui.theme.SmallNumber
import app.tellyscope.ui.theme.StatNumber
@@ -284,7 +284,7 @@ private fun DevicePicker(state: UiState, actions: DeviceActions) {
Modifier.clip(MaterialTheme.shapes.large).clickable { open = true }.padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
- BrandBadge(device)
+ KindBadge(device)
Column(Modifier.weight(1f, fill = false)) {
Text(name(device), maxLines = 1, overflow = TextOverflow.Ellipsis)
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -300,15 +300,23 @@ private fun DevicePicker(state: UiState, actions: DeviceActions) {
.filter { state.showOffline || it.state == DeviceState.Online || it.id == state.selectedId }
.forEach { d ->
DropdownMenuItem(
- text = { Text(name(d)) },
- leadingIcon = { StateDot(d.state) },
- trailingIcon = {
- Text(
- if (d.state == DeviceState.Online) Copy.state(d.state)
- else d.lastSeen?.let { "${Copy.state(d.state)}, seen ${Copy.ago(it, state.now)}" } ?: Copy.state(d.state),
- style = MaterialTheme.typography.labelSmall,
- )
+ // Name over state, like the top bar: a long name gets the full width.
+ text = {
+ Column {
+ Text(name(d), maxLines = 1, overflow = TextOverflow.Ellipsis)
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ StateDot(d.state)
+ Spacer(Modifier.width(6.dp))
+ Text(
+ if (d.state == DeviceState.Online) Copy.state(d.state)
+ else d.lastSeen?.let { "${Copy.state(d.state)}, seen ${Copy.ago(it, state.now)}" } ?: Copy.state(d.state),
+ style = MaterialTheme.typography.labelSmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ }
},
+ leadingIcon = { Icon(DeviceIcons.of(deviceKind(d)), contentDescription = deviceKind(d).word()) },
onClick = { open = false; actions.select(d.id) },
)
}
@@ -386,33 +394,19 @@ fun RenameDialog(current: String, networkName: String, onSave: (String) -> Unit,
)
}
-/**
- * The maker's name on a tile, when the TV said who made it. A wordmark in the app's own colours,
- * not the maker's logo: no third-party artwork ships in the app.
- */
+/** What kind of device it is, on a tile: TV, projector or streaming stick. Generic shapes, never a maker's logo. */
@Composable
-private fun BrandBadge(d: Device) {
- val maker = (d.manufacturer ?: d.hit.maker)?.let(::brand) ?: return
+private fun KindBadge(d: Device) {
+ val kind = deviceKind(d)
Box(
- Modifier.padding(end = 10.dp).widthIn(min = 52.dp).height(36.dp).clip(MaterialTheme.shapes.medium)
- .background(MaterialTheme.colorScheme.secondaryContainer).padding(horizontal = 8.dp),
+ Modifier.padding(end = 10.dp).size(40.dp).clip(MaterialTheme.shapes.medium)
+ .background(MaterialTheme.colorScheme.secondaryContainer),
contentAlignment = Alignment.Center,
) {
- Text(maker, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSecondaryContainer, maxLines = 1)
+ Icon(DeviceIcons.of(kind), contentDescription = kind.word(), tint = MaterialTheme.colorScheme.onSecondaryContainer)
}
}
-/** Makers of Android TVs and boxes, as they write their own name. Chip makers (Amlogic) don't count. */
-private fun brand(maker: String): String? {
- val words = maker.split(Regex("[^A-Za-z]+"))
- return BRANDS.firstOrNull { b -> words.any { it.equals(b, ignoreCase = true) } }
-}
-
-private val BRANDS = listOf(
- "XGIMI", "Google", "Sony", "TCL", "Xiaomi", "Philips", "Hisense", "NVIDIA", "Amazon", "Nokia",
- "Toshiba", "Sharp", "Skyworth", "Haier", "Panasonic", "Nebula", "Dangbei", "Formovie", "onn",
-)
-
/** Forgetting only touches this phone; the TV keeps its own list of allowed computers. */
@Composable
fun ForgetDialog(name: String, onForget: () -> Unit, onDismiss: () -> Unit) {
diff --git a/app/src/test/java/app/tellyscope/DeviceKindTest.kt b/app/src/test/java/app/tellyscope/DeviceKindTest.kt
new file mode 100644
index 0000000..1b0daff
--- /dev/null
+++ b/app/src/test/java/app/tellyscope/DeviceKindTest.kt
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-3.0-only
+
+package app.tellyscope
+
+import app.tellyscope.data.Device
+import app.tellyscope.data.DeviceKind
+import app.tellyscope.data.DeviceState
+import app.tellyscope.data.ScanHit
+import app.tellyscope.data.ScanKind
+import app.tellyscope.data.deviceKind
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+class DeviceKindTest {
+ private fun kind(manufacturer: String? = null, model: String? = null, maker: String? = null, hostname: String? = null) =
+ deviceKind(Device("tv", ScanHit("tv", 5555, ScanKind.Classic, hostname, maker), DeviceState.Online, model, manufacturer, "11", null))
+
+ @Test fun projectorMakers() {
+ assertEquals(DeviceKind.Projector, kind(manufacturer = "XGIMI", model = "Horizon Pro"))
+ assertEquals(DeviceKind.Projector, kind(manufacturer = "Anker Nebula", model = "Capsule 3"))
+ assertEquals(DeviceKind.Projector, kind(maker = "Dangbei"))
+ }
+
+ @Test fun projectorInAName() {
+ assertEquals(DeviceKind.Projector, kind(manufacturer = "Amlogic", hostname = "living-room-projector"))
+ }
+
+ @Test fun sticksAndBoxes() {
+ assertEquals(DeviceKind.Stick, kind(manufacturer = "Amazon", model = "AFTMM"))
+ assertEquals(DeviceKind.Stick, kind(manufacturer = "Google", model = "Chromecast"))
+ assertEquals(DeviceKind.Stick, kind(manufacturer = "Xiaomi", model = "Mi TV Stick"))
+ assertEquals(DeviceKind.Stick, kind(manufacturer = "NVIDIA", model = "SHIELD Android TV"))
+ assertEquals(DeviceKind.Stick, kind(maker = "Google", hostname = "chromecast"))
+ }
+
+ @Test fun everythingElseIsATv() {
+ assertEquals(DeviceKind.Tv, kind(manufacturer = "Sony", model = "BRAVIA 4K VH2"))
+ assertEquals(DeviceKind.Tv, kind(manufacturer = "TCL", model = "Smart TV Pro"))
+ assertEquals(DeviceKind.Tv, kind())
+ }
+
+ /** "aft" only counts at the start of a model, so a name that merely contains it stays a TV. */
+ @Test fun aftOnlyAsAPrefix() = assertEquals(DeviceKind.Tv, kind(manufacturer = "Philips", model = "Craft 55"))
+}
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index 112e0f6..3e7aca7 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -12,6 +12,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.test.junit4.v2.createComposeRule
+import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
@@ -157,6 +158,13 @@ class ScreenshotTest {
@Test fun device_overview_dark() = shot("04_device", dark = true) { DeviceScreen(deviceState(), DeviceActions()) }
+ @Test fun device_picker() = shot("04_device_picker", screen = true, before = {
+ compose.onNodeWithContentDescription("Switch TV").performClick()
+ compose.mainClock.advanceTimeBy(1_000)
+ compose.onNodeWithText("Add a TV").assertExists()
+ Unit
+ }) { DeviceScreen(deviceState().copy(showOffline = true), DeviceActions()) }
+
@Config(qualifiers = "w411dp-h1500dp-xxhdpi")
@Test fun device_confirmDisable() {
val state = deviceState { copy(pending = "com.xgimi.assistant" to Action.Disable) }