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.
Remove the Temp reading everywhere
jesse-agent-232c19d3524a5d0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 18eb88b..7193402 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,7 @@ until this file has a section for its version.## Unreleased- **Improved:** Remote volume moves the full range in about 15 taps, without lag. [#267](../../pull/267)+- **Improved:** The Temp reading is gone, since many TVs don't let apps read it. [#PR](../../pull/PR)- **Fixed:** On Fire TV, making Projectivy Home now opens it straight away, without a Home press. [#263](../../pull/263)- **Fixed:** On Fire TV, Reset TV now puts Amazon's launcher back when Projectivy holds Home, by turning its accessibility service off. Undo turns it back on. [#263](../../pull/263)diff --git a/README.md b/README.mdindex 37e6aa2..febad21 100644--- a/README.md+++ b/README.md@@ -47,10 +47,10 @@ Debloat your Android TV, install apps, and browse and transfer files on it, all## What it does-Tellyscope talks to your Android TV, Google TV, NVIDIA Shield or Fire TV over Wi-Fi using ADB, the debugging protocol developers use. Tested on Fire TV (Fire OS 8); a few remote keys and the temperature reading don't work there yet. NVIDIA Shield hasn't been tested on real hardware yet.+Tellyscope talks to your Android TV, Google TV, NVIDIA Shield or Fire TV over Wi-Fi using ADB, the debugging protocol developers use. Tested on Fire TV (Fire OS 8); a few remote keys don't work there yet. NVIDIA Shield hasn't been tested on real hardware yet.- **Connect.** Finds TVs on your Wi-Fi, looking again every 10 seconds or when you tap **Rescan**, or add one by IP. Works with network debugging and with Android 11+ wireless debugging and its pairing code. TVs reconnect by themselves.-- **See how it's doing.** Free space, CPU, RAM, temperature and network speed, plus what's paired or plugged in. **Advanced monitor** has CPU and RAM by app, processes, network and data used.+- **See how it's doing.** Free space, CPU, RAM and network speed, plus what's paired or plugged in. **Advanced monitor** has CPU and RAM by app, processes, network and data used.- **Debloat.** Matches your TV to one of 330+ tested lists (adapted from [cleanyourtv](https://github.com/Gathin23/cleanyourtv)) and shows every app it will turn off before it does. Untick anything you use, or a whole group from its heading, then watch each app turn off. No list for your model? Pick from the maker's lists, or by hand.- **Apps.** See what's running and what's on the TV. Turn off apps you don't want, turn them back on any time, and uninstall the ones you added yourself.- **Install apps.** From an APK, split APKs or an `.apks`/`.xapk`/`.apkm` bundle on your phone; the picker opens in Downloads and shows only apps. It says first whether it's new, an update or an older version.diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Commands.kt b/adb/src/main/kotlin/app/tellyscope/adb/Commands.ktindex f958d4c..4743b3d 100644--- a/adb/src/main/kotlin/app/tellyscope/adb/Commands.kt+++ b/adb/src/main/kotlin/app/tellyscope/adb/Commands.kt@@ -7,18 +7,14 @@ package app.tellyscope.adbinternal object Commands {const val SEP = "@@tellyscope@@"- const val THERMAL =- "for z in /sys/class/thermal/thermal_zone*; do echo \"$(cat \$z/type 2>/dev/null)=$(cat \$z/temp 2>/dev/null)\"; done"-/** Every 2 s: CPU counters, memory and the byte counters for network speed. */val FAST = listOf("cat /proc/stat", "cat /proc/meminfo", "cat /proc/net/dev").batch()- /** Every 60 s and on open: identity, storage, uptime, temperature. */+ /** Every 60 s and on open: identity, storage, uptime, packages. */val SLOW = listOf("getprop","df -k /data","cat /proc/uptime",- THERMAL,PACKAGES,).batch()diff --git a/adb/src/main/kotlin/app/tellyscope/adb/DeviceMonitor.kt b/adb/src/main/kotlin/app/tellyscope/adb/DeviceMonitor.ktindex 73d727c..41a346c 100644--- a/adb/src/main/kotlin/app/tellyscope/adb/DeviceMonitor.kt+++ b/adb/src/main/kotlin/app/tellyscope/adb/DeviceMonitor.kt@@ -22,7 +22,6 @@ data class Stats(val memory: Parsers.Memory?,val storage: Parsers.Storage? = null,val uptimeSeconds: Long? = null,- val temperatureC: Double? = null,val model: String? = null,val manufacturer: String? = null,/** The name on the box; the manufacturer can be the factory (Philips TVs say TPV). */@@ -116,7 +115,7 @@ class StatsGate {/*** Live stats on three tiers, at the rates of [StatsGate.profile]: CPU/RAM/network speed, the process- * list (read at once when its level changes), and identity/storage/uptime/temperature/packages every+ * list (read at once when its level changes), and identity/storage/uptime/packages every* [slow]. Reads run one after another, never overlapping: a tier slower than its interval just* reads back to back. A new profile takes effect at once, not after the old interval.* The first emission comes after one fast interval, since CPU % needs two samples.@@ -267,14 +266,13 @@ class DeviceMonitor(}private suspend fun readSlow(): Stats? {- val (getprop, df, uptime, thermal, pm) = Commands.split(run(Commands.SLOW) ?: return null, 5)+ val (getprop, df, uptime, pm) = Commands.split(run(Commands.SLOW) ?: return null, 4)val props = Parsers.props(getprop)return Stats(cpuPercent = null,memory = null,storage = Parsers.storage(df),uptimeSeconds = Parsers.uptimeSeconds(uptime),- temperatureC = Parsers.temperatureC(thermal),model = props["ro.product.model"],manufacturer = props["ro.product.manufacturer"],brand = props["ro.product.brand"],diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Parsers.kt b/adb/src/main/kotlin/app/tellyscope/adb/Parsers.ktindex 9df4972..7fe7051 100644--- a/adb/src/main/kotlin/app/tellyscope/adb/Parsers.kt+++ b/adb/src/main/kotlin/app/tellyscope/adb/Parsers.kt@@ -53,22 +53,6 @@ object Parsers {fun uptimeSeconds(procUptime: String): Long? =procUptime.trim().substringBefore(' ').toDoubleOrNull()?.toLong()- /**- * Output of [Commands.THERMAL]: `type=millidegrees` lines. Prefers a CPU/SoC zone, otherwise- * the hottest plausible one. Null when nothing readable, so the UI shows a dash, never 0.- */- fun temperatureC(thermal: String): Double? {- val zones = thermal.lineSequence().mapNotNull { line ->- val type = line.substringBefore('=', "").trim().lowercase()- val raw = line.substringAfter('=', "").trim().toDoubleOrNull() ?: return@mapNotNull null- val c = if (raw > 1000) raw / 1000 else raw // some kernels report whole degrees- if (c in 1.0..150.0) type to c else null- }.toList()- if (zones.isEmpty()) return null- val cpu = zones.filter { (t, _) -> listOf("cpu", "soc", "tsens", "core").any { t.contains(it) } }- return (cpu.ifEmpty { zones }).maxOf { it.second }- }-data class Package(val name: String, val uid: Int?, val versionCode: Long? = null)/**diff --git a/adb/src/test/kotlin/app/tellyscope/adb/DeviceMonitorTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/DeviceMonitorTest.ktindex bfe5ca3..96939ec 100644--- a/adb/src/test/kotlin/app/tellyscope/adb/DeviceMonitorTest.kt+++ b/adb/src/test/kotlin/app/tellyscope/adb/DeviceMonitorTest.kt@@ -33,7 +33,7 @@ class DeviceMonitorTest {} else {ok("[ro.product.model]: [XK03H]\n[ro.build.version.sdk]: [30]\n$sep" +"Filesystem 1K-blocks Used Available Use% Mounted on\n/dev/x 16000 9800 6200 62% /data\n$sep" +- "300.5 100.0\n$sep" + "cpu-thermal=52000\n")+ "300.5 100.0\n")}}}@@ -44,7 +44,6 @@ class DeviceMonitorTest {assertEquals(Parsers.Memory(2000, 500), s.memory)assertEquals(Parsers.Storage(16000, 9800), s.storage)assertEquals(300L, s.uptimeSeconds)- assertEquals(52.0, s.temperatureC)assertEquals("XK03H", s.model)assertEquals(30, s.sdk)}@@ -82,7 +81,7 @@ class DeviceMonitorTest {"PID USER RES %CPU NAME\n2201 u0_a87 312M 3.5 com.google.android.youtube.tv\n512 system 120M 9.0 system_server\n" +"$sep mWakefulness=Asleep\n",)- else -> ok("$sep$sep$sep${sep}package:com.google.android.youtube.tv uid:10087\n")+ else -> ok("$sep$sep${sep}package:com.google.android.youtube.tv uid:10087\n")}}val s = DeviceMonitor(tv).stats().first()@@ -189,7 +188,7 @@ class DeviceMonitorTest {command.startsWith("cat /proc/stat") -> ok("cpu 25 0 0 75 0 0 0 0\n@@tellyscope@@\nMemTotal: 2000 kB\n")command.startsWith("ps -A") -> ok(ps)command == "ps" -> ok(plain)- command.startsWith("getprop") -> ok("${SEP.repeat(4)}package:com.google.android.youtube.tv uid:10087\n")+ command.startsWith("getprop") -> ok("${SEP.repeat(3)}package:com.google.android.youtube.tv uid:10087\n")else -> ok("")}}diff --git a/adb/src/test/kotlin/app/tellyscope/adb/ParsersTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/ParsersTest.ktindex eff3170..b7c9ba0 100644--- a/adb/src/test/kotlin/app/tellyscope/adb/ParsersTest.kt+++ b/adb/src/test/kotlin/app/tellyscope/adb/ParsersTest.kt@@ -30,13 +30,6 @@ class ParsersTest {assertNull(Parsers.storage("df: /data: Permission denied\n"))}- @Test fun temperaturePrefersCpuZoneAndScales() {- assertEquals(52.0, Parsers.temperatureC("battery=30000\ncpu-thermal=52000\ngpu=61000\n"))- assertEquals(61.0, Parsers.temperatureC("battery=30000\ngpu=61000\n"))- assertEquals(45.0, Parsers.temperatureC("soc_thermal=45\n"))- assertNull(Parsers.temperatureC("=\ncpu=\nx=-40000\n"))- }-@Test fun packagesWithUid() {val out = "package:com.google.android.youtube.tv uid:10087\npackage:android uid:1000\npackage:com.shared uid:10050,10051\njunk\n"assertEquals(diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.ktindex 4c96455..d6dadfc 100644--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt@@ -348,7 +348,6 @@ class AdbDeviceSource(context: Context) : DeviceSource {ramTotalMb = mem?.let { (it.totalKb / 1024).toInt() } ?: 0,storageUsedGb = s.storage?.let { it.usedKb / 1_048_576.0 },storageTotalGb = s.storage?.let { it.totalKb / 1_048_576.0 },- tempC = s.temperatureC?.toInt(),uptimeSeconds = s.uptimeSeconds ?: 0,screenOn = s.screenOn,procs = s.processes.map { Proc(it.pid, it.name, it.packageName, it.cpuPercent ?: 0.0, (it.rssKb / 1024).toInt()) },diff --git a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.ktindex 8a00bc6..d6f3af5 100644--- a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt+++ b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt@@ -163,7 +163,6 @@ class FakeDeviceSource(ramTotalMb = 2048,storageUsedGb = 9.8,storageTotalGb = 16.0,- tempC = 52 + random.nextInt(-1, 2),uptimeSeconds = 3 * 86_400L + 4 * 3_600L,screenOn = true,procs = procs,diff --git a/app/src/main/java/app/tellyscope/data/Model.kt b/app/src/main/java/app/tellyscope/data/Model.ktindex 0a1f8e2..d063dac 100644--- a/app/src/main/java/app/tellyscope/data/Model.kt+++ b/app/src/main/java/app/tellyscope/data/Model.kt@@ -60,7 +60,7 @@ data class Device(/*** The slow-changing facts from a TV's last good reading, saved on the phone so an offline TV- * (even after a restart) still shows them. Live numbers (CPU, RAM, temp, network) are never kept.+ * (even after a restart) still shows them. Live numbers (CPU, RAM, network) are never kept.*/data class LastKnown(val manufacturer: String? = null,@@ -97,7 +97,6 @@ data class Snapshot(val ramTotalMb: Int,val storageUsedGb: Double?,val storageTotalGb: Double?,- val tempC: Int?,val uptimeSeconds: Long,val screenOn: Boolean?,val procs: List<Proc>,diff --git a/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt b/app/src/main/java/app/tellyscope/ui/AdvancedScreen.ktindex 5933d8a..2bc6822 100644--- a/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/AdvancedScreen.kt@@ -145,7 +145,6 @@ private fun Block(title: String, body: @Composable () -> Unit) {private fun Stats(s: Snapshot, staleSince: Long?) {val cells = listOf("CPU" to "${s.cpuPercent}%",- "Temperature" to s.tempC?.let { "$it°C" },"On for" to Copy.uptime(s.uptimeSeconds),"Screen" to s.screenOn?.let { if (it) "On" else "Off" },)diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.ktindex f203402..363e7a0 100644--- a/app/src/main/java/app/tellyscope/ui/Copy.kt+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt@@ -462,13 +462,11 @@ object Copy {return when {storage != null && storage >= FULL -> Health(false, "Storage almost full")ram != null && ram >= FULL -> Health(false, "Memory almost full$most")- (s.tempC ?: 0) >= HOT_C -> Health(false, "Running hot")else -> Health(true, "Running fine")}}const val FULL = 0.9- private const val HOT_C = 80fun bytes(v: Long): String = when {v >= 1L shl 30 -> "%.1f GB".format(v / (1L shl 30).toDouble())diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.ktindex 6db0f76..057e748 100644--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt@@ -139,7 +139,7 @@ data class DeviceActions(/*** The TV's vitals in one small card: internal storage as a full bar, since it decides whether an- * install fits, then CPU, RAM, temperature and network speed as plain numbers.+ * install fits, then CPU, RAM and network speed as plain numbers.*/@Composableinternal fun SystemWidget(s: Snapshot) = SystemWidget(s.storageUsedGb, s.storageTotalGb, s)@@ -177,7 +177,6 @@ internal fun SystemWidget(usedGb: Double?, totalGb: Double?, live: Snapshot?, asRow {Vital("CPU", live?.let { "${it.cpuPercent}%" } ?: dash, Modifier.weight(1f))Vital("RAM", live?.takeIf { it.ramTotalMb > 0 }?.let { "${it.ramUsedMb * 100 / it.ramTotalMb}%" } ?: dash, Modifier.weight(1f))- Vital("Temp", live?.tempC?.let { "$it\u00b0C" } ?: dash, Modifier.weight(1f))Vital("Network", live?.netBytesPerSec?.let(Copy::speed) ?: dash, Modifier.weight(1.3f))}}diff --git a/app/src/test/java/app/tellyscope/HealthTest.kt b/app/src/test/java/app/tellyscope/HealthTest.ktindex c50a86d..3c7887a 100644--- a/app/src/test/java/app/tellyscope/HealthTest.kt+++ b/app/src/test/java/app/tellyscope/HealthTest.kt@@ -8,19 +8,17 @@ import org.junit.Assert.assertEqualsimport org.junit.Testclass HealthTest {- private fun snap(ram: Double = 0.5, storage: Double? = 0.5, temp: Int? = 50) = Snapshot(+ private fun snap(ram: Double = 0.5, storage: Double? = 0.5) = Snapshot(at = 0, cpuPercent = 10,ramUsedMb = (ram * 1000).toInt(), ramTotalMb = 1000,storageUsedGb = storage?.let { it * 10 }, storageTotalGb = storage?.let { 10.0 },- tempC = temp, uptimeSeconds = 60, screenOn = true, procs = emptyList(),+ uptimeSeconds = 60, screenOn = true, procs = emptyList(),)@Test fun fine() = assertEquals(Copy.Health(true, "Running fine"), Copy.health(snap(), listOf("YouTube")))- @Test fun storageBeforeMemoryBeforeHeat() {- assertEquals("Storage almost full", Copy.health(snap(ram = 0.95, storage = 0.95, temp = 90), emptyList()).text)- assertEquals("Memory almost full", Copy.health(snap(ram = 0.95, temp = 90), emptyList()).text)- assertEquals("Running hot", Copy.health(snap(temp = 90), emptyList()).text)+ @Test fun storageBeforeMemory() {+ assertEquals("Storage almost full", Copy.health(snap(ram = 0.95, storage = 0.95), emptyList()).text)}@Test fun thresholdIsNinetyPercent() {@@ -38,6 +36,6 @@ class HealthTest {}@Test fun missingStatsAreNotProblems() {- assertEquals(true, Copy.health(snap(storage = null, temp = null), emptyList()).ok)+ assertEquals(true, Copy.health(snap(storage = null), emptyList()).ok)}}diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.ktindex e4d6170..97c56b7 100644--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt@@ -797,7 +797,7 @@ class ScreenshotTest {// Away, storage shows as it was last seen; the live numbers are dashes.compose.onNodeWithText("As of ", substring = true).assertExists()compose.onNodeWithText("Internal storage").assertExists()- compose.onAllNodesWithText("\u2014").assertCountEquals(4)+ compose.onAllNodesWithText("\u2014").assertCountEquals(3)compose.onNodeWithText("Updated ", substring = true).assertExists()// No Remote while the TV is away.compose.onNodeWithText("Remote", useUnmergedTree = true).assertDoesNotExist()diff --git a/docs/screenshots/tv-page.png b/docs/screenshots/tv-page.pngindex b81d6c9..45cd554 100644Binary files a/docs/screenshots/tv-page.png and b/docs/screenshots/tv-page.png differ