Skip to content

Native auto-unlock fails on non-Chinese iOS 27: passcode TextField not promoted and number order reversed #174

Done

Description

@Luzivog

Environment

  • iphone-control: v0.2.11 (Linux x86_64, native iOS 27 backend without WDA)
  • Device: iPhone16,1 (iPhone 15 Pro), iOS 27.0.1, English device language
  • Auto-unlock passcode configured (6 digits, UNLOCK-DISABLED absent)

Symptom

When the phone is locked (AFU) and an action triggers auto-unlock:

  1. The screen wakes and swipes up to the passcode keypad.
  2. Each of the 3 unlock rounds hides and re-opens the keypad without entering a single digit.
  3. The call fails with:
    Couldn't bring up the passcode keypad (not a single digit was entered); unlock it by hand...

Debug log (ICTL_LOG=info,ictl_unlock=debug,ictl_daemon::tools::native=debug):

ictl_daemon::tools::native: native read: app pid 236 with 15 elements, 0 over it, app frame Some((0.0, 0.0, 393.0, 852.0)), screen 393x852
ictl_unlock: unlock round 2: locked, tree read with the check: true
ictl_unlock: unlock round 2: keypad found, passcode field None among 14 elements

Root cause (2 places)

  1. crates/ictl-ax/src/xml.rs (kind / passcode_value, lines 110 & 143-147):

    On native iOS 27, the lock-screen passcode field arrives as TextField and is only promoted to SecureTextField when passcode_value(&e.value) returns true:

    fn passcode_value(v: &str) -> bool {
        let numbers = v.split(|c: char| !c.is_ascii_digit()).filter(|n| !n.is_empty()).count();
        let lower = v.to_lowercase();
        numbers == 2 && (v.contains("位") || lower.contains("passcode") || lower.contains("digit"))
    }

    On real English iOS (SBUIPasscodeEntryField), the accessibility label is "Passcode field" and the value is "0 of 6 values entered" (similarly French "0 valeur saisie sur 6", German "0 von 6 Werten eingegeben", Spanish "0 de 6 valores introducidos"). The value does not contain "位", "passcode", or "digit", so passcode_value returns false and elements::passcode_field returns None.

  2. crates/ictl-wda/src/elements.rs (parse_passcode_value, lines 793-800):

    match nums[..] {
        [total, entered] => Some((total, entered)),
        _ => None,
    }

    Chinese puts total before entered ("共6位数,已输入2位" -> [6, 2]), while English/French/German/Spanish put entered before total ("0 of 6 values entered" -> [0, 6]). Assigning [total, entered] positionally would parse total = 0 and trigger LengthMismatch.

Suggested fix (verified locally on iPhone16,1, iOS 27.0.1)

  1. In crates/ictl-ax/src/xml.rs, check e.label, e.identifier, and e.value (accepting localized labels like "Passcode field" / "Champ de code" and localized value phrases like "values entered" / "valeur saisie" alongside "位" / "passcode" / "digit").
  2. In crates/ictl-wda/src/elements.rs, since 0 <= entered <= total holds in every locale (and order is irrelevant when entered == total), return Some((a.max(b), a.min(b))) when a.max(b) > 0.

After building v0.2.11 locally with those two changes and restarting the daemon, unattended auto-unlock succeeded on the first attempt (Unlocked automatically (8.3 s)).

Activity

  1. Derrors commented on Nov 24, 2026

    @Derrors
    Owner

    Thanks for the detailed report and root-cause analysis. Both issues are confirmed, and the fix is in #176.

    • Number order (parse_passcode_value): returns (max, min) as you suggested, so the order no longer matters. This also fixes the WDA backend, which goes through the same function.
    • Field promotion (ictl-ax kind): the value must hold exactly two numbers with a non-zero larger one, plus any of:
      • a known label word (密码 / passcode / champ de code),
      • a known value word (位 / digit / entered / saisie / eingegeben / introducido …),
      • or, as a fallback for languages not listed, a 4- or 6-digit total.

    Tests now include the English, French, German and Spanish values you gave. If you get a chance to try the PR branch on your iPhone 15 Pro, that would be a welcome extra check, since I haven't run it on an English-locale device myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions