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 the package id next to the app's own name

jesse-agent-232b447d820ca3b
diff --git a/app/src/helper/java/app/tellyscope/helper/Labels.java b/app/src/helper/java/app/tellyscope/helper/Labels.java
index 84945d6..c3a7edc 100644
--- a/app/src/helper/java/app/tellyscope/helper/Labels.java
+++ b/app/src/helper/java/app/tellyscope/helper/Labels.java
@@ -50,7 +50,9 @@ public final class Labels {
string(out, ai.loadLabel(pm).toString());
out.print(",\"v\":");
out.print(versionCode(p));
- String icon = icon(ai.loadIcon(pm));
+ // TV-only apps often ship a banner and no icon, which would draw as the generic robot.
+ Drawable art = ai.icon == 0 && ai.banner != 0 ? ai.loadBanner(pm) : ai.loadIcon(pm);
+ String icon = icon(art);
if (icon != null) {
out.print(",\"i\":\"");
out.print(icon);
@@ -86,7 +88,15 @@ public final class Labels {
if (d == null) return null;
try {
Bitmap b = Bitmap.createBitmap(ICON_PX, ICON_PX, Bitmap.Config.ARGB_8888);
- d.setBounds(0, 0, ICON_PX, ICON_PX);
+ // Fit, centred: a 16:9 banner keeps its shape instead of being squashed square.
+ int w = d.getIntrinsicWidth(), h = d.getIntrinsicHeight();
+ if (w > 0 && h > 0 && w != h) {
+ int fw = w > h ? ICON_PX : ICON_PX * w / h;
+ int fh = w > h ? ICON_PX * h / w : ICON_PX;
+ d.setBounds((ICON_PX - fw) / 2, (ICON_PX - fh) / 2, (ICON_PX + fw) / 2, (ICON_PX + fh) / 2);
+ } else {
+ d.setBounds(0, 0, ICON_PX, ICON_PX);
+ }
d.draw(new Canvas(b));
ByteArrayOutputStream png = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 100, png);
diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.kt
index de6a8c0..bcad8be 100644
--- a/app/src/main/java/app/tellyscope/ui/Copy.kt
+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt
@@ -23,11 +23,17 @@ object Copy {
Action.Open -> "Yes, open it"
}
- fun explain(action: Action, app: String) = when (action) {
- Action.Stop -> "Stops $app until you open it again."
- Action.Disable -> "Hides $app and stops it running. Nothing is deleted; you can turn it back on here."
- Action.Enable -> "Turns $app back on."
- Action.Open -> "Opens $app on the TV."
+ /**
+ * Names the package next to the label: the label comes from the app itself, and any app can
+ * call itself "Settings". The package id is what actually gets changed.
+ */
+ fun explain(action: Action, app: String, pkg: String) = "$app ($pkg)".let { who ->
+ when (action) {
+ Action.Stop -> "Stops $who until you open it again."
+ Action.Disable -> "Hides $who and stops it running. Nothing is deleted; you can turn it back on here."
+ Action.Enable -> "Turns $who back on."
+ Action.Open -> "Opens $who on the TV."
+ }
}
fun done(action: Action, app: String) = when (action) {
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
index e8b3052..3d66192 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
@@ -441,7 +441,10 @@ private fun EmptyLine(q: String) {
@Composable
fun AppIcon(app: AppInfo, modifier: Modifier = Modifier) {
- val image = remember(app.icon) { app.icon?.let { BitmapFactory.decodeByteArray(it, 0, it.size)?.asImageBitmap() } }
+ val image = remember(app.icon) {
+ // A 96 px icon is a few KB; anything far bigger is a TV sending something odd.
+ app.icon?.takeIf { it.size <= 64 * 1024 }?.let { BitmapFactory.decodeByteArray(it, 0, it.size)?.asImageBitmap() }
+ }
if (image != null) {
Image(image, contentDescription = null, modifier.size(40.dp).clip(MaterialTheme.shapes.medium))
return
@@ -486,6 +489,8 @@ private fun AppRow(
val proposed = pending?.takeIf { it.first == app.packageName }?.second
AnimatedVisibility((open || proposed != null) && app.protectedReason == null) {
Column(Modifier.padding(start = 52.dp, top = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ // The label is whatever the app calls itself; the package id is what an action touches.
+ Text(app.packageName, style = SmallNumber, color = MaterialTheme.colorScheme.onSurfaceVariant)
if (proposed == null) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
if (app.enabled && ram > 0) OutlinedButton(onClick = { actions.propose(app.packageName, Action.Stop) }) { Text(Copy.button(Action.Stop)) }
@@ -493,7 +498,7 @@ private fun AppRow(
else FilledTonalButton(onClick = { actions.propose(app.packageName, Action.Enable) }) { Text(Copy.button(Action.Enable)) }
}
} else {
- Text(Copy.explain(proposed, app.label), style = MaterialTheme.typography.bodyMedium)
+ Text(Copy.explain(proposed, app.label, app.packageName), style = MaterialTheme.typography.bodyMedium)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(onClick = actions.confirm) { Text(Copy.confirm(proposed)) }
TextButton(onClick = actions.cancel) { Text("Cancel") }