Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ What changed in each release, one line per change. Versions follow [Semantic Ver
- With native control (iOS 27), reading the screen no longer keeps failing until the phone is replugged when the phone's accessibility service stops answering; it is restarted on its own (#152).
- With native control (iOS 27), automatic unlocking no longer fails with "couldn't bring up the passcode keypad" while the keypad is on screen: the keys it tapped were sometimes not taken by the phone.
- With native control (iOS 27), an app launched right after Home is no longer sent back to the home screen when the daemon had left the touch session idle (for example the first actions after the daemon started).
- With native control (iOS 27), when the phone's accessibility service reads every app as empty (only the home screen reads), it is restarted on its own as well, instead of reading the screen failing until it is ended by hand.

## [0.2.8] - 2026-11-18

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- 原生控制(iOS 27)下,手机上的无障碍服务不再应答时,读界面不会再一直失败到重新插线为止;会自动把它重启(#152)。
- 原生控制(iOS 27)下,自动解锁不会再在密码键盘已经出来时报「调不出锁屏密码键盘」:点下去的数字键有时没被手机认。
- 原生控制(iOS 27)下,触摸会话闲置后(比如守护进程刚启动)按 Home 再马上启动 App,App 不会再被送回主屏幕。
- 原生控制(iOS 27)下,手机上的无障碍服务把每个 App 都读成空的(只有主屏幕读得出来)时,也会自动重启它,不会再一直读界面失败到手动结束它为止。

## [0.2.8] - 2026-11-18

Expand Down
21 changes: 20 additions & 1 deletion crates/ictl-device/src/ax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ impl Tunnel {
tracing::debug!("remoteAXService: walk cut at {} elements", elements.len());
}
if elements.is_empty() {
return Err(DeviceError::Timeout(ictl_l10n::tr!("没有读到界面元素", "no screen elements read").into()));
tracing::debug!("remoteAXService: app {} reads no elements on a new session either", app.pid);
return Err(nothing_read());
}
let overlays = if overlays { self.ax_overlays(app.pid).await } else { Vec::new() };
Ok(AxScreen {
Expand Down Expand Up @@ -197,6 +198,15 @@ impl Tunnel {
// SpringBoard's application element answers whichever app is in front: its children are the status bar's items
// and whatever it draws over the app; see `Tunnel::ax_overlays`

/// The frontmost app reads no elements at all, not even its own application element, on a new session too. axauditd
/// gets stuck this way as well (iPhone19,7, iOS 27.2.1): every app read empty, SpringBoard read as usual, with no
/// timeout, and neither a new session nor restarting the daemon helped; ending axauditd did. So it is told as the
/// service not answering ([`DeviceError::AxUnanswered`], read the same as before), which the daemon restarts it for.
/// Not to be confused with the lock screen under the HID screen stream (#126), which reads one element, the app's
fn nothing_read() -> DeviceError {
DeviceError::AxUnanswered(ictl_l10n::tr!("没有读到界面元素", "no screen elements read").into())
}

/// The frontmost app's element, asked again for up to `wait` while the phone has none (between two apps)
async fn frontmost(s: &AxSession, wait: Duration) -> Result<ObjectRef> {
let deadline = Instant::now() + wait;
Expand Down Expand Up @@ -224,6 +234,15 @@ mod wedge_tests {
assert_eq!(e.to_string(), DeviceError::Timeout("remoteAXService: deviceAPIVersion".into()).to_string());
}

/// An app that reads no elements at all is axauditd stuck too (restarted for), and says what it said before
#[test]
fn an_app_read_with_no_elements_is_an_unanswered_accessibility_service() {
let e = nothing_read();
assert!(matches!(&e, DeviceError::AxUnanswered(_)), "{e:?}");
let before = DeviceError::Timeout(ictl_l10n::tr!("没有读到界面元素", "no screen elements read").into());
assert_eq!(e.to_string(), before.to_string());
}

/// Paths as the phone lists them (iOS 27.2.1); only axauditd itself is ended
#[test]
fn only_axauditd_is_the_accessibility_daemon() {
Expand Down
1 change: 1 addition & 0 deletions docs/dev/regression-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@
| 155 | 原生控制(iOS 27):手机上的 axauditd(remoteAXService 背后的进程)卡住后,每次读界面都超时(先 `remoteAXService: request`,之后每次握手 `deviceAPIVersion`),守护进程一直「准备手机失败,稍后重试」,重连、重建隧道、重启守护进程都没用,只有重新插线才恢复。iPhone 15 Pro Max(iOS 27.2.1)上见过三次:两次在部署重启守护进程后,一次在自动解锁后。2026-11-18 排查:只在锁屏键按下后马上读界面时出现(完整场景回归里约 35 次锁屏碰上 2 次),卡住前 axauditd 不报错、日志停住 8 秒,像在等一个不回的应答;没能复现的有:客户端请求中途断开或不发 clientNeedsAccessibility: false(10 次)、40 个半开连接加 48 次切换 App、锁屏状态下重启守护进程(5 次)、锁屏前后每 0.1 秒读一次(20 轮,带或不带 SpringBoard 的元素)。根因在 axauditd 内部,要抓它卡住时的调用栈(sysdiagnose)才看得到 | 无障碍服务不应答单独成一种错误(`DeviceError::AxUnanswered`,文字同超时);读界面、读前台 App 碰到它时经 CoreDevice 结束 axauditd(下次连接系统自动拉起),再读一次;同一台设备一分钟内最多一次,事件日志记「已重启手机上的 axauditd」 | 单测 `an_unanswered_accessibility_service_is_told_apart_and_reads_as_a_timeout`、`only_axauditd_is_the_accessibility_daemon` + 真机(经 AppService 给 axauditd 发 SIGSTOP 冻住:main 上一直报超时,修复后下一次读界面直接成功、axauditd 换了进程号) |
| 156 | 原生控制(iOS 27):自动解锁时密码键盘出来了,却一位都输不进去,三轮后报「调不出锁屏密码键盘」(偶尔停在第 2、3 位)。每点一个数字键就要读密码栏,读之前得先关 HID 会话(开着时手机不让无障碍服务看锁屏);点完马上关,手机不认这次触摸。时有时无:同一台手机(iPhone19,7,iOS 27.2.1)不等也能解锁了几个小时,之后每一下都丢 | 关 HID 会话前,等上一次 HID 操作发出满 `TOUCH_LANDS`(0.35 秒)。丢键期间同一个守护进程里轮流量的解锁成功数:0 毫秒 0/9,50 毫秒 0/3,100 毫秒 0/3,150 毫秒 1/3,200 毫秒 3/4,250 毫秒 5/5,350 毫秒 3/3 | 单测 `the_hid_session_stays_open_until_the_last_touch_has_landed` + 真机脚本 `scenarios.py lock` |
| 157 | 原生:守护进程闲置 30 秒关掉 HID 会话后,在主屏幕上按 Home、马上启动 App,App 到了前台又被送回主屏幕(7/8);守护进程刚启动后 `run.py` 第一轮常因此失败。#130 的 0.6 秒是从调用 HID 算起的,重开会话(屏幕媒体流,约 0.6 秒)把它用完了,按下后一点没等 | 先开好 HID 会话,再从按下 Home 算 0.6 秒 | 真机(iPhone19,7,iOS 27.2.1:闲置后 Home 再启动时钟,0.2.8 是 7/8 回到主屏幕,会话开着时 0/8);真机脚本 `scenarios.py idle` |
| 158 | 原生控制(iOS 27):axauditd 的另一种卡法:前台 App 一个元素都读不到(连 Application 元素都没有),换新会话也一样,SpringBoard 照常读得出来,也不超时,所以 #155 的重启不触发;读界面、按名字点击、启动 App 都报「读界面失败:超时:没有读到界面元素」,重启守护进程、结束 App 重开都没用,结束 axauditd 后马上恢复(iPhone19,7,iOS 27.2.1,见过一次) | 重连后前台 App 仍一个元素都读不到时按无障碍服务不应答处理(`DeviceError::AxUnanswered`,文字不变),走 #155 的重启(一分钟内最多一次);锁屏在 HID 媒体流下读到的是 1 个元素(#126),不算 | 单测 `an_app_read_with_no_elements_is_an_unanswered_accessibility_service` + 真机(没能按需复现卡住;默认步骤和场景跑下来不误触发重启,事件日志没有「已重启手机上的 axauditd」) |
13 changes: 10 additions & 3 deletions tests/device/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
and an app started right afterwards stays in front (#130)
idle after the daemon has closed the idle HID session, Home on the home screen and an app started right
afterwards stays in front (#157); takes about 2 minutes (it waits for the session to close)
url a link opened right after its app was terminated opens (#131); text on the web page can be waited for (#133)
url a link opened right after its app was terminated opens (#131; in Safari natively, in the default browser
through WDA); text on the web page can be waited for (#133)
lock the lock button locks within seconds, again and again (#59, #102, #105); the next action unlocks first
and says so (#144); a tap right after unlocking isn't swallowed (#127)

Expand All @@ -39,6 +40,7 @@
import asyncio
import base64
import json
import re
import os
import shlex
import sys
Expand Down Expand Up @@ -301,8 +303,13 @@ async def url(p: Phone):
err, text, dt, _ = await p.call("iphone_open_url", {"url": "https://example.com"})
# iPad 的过渡动画中回答可能暂时写 DockFolderViewService;用实际前台状态核对启动结果。
front = await p.front()
check(c, f"#131 a link opened right after Safari was terminated opens in Safari ({dt:.2f}s)",
not err and "https://example.com" in text and dev.SAFARI in front, f"{text} / {front}")
# natively a web link always opens in Safari; through WDA the system opens it in the default browser, which may be
# another one (Chrome): the app the answer names, in front and not the home screen, is as good
m = re.search(r"(?:前台|foreground) ([\w.-]+)", text)
opened = m.group(1) if m else ""
in_browser = dev.SAFARI in front or (bool(opened) and opened != dev.SPRINGBOARD and opened in front)
check(c, f"#131 a link opened right after Safari was terminated opens in a browser ({opened or '?'}, {dt:.2f}s)",
not err and "https://example.com" in text and in_browser, f"{text} / {front}")
if not err and dev.SAFARI in front and dev.SAFARI not in text:
print(f"NOTE [{c}] 打开链接的回答和随后查询的前台 App 不一致:{short(text)}", flush=True)
# a word of the page's English paragraph (the page has no heading in the tree, and its first paragraph follows
Expand Down
Loading