-
Notifications
You must be signed in to change notification settings - Fork 8
Scrcpy Server Integration and Upgrade
星冉 edited this page Jul 21, 2026
·
1 revision
Last updated: 2026-07-22
Screen Remote currently bundles the official scrcpy server 4.1. app/build.gradle.kts is the single source of truth for version, download URL, asset path, and SHA-256:
scrcpyServerVersion = "4.1"- Asset:
app/src/main/assets/scrcpy-server.jar - Pre-build verification:
:app:verifyScrcpyServerVersion - Explicit update task:
:app:updateScrcpyServer
The wiki does not duplicate the exact hash, which could drift from Gradle.
- Server arguments explicitly enable
send_device_meta=trueandsend_stream_meta=true. - scrcpy assigns socket roles by
accept()order and has no client role handshake. - The client establishes video, optional audio, and control channels strictly and sequentially, never concurrently.
- All required channels and the video dummy byte must be ready before the connection set is exposed upstream.
- Fixed-size metadata uses complete reads; one read is never assumed to fill a header.
- Video and audio negotiate independently. An audio codec ID of zero may disable audio at runtime.
- Negotiated codecs and dimensions are runtime facts and do not overwrite user preferences.
- Remote display power is changed through the
SET_DISPLAY_POWERcontrol message, not an obsolete server startup option.
| Boundary | Current implementation |
|---|---|
| Server arguments and startup | infrastructure/scrcpy/connection/internal/ServerSetup.kt |
| SCID, forwarding, and sockets | infrastructure/scrcpy/connection/ |
| Video/audio metadata |
ConnectionMetadataReader.kt and infrastructure/scrcpy/stream/
|
| Control protocol | infrastructure/scrcpy/protocol/ScrcpyProtocol.kt |
| Control writes | infrastructure/scrcpy/controller/ScrcpyControllerTransport.kt |
| Server asset and verification | app/build.gradle.kts |
- Review upstream server protocol changes first; desktop client UI changes are not a substitute for protocol review.
- Update
scrcpyServerVersion, SHA-256, and affected client protocol implementation together. - Run
./gradlew :app:updateScrcpyServerto download and verify the asset through the build task. - Verify server arguments, socket count and order, dummy byte, metadata, packet formats, and control messages.
- Run protocol and socket-order tests, then the complete unit suite and debug build.
- Validate startup, video, optional audio, control, and cleanup on a real device through at least one of USB, TCP, or Wireless Debugging.
./gradlew testDebugUnitTest --tests '*ConnectionSocketOrderTest'
./gradlew testDebugUnitTest --tests '*ScrcpyStreamProtocolTest'
./gradlew :app:verifyScrcpyServerVersion
./gradlew assembleDebugWhen server interfaces, metadata, or control protocol change, add or update the corresponding focused tests as well.
- 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. / 技术主题仅在完成逐页审核后加入侧边栏。