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.

Reports list the Android core last instead of leaving it out

jesse-agent-232f4a83ef9a086
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/Reports.kt b/adb/src/main/kotlin/app/tellyscope/adb/Reports.kt
index 11bfa3d..591442b 100644
--- a/adb/src/main/kotlin/app/tellyscope/adb/Reports.kt
+++ b/adb/src/main/kotlin/app/tellyscope/adb/Reports.kt
@@ -170,17 +170,19 @@ object Reports {
}
/**
- * "Help add this TV": cleanyourtv's tv-list.yml, with the apps the TV came with. The Android
- * core every TV has is only counted; of the rest, the issue lists as many as fit.
+ * "Help add this TV": cleanyourtv's tv-list.yml, with the apps the TV came with, as many as fit.
+ * The Android core every TV has comes last, so it's what the budget cuts first; debloat lists
+ * still turn some of it off, so it isn't dropped.
*/
fun newTv(app: AppFacts, tv: TvFacts, stage: Stage, details: String): Report {
- val (core, listed) = tv.stockPackages.partition(::isCore)
+ val (core, own) = tv.stockPackages.partition(::isCore)
+ val listed = own + core
val written = Redact.text(details.trim(), tv.identifiers)
return fit(listed.size) { keep ->
val more = listed.size - keep
val body = buildString {
if (written.isNotEmpty()) append(written).append("\n\n")
- append("Apps the TV came with (${listed.size}, plus ${core.size} Android core):\n")
+ append("Apps the TV came with (${own.size} maker and Google, ${core.size} Android core):\n")
listed.take(keep).forEach { append(it).append("\n") }
if (more > 0) append("+$more more, added as a comment\n")
append("\nUser-installed apps: ${tv.userApps} (not listed)\n")
@@ -203,7 +205,7 @@ object Reports {
}
}
- /** `android` and `com.android.*`: on every TV, and never what a debloat list is about. */
+ /** `android` and `com.android.*`: on every TV, so the least a list of this one's apps needs. */
private fun isCore(pkg: String) = pkg == "android" || pkg.startsWith("com.android.")
/**
@@ -222,7 +224,7 @@ object Reports {
val bare = build(0)
val details = bare.fields.getValue("details")
var chars = details.length
- while (chars > 0 && bare.copy(fields = bare.fields + ("details" to details.take(chars) + CUT)).link.length > Report.MAX_URL) chars -= 200
+ while (chars > 0 && bare.copy(fields = bare.fields + ("details" to details.take(chars) + CUT)).link.length > Report.MAX_URL) chars = (chars - 200).coerceAtLeast(0)
return bare.copy(
fields = bare.fields + ("details" to details.take(chars) + CUT),
rest = listOfNotNull(details.drop(chars), bare.rest).joinToString("\n\n"),
diff --git a/adb/src/test/kotlin/app/tellyscope/adb/ReportsTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/ReportsTest.kt
index ab1230f..ccdd593 100644
--- a/adb/src/test/kotlin/app/tellyscope/adb/ReportsTest.kt
+++ b/adb/src/test/kotlin/app/tellyscope/adb/ReportsTest.kt
@@ -55,7 +55,7 @@ class ReportsTest {
assertEquals("Android 11 (API 30), build RTT1.230922.001", q["android"])
assertEquals("Could not connect over ADB", q["stage"])
val details = q.getValue("details")
- assertTrue(details.startsWith("Stuck at Allow\n\nApps the TV came with (2, plus 0 Android core):\ncom.google.android.tvlauncher\ncom.xgimi.filemanager\n"), details)
+ assertTrue(details.startsWith("Stuck at Allow\n\nApps the TV came with (2 maker and Google, 0 Android core):\ncom.google.android.tvlauncher\ncom.xgimi.filemanager\n"), details)
assertTrue("User-installed apps: 7 (not listed)" in details)
}
@@ -66,24 +66,22 @@ class ReportsTest {
}
@Test fun longAppListFitsTheLinkAndTheRestWaitsForAComment() {
- val big = tv.copy(stockPackages = (1..400).map { "com.vendor.app%03d".format(it) } + listOf("android", "com.android.providers.tv"))
+ val vendor = (1..400).map { "com.vendor.app%03d".format(it) }
+ val big = tv.copy(stockPackages = listOf("android", "com.android.printspooler") + vendor)
val r = Reports.newTv(app, big, Reports.Stage.HERE_IS_MY_LIST, "")
assertTrue(r.link.length <= Report.MAX_URL, "${r.link.length}")
val details = query(r.link).getValue("details")
- assertTrue(details.startsWith("Apps the TV came with (400, plus 2 Android core):\ncom.vendor.app001\n"), details)
- val shown = details.lines().count { it.startsWith("com.vendor.") }
- assertTrue(shown in 100..399, "$shown")
- assertTrue("+${400 - shown} more, added as a comment" in details, details)
- // Every app is either in the issue or in the comment, once.
- val rest = r.rest!!.lines().drop(1)
- assertEquals((1..400).map { "com.vendor.app%03d".format(it) }, details.lines().filter { it.startsWith("com.vendor.") } + rest)
- assertFalse("com.android.providers.tv" in details + r.rest)
- }
-
- @Test fun androidCoreIsOnlyCounted() {
- val details = Reports.newTv(app, tv.copy(stockPackages = listOf("android", "com.android.systemui", "com.google.android.katniss")), Reports.Stage.HERE_IS_MY_LIST, "").fields.getValue("details")
- assertTrue("Apps the TV came with (1, plus 2 Android core):\ncom.google.android.katniss\n" in details, details)
- assertFalse("systemui" in details)
+ assertTrue(details.startsWith("Apps the TV came with (400 maker and Google, 2 Android core):\ncom.vendor.app001\n"), details)
+ val shown = details.lines().filter { it.startsWith("com.") || it == "android" }
+ assertTrue(shown.size in 100..399, "${shown.size}")
+ assertTrue("+${402 - shown.size} more, added as a comment" in details, details)
+ // Every app is in the issue or in the comment, once, and the Android core is what's cut first.
+ assertEquals(vendor + listOf("android", "com.android.printspooler"), shown + r.rest!!.lines().drop(1))
+ }
+
+ @Test fun androidCoreComesLastNotOut() {
+ val details = Reports.newTv(app, tv.copy(stockPackages = listOf("android", "com.android.printspooler", "com.google.android.katniss")), Reports.Stage.HERE_IS_MY_LIST, "").fields.getValue("details")
+ assertTrue("Apps the TV came with (1 maker and Google, 2 Android core):\ncom.google.android.katniss\nandroid\ncom.android.printspooler\n" in details, details)
}
@Test fun longLogKeepsItsNewestLines() {