Run a virtual iPhone on an Apple Silicon Mac.
Swift
Duo: publish the inner display at 3x to every process
Jackyde9d8f805d3f
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.mdindex 7fd4c3c5..699d41b3 100644--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@ -620,6 +620,18 @@> `libdevicehubfix`'s CMAngleManager stand-in steps aside when CoreMotion's> own manager is available.+> **Inner display point scale (2026-10-31, issue #784):**+> `system-springboard-cfw-fold_display`'s `libvphonefolddisplay` now has+> backboardd send `-[CADisplay setDisplayProperties:]` with `pointScale` 3+> for the inner virtual display as soon as the render server answers. A+> virtual display is created at point scale 1 and only SpringBoard's adapter+> answered 3, so a process outside SpringBoard (XCTest under WebDriverAgent,+> vphoned) saw the inner panel at 1x or 2x. The server takes the scale only+> from a caller with `com.apple.QuartzCore.displayable-context`: backboardd's+> request took, SpringBoard's changed nothing. No patch was added or+> changed; see `Research/Guest/iphone_duo_bringup.md`, "the inner display's+> point scale, for every process".+> **SpringBoard fold-guard (2026-10-25):** `system-springboard-cfw-fold_guard`> (guest system set, on in `standard`, blocked in `tvos`, `tvos-4k` and> `homepod-mini`, foldable guests only, iOS 27+; installsdiff --git a/Research/Guest/iphone_duo_bringup.md b/Research/Guest/iphone_duo_bringup.mdindex b79b1138..117714ad 100644--- a/Research/Guest/iphone_duo_bringup.md+++ b/Research/Guest/iphone_duo_bringup.md@@ -5106,3 +5106,49 @@ surface (`willUnblank` never runs: the panel goes off by display state). So`display.orientation` reports `screen_off`, and the VM window covers thepanel with black while it is off and for 0.3 s after it comes on. Both wakesnow go from black to the lock screen (60 fps capture).++## 2026-10-31: the inner display's point scale, for every process++Issue #784: WebDriverAgent saw the inner display at scale 2 (logical+1426.5×1003.5) and captured it at 1x in a corner, and vphoned's+`display.modes` said `pointScale` 1. Only SpringBoard saw 3, through the+adapter's `-[CADisplay pointScale]` answer; applications took 3 from+SpringBoard's display configuration. Every other process (XCTest's, vphoned)+read the render display itself, which a virtual display creates at 1. The+raw scale also showed in SpringBoard's own mode:+`FBSDisplayMode 669x951@3x (2007x2853/2(3.0))`.++Where the value lives (iOS 27.1 QuartzCore, 24A94425):++- A client's `-[CADisplay pointScale]` is the published display info's field+ 0x310 (`CA::Display::Display::update`), which+ `CA::WindowServer::Display::build_display_info_data` copies from the server+ display's field 0x94. `Display`'s constructor sets 1, `AppleDisplay`'s takes+ the panel's; `kCAVirtualDisplay*` options have no scale.+- The only other writer is `Server::set_display_properties`, reached by+ `-[CADisplay setDisplayProperties:]` with `-[CADisplayProperties+ setPointScale:]` (update mask 0x20, 1 to 4), which republishes the info.+ `_CASSetDisplayProperties` clears mask bits 0x10 and 0x20 unless the+ caller's audit flags have bit 1, `com.apple.QuartzCore.displayable-context`+ in `entitlements_for_audit_token`'s table. Sent from SpringBoard it changed+ nothing; from backboardd it took.+- A client keeps the scale it first read: a running Settings and vphoned+ still said 1 after the change, a relaunched Settings 3.++So backboardd sends `pointScale` 3 for the inner display as soon as its+render server answers (`vpSetInnerDisplayPointScale`, on the main queue after+`_detectDisplays`, since a CADisplay call from inside that never returns), a+second after the display is added and before SpringBoard and applications+start. The SpringBoard adapter's answer stays: it changes nothing now, and+covers a SpringBoard that read first.++Measured on sbdisplay-duo after a backboardd restart and after a cold boot+with the new bundle: vphoned's `display.modes` gives the inner display+`pointScale` 3 (display type still 3, virtual: no property sets it); a fresh+Settings has `CADisplay.pointScale` 3, `UIScreen` 951×669 at scale 3 and+`FBSDisplayMode 669x951@3x (2007x2853/3)`, so SpringBoard too read 3 first;+the Home Screen on both panels draws as before and taps open apps on both.+An application started while the device is closed lists only the cover's+`UIScreen`, and one started while open lists both, in the same boot. Not run: WebDriverAgent itself,+and #784's secondary points (`hingeAngle` POST, and the empty `Wireless`+displays, type 2 at 0×0, that WDA lists at 1408×2048 @2).diff --git a/VPhoneGuestComponents/FoldDisplay/FoldDisplayBackboard.m b/VPhoneGuestComponents/FoldDisplay/FoldDisplayBackboard.mindex 78b54828..12dc11c9 100644--- a/VPhoneGuestComponents/FoldDisplay/FoldDisplayBackboard.m+++ b/VPhoneGuestComponents/FoldDisplay/FoldDisplayBackboard.m@@ -58,6 +58,40 @@ static void vpSetInnerDisplayProMotionMode(id display) {vpFoldDisplayLog([NSString stringWithFormat:@"inner display: 120 Hz mode %@", set ? @"set" : @"refused"]);}+// A render display's point scale is what every client's CADisplay.pointScale,+// FBSDisplayMode and UIScreen.scale start from. A hardware display takes it+// from its panel; a virtual display is created at 1, and a process outside+// SpringBoard (XCTest, so WebDriverAgent; vphoned) saw the inner panel at 1x.+// Only a client holding com.apple.QuartzCore.displayable-context may change+// it, which backboardd does, through the render server once that runs: from+// inside _detectDisplays a CADisplay call never returns. A client keeps the+// scale it first read, so this runs as soon as the server answers, before+// SpringBoard or any application starts.+static void vpSetInnerDisplayPointScale(unsigned int attempt) {+ Method set = class_getInstanceMethod(objc_getClass("CADisplay"), sel_registerName("setDisplayProperties:"));+ Method scale = class_getInstanceMethod(objc_getClass("CADisplayProperties"), sel_registerName("setPointScale:"));+ if (!set || !scale || strcmp(method_getTypeEncoding(set), "B24@0:8@16") != 0 ||+ strcmp(method_getTypeEncoding(scale), "v24@0:8Q16") != 0) {+ vpFoldDisplayLog(@"inner display: point scale ABI unavailable, staying at 1x");+ return;+ }+ id inner = nil;+ for (id display in vpReadObject(objc_getClass("CADisplay"), "displays") ?: @[])+ if ([vpReadObject(display, "name") isEqual:vpInnerDisplayName]) inner = display;+ if (!inner) {+ if (attempt < 20)+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC / 4), dispatch_get_main_queue(),+ ^{ vpSetInnerDisplayPointScale(attempt + 1); });+ else+ vpFoldDisplayLog(@"inner display: not among the render server's displays, staying at 1x");+ return;+ }+ id properties = [objc_getClass("CADisplayProperties") new];+ ((void (*)(id, SEL, unsigned long long))objc_msgSend)(properties, sel_registerName("setPointScale:"), 3);+ BOOL accepted = ((BOOL (*)(id, SEL, id))objc_msgSend)(inner, sel_registerName("setDisplayProperties:"), properties);+ vpFoldDisplayLog([NSString stringWithFormat:@"inner display: point scale 3 %@", accepted ? @"sent" : @"refused"]);+}+// Adds the inner panel's render display to a render server, once. It is// never removed: FrontBoard keeps identities for the life of the monitor.static BOOL vpAddInnerRenderDisplayToServer(id server) {@@ -89,7 +123,10 @@ static BOOL vpAddInnerRenderDisplayToServer(id server) {((void (*)(id, SEL, BOOL))objc_msgSend)(display, setEnabled, YES);vpTagUnknownDisplay(display);vpInnerRenderDisplay = display;- dispatch_async(dispatch_get_main_queue(), ^{ vpShareInnerDisplayPages(display); });+ dispatch_async(dispatch_get_main_queue(), ^{+ vpSetInnerDisplayPointScale(0);+ vpShareInnerDisplayPages(display);+ });vpFoldDisplayLog([NSString stringWithFormat:@"inner display: render display added %@ uniqueId=%@", display,[display respondsToSelector:sel_registerName("uniqueId")] ? [display valueForKey:@"uniqueId"] : @"-"]);return YES;