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.

Answer the TV's "Allow debugging?" prompt from the phone

jesse-agent-23299c51844c64e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b1eff1..dea81a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ until this file has a section for its version.
- **New:** Faster animations: menus move at twice the speed. [#35](../../pull/35)
- **New:** Clear every app's cache in one tap; app data stays. [#35](../../pull/35)
- **New:** Save a screenshot of the TV to your phone. [#35](../../pull/35)
+- **New:** Allow or deny another device's connection request from your phone. [#36](../../pull/36)
## 0.1.0 — 2026-10-23
diff --git a/adb/src/main/kotlin/app/tellyscope/adb/ConnectionPrompt.kt b/adb/src/main/kotlin/app/tellyscope/adb/ConnectionPrompt.kt
new file mode 100644
index 0000000..1182721
--- /dev/null
+++ b/adb/src/main/kotlin/app/tellyscope/adb/ConnectionPrompt.kt
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-3.0-only
+package app.tellyscope.adb
+
+/** Another device's "Allow debugging?" prompt on the TV, with the key fingerprint it shows. */
+data class ConnectionRequest(val fingerprint: String)
+
+/**
+ * Answers the TV's own "Allow debugging?" prompt for another device, from the phone. Tellyscope
+ * never decides: it reads the prompt off the screen, shows its fingerprint, and presses the
+ * button the user picked. "Always allow" is only ticked when the user ticks it.
+ */
+class ConnectionPrompt(private val shell: AdbShell) {
+
+ /** The prompt on screen now, or null. Cheap enough to poll: one `dumpsys window` line. */
+ suspend fun pending(): ConnectionRequest? {
+ if (showing() == null) return null
+ return screen()?.let { ConnectionRequest(it.fingerprint) }
+ }
+
+ /**
+ * Presses Allow or Cancel on the prompt, but only while it still shows [request]'s
+ * fingerprint: a different device's prompt may have replaced it. False when it no longer does.
+ */
+ suspend fun answer(request: ConnectionRequest, allow: Boolean, always: Boolean): Boolean {
+ if (showing() == null) return false
+ val s = screen()?.takeIf { it.fingerprint == request.fingerprint } ?: return false
+ if (allow && s.always != null && s.always.checked != always) tap(s.always.bounds)
+ val button = (if (allow) s.allow else s.cancel) ?: return false
+ return tap(button)
+ }
+
+ /** The focused window's package when it's the system's debugging prompt. */
+ private suspend fun showing(): String? =
+ focused(shell.shell("dumpsys window | grep -E 'mCurrentFocus|mFocusedWindow'").output)
+
+ private suspend fun screen(): Prompt? = parse(shell.shell("uiautomator dump $DUMP >/dev/null 2>&1; cat $DUMP; rm -f $DUMP").output)
+
+ private suspend fun tap(b: Bounds) = shell.shell("input tap ${(b.left + b.right) / 2} ${(b.top + b.bottom) / 2}").exitCode == 0
+
+ data class Bounds(val left: Int, val top: Int, val right: Int, val bottom: Int)
+ data class Box(val bounds: Bounds, val checked: Boolean)
+ data class Prompt(val fingerprint: String, val allow: Bounds?, val cancel: Bounds?, val always: Box?)
+
+ companion object {
+ private const val DUMP = "/data/local/tmp/tellyscope-ui.xml"
+ private val NODE = Regex("<node [^>]*>")
+ private val ATTR = Regex("([\\w-]+)=\"([^\"]*)\"")
+ private val BOUNDS = Regex("\\[(\\d+),(\\d+)]\\[(\\d+),(\\d+)]")
+ /** adb shows the key's MD5 as 16 colon-separated hex pairs. */
+ private val FINGERPRINT = Regex("(?:[0-9A-Fa-f]{2}:){15}[0-9A-Fa-f]{2}")
+
+ /**
+ * The prompt in a `uiautomator dump`: AOSP's AlertDialog ids, from [SYSTEM] packages only.
+ * Null when there is no fingerprint.
+ */
+ /**
+ * Where the system draws the prompt: System UI on stock Android, and TV builds may move
+ * it. Only these count, so an app with a look-alike screen is never answered.
+ */
+ private val SYSTEM = setOf("com.android.systemui", "android", "com.android.tv.settings")
+ private val WINDOW = Regex("\\s([\\w.]+)/[\\w.$]*UsbDebugging[\\w.$]*")
+
+ /** The package of a focused `…/…UsbDebugging…` window in `dumpsys window`, if a system one. */
+ fun focused(dumpsys: String): String? = WINDOW.find(dumpsys)?.groupValues?.get(1)?.takeIf { it in SYSTEM }
+
+ fun parse(xml: String): Prompt? {
+ val nodes = NODE.findAll(xml).map { n -> ATTR.findAll(n.value).associate { it.groupValues[1] to it.groupValues[2] } }
+ .filter { it["package"] in SYSTEM }.toList()
+ fun id(name: String) = nodes.firstOrNull { it["resource-id"] == "android:id/$name" }
+ fun bounds(n: Map<String, String>?) = n?.get("bounds")?.let(BOUNDS::matchEntire)?.groupValues
+ ?.let { (_, l, t, r, b) -> Bounds(l.toInt(), t.toInt(), r.toInt(), b.toInt()) }
+ val fingerprint = id("message")?.get("text")?.let(FINGERPRINT::find)?.value?.uppercase() ?: return null
+ val always = id("alwaysUse")
+ return Prompt(
+ fingerprint = fingerprint,
+ allow = bounds(id("button1")),
+ cancel = bounds(id("button2")),
+ always = bounds(always)?.let { Box(it, always?.get("checked") == "true") },
+ )
+ }
+ }
+}
diff --git a/adb/src/test/kotlin/app/tellyscope/adb/ConnectionPromptTest.kt b/adb/src/test/kotlin/app/tellyscope/adb/ConnectionPromptTest.kt
new file mode 100644
index 0000000..d464c94
--- /dev/null
+++ b/adb/src/test/kotlin/app/tellyscope/adb/ConnectionPromptTest.kt
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-3.0-only
+package app.tellyscope.adb
+
+import kotlinx.coroutines.test.runTest
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertNull
+import kotlin.test.assertTrue
+
+class ConnectionPromptTest {
+ private val fp = "AB:CD:EF:01:23:45:67:89:AB:CD:EF:01:23:45:67:89"
+
+ private fun dump(fingerprint: String = fp, checked: Boolean = false, pkg: String = "com.android.systemui") = """
+ <?xml version='1.0' encoding='UTF-8' standalone='yes' ?><hierarchy rotation="0">
+ <node index="0" text="Allow USB debugging?" resource-id="android:id/alertTitle" package="$pkg" bounds="[200,300][1700,360]" />
+ <node index="1" text="The computer's RSA key fingerprint is:&#10;$fingerprint" resource-id="android:id/message" package="$pkg" bounds="[200,380][1700,480]" />
+ <node index="2" text="Always allow from this computer" resource-id="android:id/alwaysUse" checkable="true" checked="$checked" package="$pkg" bounds="[200,500][900,560]" />
+ <node index="3" text="Cancel" resource-id="android:id/button2" package="$pkg" bounds="[1200,600][1400,680]" />
+ <node index="4" text="Allow" resource-id="android:id/button1" package="$pkg" bounds="[1450,600][1650,680]" />
+ </hierarchy>
+ """.trimIndent()
+
+ private fun tv(xml: String, focus: String = "mCurrentFocus=Window{1 u0 com.android.systemui/com.android.systemui.usb.UsbDebuggingActivity}") =
+ FakeShell(mapOf("dumpsys window" to ok(focus), "uiautomator" to ok(xml)))
+
+ @Test fun readsTheFingerprint() = runTest {
+ assertEquals(ConnectionRequest(fp), ConnectionPrompt(tv(dump())).pending())
+ }
+
+ @Test fun noPromptNoDump() = runTest {
+ val sh = tv(dump(), focus = "mCurrentFocus=Window{1 u0 com.spocky.projengmenu/.ui.MainActivity}")
+ assertNull(ConnectionPrompt(sh).pending())
+ assertFalse(sh.ran.any { it.startsWith("uiautomator") })
+ }
+
+ @Test fun lookAlikeFromAnAppIsIgnored() = runTest {
+ assertNull(ConnectionPrompt.parse(dump(pkg = "com.evil.app")))
+ val sh = tv(dump(), focus = "mCurrentFocus=Window{1 u0 com.evil.app/com.evil.app.UsbDebuggingActivity}")
+ assertNull(ConnectionPrompt(sh).pending())
+ }
+
+ @Test fun allowLeavesAlwaysUnticked() = runTest {
+ val sh = tv(dump())
+ assertTrue(ConnectionPrompt(sh).answer(ConnectionRequest(fp), allow = true, always = false))
+ assertEquals(listOf("input tap 1550 640"), sh.ran.filter { it.startsWith("input") })
+ }
+
+ @Test fun alwaysIsTickedOnlyWhenAsked() = runTest {
+ val sh = tv(dump())
+ ConnectionPrompt(sh).answer(ConnectionRequest(fp), allow = true, always = true)
+ assertEquals(listOf("input tap 550 530", "input tap 1550 640"), sh.ran.filter { it.startsWith("input") })
+ }
+
+ @Test fun denyPressesCancel() = runTest {
+ val sh = tv(dump(checked = true))
+ ConnectionPrompt(sh).answer(ConnectionRequest(fp), allow = false, always = false)
+ assertEquals(listOf("input tap 1300 640"), sh.ran.filter { it.startsWith("input") })
+ }
+
+ @Test fun aDifferentPromptIsNotAnswered() = runTest {
+ val sh = tv(dump(fingerprint = "11:22:33:44:55:66:77:88:99:00:AA:BB:CC:DD:EE:FF"))
+ assertFalse(ConnectionPrompt(sh).answer(ConnectionRequest(fp), allow = true, always = false))
+ assertFalse(sh.ran.any { it.startsWith("input") })
+ }
+}
diff --git a/app/src/main/java/app/tellyscope/MainActivity.kt b/app/src/main/java/app/tellyscope/MainActivity.kt
index 5eeda05..ed08b3d 100644
--- a/app/src/main/java/app/tellyscope/MainActivity.kt
+++ b/app/src/main/java/app/tellyscope/MainActivity.kt
@@ -208,6 +208,7 @@ fun TellyscopeApp(vm: TellyscopeViewModel) {
setFastAnimations = vm::setFastAnimations,
clearCaches = vm::clearCaches,
screenshot = { saveScreenshot.launch(Copy.screenshotName(System.currentTimeMillis())) },
+ answerRequest = vm::answerRequest,
),
)
}
diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
index e04ca63..3ea0b2d 100644
--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
@@ -14,6 +14,8 @@ import app.tellyscope.adb.Sideload
import app.tellyscope.adb.TvFile
import app.tellyscope.adb.TvFolder
import app.tellyscope.adb.Actions
+import app.tellyscope.adb.ConnectionPrompt
+import app.tellyscope.adb.ConnectionRequest
import app.tellyscope.adb.Connector
import app.tellyscope.adb.DeviceLink
import app.tellyscope.adb.LabelHelper
@@ -440,6 +442,11 @@ class AdbDeviceSource(context: Context) : DeviceSource {
override suspend fun screenshot(deviceId: String, sink: Sink) = Tweaks(session(deviceId)).screenshot(sink)
+ override suspend fun connectionRequest(deviceId: String) = ConnectionPrompt(session(deviceId)).pending()
+
+ override suspend fun answerRequest(deviceId: String, request: ConnectionRequest, allow: Boolean, always: Boolean) =
+ ConnectionPrompt(session(deviceId)).answer(request, allow, always)
+
/**
* The history key for a TV, read from it once connected and saved with it. Until it has
* answered (offline since install) the address stands in, and that history moves over when
diff --git a/app/src/main/java/app/tellyscope/data/DeviceSource.kt b/app/src/main/java/app/tellyscope/data/DeviceSource.kt
index a3f7adf..5c1ce0d 100644
--- a/app/src/main/java/app/tellyscope/data/DeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/DeviceSource.kt
@@ -3,6 +3,7 @@
package app.tellyscope.data
import app.tellyscope.adb.ApkInfo
+import app.tellyscope.adb.ConnectionRequest
import app.tellyscope.adb.InstallResult
import app.tellyscope.adb.InstalledVersion
import app.tellyscope.adb.Progress
@@ -114,4 +115,13 @@ interface DeviceSource {
/** A PNG of what the TV shows right now, into [sink]. */
suspend fun screenshot(deviceId: String, sink: Sink)
+
+ /** Another device's "Allow debugging?" prompt showing on the TV now, or null. */
+ suspend fun connectionRequest(deviceId: String): ConnectionRequest?
+
+ /**
+ * Presses Allow or Cancel on that prompt, ticking "Always allow" only when [always]. False
+ * when the prompt was gone or showed another fingerprint by then.
+ */
+ suspend fun answerRequest(deviceId: String, request: ConnectionRequest, allow: Boolean, always: Boolean): Boolean
}
diff --git a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
index 5800afa..a0e1c75 100644
--- a/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/FakeDeviceSource.kt
@@ -3,6 +3,7 @@
package app.tellyscope.data
import app.tellyscope.adb.ApkInfo
+import app.tellyscope.adb.ConnectionRequest
import app.tellyscope.adb.InstallResult
import app.tellyscope.adb.InstalledVersion
import app.tellyscope.adb.Progress
@@ -333,6 +334,10 @@ class FakeDeviceSource(
throw IOException("the demo TV has no screen to capture")
}
+ override suspend fun connectionRequest(deviceId: String): ConnectionRequest? = null
+
+ override suspend fun answerRequest(deviceId: String, request: ConnectionRequest, allow: Boolean, always: Boolean) = false
+
private companion object {
val fakeList = DeviceList(
id = "xgimi-horizon-pro",
diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.kt
index 2adc4f0..68dfcfe 100644
--- a/app/src/main/java/app/tellyscope/ui/Copy.kt
+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt
@@ -313,4 +313,13 @@ object Copy {
"TV screenshot " + SimpleDateFormat("yyyy-MM-dd HH.mm.ss", Locale.ROOT).format(Date(at)) + ".png"
const val SCREENSHOT_SAVED = "Screenshot saved to your phone"
const val SCREENSHOT_FAILED = "Couldn't take a screenshot. Check the TV is still connected."
+ const val REQUEST_TITLE = "Another device wants to control this TV"
+ const val REQUEST_TEXT = "The TV is asking whether to allow debugging from a device with this key fingerprint. " +
+ "Allow it only if you started this yourself and the fingerprint matches the one that device shows."
+ const val REQUEST_ALWAYS = "Always allow this device"
+ const val REQUEST_ALLOW = "Allow"
+ const val REQUEST_DENY = "Deny"
+ const val REQUEST_ALLOWED = "Allowed. That device can control the TV now."
+ const val REQUEST_DENIED = "Denied. That device can't connect."
+ const val REQUEST_GONE = "The TV's prompt had closed or changed, so nothing was pressed."
}
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
index 0ade683..913a142 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceScreen.kt
@@ -128,6 +128,8 @@ data class DeviceActions(
val clearCaches: () -> Unit = {},
/** Asks where to save a screenshot of the TV on the phone, then takes it. */
val screenshot: () -> Unit = {},
+ /** Allow or Deny on another device's debugging prompt, and whether to always allow it. */
+ val answerRequest: (allow: Boolean, always: Boolean) -> Unit = { _, _ -> },
)
/** Off while the remote is made faster: the device page hides its Remote button. */
@@ -193,6 +195,7 @@ fun DeviceScreen(
// A reading from before the TV went away is stale: it doesn't speak for the TV now.
val live = snap?.takeIf { !offline }
item { TvCard(state, live, actions) }
+ if (!offline) ui.request?.let { r -> item { RequestCard(r, ui.busy == ANSWERING, actions.answerRequest) } }
val restart = state.restarting[device.id]
if (restart != null) {
item { RestartingCard(restart, state.now) }
diff --git a/app/src/main/java/app/tellyscope/ui/RequestCard.kt b/app/src/main/java/app/tellyscope/ui/RequestCard.kt
new file mode 100644
index 0000000..db37ca5
--- /dev/null
+++ b/app/src/main/java/app/tellyscope/ui/RequestCard.kt
@@ -0,0 +1,56 @@
+// 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.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.selection.toggleable
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.Checkbox
+import androidx.compose.material3.FilledTonalButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedButton
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+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.semantics.Role
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.unit.dp
+import app.tellyscope.adb.ConnectionRequest
+
+/**
+ * The TV's "Allow debugging?" prompt, answered from the phone. The fingerprint is always shown,
+ * "Always allow" starts unticked for every new request, and Deny comes first.
+ */
+@Composable
+fun RequestCard(request: ConnectionRequest, busy: Boolean, answer: (allow: Boolean, always: Boolean) -> Unit) {
+ var always by rememberSaveable(request.fingerprint) { mutableStateOf(false) }
+ Card(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.tertiaryContainer)) {
+ Column(Modifier.fillMaxWidth().padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Text(Copy.REQUEST_TITLE, style = MaterialTheme.typography.titleMedium)
+ Text(Copy.REQUEST_TEXT, style = MaterialTheme.typography.bodyMedium)
+ // Eight pairs a line, so a pair is never split when comparing it with the other device.
+ Text(request.fingerprint.split(':').chunked(8).joinToString("\n") { it.joinToString(":") }, style = MaterialTheme.typography.bodyMedium, fontFamily = FontFamily.Monospace)
+ Row(
+ Modifier.fillMaxWidth().toggleable(always, enabled = !busy, role = Role.Checkbox) { always = it },
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Checkbox(checked = always, onCheckedChange = null, enabled = !busy)
+ Text(Copy.REQUEST_ALWAYS, Modifier.padding(start = 8.dp), style = MaterialTheme.typography.bodyMedium)
+ }
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ FilledTonalButton(onClick = { answer(false, false) }, enabled = !busy) { Text(Copy.REQUEST_DENY) }
+ OutlinedButton(onClick = { answer(true, always) }, enabled = !busy) { Text(Copy.REQUEST_ALLOW) }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
index 62f27a2..d443f60 100644
--- a/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
+++ b/app/src/main/java/app/tellyscope/ui/TellyscopeViewModel.kt
@@ -5,6 +5,7 @@ package app.tellyscope.ui
import android.net.Uri
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
+import app.tellyscope.adb.ConnectionRequest
import app.tellyscope.adb.InstallKind
import app.tellyscope.adb.InstallResult
import app.tellyscope.adb.InstalledVersion
@@ -80,6 +81,8 @@ data class DeviceUi(
val lists: Suggestions? = null,
/** Private DNS and animation speed; null until read, or when the TV wouldn't say. */
val tweaks: TvTweaks? = null,
+ /** Another device asking the TV for debugging access; null when nothing is asking. */
+ val request: ConnectionRequest? = null,
)
data class SideloadUi(
@@ -138,6 +141,9 @@ const val DISABLING = "lists"
const val CLEARING = "caches"
const val SCREENSHOT = "screenshot"
+/** [DeviceUi.busy] value while the TV's connection prompt is being answered. */
+const val ANSWERING = "request"
+
class TellyscopeViewModel(
private val source: DeviceSource,
private val storage: PhoneStorage? = null,
@@ -168,6 +174,7 @@ class TellyscopeViewModel(
private var liveJob: Job? = null
private var mediumJob: Job? = null
private var listsJob: Job? = null
+ private var requestJob: Job? = null
init {
viewModelScope.launch {
@@ -277,6 +284,7 @@ class TellyscopeViewModel(
liveJob?.cancel()
mediumJob?.cancel()
listsJob?.cancel()
+ requestJob?.cancel()
_state.update { it.copy(selectedId = id, device = DeviceUi(snapshot = id?.let(lastSnapshot::get)), query = "") }
val device = _state.value.selected ?: return
// History lives on the phone, so it shows (and undo is offered) even while the TV is off.
@@ -293,6 +301,7 @@ class TellyscopeViewModel(
}
// Its own job: the list download never holds up apps or stats.
listsJob = viewModelScope.launch { loadLists(id!!) }
+ requestJob = viewModelScope.launch { watchRequests(id!!) }
mediumJob = viewModelScope.launch {
// A TV that drops mid-read throws; the live flow ends and the offline card takes over.
try {
@@ -669,6 +678,46 @@ class TellyscopeViewModel(
}
}
+ /**
+ * Another device's "Allow debugging?" prompt, checked every few seconds while the TV's page
+ * is open. A failed check just waits for the next one.
+ */
+ private suspend fun watchRequests(id: String) {
+ while (true) {
+ val request = try {
+ source.connectionRequest(id)
+ } catch (e: CancellationException) {
+ throw e
+ } catch (_: Exception) {
+ null
+ }
+ updateDevice(id) { if (it.busy == ANSWERING) it else it.copy(request = request) }
+ delay(5_000)
+ }
+ }
+
+ /** The user's answer to [DeviceUi.request]; nothing is ever answered without it. */
+ fun answerRequest(allow: Boolean, always: Boolean) {
+ val id = _state.value.selectedId ?: return
+ val request = _state.value.device.request ?: return
+ updateDevice(id) { it.copy(busy = ANSWERING) }
+ viewModelScope.launch {
+ val ok = try {
+ source.answerRequest(id, request, allow, always)
+ } catch (e: CancellationException) {
+ throw e
+ } catch (_: Exception) {
+ false
+ }
+ _notice.value = when {
+ !ok -> Copy.REQUEST_GONE
+ allow -> Copy.REQUEST_ALLOWED
+ else -> Copy.REQUEST_DENIED
+ }
+ updateDevice(id) { it.copy(busy = null, request = null) }
+ }
+ }
+
/** "Pick your TV": remember the choice for this TV and show its list. */
fun pickList(listId: String) {
val id = _state.value.selectedId ?: return
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index 1f0b7e7..0ce27d0 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -21,6 +21,7 @@ import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import app.tellyscope.adb.ApkInfo
+import app.tellyscope.adb.ConnectionRequest
import app.tellyscope.adb.InstallRefusal
import app.tellyscope.adb.InstalledVersion
import app.tellyscope.adb.Progress
@@ -425,6 +426,11 @@ class ScreenshotTest {
}) { DeviceScreen(deviceState { copy(history = history) }, DeviceActions()) }
}
+ @Test fun device_connectionRequest() = shot("17_device_request") {
+ val request = ConnectionRequest("AB:CD:EF:01:23:45:67:89:AB:CD:EF:01:23:45:67:89")
+ DeviceScreen(deviceState { copy(request = request) }, DeviceActions())
+ }
+
private val dir = Files.createTempDirectory("shots").toFile()
private fun apk(name: String, bytes: Long) = File(dir, name).also { RandomAccessFile(it, "rw").use { f -> f.setLength(bytes) } }
private val kodi = PickedApp(listOf(apk("kodi.apk", 74_000_000)), ApkInfo("org.xbmc.kodi", 2101, "21.1"), "Kodi")