Feature: Add remote lock screen for Android hosts

Implement the Ctrl+Alt+Del path on Android as a system lock screen.
Android has no secure attention sequence, so COMMAND_SCREEN_CTRL_ALT_DEL
is mapped in the client to GLOBAL_ACTION_LOCK_SCREEN and the server
exposes it as the new MCP tool remote_lock_screen.

The Android client resolves ControlService.lockScreen()/canLockScreen()
in nativeInit and dispatches the command from the screen sub-connection
through the usual attach/detach JNI path. The lock action is posted to
the accessibility service handler because performGlobalAction must not
run on the receiver thread.

Login advertises the new CLIENT_CAP_LOCK_SCREEN bit only when the
accessibility service is bound and the API level is 28+, so the server
can reject old APKs and Windows/Linux hosts up front instead of
reporting a lock that never happened. There is no receipt: a successful
call only means the command was delivered, and the tool description
tells the caller to confirm with get_screenshot.

Server side adds the schema and handler next to remote_clipboard, audits
the call, and gates it on client type plus the capability bit. Since it
is the only APK-only tool, check_platform_table.py gains a documented
exemption from the Windows baseline invariant, and make_tools_json.py
learns an APK-only platform set. tools.json is regenerated from the live
server and the plan document now counts 62 tools.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-11 20:59:10 +01:00
1 parent 0a0b709e8a
commit fd1b085279
11 files changed
+264 -14

No files matched your search

+32 -1
View File
@@ -15,7 +15,7 @@
],
"version": 2,
"protocolVersion": "2025-06-18",
"toolCount": 61,
"toolCount": 62,
"tools": [
{
"name": "list_online_hosts",
@@ -2727,6 +2727,37 @@
"type": "object"
}
},
{
"name": "remote_lock_screen",
"description": "把远程 Android 主机锁屏。报文是 COMMAND_SCREEN_CTRL_ALT_DEL(客户端的 Ctrl+Alt+Del 命令,目前只有 Android 实现:没有该组合键,客户端映射为系统的 GLOBAL_ACTION_LOCK_SCREEN)。需先 remote_open 建立会话;锁定后锁屏界面会挡住后续注入,要继续操作得先有人解锁(密码/指纹)。没有回执:ok 只代表命令已下发,实际是否锁上取决于系统策略(例如已设置设备管理器策略、部分定制 ROM 可能忽略),请随后用 get_screenshot 确认。只有声明 CLIENT_CAP_LOCK_SCREEN 的新版 APK 支持,老 APK 与 Windows/Linux 主机返回 -32005。",
"gate": "remote_control",
"write": true,
"platforms": [
"apk"
],
"impl": "mfc",
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {
"description": "remote_open 返回的 session_id",
"type": "string"
}
},
"required": [
"id",
"session_id"
],
"type": "object"
},
"outputSchema": {
"properties": {},
"type": "object"
}
},
{
"name": "remote_block_input",
"description": "锁定或解除目标 Windows 主机的本机键鼠。做 GUI 自动化时先 block=true,真人碰一下鼠标就不会打断流程。必须带期限:max_block_ms(默认 300000 毫秒)到期由服务端自动解除,并在下一次调用结果的 auto_unblocked 里上报;remote_close 或会话闲置回收时服务端也会强制解除。两个限制:1) Windows 只在调用进程具备管理员权限(或 UIAccess)时才允许 BlockInput,普通权限的客户端会静默失败且不上报结果,所以本工具的成功只代表命令已送达、不保证真的锁住了——不要凭它断言对端已被锁;2) 若屏幕子连接因目标机断网被拆,服务端也再没有下发通道,只能等客户端进程退出(BlockInput 随调用线程结束自动释放)。仅 Windows 支持(Linux 客户端不处理该报文,直接报 -32005)。",