Link test: UDP echo sweep, soak and TCP each way, driven by the app
CI / Analyze & Test (push) Successful in 10s
CI / Debug APK (push) Successful in 25s

The tablet's app sockets are the only ones bound to the USB link, so the
measurement has to run in the app. tool/linktest_server.py serves the
Orin end and logs every result with its own TCP_INFO. Startable without
touching the screen: am start ... --es linktest <label>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
2026-10-11 15:55:52 +09:00
parent f14202047f
commit 6b5fef41c4
5 changed files with 416 additions and 6 deletions
@@ -1,6 +1,7 @@
package dev.yukart.display
import android.content.Context
import android.content.Intent
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
@@ -20,12 +21,16 @@ import io.flutter.plugin.common.MethodChannel
* default network while WiFi or cellular is up, and ordinary sockets go elsewhere.
* When asked, the whole process is bound to the Ethernet (NCM) network while it
* exists, and unbound when it goes.
*
* Also a development hook: `am start -n dev.yukart.display/.MainActivity --es linktest <label>`
* runs the link test (lib/linktest.dart) without touching the screen.
*/
class MainActivity : FlutterActivity() {
private lateinit var channel: MethodChannel
private lateinit var cm: ConnectivityManager
private var ethernet: Network? = null
private var wantBinding = false
private var pendingLinkTest: String? = null
private val callback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
@@ -44,6 +49,12 @@ class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
pendingLinkTest = intent?.getStringExtra("linktest")
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
intent.getStringExtra("linktest")?.let { channel.invokeMethod("linktest", it) }
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
@@ -57,6 +68,10 @@ class MainActivity : FlutterActivity() {
apply()
result.success(ethernet != null)
}
"takeLinkTest" -> {
result.success(pendingLinkTest)
pendingLinkTest = null
}
else -> result.notImplemented()
}
}