title: Pixel 10 Fold Screen State Detector description: 识别 Pixel 10 Fold 的四种屏幕状态(外屏、内屏全屏、内屏分屏左、内屏分屏右),用于微信界面自动化 name: pixel-fold-screen-detector
trigger: 当需要判断当前 Pixel 10 Fold 处于哪种屏幕状态时
Pixel 10 Fold 屏幕状态识别器
四种状态定义
| 状态 | 分辨率 | 特征 |
|---|---|---|
| 外屏 (Outer) | 1080x2364 | 窄长屏幕,微信单列布局 |
| 内屏全屏 (Inner-Full) | 2076x2152 | 方形大屏,微信全屏显示 |
| 内屏分屏左 (Inner-Split-Left) | ~1038x2152 | 分屏模式,微信在左侧 |
| 内屏分屏右 (Inner-Split-Right) | ~1038x2152 | 分屏模式,微信在右侧 |
识别方法
方法 1: 通过分辨率 + 微信元素位置判断 (推荐)
方法 1: 通过分辨率 + 微信元素分布判断 (推荐)
关键发现: 不能只看所有 OCR 元素,必须识别微信特有的界面元素(如底部导航栏"微信"/"通讯录"/"发现"/"我",或聊天标题)。同时要看元素分布,不能只看个别坐标。
判断逻辑:
- 分辨率 1080x2364 → 外屏
- 分辨率 2076x2152 → 需要进一步判断:
- 获取所有微信元素的 x 坐标
- 如果所有元素 x
- 如果所有元素 x > 1038 → 内屏分屏右
- 如果元素分布在两侧 → 内屏全屏
常见错误:
- ❌ 只看一两个元素的坐标(可能碰巧在左侧或右侧)
- ❌ 把终端文字(如
mcp_android,python3)当作微信元素 - ❌ 看到元素在两侧就判断为全屏(可能是终端文字在另一侧)
正确做法:
- ✅ 识别多个微信特有元素(标题、导航栏、聊天列表)
- ✅ 计算所有微信元素的分布比例
- ✅ 过滤掉终端文字(包含
mcp_,python3,su -c,data/等)
import subprocess
import json
def detect_screen_state():
"""检测 Pixel 10 Fold 当前屏幕状态
Returns:
'outer' - 外屏
'inner_full' - 内屏全屏
'inner_split_left' - 内屏分屏,微信在左
'inner_split_right' - 内屏分屏,微信在右
'unknown' - 未知状态
"""
# Step 1: 获取分辨率
result = subprocess.run(['su', '-c', 'wm size'], capture_output=True, text=True)
line = result.stdout.strip()
if 'Physical size:' not in line:
return 'unknown'
size = line.split(':')[1].strip()
# Step 2: 根据分辨率初步判断
if size == '1080x2364':
return 'outer'
if size == '2076x2152':
# 可能是内屏全屏或分屏,需要进一步判断
return detect_inner_state()
return 'unknown'
def detect_inner_state():
"""判断内屏状态:全屏、分屏左、分屏右
方法:截图后 OCR 识别微信特有元素的位置分布
- 内屏全屏:微信元素分布在整个屏幕宽度(0-2076)
- 分屏左:微信主要元素在左半屏(x < 1038)
- 分屏右:微信主要元素在右半屏(x > 1038)
**重要**: 只看微信元素,忽略 Termux 终端文字等干扰
"""
# 截图
screenshot_path = '/data/data/com.termux/files/home/temp_state.png'
subprocess.run(['su', '-c', f'screencap -p {screenshot_path}'])
# OCR 识别(需要 ocr_tools.py)
try:
import sys
sys.path.insert(0, '/data/data/com.termux/files/home/pixelphone/event_bus')
from ocr_tools import run_ocr
results = run_ocr(screenshot_path)
# 识别微信特有元素,过滤终端文字
wechat_elements = []
terminal_keywords = ['mcp_', 'python3', 'su -c', 'data/', 'com.termux', 'hermes', 'adb']
for r in results:
text = r['text']
# 过滤终端文字
if any(kw in text for kw in terminal_keywords):
continue
# 微信主界面元素
if any(kw in text for kw in ['微信', '通讯录', '发现', '我', '选择聊天', '文件传输助手']):
wechat_elements.append(r['center']['x'])
# 聊天列表元素(包含时间、消息预览)
elif ':' in text and any(kw in text for kw in ['火星人', '宜创', 'TGO', '晓灰']):
wechat_elements.append(r['center']['x'])
# 群聊名称
elif '群' in text and ('人' in text or 'TGO' in text):
wechat_elements.append(r['center']['x'])
if not wechat_elements:
return 'unknown'
# 判断逻辑:看微信元素集中在哪一侧
left_count = sum(1 for x in wechat_elements if x < 1038)
right_count = sum(1 for x in wechat_elements if x >= 1038)
total = len(wechat_elements)
left_ratio = left_count / total
right_ratio = right_count / total
# 如果元素分布在两侧,是全屏
# 如果主要集中在左侧,是左分屏
# 如果主要集中在右侧,是右分屏
if left_ratio > 0.8:
return 'inner_split_left'
elif right_ratio > 0.8:
return 'inner_split_right'
else:
return 'inner_full'
except Exception as e:
print(f"OCR 失败: {e}")
return 'unknown'
判断逻辑总结
| 分辨率 | 微信元素位置 | 状态 |
|---|---|---|
| 1080x2364 | - | 外屏 (outer) |
| 2076x2152 | 主要 x | 内屏分屏左 (inner_split_left) |
| 2076x2152 | 主要 x > 1038 | 内屏分屏右 (inner_split_right) |
| 2076x2152 | 分布在两侧 | 内屏全屏 (inner_full) |
实际测试验证记录
| 测试 | 分辨率 | 微信元素坐标 | 实际状态 | 判断结果 | 是否正确 |
|---|---|---|---|---|---|
| 1 | 1080x2364 | "微信"(538, 226), "+"(982, 227) | 外屏 | 外屏 | ✅ |
| 2 | 2076x2152 | "微信"(512, 227), 列表(345, 494) | 内屏全屏 | 内屏全屏 | ✅ |
| 3 | 2076x2152 | "微信"(511, 228), 列表(345, 553) | 内屏分屏左 | 内屏分屏左 | ✅ |
| 4 | 2076x2152 | "选择聊天"(1562, 228) | 内屏分屏右 | 内屏分屏右 | ✅ |
各状态下的微信坐标
外屏 (1080x2364) - 已验证
微信主界面
| 元素 | 坐标 |
|---|---|
| 搜索按钮 | (874, 228) |
| "+" 按钮 | (982, 227) |
| 底部-微信 | (133, 2268) |
| 底部-通讯录 | (402, 2270) |
| 底部-发现 | (674, 2268) |
| 底部-我 | (943, 2268) |
聊天界面
| 元素 | 坐标 |
|---|---|
| 返回按钮 " | (61, 226) |
| 更多按钮 "+" | (1013, 1601) |
| 语音按钮 | (76, 2218) |
更多菜单(附件菜单)
| 元素 | 坐标 |
|---|---|
| 相册 | (167, 1914) |
| 拍摄 | (413, 1914) |
| 位置 | (661, 1912) |
| 语音输入 | (913, 1915) |
| 收藏 | (168, 2175) |
| 个人名片 | (414, 2175) |
| 文件 | (661, 2175) |
| 音乐 | (910, 2176) |
相册选择界面
| 元素 | 坐标 |
|---|---|
| 发送 | (954, 2230) |
| 预览 | (87, 2229) |
| 原图 | (569, 2231) |
内屏全屏 (2076x2152) - 已验证
微信主界面
| 元素 | 坐标 |
|---|---|
| 微信标题 | (1036, 228) |
| "+" 按钮 | (1977, 227) |
| 底部导航 | 分布在整个底部 |
分享界面 - 选择聊天
| 元素 | 坐标 |
|---|---|
| 选择聊天 | (1562, 228) |
| 搜索 | (1217, 370) |
| 最近转发 | (1168, 518) |
| 最近聊天 | (1169, 1005) |
| 创建聊天 | (1972, 1005) |
内屏分屏左 (2076x2152, 微信在左半屏) - 已验证 2026-06-25
特征
- 微信元素集中在左半屏(x
- "微信"标题约在 (511, 228)
- 聊天列表在左侧
微信主界面
| 元素 | 坐标 |
|---|---|
| 微信 | (511, 228) |
| 聊天列表 | (345, 494) 等 |
分享界面 - 选择聊天
| 元素 | 坐标 | 验证状态 |
|---|---|---|
| 选择聊天 | (511, 228) | ✅ |
| 搜索框 | (190, 371) | ✅ |
| 联系人标签 | (90, 506) | ✅ |
| 火星人联系人 | (263, 620) | ✅ |
| 发送按钮 | (700, 1833) | ✅ |
| 取消按钮 | (326, 1836) | ✅ |
使用流程
# Step 1: 触发 System Share
su -c "am start -f 0x10000000 -a android.intent.action.SEND -t image/png --eu android.intent.extra.STREAM file:///sdcard/Pictures/image.png"
# Step 2: 等待界面加载,点击搜索框
su -c "input tap 190 371"
# Step 3: 确保 ADBKeyboard 已切换
su -c "ime set com.android.adbkeyboard/.AdbIME"
# Step 4: 输入联系人名称
su -c "am broadcast -a ADB_INPUT_TEXT --es msg '火星人'"
# Step 5: 点击联系人标签
su -c "input tap 90 506"
# Step 6: 点击搜索结果中的联系人
su -c "input tap 263 620"
# Step 7: 点击发送按钮
su -c "input tap 700 1833"
关键注意事项
- 必须先切换 ADBKeyboard - 默认输入法是微信键盘,无法输入中文
- 点击联系人标签 - 搜索后需要点击"联系人"标签才能看到可点击的联系人
- 不要点击搜索框里的文字 - 要点击联系人列表里的按钮
- 图片路径 - 必须使用微信可访问的公共目录(如 /sdcard/Pictures/)
内屏分屏右 (2076x2152, 微信在右半屏) - 已验证
特征
- 微信元素集中在右半屏(x > 1038)
- "选择聊天"标题约在 (1562, 228)
- 聊天列表在右侧
分享界面 - 选择聊天
| 元素 | 坐标 |
|---|---|
| 选择聊天 | (1562, 228) |
| 搜索 | (1217, 370) |
| 最近转发 | (1168, 518) |
| 最近聊天 | (1169, 1005) |
| 创建聊天 | (1972, 1005) |
聊天界面 - 输入框与发送按钮 (2026-06-25 验证)
重要: 这些坐标是通过用户协助校准发现的(用户输入 distinctive 文字后 OCR 定位)
| 元素 | 坐标 | 状态 | 验证方法 |
|---|---|---|---|
| 输入框 (含文字) | (1454, 1889) | 键盘激活 | 用户输入 "输入框在这里" 后 OCR 定位 |
| 发送按钮 | (1979, 1887) | 键盘激活 | OCR 识别 "发送" 按钮 |
注意: 输入框坐标是在键盘已弹出、文字已输入的状态下测得的。空输入框可能位置相同但无法通过 OCR 定位。详见 references/inner-split-right-chat-coordinates.md。
CRITICAL: 发送按钮 "发送" 只有在输入文字后才会出现。空输入时底部显示 "+" 按钮(约 1500, 1601 位置)。必须先输入文字,然后 OCR 查找 "发送" 按钮位置。
验证记录
测试验证 (2026-06-25)
| 测试 | 分辨率 | 关键元素 | 判断结果 | 实际状态 | 是否正确 |
|---|---|---|---|---|---|
| 1 | 1080x2364 | "微信"(538, 226) | 外屏 | 外屏 | ✅ |
| 2 | 2076x2152 | "微信"(1036, 228), "+"(1977, 227) | 内屏全屏 | 内屏全屏 | ✅ |
| 3 | 2076x2152 | "微信"(511, 228), 列表(345, 494) | 内屏分屏左 | 内屏分屏左 | ✅ |
| 4 | 2076x2152 | "选择聊天"(1562, 228) | 内屏分屏右 | 内屏分屏右 | ✅ |
屏幕类型 + 键盘状态判断
八种状态组合
| 屏幕类型 | 键盘状态 | 说明 |
|---|---|---|
| 外屏 (outer) | 无键盘 | 正常界面 |
| 外屏 (outer) | 有键盘 | 输入框被点击,键盘弹出 |
| 内屏全屏 (inner_full) | 无键盘 | 正常界面 |
| 内屏全屏 (inner_full) | 有键盘 | 输入框被点击,键盘弹出 |
| 内屏分屏左 (inner_split_left) | 无键盘 | 正常界面 |
| 内屏分屏左 (inner_split_left) | 有键盘 | 输入框被点击,键盘弹出 |
| 内屏分屏右 (inner_split_right) | 无键盘 | 正常界面 |
| 内屏分屏右 (inner_split_right) | 有键盘 | 输入框被点击,键盘弹出 |
判断键盘状态
def detect_keyboard_state():
"""判断键盘是否弹出
方法:截图后 OCR 识别底部是否有键盘特征
- 有键盘:底部有"空格"、"回车"、"123"等键盘元素
- 无键盘:底部有微信导航栏或输入框
**重要**: 必须先判断屏幕类型,因为不同屏幕类型键盘位置不同
Returns:
True - 键盘弹出
False - 无键盘
"""
screenshot_path = '/data/data/com.termux/files/home/temp_keyboard.png'
subprocess.run(['su', '-c', f'screencap -p {screenshot_path}'])
try:
import sys
sys.path.insert(0, '/data/data/com.termux/files/home/pixelphone/event_bus')
from ocr_tools import run_ocr
results = run_ocr(screenshot_path)
# 键盘特征关键词
keyboard_keywords = ['空格', '回车', '123', 'ABC', '拼音', '英文', '中/英', '符号']
for r in results:
if any(kw in r['text'] for kw in keyboard_keywords):
return True
# 额外检查:看底部是否有输入框特征(没有键盘时)
# 微信输入框通常在底部,有"按住说话"或输入框提示
input_box_keywords = ['按住说话', '发送', '相册', '拍摄']
bottom_elements = [r for r in results if r['center']['y'] > 1800] # 底部区域
for r in bottom_elements:
if any(kw in r['text'] for kw in input_box_keywords):
return False
return False
except Exception as e:
print(f"OCR 失败: {e}")
return False
用户工作流偏好 (重要 — 必须遵守)
用户明确要求: "我说了 stepbystep 你自己别乱搞 我让你去干啥 你只做一步不要自己做下一步做判断"
核心原则: 用户是指挥官,我是执行者。用户说一步,我做一步,然后报告结果并等待下一步指令。
严格执行流程
- 执行当前步骤(只做用户明确要求的操作)
- 截屏 + OCR 验证结果(不要假设成功)
- 报告当前状态(成功/失败/界面变化/坐标位置)
- 等待用户下一步指令(不要自行推断)
- 不要连续执行多个步骤(即使看起来 obvious)
绝对禁止
- ❌ 连续执行多步: "现在打开微信,然后点击相册,然后选择图片..."
- ❌ 自行判断: "我判断当前是内屏分屏左,所以点击..."
- ❌ 自行推断: "下一步应该点击发送"
- ❌ 假设成功: 不验证就执行下一步
- ❌ 替用户决定: "我觉得应该先..."
正确示例
- ✅ "已打开微信。请告诉我下一步做什么?"
- ✅ "当前状态:内屏分屏左。请指示下一步操作。"
- ✅ "点击完成。当前界面显示... 请告诉我下一步。"
- ✅ "截图显示'选择聊天'界面,搜索框在 (190,371)。请指示。"
用户反馈信号(必须立即纠正)
- "你错了" → 立即停止,重新检查当前状态
- "你都不判断的么" → 用户希望我多验证,但仍然是 step-by-step
- "停止" → 立即停止所有操作
- "还是不对" → 重新分析,不要重复同样错误
关键教训
- 用户说"go"不代表可以连续执行多步
- 用户说"你来"不代表可以自行推断
- 每次操作后必须验证(截图+OCR),不要假设
- 坐标点击后必须验证界面是否变化,不要假设点击成功
关键操作陷阱
1. 输入法切换陷阱
问题: 默认输入法是微信键盘(com.tencent.wetype),无法输入中文。
解决: 每次输入前必须检查并切换 ADBKeyboard:
# 检查当前输入法
su -c "settings get secure default_input_method"
# 如果不是 ADBKeyboard,先切换
su -c "ime set com.android.adbkeyboard/.AdbIME"
常见错误: 直接输入中文,失败后才检查输入法。
2. 联系人点击陷阱
问题: 搜索后点击搜索框里的文字,而不是联系人列表里的按钮。
解决: 搜索后必须先点击"联系人"标签,再点击列表中的联系人:
搜索框输入 → 点击"联系人"标签 → 点击联系人列表项 → 点击发送
常见错误: 直接点击搜索框中的文字(如"火星人"),而不是列表中的联系人按钮。
3. OCR 识别陷阱
问题: 终端输出文字覆盖在截图上,被 OCR 误识别为界面元素。
解决:
- 识别时过滤掉终端文字(通常包含
mcp_,python3,su -c等) - 优先识别微信特有元素("微信", "通讯录", "发现", "我", "选择聊天")
- 检查元素位置是否合理(如标题应在顶部,导航栏在底部)
4. 屏幕状态判断陷阱
问题: 只看个别元素坐标判断分屏方向,忽略整体分布。
解决: 必须看多个微信元素的分布:
- 内屏分屏左:所有微信元素 x
- 内屏分屏右:所有微信元素 x > 1038
- 内屏全屏:微信元素分布在两侧
常见错误: 看到一两个元素在左侧就判断为分屏左,忽略其他元素在右侧(可能是终端文字)。
坐标记录系统
记录文件
{
"outer_no_keyboard": {
"more_button": [1013, 1601],
"album_button": [167, 1914],
"send_button": [954, 2230],
"verified": true
},
"outer_with_keyboard": {
"more_button": [1013, 1400],
"verified": false
},
"inner_full_no_keyboard": {
"more_button": [1977, 1601],
"verified": false
},
"inner_split_left_no_keyboard": {
"more_button": [500, 1601],
"verified": false
},
"inner_split_right_no_keyboard": {
"more_button": [1500, 1601],
"verified": false
},
"inner_split_right_with_keyboard": {
"input_box": [1454, 1889],
"send_button": [1979, 1887],
"verified": true,
"notes": "Send button ONLY appears after text is typed. Empty input shows '+' button at ~1500,1601"
}
}
WeChat Chat UI Coordinates (Verified)
inner_split_right (WeChat on right half)
| Element | Coordinates | Notes |
|---|---|---|
| Input box | (1454, 1889) | Tap to focus. User can type distinctive text to help OCR locate it. |
| Send button | (1979, 1887) | ONLY appears after text is typed. Empty input shows "+" button instead. |
CRITICAL: The "+" button (for image/video) at the bottom CHANGES to "发送" (send) button AFTER you type text. You CANNOT find "发送" before typing.
Correct sequence:
- Tap input box at (1454, 1889)
- Switch to ADBKeyboard (WeChat auto-switches to WeType keyboard)
- Type text via
am broadcast -a ADB_INPUT_TEXT - Screenshot + OCR to find "发送" button location (now visible)
- Tap "发送" at (1979, 1887)
- Verify via
get_wechat_messagesdatabase query
Chat List vs Chat UI
On inner_split_right, the right half may show the WeChat main chat list (showing recent conversations as scrollable items) rather than the actual chat conversation UI (with message history and an input box at the bottom).
How to identify:
- Chat list: shows multiple entries like "6-TGO和朋友们的AGI" at bottom
- Chat UI: shows single conversation thread, title bar shows contact name
- Chat list has NO input box — you must click the specific chat entry to open chat UI
Common mistake: Tapping the title bar "火星人" does NOT open chat UI if you're on the chat list. You must tap the actual chat entry row (showing recent message preview).
Pitfalls
import json
import os
COORDS_FILE = '/data/data/com.termux/files/home/.hermes/skills/android/pixel-fold-screen-detector/coords_record.json'
def load_coords():
if os.path.exists(COORDS_FILE):
with open(COORDS_FILE, 'r') as f:
return json.load(f)
return {}
def save_coords(coords):
with open(COORDS_FILE, 'w') as f:
json.dump(coords, f, indent=2)
def get_button_coords(screen_state, keyboard_state, button_name):
"""获取按钮坐标
Returns:
(x, y, verified) - 坐标和是否已验证
None - 未记录
"""
key = f"{screen_state}_{'with' if keyboard_state else 'no'}_keyboard"
coords = load_coords()
if key in coords and button_name in coords[key]:
return (*coords[key][button_name], coords[key].get('verified', False))
return None
def record_button_coords(screen_state, keyboard_state, button_name, x, y, verified=False):
"""记录按钮坐标"""
key = f"{screen_state}_{'with' if keyboard_state else 'no'}_keyboard"
coords = load_coords()
if key not in coords:
coords[key] = {}
coords[key][button_name] = [x, y]
coords[key]['verified'] = verified
save_coords(coords)
完整使用流程
1. 判断当前状态
screen_state = detect_screen_state() # outer / inner_full / inner_split_left / inner_split_right
keyboard_state = detect_keyboard_state() # True / False
2. 检查是否有记录
coords = get_button_coords(screen_state, keyboard_state, 'more_button')
if coords and coords[2]: # 已验证
x, y = coords[0], coords[1]
print(f"使用已验证坐标: ({x}, {y})")
else:
print("未记录,需要探索")
3. 未知状态:探索-测试-记录
def explore_button(screen_state, keyboard_state, button_name, expected_text):
"""探索按钮位置
Args:
button_name: 按钮名称(如 'more_button')
expected_text: 期望的 OCR 文字(如 '+' 或 '更多')
Returns:
(x, y) - 找到的坐标
None - 未找到
"""
# 截图
screenshot_path = '/data/data/com.termux/files/home/temp_explore.png'
subprocess.run(['su', '-c', f'screencap -p {screenshot_path}'])
# OCR 识别
import sys
sys.path.insert(0, '/data/data/com.termux/files/home/pixelphone/event_bus')
from ocr_tools import run_ocr
results = run_ocr(screenshot_path)
# 查找期望文字
for r in results:
if expected_text in r['text']:
x, y = r['center']['x'], r['center']['y']
# 点击测试
subprocess.run(['su', '-c', f'input tap {x} {y}'])
time.sleep(1)
# 截图验证
verify_path = '/data/data/com.termux/files/home/temp_verify.png'
subprocess.run(['su', '-c', f'screencap -p {verify_path}'])
verify_results = run_ocr(verify_path)
# 验证是否成功(界面是否变化)
# 这里需要具体的验证逻辑
verified = verify_click_success(verify_results, button_name)
# 记录
record_button_coords(screen_state, keyboard_state, button_name, x, y, verified)
return (x, y)
return None
def verify_click_success(ocr_results, button_name):
"""验证点击是否成功
根据按钮类型验证界面变化
"""
if button_name == 'more_button':
# 应该出现相册、拍摄等选项
for r in ocr_results:
if '相册' in r['text'] or '拍摄' in r['text']:
return True
elif button_name == 'album_button':
# 应该进入相册选择界面
for r in ocr_results:
if '发送' in r['text'] or '预览' in r['text']:
return True
elif button_name == 'send_button':
# 应该发送成功,回到聊天界面
for r in ocr_results:
if '文件传输助手' in r['text'] or '聊天' in r['text']:
return True
return False
4. 完整示例
from pixel_fold_screen_detector import detect_screen_state, detect_keyboard_state
from pixel_fold_screen_detector import get_button_coords, explore_button
def send_image_auto(image_path, contact_id='filehelper'):
"""自动发送图片(自适应屏幕和键盘状态)"""
# Step 1: 判断状态
screen_state = detect_screen_state()
keyboard_state = detect_keyboard_state()
print(f"当前状态: {screen_state}, 键盘: {'有' if keyboard_state else '无'}")
# Step 2: 打开聊天窗口
subprocess.run(['su', '-c', f'am start -n com.tencent.mm/.ui.chatting.ChattingUI --es Chat_User {contact_id}'])
time.sleep(2)
# Step 3: 点击更多按钮
coords = get_button_coords(screen_state, keyboard_state, 'more_button')
if coords and coords[2]: # 已验证
x, y = coords[0], coords[1]
print(f"使用已验证坐标点击更多按钮: ({x}, {y})")
else:
print("探索更多按钮位置...")
x, y = explore_button(screen_state, keyboard_state, 'more_button', '+')
subprocess.run(['su', '-c', f'input tap {x} {y}'])
time.sleep(1)
# Step 4: 点击相册按钮
coords = get_button_coords(screen_state, keyboard_state, 'album_button')
if coords and coords[2]:
x, y = coords[0], coords[1]
else:
x, y = explore_button(screen_state, keyboard_state, 'album_button', '相册')
subprocess.run(['su', '-c', f'input tap {x} {y}'])
time.sleep(2)
# Step 5: 选择图片并发送
# ...
用户明确偏好
Step by Step 执行:用户明确要求一步一步执行,不要自己判断下一步。每次只做用户要求的一个步骤,等待用户确认后再继续。
用户交互风格
重要:用户明确要求 step-by-step 执行方式。每次只执行一步,等待用户确认后再做下一步。不要自行推断后续步骤或判断"应该"做什么。
执行流程:
- 执行当前步骤
- 报告结果(成功/失败/当前状态)
- 等待用户下一步指令
- 不要连续执行多个步骤
注意事项
- 首次使用:所有坐标都是未验证状态,需要逐步探索
- 坐标变化:微信更新或系统更新可能导致坐标变化,需要重新验证
- 键盘弹出:点击输入框后键盘会弹出,底部按钮位置会上移
- 分屏切换:折叠屏展开/折叠时,需要重新检测状态
- 记录持久化:坐标记录保存在 JSON 文件中,重启后仍然有效
- ADBKeyboard:中文输入需要 ADBKeyboard,安装和切换方法见下方
ADBKeyboard 安装与使用
安装
# 下载 APK
curl -fL -o /data/local/tmp/ADBKeyboard.apk https://github.com/senzhk/ADBKeyBoard/raw/master/ADBKeyboard.apk
# 安装
su -c "pm install /data/local/tmp/ADBKeyboard.apk"
切换输入法
# 设置为默认输入法
su -c "settings put secure default_input_method com.android.adbkeyboard/.AdbIME"
# 验证
su -c "settings get secure default_input_method"
# 应输出: com.android.adbkeyboard/.AdbIME
输入中文
# 通过广播发送中文
su -c "am broadcast -a ADB_INPUT_TEXT --es msg '要输入的中文'"
注意:input text 和 mcp_android_phone_input_text 在 Android 16 上不支持中文输入,必须使用 ADBKeyboard。
- System Share 不稳定:微信 8.x + Android 16 上 ACTION_SEND 可能闪退,优先使用直接打开聊天窗口 + 相册发送方式
示例代码
from pixel_fold_screen_detector import detect_screen_state
state = detect_screen_state()
print(f"当前状态: {state}")
if state == 'outer':
coords = OUTER_SCREEN_COORDS
elif state == 'inner_full':
coords = INNER_FULL_COORDS
elif state == 'inner_split_left':
coords = INNER_SPLIT_LEFT_COORDS
elif state == 'inner_split_right':
coords = INNER_SPLIT_RIGHT_COORDS
注意事项
- 分屏模式需要额外判断微信在左半屏还是右半屏
- 坐标可能因微信版本更新而变化
- 建议每次操作前都重新检测屏幕状态
- 参考
references/calibration-session-20260625.md获取实际校准数据 - 参考
references/pixel-10-fold-coordinates-20260625.md获取已验证坐标