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

+7 -1
View File
@@ -113,10 +113,16 @@ def check_win_baseline(tools):
任何工具都不该缺 win:缺了要么是标注出错,要么是这个工具根本不该注册。
支持面从宽到窄依次是 win > lnx > mac ≈ apk,这条阶梯也在这里顺带核对,
倒挂说明某一档标反了。
APK_ONLY_EXEMPT 是这条不变式的白名单:只放「语义上只属于 Android」的工具。
目前只有 remote_lock_screen——COMMAND_SCREEN_CTRL_ALT_DEL 在 Android 映射为系统
锁屏,Windows 侧要实现 Ctrl+Alt+Del(SendSAS)需要客户端具备 SYSTEM 或 UIAccess,
本轮不做。新增白名单条目必须写清楚这个理由。
"""
APK_ONLY_EXEMPT = {"remote_lock_screen"}
problems = 0
for t in tools:
if "win" not in t["platforms"]:
if "win" not in t["platforms"] and t["name"] not in APK_ONLY_EXEMPT:
problems += 1
print(f"!! {t['name']}: platforms={t['platforms']} 不含 win,但 Windows 应全量支持")
+4
View File
@@ -59,6 +59,7 @@ GATE = {
"remote_keyboard": ("remote_control", True, False),
"remote_mouse": ("remote_control", True, False),
"remote_clipboard": ("remote_control", True, False),
"remote_lock_screen": ("remote_control", True, False),
"remote_block_input": ("remote_control", True, False),
# ---- file_transfer ----
@@ -129,6 +130,7 @@ _TRIO = ["win", "lnx", "mac"]
_WL = ["win", "lnx"]
_WLA = ["win", "lnx", "apk"]
_WIN = ["win"]
_APKONLY = ["apk"]
PLATFORMS = {
# 服务端本地数据,与客户端平台无关
@@ -175,6 +177,8 @@ PLATFORMS = {
"remote_keyboard": _WLA,
"remote_mouse": _WLA,
"remote_clipboard": _WLA,
# COMMAND_SCREEN_CTRL_ALT_DEL:只有 Android 客户端实现(映射为系统锁屏)
"remote_lock_screen": _APKONLY,
# 需要 CLIENT_CAP_SCREEN_PREVIEW:Windows 恒有,Linux 仅在探测到 X11 桌面时声明,
# Android 仅在无障碍服务在跑时声明(takeScreenshot,只支持 mode=screen)