Follow-up to #2340 (10d64004). Hex's two other advanceToNextInputMode() callers reach the
same iOS 27.2 host crash on the iPhone Duo unfolded and upright (Apple's keyboard split):
UIKit's next-keyboard switch runs -[UIKeyboardLayoutStar activationIndicatorView], which
reads one key past the end of a split keyboard that isn't laid out yet. The automatic
hand-off on number-pad fields would crash the app being typed in without the person
touching anything.
- Number pads (KeyboardViewController.handOffNumericPadIfNeeded): hand off only when
KeyboardFieldRouting.handsOffNumberPad says so, i.e. iOS asks for a globe and Apple's
keyboard isn't split. On the split posture Hex stays on its own 123 page, as it already
does wherever iOS draws its own globe. The Duo's posture needs the keyboard's window
(FullKeyboardView.currentPosture is nil until then), so when it isn't known yet the
hand-off waits and viewWillLayoutSubviews asks again; on every other device the posture
is known at once and the hand-off runs exactly where it did.
- Code from Messages chip: not offered on the split posture (KeyboardClipboardTracker.offer
canSwitchKeyboard false, also while the Duo's posture isn't known); a copied code still
gets Paste, and the globe's list (#2340) leads to Apple's keyboard. Its tap handler also
refuses to advance there. Chosen over opening the list from the chip's own touch: the
chip's whole point is one tap, a list that appears after a 0.2 s hold is what the globe
already does on this posture, and hiding it keeps the change small. The strip refreshes
when the posture changes so the chip follows a fold or unfold.
Everywhere else (every iPhone, the Duo folded or turned, every iPad) behaviour is unchanged.
Verified (Mac Studio, iOS 27.2 simulators):
- xcodebuild test: 760 tests, 0 failures, including the new
ShiftStateMachineTests.testNumberPadsStayOnHexWhereApplesKeyboardSplits and
KeyboardClipboardTests.testNoCodeFromMessagesWhereApplesKeyboardSplits.
- iPhone SE, split posture forced by a diagnostic build: number pad stays on Hex's 123
page 20/20, no Code from Messages chip and a tap where it was stays on Hex 10/10.
Unforced: the chip shows and its tap switches 10/10, number pad hands off 9/10.
- Number-pad hand-off unchanged elsewhere: 20 launches each in parallel, iPhone SE
base 12/20 vs this 18/20, Duo cover base 16/20 vs this 18/20 (the simulator drops some
hand-offs on both builds, a pre-existing flake). Host never died.
- code-shape.py --check passes (FullKeyboardView.swift 1,459 lines, no new files).
- Not verified on a real Duo or an unfolded Duo simulator (it can't be unfolded).