Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Document the attitude hook lock order and iOS 26 template slimming

Jackya6a2aaecd38e
diff --git a/Research/Guest/setup_assistant_skip.md b/Research/Guest/setup_assistant_skip.md
index c975fbbb..8e380620 100644
--- a/Research/Guest/setup_assistant_skip.md
+++ b/Research/Guest/setup_assistant_skip.md
@@ -91,6 +91,15 @@ Until the milestone:
first answered and SpringBoard left alone, Setup never started after the
milestone and the guest went to the Lock Screen.
+iOS 26.6.2 (23G90, `i26-raw`, 2026-10-09) behaves the same: DataMigrator runs
+from the start of the boot and records `LastSystemVersion = 23G90` 64–87 s
+after the VM starts, and had not after 129 s while a 2.9.0 `setup.skip`
+retried every 9 s, so a 2.9.0 setup boot ran out of its 120 s. There a second fault followed: the
+2.9.0 attitude hook deadlocked SpringBoard as soon as migration ended
+(`Research/Guest/virtual_attitude.md`, "Lock order"), so a relaunch was never
+taken at all and Setup.app died to its launch watchdog. With the hook fixed
+the setup boot passes without restarting SpringBoard.
+
So `setup.skip` writes the keys and leaves SpringBoard alone while data
migration is running for the running build: `kern.osversion` is not recorded
as `LastSystemVersion` or as `DMLastMigrationResults.buildVersion`, and
diff --git a/Research/Guest/virtual_attitude.md b/Research/Guest/virtual_attitude.md
index ef765f0a..f23998bc 100644
--- a/Research/Guest/virtual_attitude.md
+++ b/Research/Guest/virtual_attitude.md
@@ -46,6 +46,36 @@ captures and cancellation prevent a timer retaining a released manager.
Enabling/disabling an existing subscription switches between simulation and
retained native implementations, including native availability when disabled.
+### Lock order
+
+"Apps" are paths containing `.app/`, so SpringBoard
+(`/System/Library/CoreServices/SpringBoard.app/SpringBoard`) loads the hook
+too. Core Motion's `-[CMMotionManager setDeviceMotionUpdateInterval:]` (and
+other methods) hop synchronously to its `com.apple.CoreMotion.MotionThread`,
+and blocks on that thread call the public getters, such as
+`isDeviceMotionActive`, on the same manager. The first version held the
+session lock around the native setter and took it again in the getters. On
+iOS 26.6.2 that froze SpringBoard on every boot after data migration: the main
+thread builds the Home Screen's parallax (`SBRootFolderView
+_updateParallaxSettings` → `_UIMotionEffectCoreMotionEventProvider init`),
+which sets the interval, while the MotionThread waits in `VPhoneActive`. The
+screen stayed black, Setup.app was killed by its 20 s launch watchdog waiting
+for SpringBoard, any vphoned call that needs SpringBoard (`screen.unlock`,
+`apps.foreground`, a respring) hung, and template setup boots failed at
+setup-skip. 27.0's setter has the same synchronous hop, so the order matters
+there as well even though no 27.0 boot was seen to hang.
+
+The rule since: no hooked getter waits for a lock that a caller of a native
+method may hold. `active`, `frame` and `latest` are atomic and the getters
+read them without the session lock; the setter calls the native method before
+it takes the lock; sessions are found through the associated object and
+created under a private `os_unfair_lock`, never `@synchronized` on the manager.
+`AttitudeLockOrderTests` (part of `make test-attitude`) replaces the native
+setter, start and stop with stand-ins that wait for a second thread calling
+the getters, and fails without the rule.
+
+### Configuration transport
+
vphoned serializes publication/readback and persists one dictionary,
`VPhoneAttitudeConfiguration`, in mobile's `com.apple.backboardd` preferences.
It packs angles and enabled in one 64-bit Darwin notification state,
diff --git a/Research/Host/machine_templates.md b/Research/Host/machine_templates.md
index 7a3c2bb5..bec4135a 100644
--- a/Research/Host/machine_templates.md
+++ b/Research/Host/machine_templates.md
@@ -367,6 +367,17 @@ those languages.
`--no-template` takes no slimming switch; `--template <id>` takes them only to
check them against the template.
+`trimmed` is the service list measured for the guest's iOS, and vphoned has
+one only for iOS 27 (`GuestServiceProfile.supportedMajors`, mirrored by
+`VPhoneTemplateSlimmingRequest.trimmedServiceProfileMajors`). Elsewhere
+`services.profile.apply trimmed` refuses ("No trimmed service list for iOS
+26"), which used to fail an iOS 26.6.2 build at service-profile, after the
+restore and most of the setup boot. So `VPhoneMachineTemplateSlimming.fitted(toIOSVersion:)`
+turns `trimmed` into `none` on such a version, where the key is made
+(`VPhoneMachineTemplateKeys.key`) and in `vm template setup`: an iOS 26
+template's key reads `services none`. `--accounts-off`, whose group is part of
+the iOS 27 list, is refused there before anything is built.
+
`--slim off` still has a setup boot: skipping Setup and waiting for
first-boot work are not slimming. Without them every clone would start at the
Setup screen and write its own first-boot state (P2 measured 3.2 GB per clone