tools: wireless-adb beacon — self-healing bridge across drops + port rotation

The phone's wireless-debug port rotates and the bridge drops; this makes
adb reconnect automatically. Three pieces:
- adb-beacon (Android dev app): reads adbd's own mDNS advertisement
  (_adb-tls-connect._tcp) via NsdManager for the live connect port — no
  root, no Shizuku — plus the wlan0 IPv4, and POSTs {ip,port} to fmr every
  time it changes (continuous NSD discovery catches rotation in seconds).
  Foreground service (specialUse) so it survives backgrounding.
- tools/adb-beacon/receiver.py: ~30-line rendezvous on fmr:9099 (secret-
  gated POST stores the latest endpoint; GET returns it). Deployed as
  echolot-adb-beacon.service.
- PC connector polls the endpoint and keeps `adb connect` current.

Dev tooling, separate from the product. Bootstrap: sideload the beacon
APK once (no adb needed); thereafter adb self-heals for everything.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrambossek
2026-07-31 21:50:33 +02:00
co-authored by Claude Opus 5
parent bc220f950e
commit 52748ac853
7 changed files with 376 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: 2026 Echolot contributors
// SPDX-License-Identifier: GPL-3.0-or-later
plugins {
// AGP 9 built-in Kotlin (no kotlin.android — see core-probe note).
alias(libs.plugins.android.application)
}
// Dev tool (NOT the product app): reports this phone's rotating wireless-debug
// endpoint to the fmr beacon so the PC can keep `adb connect` current. Reads
// the connect port from adbd's own mDNS advertisement (_adb-tls-connect._tcp)
// via NsdManager — no root, no Shizuku.
android {
namespace = "app.echo_lot.adbbeacon"
compileSdk = 36
defaultConfig {
applicationId = "app.echo_lot.adbbeacon"
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "0.1.0"
// Prefilled beacon config (dev tool — secret in the APK is fine).
buildConfigField("String", "BEACON_URL", "\"http://fmr-1.echo-lot.app:9099/beacon\"")
buildConfigField("String", "BEACON_SECRET", "\"D4OmG5gGJsElqVVbtYIZbR\"")
}
buildTypes { release { isMinifyEnabled = false } }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures { buildConfig = true }
}
dependencies {
implementation(libs.kotlinx.coroutines.android)
implementation(libs.androidx.core.ktx)
implementation("androidx.activity:activity:1.9.3")
}