Repository navigation
fix(daemon): native unlocking keeps the HID session open until a key tap has landed - #154
Merged
Merged
Conversation
…tap has landed With native control (iOS 27), unlocking reads the passcode field after every key, and closes the HID session first (the phone hides the lock screen from accessibility while its screen stream is open). Closed right after the tap, the phone sometimes doesn't take the touch: the keypad is up, no key goes down, and unlocking fails with "couldn't bring up the passcode keypad". The session now stays open until 350 ms after the last HID action. Measured on an iPhone19,7 (iOS 27.2.1) while it was losing keys, unlocks by wait: 0 ms 0/9, 50 ms 0/3, 100 ms 0/3, 150 ms 1/3, 200 ms 3/4, 250 ms 5/5, 350 ms 3/3. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Derrors
force-pushed
the
fix/native-unlock-tap-cancelled
branch
from
November 18, 2026 06:34
b85cb68 to
bfce25d
Compare
This was referenced Nov 18, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
With native control (iOS 27), automatic unlocking could fail with "couldn't bring up the passcode keypad" while the keypad was on screen: no key went down and the passcode field stayed at 0 digits (now and then it stopped at the 2nd or 3rd digit instead).
Unlocking reads the passcode field after every key, and
read_lock_screencloses the HID session first, because the phone hides the lock screen from accessibility while the session's screen stream is open. Closed right after the tap, the phone sometimes doesn't take the touch. It isn't every time: the same phone unlocked for hours onmain, then lost every key until the end of the day, across daemon restarts.read_lock_screennow keeps the session open until 350 ms after the last HID action (TOUCH_LANDS). Unlocks while the phone was losing keys, by wait, the waits taken in turn within one daemon: 0 ms 0/9, 50 ms 0/3, 100 ms 0/3, 150 ms 1/3, 200 ms 3/4, 250 ms 5/5, 350 ms 3/3. An unlock takes about 1.5 s longer (about 10.0 s instead of 8.3 s).Not found out: what puts the phone into the state where it loses the keys. It began after the second restart of axauditd (#152) within a minute, during
scenarios.py lock; reading the passcode field still worked afterwards (typed by hand, it read 0 → 2 → 3), and a single tap on a key through a fresh HID session that stayed open for 3 s registered.Tests
1. Unit tests
cargo test --workspace --all-features --locked,cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo fmt --check(per package) passthe_hid_session_stays_open_until_the_last_touch_has_landed(how long is left to wait; that the phone drops the touch can only be seen on a device)#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.pydefault steps pass on this branch (exit code 0)tests/device/scenarios.pypasses on this branch: default scenarios,lockandurl, 57 checks, 0 failed;lockthree more times, 13/13 eachmainor the latest release, same device, for comparison (run.py --repeat 5 --json,compare.py); no step clearly slower, or why:compare.pyrefused both files ("NOT THE SAME STEPS": the two Clock tabsrun.pytaps came in the other order), so the medians were compared by its rule by hand. One step is over it: the last Home, 1.36 s onmain, 1.77 s here (1.8 s in 3 of 5 runs, twice). It comes from how the daemon was started, not from the change:main's binary started by hand like the branch's took 1.72–1.78 s in 5 of 5, under launchd 1.31–1.45 s in 10 of 10. The new wait is only on the unlock path.scenarios.py --lock lock, see part 4tests/device/tasks.py: 71 checks, 1 failed,[self] nor through the control page's API (Linux); it fails the same way onmainon this Macrun.py output
3. Regression cases (docs/dev/regression-cases.md)
statusshows native control instead of asking for WDA #127, feat(mcp): iphone_swipe holds before moving with hold, to drag icons #144 (scenarios.py lock)4. Real-device proof of the fix or feature
main/ the release, gone with this branch, same device and stepsSteps and results (before / after, output, log lines, screenshots)
Checklist
🤖 Generated with Claude Code