-
Notifications
You must be signed in to change notification settings - Fork 8
Device Pairing and Wireless Debugging
Wireless Debugging has two independent phases: pairing establishes trust material, while connect establishes a verifiable TLS ADB transport. Pairing success is not connect success, and mDNS discovery is not automatic pairing.
- Enable Developer Options and Wireless Debugging on the controlled Android 11+ device.
- Choose “Pair device with pairing code” and obtain the pairing IP, temporary port, and code.
- Submit all three in the controller and wait for explicit pairing success or failure.
- Use the device's
_adb-tls-connect._tcpservice or a user-provided connect endpoint to establish the real ADB connection. - Only after ADB verification may management begin or scrcpy startup continue.
The pairing and connect ports are different concepts and must not be assumed fixed. Pairing codes and ports expire.
-
DevicePairingViewModeland pairing UI own input, progress, and user feedback. -
AdbPairingManager.pairWithCode()checks the Android version and callsAdbRuntimeProvider.get().pairWithCode(). - Pairing protocol, key and peer material, and TLS implementation live in the
external/dadbruntime. The main app does not duplicate the protocol. -
PairingEndpointMetadataManagerstores successful records used by UI and mDNS pairing recognition. Pairing codes are not persisted into long-lived docs or logs. -
AdbConnectionManager.connectMdnsService()resolves a TLS connect service and then creates network Dadb under an mDNS transport identity.
MdnsSessionDiscoveryManager consumes pairing and connect services from the dadb monitor and exposes monitoring, loading, online sessions, and selectable services as a StateFlow. UI expresses interactive consumers through acquire/release instead of maintaining another refresh timer or deduplication cache.
Keep these concepts separate:
- Service name: used for current resolution and user selection.
- Canonical mDNS serial: used for session presence matching and connection-pool identity.
- Resolved host and port: a temporary network endpoint, not session identity.
A pairing service may prompt the user to pair first. Only a connect service can be used for a direct connect attempt.
| Stage | Typical evidence | Next step |
|---|---|---|
| Discovery | No service, monitor stopped or failed | Check same-network reachability, Wireless Debugging, and monitor lifecycle |
| Pairing | Unsupported version, endpoint refusal, expired code | Reopen the device pairing screen and use the new pairing port and code |
| TLS connect | Service found but handshake or trust fails | Check peer material, connect service, and endpoint resolution |
| ADB verify | TLS established but serial or command verification fails | Inspect the ADB connector and runtime diagnostics |
| scrcpy | ADB management works but remote control does not | Inspect server, sockets, metadata, and decoders |
Primary log tags are ADBP for pairing and ADBC for connection and verification. Never log a complete pairing code, private key, or reusable sensitive material.
-
MdnsSessionPresenceTest: service normalization, presence matching, and pairing/connect merging. -
MdnsServiceSelectionTest: selection and pairing-prompt policy. -
DeviceTransportSerialTest: mDNS identity normalization. - Pairing, TLS trust, and Android system prompts still require Android 11+ device testing.
- Overview / 总览
- Quick Start / 快速开始
- Connection & Pairing / 连接设备与配对
- Session Management / 会话管理
- Remote Control / 远程控制
- Settings / 设置
- Management Features / 管理功能
- FAQ / 常见问题
- Overview / 总览
- Technical Index / 技术文档索引
- Audit Checklist / 初始化与更新清单
- Conventions / 文档维护约定
- Architecture / 架构
- Module Map / 模块地图与边界
- Runtime Path / 运行时主链路
- Session State / 会话状态与事件
- Session Lifecycle / 会话配置与连接生命周期
- ADB, USB & Wireless / ADB、USB 与无线
- ADB Lifecycle / ADB 连接生命周期
- Pairing / 设备配对与无线调试
- Codecs / 编码与解码
- Remote Interaction / 远程交互性能与悬浮菜单
- Clipboard / 剪贴板同步
- Management / 管理功能
- Events & Shell / 事件、监控与 Shell
- Logging / 日志系统与维护
- Troubleshooting / 分层排障方法
- UI Design / UI 设计系统
- Bilingual Copy / 双语与文案
- Remote UI Analysis / 远程 UI 布局分析
- Engineering Rules / 工程与验证规则
- External Research / 外部研究与取舍
Technical topics appear here only after their page-level audit is complete. / 技术主题仅在完成逐页审核后加入侧边栏。