Run a virtual iPhone on an Apple Silicon Mac.
Swift
Research: keep the Duo simulator reference values, drop the raw records
Jacky79334c541dea
diff --git a/Research/Guest/Evidence/duo-sim-baseline/BASELINE.md b/Research/Guest/Evidence/duo-sim-baseline/BASELINE.mdindex e8629f02..e4242e23 100644--- a/Research/Guest/Evidence/duo-sim-baseline/BASELINE.md+++ b/Research/Guest/Evidence/duo-sim-baseline/BASELINE.md@@ -83,13 +83,18 @@ panel's 120 Hz" (in this branch), not from the alignment change.## Data files+These files were deleted on 2026-10-30, after the values worth keeping were+moved into this table, the domain notes and+`Research/Guest/iphone_duo_simulator_reference.md`. Rerunning the probes+recreates them (README.md).+| file | records | scope | notes ||---|---|---|---|| `smoke.json` | 60 | harness smoke run | || `display.json` + `display.md` | 46085 | backboardd CADisplay / CAWindowServer / BKS, SpringBoard UIScreen / FBS display configurations, digitizers | getters enumerated at runtime; extra field `capture` || `springboard.json` + `springboard.md` | 37408 | content-mode coordinator and resolver, window scenes, traits pipeline, continuous fold, backlight, auto-lock | 45 steps, all four device orientations || `sensors.json` + `sensors.md` | 10932 | CMMagicPose / CMDeviceStateEvent tables, hinge HID, SBFDevicePoseProvider, UIDevice, 527 MobileGestalt keys | `sim_note` marks 2578 sim-only or synthetic values; do not align to them |-| `appkit.json` + `appkit.md` | 20829 | Preferences, MobileSafari, VPAppKitProbe: scenes, geometry, traits, safe area, migration callbacks | probe app source in `raw/appkit/probe-app` |+| `appkit.json` + `appkit.md` | 20829 | Preferences, MobileSafari, VPAppKitProbe: scenes, geometry, traits, safe area, migration callbacks | probe app source in `src/appkit/probe-app` || `chrome.json` + `chrome.md` | 127674 | status bar, icon grid, dock, quick actions, notification list, clock, wallpaper | `meta.skipped_getters` lists getters that throw || `vm-springboard.json`, `vm-display.json`, `vm-sensors.json`, `vm-chrome.json`, `vm-appkit.json` + `vm-notes.md` | see `vm-notes.md` | the same probes on duobase-01 | `meta.vm`, `meta.steps` (per-step display.pose, orientation, screenshot size and lit/dark, SpringBoard pid); extra fields `probe`, `step`. Second pass (2026-10-30): records with `bundle` 2.14.0-local.9064efca and `step` `fx-<label>`, described in `meta.fix` |diff --git a/Research/Guest/Evidence/duo-sim-baseline/README.md b/Research/Guest/Evidence/duo-sim-baseline/README.mdindex 4d72fcde..ae52448e 100644--- a/Research/Guest/Evidence/duo-sim-baseline/README.md+++ b/Research/Guest/Evidence/duo-sim-baseline/README.md@@ -4,11 +4,19 @@ Shared tooling for recording what Apple's own iPhone Duo simulator returns frompublic and private APIs in each fold posture, so vphone-duo (iPhone19,4, iOS 27.124A94425 in a Virtualization.framework VM) can be compared against it.-**In the repository:** the tables (`BASELINE.md`, `<domain>.md`, `vm-notes.md`),-`tools/`, `probes/` and `smoke.json`. The per-domain record files-(`<domain>.json`, `vm-<domain>.json`, 2–63 MB each) and the transcripts and-screenshots under `raw/` (about 1 GB) are not committed; rerunning the probes-recreates them. Paths to them in these notes refer to that local output.+**In the repository:**++- the tables: `BASELINE.md`, `<domain>.md`, `vm-notes.md`;+- the harness in `tools/`, the probes in `probes/`, and `smoke.json`;+- `src/`: the per-domain drivers, probe generators, the probe app and the VM+ run scripts, which first lived under `raw/`.++The per-domain record files (`<domain>.json` and `vm-<domain>.json`, 2–63 MB+each) and the transcripts and screenshots under `raw/` (about 1 GB) were+deleted on 2026-10-30. The values worth keeping that were not already in these+tables are now in `Research/Guest/iphone_duo_simulator_reference.md`. Paths to+`*.json` and `raw/` in these notes name output that rerunning the probes+recreates.- Xcode 27.1 (27A9275), runtime iOS 27.1 (24A94425), device type`com.apple.CoreSimulator.SimDeviceType.iPhone-Duo` (iPhone19,4).diff --git a/Research/Guest/Evidence/duo-sim-baseline/appkit.md b/Research/Guest/Evidence/duo-sim-baseline/appkit.mdindex 1956d1ee..5c9c9727 100644--- a/Research/Guest/Evidence/duo-sim-baseline/appkit.md+++ b/Research/Guest/Evidence/duo-sim-baseline/appkit.md@@ -13,7 +13,7 @@ Xcode 27.1. All values are as observed; enums are listed in `appkit.json` `meta.| `probes/appkit-introspect.lldb`, `probes/appkit-hinge-classes.lldb` | getter enumeration (`class_copyMethodList` / properties / ivars) used to choose the getters; output in `raw/appkit/introspect-*.txt` || `probes/appkit-run.zsh` | driver: posture, launch, probe, screenshots, callback log per state || `probes/appkit-merge.zsh` | builds `appkit.json` from `raw/appkit/<app>/<scenario>/records.jsonl` |-| `raw/appkit/probe-app/` | VPAppKitProbe source (`main.m`, `Info.plist`, `build.zsh`) |+| `src/appkit/probe-app/` | VPAppKitProbe source (`main.m`, `Info.plist`, `build.zsh`) || `raw/appkit/<app>/<scenario>/` | per state `NN-<label>.txt` (transcript), `.json` (probe output), `.posture.json`, `shots/NN-<label>-d{1,3}.png`, `posture/` (posture.zsh artifacts), `events.jsonl` (VPAppKitProbe callback log) |Apps: Preferences (SwiftUI `SettingsNavigationSplitView`), MobileSafari, anddiff --git a/Research/Guest/Evidence/duo-sim-baseline/display.md b/Research/Guest/Evidence/duo-sim-baseline/display.mdindex 8be3d269..e70837e1 100644--- a/Research/Guest/Evidence/duo-sim-baseline/display.md+++ b/Research/Guest/Evidence/duo-sim-baseline/display.md@@ -8,8 +8,8 @@ output in `raw/display/posture/` (screenshots downscaled to 480 px).## How it was collected- `probes/display-backboardd.lldb`, `probes/display-springboard.lldb`,- `probes/display-safari.lldb` are generated by `raw/display/gen-probe.zsh` from- `raw/display/src/{helpers.lldbfrag,*.body,footer.lldbfrag}`.+ `probes/display-safari.lldb` are generated by `src/display/gen-probe.zsh` from+ `src/display/src/{helpers.lldbfrag,*.body,footer.lldbfrag}`.- Getters are enumerated, not listed by hand. For each object, the probe takesevery declared property getter plus every zero-argument, non-void method ofthe class and its superclasses below NSObject (`class_copyPropertyList`,@@ -23,12 +23,12 @@ output in `raw/display/posture/` (screenshots downscaled to 480 px).32 display-relevant getters are named in the probe, because third-partycategories add hundreds more.- lldb expressions here cannot use `@try`. A getter that raises an exception- aborts the whole expression, so `raw/display/iterate.zsh` traced the last+ aborts the whole expression, so `src/display/iterate.zsh` traced the lastgetter called to a file and added it to a skip list. Only one getter raised:`-[CAWindowServerDisplay secureIndicatorsEnabled]`. It is recorded with theerror "raises an Objective-C exception in this process (not called)".- Each capture: `posture.zsh` (swap or status), then the backboardd probe, then- the SpringBoard probe (plus MobileSafari for 08-13). `raw/display/capture.zsh`,+ the SpringBoard probe (plus MobileSafari for 08-13). `src/display/capture.zsh`,`orient-cycle.zsh`, `merge.zsh`.## Capturesdiff --git a/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-merge.zsh b/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-merge.zshindex 16451df9..0ff21a06 100755--- a/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-merge.zsh+++ b/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-merge.zsh@@ -39,7 +39,7 @@ $jq -n --argjson runtime "$runtime" --argjson device "$device" --arg xcode "$xcoapps: {Preferences: "com.apple.Preferences",MobileSafari: "com.apple.mobilesafari",- VPAppKitProbe: "com.vphone.duobaseline.appkitprobe: minimal ObjC UIKit app, all 4 orientations in Info.plist, one window scene, UIDeviceFamily 1; source raw/appkit/probe-app (build.zsh); logs every scene/geometry/trait/screen/hinge callback to Documents/events.jsonl"+ VPAppKitProbe: "com.vphone.duobaseline.appkitprobe: minimal ObjC UIKit app, all 4 orientations in Info.plist, one window scene, UIDeviceFamily 1; source src/appkit/probe-app (build.zsh); logs every scene/geometry/trait/screen/hinge callback to Documents/events.jsonl"},scenarios: {"launch-closed": "closed (portrait) -> launch app -> book (anchored at closed) -> open (from book) -> closed",diff --git a/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-run.zsh b/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-run.zshindex 2e274e45..95f8f457 100755--- a/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-run.zsh+++ b/Research/Guest/Evidence/duo-sim-baseline/probes/appkit-run.zsh@@ -74,7 +74,7 @@ snap() {value: ($shots | split("\n") | map(split(" ") | {path: (.[0] | sub($rootp; "")), state: .[1]})), error: null} | tag),(if $app_is_probe then{api: "VPAppKitProbe.callbackSequence", kind: "public",- call: "UIWindowSceneDelegate / UISceneDelegate / UIViewController / UIHingeInteraction / NSNotification callbacks logged by raw/appkit/probe-app since the posture change started (t_rel seconds after posture.zsh was invoked; the swap itself begins after its lldb detach, ~3-4 s later)",+ call: "UIWindowSceneDelegate / UISceneDelegate / UIViewController / UIHingeInteraction / NSNotification callbacks logged by src/appkit/probe-app since the posture change started (t_rel seconds after posture.zsh was invoked; the swap itself begins after its lldb detach, ~3-4 s later)",value: $ev, error: (if ($ev | length) == 0 then "no callbacks since the posture change started" else null end)} | tagelse empty end)' --argjson app_is_probe $([[ $app == VPAppKitProbe ]] && print true || print false) >> $dir/records.jsonldiff --git a/Research/Guest/Evidence/duo-sim-baseline/sensors.md b/Research/Guest/Evidence/duo-sim-baseline/sensors.mdindex 2fbae66e..282b356c 100644--- a/Research/Guest/Evidence/duo-sim-baseline/sensors.md+++ b/Research/Guest/Evidence/duo-sim-baseline/sensors.md@@ -21,7 +21,7 @@ the value is synthetic or sim-only). Raw transcripts: `raw/sensors/snap/`.| `probes/sensors-backboardd.lldb` | group `hid`: backboardd's HID services, the hinge-angle service and its last events, event processors || `probes/sensors-app-hinge-register.lldb` | not a record source: registers a no-op hinge observer in Preferences (see "App side") || `probes/sensors-discover-*.lldb` | discovery dumps (method/ivar/property lists, class scans) → `raw/sensors/discovery/` |-| `raw/sensors/run-sensors.zsh` | runner: `posture`, `snapshot`, `assemble` |+| `src/sensors/run-sensors.zsh` | runner: `posture`, `snapshot`, `assemble` || `raw/sensors/sim-notes.jq` | the rules that set `sim_note` || `raw/sensors/identity/` | the device type's `capabilities.plist` / `profile.plist` as JSON (the source of many MobileGestalt answers), and the MG key list || `raw/sensors/snap/<nn>-<posture>/` | per snapshot: transcripts (`<process>-<probe>.txt` and `.raw.txt`), `records.jsonl`, `posture.json` |diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/Info.plist b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/Info.plistnew file mode 100644index 00000000..188913e9--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/Info.plist@@ -0,0 +1,38 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>CFBundleIdentifier</key><string>com.vphone.duobaseline.appkitprobe</string>+ <key>CFBundleExecutable</key><string>VPAppKitProbe</string>+ <key>CFBundleName</key><string>VPAppKitProbe</string>+ <key>CFBundleDisplayName</key><string>AppKitProbe</string>+ <key>CFBundlePackageType</key><string>APPL</string>+ <key>CFBundleShortVersionString</key><string>1.0</string>+ <key>CFBundleVersion</key><string>1</string>+ <key>CFBundleSupportedPlatforms</key><array><string>iPhoneSimulator</string></array>+ <key>MinimumOSVersion</key><string>27.1</string>+ <key>UIDeviceFamily</key><array><integer>1</integer></array>+ <key>UILaunchScreen</key><dict/>+ <key>UISupportedInterfaceOrientations</key>+ <array>+ <string>UIInterfaceOrientationPortrait</string>+ <string>UIInterfaceOrientationPortraitUpsideDown</string>+ <string>UIInterfaceOrientationLandscapeLeft</string>+ <string>UIInterfaceOrientationLandscapeRight</string>+ </array>+ <key>UIApplicationSceneManifest</key>+ <dict>+ <key>UIApplicationSupportsMultipleScenes</key><false/>+ <key>UISceneConfigurations</key>+ <dict>+ <key>UIWindowSceneSessionRoleApplication</key>+ <array>+ <dict>+ <key>UISceneConfigurationName</key><string>Default</string>+ <key>UISceneDelegateClassName</key><string>VPSceneDelegate</string>+ </dict>+ </array>+ </dict>+ </dict>+</dict>+</plist>diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/build.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/build.zshnew file mode 100755index 00000000..1d870dea--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/build.zsh@@ -0,0 +1,12 @@+#!/bin/zsh+# build.zsh [out-dir] — builds and ad hoc signs VPAppKitProbe.app for the iOS 27.1 simulator.+set -euo pipefail+here=${0:a:h}+out=${1:-$here/build}+app=$out/VPAppKitProbe.app+rm -rf $app; mkdir -p $app+xcrun --sdk iphonesimulator clang -arch arm64 -mios-simulator-version-min=27.1 -fobjc-arc -fmodules \+ -Wall -Wno-deprecated-declarations -framework UIKit -o $app/VPAppKitProbe $here/main.m+cp $here/Info.plist $app/Info.plist+codesign -s - -f $app >/dev/null 2>&1+print -- $appdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/main.m b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/main.mnew file mode 100644index 00000000..824dd86a--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/appkit/probe-app/main.m@@ -0,0 +1,191 @@+// VPAppKitProbe: a minimal third-party-style UIKit app for the iPhone Duo baseline+// (appkit domain). It supports all four orientations, adopts the scene lifecycle with+// one window scene, and logs every scene / geometry / trait / screen / hinge callback,+// each with a snapshot of the geometry the app sees, as JSON lines to+// <data container>/Documents/events.jsonl (and NSLog). Only public API, except the snapshot reads the private+// UITraitCollection -displayCornerRadius when it responds.+#import <UIKit/UIKit.h>+#include <mach/mach_time.h>++static NSFileHandle *VPLogHandle;+static double VPMono(void) {+ static mach_timebase_info_data_t tb; if (!tb.denom) mach_timebase_info(&tb);+ return (double)mach_continuous_time() * tb.numer / tb.denom / 1e9;+}+static NSDictionary *VPRect(CGRect r) { return @{@"x": @(r.origin.x), @"y": @(r.origin.y), @"width": @(r.size.width), @"height": @(r.size.height)}; }+static NSDictionary *VPInsets(UIEdgeInsets i) { return @{@"top": @(i.top), @"left": @(i.left), @"bottom": @(i.bottom), @"right": @(i.right)}; }++static UIWindowScene *VPScene(void) {+ for (UIScene *s in UIApplication.sharedApplication.connectedScenes)+ if ([s isKindOfClass:UIWindowScene.class]) return (UIWindowScene *)s;+ return nil;+}++static NSDictionary *VPSnapshot(UIWindowScene *ws) {+ if (!ws) return @{};+ UIWindow *w = ws.windows.firstObject;+ UIScreen *sc = ws.screen;+ UITraitCollection *tc = ws.traitCollection;+ UIWindowSceneGeometry *g = ws.effectiveGeometry;+ NSMutableArray *screens = [NSMutableArray array];+ for (UIScreen *s in UIScreen.screens) [screens addObject:[NSString stringWithFormat:@"%p", s]];+ return @{+ @"scene": [NSString stringWithFormat:@"%p", ws],+ @"activationState": @(ws.activationState),+ @"screen": [NSString stringWithFormat:@"%p", sc],+ @"screenIsMain": @(sc == UIScreen.mainScreen),+ @"screens": screens,+ @"mainScreen": [NSString stringWithFormat:@"%p", UIScreen.mainScreen],+ @"screenBounds": VPRect(sc.bounds), @"screenNativeBounds": VPRect(sc.nativeBounds), @"screenScale": @(sc.scale),+ @"sceneBounds": VPRect(ws.coordinateSpace.bounds),+ @"geometryBounds": VPRect(g.coordinateSpace.bounds),+ @"geometryOrientation": @(g.interfaceOrientation),+ @"geometryResizing": @(g.isInteractivelyResizing),+ @"geometryOrientationLocked": @(g.isInterfaceOrientationLocked),+ @"interfaceOrientation": @(ws.interfaceOrientation),+ @"hsc": @(tc.horizontalSizeClass), @"vsc": @(tc.verticalSizeClass), @"idiom": @(tc.userInterfaceIdiom),+ @"displayScale": @(tc.displayScale), @"displayCornerRadius(private)": [tc respondsToSelector:NSSelectorFromString(@"displayCornerRadius")] ? [tc valueForKey:@"displayCornerRadius"] : [NSNull null],+ @"windowFrame": w ? VPRect(w.frame) : [NSNull null],+ @"windowSafeArea": w ? VPInsets(w.safeAreaInsets) : [NSNull null],+ @"statusBarFrame": VPRect(ws.statusBarManager.statusBarFrame),+ @"deviceOrientation": @(UIDevice.currentDevice.orientation),+ };+}++static void VPLog(NSString *event, id detail) {+ NSDictionary *rec = @{@"t": @(CFAbsoluteTimeGetCurrent()), @"mono": @(VPMono()), @"event": event,+ @"detail": detail ?: [NSNull null], @"snapshot": VPSnapshot(VPScene())};+ NSData *d = [NSJSONSerialization dataWithJSONObject:rec options:NSJSONWritingSortedKeys error:nil];+ if (!d) return;+ NSLog(@"VPAppKitProbe %@", [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding]);+ [VPLogHandle writeData:d]; [VPLogHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];+}++static NSString *VPHingeDesc(UIHinge *h) {+ return h ? [NSString stringWithFormat:@"status=%ld angle=%.3f", (long)h.status, (double)h.angle] : @"nil";+}++// MARK: - View controller++@interface VPViewController : UIViewController+@property (nonatomic, strong) UILabel *label;+@property (nonatomic) CGRect lastBounds;+@end++@implementation VPViewController+- (void)viewDidLoad {+ [super viewDidLoad];+ self.view.backgroundColor = UIColor.systemTealColor;+ self.label = [UILabel new];+ self.label.numberOfLines = 0;+ self.label.font = [UIFont monospacedSystemFontOfSize:13 weight:UIFontWeightRegular];+ self.label.translatesAutoresizingMaskIntoConstraints = NO;+ [self.view addSubview:self.label];+ UILayoutGuide *sa = self.view.safeAreaLayoutGuide;+ [NSLayoutConstraint activateConstraints:@[+ [self.label.leadingAnchor constraintEqualToAnchor:sa.leadingAnchor constant:8],+ [self.label.trailingAnchor constraintEqualToAnchor:sa.trailingAnchor constant:-8],+ [self.label.topAnchor constraintEqualToAnchor:sa.topAnchor constant:8]]];+ UIHingeInteraction *hi = [[UIHingeInteraction alloc] initWithUpdateHandler:^(UIHingeInteraction *i, UIHingeInteractionUpdate *u) {+ VPLog(@"UIHingeInteraction.update", VPHingeDesc(u.hinge));+ }];+ [self.view addInteraction:hi];+ NSArray *traits = @[UITraitHorizontalSizeClass.class, UITraitVerticalSizeClass.class, UITraitDisplayScale.class,+ UITraitUserInterfaceIdiom.class, UITraitDisplayGamut.class, UITraitLayoutDirection.class];+ [self registerForTraitChanges:traits withHandler:^(VPViewController *vc, UITraitCollection *prev) {+ VPLog(@"traitChange", [NSString stringWithFormat:@"prev hsc=%ld vsc=%ld scale=%.1f now hsc=%ld vsc=%ld scale=%.1f",+ (long)prev.horizontalSizeClass, (long)prev.verticalSizeClass, prev.displayScale,+ (long)vc.traitCollection.horizontalSizeClass, (long)vc.traitCollection.verticalSizeClass, vc.traitCollection.displayScale]);+ }];+}+- (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; }+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)c {+ [super viewWillTransitionToSize:size withTransitionCoordinator:c];+ VPLog(@"viewWillTransitionToSize", @{@"width": @(size.width), @"height": @(size.height)});+}+- (void)viewSafeAreaInsetsDidChange { [super viewSafeAreaInsetsDidChange]; VPLog(@"viewSafeAreaInsetsDidChange", VPInsets(self.view.safeAreaInsets)); }+- (void)viewDidLayoutSubviews {+ [super viewDidLayoutSubviews];+ if (!CGRectEqualToRect(self.lastBounds, self.view.bounds)) {+ self.lastBounds = self.view.bounds;+ VPLog(@"viewDidLayoutSubviews.boundsChanged", VPRect(self.view.bounds));+ }+ NSDictionary *s = VPSnapshot(VPScene());+ self.label.text = [NSString stringWithFormat:@"VPAppKitProbe\nscene %@\nscreen %@ main=%@\norient %@ hsc %@ vsc %@\nsafe %@",+ s[@"sceneBounds"], s[@"screenBounds"], s[@"screenIsMain"], s[@"interfaceOrientation"], s[@"hsc"], s[@"vsc"],+ s[@"windowSafeArea"]];+}+@end++// MARK: - Scene delegate++@interface VPSceneDelegate : UIResponder <UIWindowSceneDelegate>+@property (nonatomic, strong) UIWindow *window;+@end++@implementation VPSceneDelegate+- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)o {+ UIWindowScene *ws = (UIWindowScene *)scene;+ self.window = [[UIWindow alloc] initWithWindowScene:ws];+ self.window.rootViewController = [VPViewController new];+ [self.window makeKeyAndVisible];+ [ws addObserver:self forKeyPath:@"effectiveGeometry" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:NULL];+ VPLog(@"scene:willConnectToSession", session.persistentIdentifier);+}+- (void)observeValueForKeyPath:(NSString *)kp ofObject:(id)o change:(NSDictionary *)ch context:(void *)ctx {+ VPLog(@"KVO.effectiveGeometry", @{@"old": [ch[NSKeyValueChangeOldKey] description] ?: @"", @"new": [ch[NSKeyValueChangeNewKey] description] ?: @""});+}+- (void)windowScene:(UIWindowScene *)ws didUpdateEffectiveGeometry:(UIWindowSceneGeometry *)prev {+ VPLog(@"windowScene:didUpdateEffectiveGeometry:", @{@"previous": prev.description ?: @"", @"current": ws.effectiveGeometry.description ?: @""});+}+- (void)windowScene:(UIWindowScene *)ws didUpdateCoordinateSpace:(id<UICoordinateSpace>)prevSpace+ interfaceOrientation:(UIInterfaceOrientation)prevOrientation traitCollection:(UITraitCollection *)prevTraits {+ VPLog(@"windowScene:didUpdateCoordinateSpace:interfaceOrientation:traitCollection:",+ @{@"prevBounds": VPRect(prevSpace.bounds), @"prevOrientation": @(prevOrientation),+ @"prevHsc": @(prevTraits.horizontalSizeClass), @"prevVsc": @(prevTraits.verticalSizeClass)});+}+- (void)sceneDidDisconnect:(UIScene *)s { VPLog(@"sceneDidDisconnect", nil); }+- (void)sceneDidBecomeActive:(UIScene *)s { VPLog(@"sceneDidBecomeActive", nil); }+- (void)sceneWillResignActive:(UIScene *)s { VPLog(@"sceneWillResignActive", nil); }+- (void)sceneWillEnterForeground:(UIScene *)s { VPLog(@"sceneWillEnterForeground", nil); }+- (void)sceneDidEnterBackground:(UIScene *)s { VPLog(@"sceneDidEnterBackground", nil); }+@end++// MARK: - App delegate++@interface VPAppDelegate : UIResponder <UIApplicationDelegate>+@end++@implementation VPAppDelegate+- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts {+ NSString *docs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;+ NSString *path = [docs stringByAppendingPathComponent:@"events.jsonl"];+ if (![NSFileManager.defaultManager fileExistsAtPath:path]) [NSData.data writeToFile:path atomically:YES];+ VPLogHandle = [NSFileHandle fileHandleForWritingAtPath:path];+ [VPLogHandle seekToEndOfFile];+ [UIDevice.currentDevice beginGeneratingDeviceOrientationNotifications];+ NSArray *names = @[UISceneWillConnectNotification, UISceneDidDisconnectNotification, UISceneDidActivateNotification,+ UISceneWillDeactivateNotification, UISceneWillEnterForegroundNotification, UISceneDidEnterBackgroundNotification,+ UIScreenDidConnectNotification, UIScreenDidDisconnectNotification, UIScreenModeDidChangeNotification,+ UIDeviceOrientationDidChangeNotification, UIApplicationDidBecomeActiveNotification,+ UIApplicationWillResignActiveNotification];+ for (NSString *n in names)+ [NSNotificationCenter.defaultCenter addObserverForName:n object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *note) {+ VPLog([@"notification." stringByAppendingString:note.name], [NSString stringWithFormat:@"%@", note.object]);+ }];+ VPLog(@"didFinishLaunching", @{@"pid": @(getpid())});+ return YES;+}+- (UISceneConfiguration *)application:(UIApplication *)app configurationForConnectingSceneSession:(UISceneSession *)s options:(UISceneConnectionOptions *)o {+ UISceneConfiguration *c = [[UISceneConfiguration alloc] initWithName:@"Default" sessionRole:s.role];+ c.delegateClass = VPSceneDelegate.class;+ return c;+}+- (UIInterfaceOrientationMask)application:(UIApplication *)app supportedInterfaceOrientationsForWindow:(UIWindow *)w {+ return UIInterfaceOrientationMaskAll;+}+@end++int main(int argc, char *argv[]) {+ @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass(VPAppDelegate.class)); }+}diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/capture.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/capture.zshnew file mode 100755index 00000000..e4d076e9--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/capture.zsh@@ -0,0 +1,28 @@+#!/bin/zsh+# capture.zsh <seq-label> <posture-label> <requested-orientation> <posture.zsh args...|status>+# Drives the posture (posture.zsh output -> raw/display/posture), then runs the backboardd and+# SpringBoard display probes and stores their transcripts as raw/display/states/<seq-label>-*.txt.+# Appends one line to raw/display/states/manifest.jsonl.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+jq=/opt/homebrew/bin/jq+sim=duo-baseline-display+seq=$1 plabel=$2 reqo=$3; shift 3+mkdir -p $here/states+pjson=$here/states/$seq-posture.json+rc=0+POSTURE_OUT=$here/posture $root/tools/posture.zsh $sim "$@" > $pjson || rc=$?+if (( rc == 3 )); then+ print -u2 "capture: posture not verified (exit 3); waiting out the testing lock and re-checking status"+ sleep 11+ POSTURE_OUT=$here/posture $root/tools/posture.zsh $sim status > $here/states/$seq-posture-recheck.json || true+fi+$here/gen-probe.zsh backboardd >/dev/null; $here/gen-probe.zsh springboard >/dev/null+$root/tools/probe.zsh $sim backboardd $root/probes/display-backboardd.lldb $here/states/$seq-backboardd.txt+$root/tools/probe.zsh $sim SpringBoard $root/probes/display-springboard.lldb $here/states/$seq-springboard.txt+for p in backboardd springboard; do+ grep -q '^{"' $here/states/$seq-$p.txt || { print -u2 "capture: no JSON in $seq-$p.txt"; grep -m3 -E '^error' $here/states/$seq-$p.txt >&2 || true; }+done+$jq -c --arg seq $seq --arg posture $plabel --arg reqo $reqo --arg args "$*" --argjson rc $rc \+ '{seq: $seq, posture: $posture, requested_orientation: $reqo, posture_args: $args, posture_exit: $rc, lit: .screenshots.lit_panel, hinge: .springboard.hinge_state, policy: .springboard.prevailing_policy, primary_on: .springboard.primary_on}' $pjson | tee -a $here/states/manifest.jsonl+for p in backboardd springboard; do grep '^{"' $here/states/$seq-$p.txt | $jq -c --arg p $p '{p: $p, n: (.records|length), orientation, errors: ([.records[] | select(.error != null)] | length)}' || true; donediff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/diffstates.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/diffstates.zshnew file mode 100755index 00000000..d6d773a9--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/diffstates.zsh@@ -0,0 +1,9 @@+#!/bin/zsh+# diffstates.zsh <seqA> <seqB> <backboardd|springboard> : list calls whose value differs (pointer addresses masked)+set -euo pipefail+here=${0:a:h}; jq=/opt/homebrew/bin/jq+norm='def n: if type == "string" then gsub("0x[0-9a-fA-F]+"; "0x?") elif type == "object" then with_entries(.value |= n) elif type == "array" then map(n) else . end; [.records[] | {key: .call, value: ((.value | n | tostring) + (if .error then " ERR:" + .error else "" end))}] | from_entries'+grep '^{"' $here/states/$1-$3.txt | $jq "$norm" > /tmp/vpA.$$+grep '^{"' $here/states/$2-$3.txt | $jq "$norm" > /tmp/vpB.$$+$jq -n -r --slurpfile a /tmp/vpA.$$ --slurpfile b /tmp/vpB.$$ '$a[0] as $A | $b[0] as $B | ($A + $B | keys[]) as $k | select($A[$k] != $B[$k]) | "\($k)\n A: \($A[$k] // "-" | .[0:300])\n B: \($B[$k] // "-" | .[0:300])"'+rm -f /tmp/vpA.$$ /tmp/vpB.$$diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-discover.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-discover.zshnew file mode 100755index 00000000..a24ff7a5--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-discover.zsh@@ -0,0 +1,31 @@+#!/bin/zsh+# gen-discover.zsh <outfile.lldb> Class1 Class2 ... : emits an lldb probe dumping methods, ivars, props of each class.+set -euo pipefail+out=$1; shift+list=""+for c in "$@"; do list+="@\"$c\", "; done+cat > $out <<LL+expr -l objc -O --+NSMutableString *vpOut = [NSMutableString string];+NSArray *vpClasses = @[${list%, }];+for (NSString *vpName in vpClasses) {+ Class vpC = NSClassFromString(vpName);+ [vpOut appendFormat:@"=== %@ %p super=%s\n", vpName, vpC, vpC ? class_getName(class_getSuperclass(vpC)) : "-"];+ if (!vpC) continue;+ unsigned int vpN = 0;+ Method *vpM = class_copyMethodList(object_getClass(vpC), &vpN);+ for (unsigned int vi = 0; vi < vpN; vi++) [vpOut appendFormat:@"+ %s %.80s\n", sel_getName(method_getName(vpM[vi])), method_getTypeEncoding(vpM[vi])];+ free(vpM);+ vpM = class_copyMethodList(vpC, &vpN);+ for (unsigned int vi = 0; vi < vpN; vi++) [vpOut appendFormat:@"- %s %.80s\n", sel_getName(method_getName(vpM[vi])), method_getTypeEncoding(vpM[vi])];+ free(vpM);+ Ivar *vpI = class_copyIvarList(vpC, &vpN);+ for (unsigned int vi = 0; vi < vpN; vi++) [vpOut appendFormat:@"ivar %s %.120s\n", ivar_getName(vpI[vi]), ivar_getTypeEncoding(vpI[vi])];+ free(vpI);+ objc_property_t *vpP = class_copyPropertyList(vpC, &vpN);+ for (unsigned int vi = 0; vi < vpN; vi++) [vpOut appendFormat:@"prop %s %.100s\n", property_getName(vpP[vi]), property_getAttributes(vpP[vi])];+ free(vpP);+}+vpOut++LLdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-probe.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-probe.zshnew file mode 100755index 00000000..aa06c6e3--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/gen-probe.zsh@@ -0,0 +1,7 @@+#!/bin/zsh+# gen-probe.zsh <body-name> : writes probes/display-<body-name>.lldb from src/helpers + src/<body>.body + src/footer+set -euo pipefail+here=${0:a:h}+root=${here:h:h}+{ print -- "expr -l objc -O --"; cat $here/src/helpers.lldbfrag $here/src/$1.body $here/src/footer.lldbfrag; } > $root/probes/display-$1.lldb+print -- $root/probes/display-$1.lldbdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/iterate.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/iterate.zshnew file mode 100755index 00000000..835fca0a--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/iterate.zsh@@ -0,0 +1,18 @@+#!/bin/zsh+# iterate.zsh <body> <process>: run the probe; on an ObjC exception, add the traced selector to vpThrowSels and retry.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+trace=/private/tmp/claude-501/-Users-Jacky--claude-spares-spare-SBbPAl/57b50db2-159e-4729-b15b-b24d84c6e854/scratchpad/vptrace.txt+for i in {1..25}; do+ rm -f $trace+ $here/gen-probe.zsh $1 >/dev/null+ $root/tools/probe.zsh duo-baseline-display $2 $root/probes/display-$1.lldb $here/test-$1.txt 2>/dev/null || true+ if grep -q 'exception breakpoint' $here/test-$1.txt; then+ sel=$(awk '{print $NF}' $trace)+ print -- "throws: $(cat $trace)"+ perl -pi -e "s/^NSArray \\*vpThrowSels = \\@\\[/NSArray *vpThrowSels = \\@[\\@\"$sel\", /" $here/src/helpers.lldbfrag+ else+ grep -E '^error' $here/test-$1.txt | head -5 || true+ print -- "done: $(wc -c < $here/test-$1.txt) bytes"; break+ fi+donediff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/merge.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/merge.zshnew file mode 100755index 00000000..02c6fd45--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/merge.zsh@@ -0,0 +1,48 @@+#!/bin/zsh+# merge.zsh: build ../../display.json from states/manifest.jsonl and the per-state probe transcripts.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+jq=/opt/homebrew/bin/jq+U=28D2B766-8C33-40F0-99D3-56571D6FF08A+work=$(mktemp -d -t dispmerge); trap 'rm -rf "$work"' EXIT+runtime=$(xcrun simctl list runtimes -j | $jq -c '.runtimes[] | select(.identifier == "com.apple.CoreSimulator.SimRuntime.iOS-27-1") | {identifier, version, buildversion}')+device=$(xcrun simctl list devices -j | $jq -c --arg u $U '.devices[] | .[] | select(.udid == $u) | {name, udid, deviceTypeIdentifier}')+xcode=$(xcodebuild -version | tr '\n' ' ' | sed 's/ *$//')+: > $work/records.jsonl; : > $work/postures.jsonl+while IFS= read -r line; do+ seq=$(print -r -- $line | $jq -r .seq); posture=$(print -r -- $line | $jq -r .posture); orient=$(print -r -- $line | $jq -r .requested_orientation)+ $jq -c --arg seq $seq --argjson m "$line" '{seq: $seq, capture: $m, posture_driver: .}' $here/states/$seq-posture.json >> $work/postures.jsonl+ for p in backboardd springboard safari; do+ f=$here/states/$seq-$p.txt+ [[ -e $f ]] || continue+ proc=$p; [[ $p == springboard ]] && proc=SpringBoard; [[ $p == safari ]] && proc=MobileSafari+ grep '^{"' $f | $jq -c --arg proc $proc --arg posture $posture --arg orient $orient --arg seq $seq '+ def pubscreen: ["bounds","nativeBounds","scale","nativeScale","coordinateSpace","fixedCoordinateSpace","traitCollection","maximumFramesPerSecond","currentMode","preferredMode","availableModes","mirroredScreen","brightness","wantsSoftwareDimming","overscanCompensation","overscanCompensationInsets","applicationFrame","isCaptured","calibratedLatency","currentEDRHeadroom","potentialEDRHeadroom","referenceDisplayModeStatus","description","class","displayIdentity_never"];+ .records[] | . as $r | ($r.api | split(".")) as $parts |+ {api, kind: (if ($parts[0] == "UIScreen" and ($parts | length) == 2 and (pubscreen | index($parts[1]))) then "public"+ elif ($parts[0] == "UITraitCollection" and ($parts[1] | startswith("_") | not)) then "public"+ else .kind end),+ process: $proc, posture: $posture, orientation: $orient, call, value, error, capture: $seq}' >> $work/records.jsonl+ done+done < $here/states/manifest.jsonl+$jq -n \+ --argjson runtime "$runtime" --argjson device "$device" --arg xcode "$xcode" \+ --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg host "$(sw_vers -productVersion) $(sysctl -n machdep.cpu.brand_string)" \+ --slurpfile pos $work/postures.jsonl --slurpfile recs $work/records.jsonl '+ {+ meta: {+ domain: "display", runtime: $runtime, device: $device, xcode: $xcode, host: $host, date: $date,+ posture_mechanism: "SBDisplayToolServiceCoordinator performDisplaySwapWithSettings: (tools/posture.zsh)",+ capture_order: [$pos[] | .seq],+ notes: [+ "posture: the posture.zsh posture plus the path that led to it, e.g. open(after-closed). closed(boot) is the state right after boot, before any swap. +safari: MobileSafari was the foreground app (captures 08-10, 12, 13); captures 01-07 and 11 are on the home screen. 11-reboot is a second boot of the same simulator (shutdown + boot after capture 10-open-P); display UUIDs change on every boot.",+ "orientation: for captures 01-07 the device was never rotated (portrait; SpringBoard scenes are portrait-only). For 08-10, 12 and 13 it is the -deviceOrientation option passed to the swap tool; the swap tool option landscapeLeft produced UIDeviceOrientation 4 and interface orientation 4 (UIInterfaceOrientationLandscapeLeft) in MobileSafari, landscapeRight produced 3/3 on the cover; on the inner display the app scene is rotated a quarter turn from that: portrait gives interface 4, landscapeLeft 1, landscapeRight 2 (see the MobileSafari and SpringBoard UIApplication.connectedScenes.summary records). MobileSafari records (process MobileSafari) show what the app saw. SpringBoard primary scenes on the cover stay interfaceOrientation 1; the inner primary scene follows the app (1, 2 or 4) - with device portrait it reported 1 right after an unfold from closed (09-book-P, 12-open-P) and 4 when the swap started on the inner (10-open-P, 13-book-P).",+ "capture: extra field, the raw/display/states/<capture>-<process>.txt transcript the record came from.",+ "BKOrientationManager raw device orientation: 0 in captures 01-07; later captures follow BKSHIDServicesSetDeviceOrientationForAutomation calls made while finding a working rotation method (last call: 1). The swap tool -deviceOrientation does not change it. After the reboot (11-13) it is 0 again.",+ "Volatile values (differ between any two reads): CAWindowServerDisplay nextWakeupTime/previousVBL/vblDelta, contextIdAtPosition, pointer addresses inside description strings, BKDigitizerTouchStreamClient creationTime, BKDisplayBrightnessController freeze times."+ ],+ postures: [$pos[]]+ },+ records: $recs+ }' > $root/display.json+print -- "merge: $($jq '.records | length' $root/display.json) records -> $root/display.json"diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/orient-cycle.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/orient-cycle.zshnew file mode 100755index 00000000..765438b1--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/orient-cycle.zsh@@ -0,0 +1,21 @@+#!/bin/zsh+# orient-cycle.zsh <seq-prefix> <posture-verb> <posture-label-P> <posture-label-after>+# With MobileSafari in the foreground: posture swap to <verb> with -deviceOrientation=portrait,+# landscapeLeft, landscapeRight (the swap tool's option names), capturing after each; then a+# reset swap to portrait. Safari's own UIDevice/scene orientation is recorded too.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+U=28D2B766-8C33-40F0-99D3-56571D6FF08A+pfx=$1 verb=$2 lp=$3 la=$4+pgrep -f "MobileSafari" >/dev/null && $root/tools/sim.zsh pid $U MobileSafari >/dev/null 2>&1 || { xcrun simctl launch $U com.apple.mobilesafari >/dev/null; sleep 5 }+$here/gen-probe.zsh safari >/dev/null+cap() {+ local seq=$1; shift+ $here/capture.zsh $seq "$@" 2>&1 | grep -v '^probe.zsh'+ $root/tools/probe.zsh $U MobileSafari $root/probes/display-safari.lldb $here/states/$seq-safari.txt 2>/dev/null+ print -- "$seq safari: $(grep '^{"' $here/states/$seq-safari.txt | /opt/homebrew/bin/jq -c '[.orientation, (.records[] | select(.api=="UIDevice.orientation") | .value), (.records[] | select(.api=="UIApplication.connectedScenes.summary") | .value[] | [.screenName, .interfaceOrientation, .coordinateSpaceBounds.width, .coordinateSpaceBounds.height])]')"+}+cap $pfx-P "$lp+safari" portrait $verb -deviceOrientation=portrait+cap $pfx-LL "$la+safari" landscapeLeft $verb -deviceOrientation=landscapeLeft+cap $pfx-LR "$la+safari" landscapeRight $verb -deviceOrientation=landscapeRight+POSTURE_OUT=$here/posture $root/tools/posture.zsh $U $verb -deviceOrientation=portrait >/dev/null 2>&1 || truediff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/orient.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/display/orient.zshnew file mode 100755index 00000000..f6ed21fc--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/orient.zsh@@ -0,0 +1,8 @@+#!/bin/zsh+# orient.zsh <UIDeviceOrientation 1-4>: BKSHIDServicesSetDeviceOrientationForAutomation from inside SpringBoard, then wait.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+$root/tools/probe.zsh duo-baseline-display SpringBoard - <<EOT >/dev/null 2>&1+expr -l objc -O -- ((void (*)(long long))dlsym(RTLD_DEFAULT, "BKSHIDServicesSetDeviceOrientationForAutomation"))($1); @"called"+EOT+sleep ${ORIENT_SETTLE:-4}diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/backboardd.body b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/backboardd.bodynew file mode 100644index 00000000..3b6fb8c9--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/backboardd.body@@ -0,0 +1,120 @@+id vpOrientation = nil;+Class vpCADisplay = NSClassFromString(@"CADisplay");+Class vpCADisplayMode = NSClassFromString(@"CADisplayMode");+NSString *(^vpCStr)(char *) = ^NSString *(char *s) { if (!s) return (NSString *)nil; NSString *vs = [NSString stringWithUTF8String:s]; free(s); return vs; };+NSArray *vpDisplays = ((id (*)(id, SEL))objc_msgSend)(vpCADisplay, @selector(displays));+NSObject *vpMain = ((id (*)(id, SEL))objc_msgSend)(vpCADisplay, @selector(mainDisplay));+vpAdd(@"CADisplay.displays", @"private", @"[CADisplay displays].count", @(vpDisplays.count), nil);+vpAdd(@"CADisplay.displays.names", @"private", @"[[CADisplay displays] valueForKey:@\"name\"]", [vpDisplays valueForKey:@"name"], nil);+vpAdd(@"CADisplay.mainDisplay.indexInDisplays", @"private", @"[[CADisplay displays] indexOfObjectIdenticalTo:[CADisplay mainDisplay]]", @((long)[vpDisplays indexOfObjectIdenticalTo:vpMain]), nil);+NSObject *vpTV = ((id (*)(id, SEL))objc_msgSend)(vpCADisplay, NSSelectorFromString(@"TVOutDisplay"));+vpAdd(@"CADisplay.TVOutDisplay", @"private", @"[CADisplay TVOutDisplay]", vpTV ? [(NSObject *)vpTV description] : nil, vpTV ? nil : @"nil");+NSMutableArray *vpDispList = [NSMutableArray arrayWithArray:vpDisplays];+NSMutableArray *vpDispCalls = [NSMutableArray array];+for (NSUInteger vi = 0; vi < vpDisplays.count; vi++) [vpDispCalls addObject:[NSString stringWithFormat:@"[CADisplay displays][%lu]<%@>", (unsigned long)vi, [(NSObject *)vpDisplays[vi] valueForKey:@"name"]]];+if (vpMain) { [vpDispList addObject:vpMain]; [vpDispCalls addObject:[NSString stringWithFormat:@"[CADisplay mainDisplay]<%@>", [vpMain valueForKey:@"name"]]]; }+for (NSUInteger vi = 0; vi < vpDispList.count; vi++) {+ NSObject *vpD = vpDispList[vi];+ NSString *vpC = vpDispCalls[vi];+ vpDump(vpD, @"CADisplay", @"private", vpC, nil);+ NSObject *vpCur = [vpD valueForKey:@"currentMode"];+ vpAdd(@"CADisplay.currentMode.getters", @"private", [vpC stringByAppendingString:@".currentMode.*"], vpCur ? vpObjDict(vpCur) : nil, vpCur ? nil : @"nil");+ NSObject *vpPref = [vpD valueForKey:@"preferredMode"];+ vpAdd(@"CADisplay.preferredMode.getters", @"private", [vpC stringByAppendingString:@".preferredMode.*"], vpPref ? vpObjDict(vpPref) : nil, vpPref ? nil : @"nil");+ NSMutableArray *vpModes = [NSMutableArray array];+ for (id vpM in (NSArray *)[vpD valueForKey:@"availableModes"]) [vpModes addObject:vpObjDict(vpM)];+ vpAdd(@"CADisplay.availableModes.getters", @"private", [vpC stringByAppendingString:@".availableModes[*].*"], vpModes, nil);+ NSObject *vpPrefs = [vpD valueForKey:@"preferences"];+ vpAdd(@"CADisplay.preferences.getters", @"private", [vpC stringByAppendingString:@".preferences.*"], vpPrefs ? vpObjDict(vpPrefs) : nil, vpPrefs ? nil : @"nil");+ NSObject *vpExt = [vpD valueForKey:@"externalDisplayAttributes"];+ vpAdd(@"CADisplay.externalDisplayAttributes.getters", @"private", [vpC stringByAppendingString:@".externalDisplayAttributes.*"], vpExt ? vpObjDict(vpExt) : nil, vpExt ? nil : @"nil");+ NSObject *vpSC = [vpD valueForKey:@"stateControl"];+ vpDump(vpSC, @"CADisplayStateControl", @"private", [vpC stringByAppendingString:@".stateControl"], nil);+ if (vpSC) {+ vpAdd(@"CADisplayStateControl._copyStateInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyStateInfo"], vpCStr(((char *(*)(id, SEL))objc_msgSend)(vpSC, NSSelectorFromString(@"_copyStateInfo"))), nil);+ vpAdd(@"CADisplayStateControl._copyAllPowerAssertionInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyAllPowerAssertionInfo"], vpCStr(((char *(*)(id, SEL))objc_msgSend)(vpSC, NSSelectorFromString(@"_copyAllPowerAssertionInfo"))), nil);+ vpAdd(@"CADisplayStateControl._copyAllFrameRateAssertionInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyAllFrameRateAssertionInfo"], vpCStr(((char *(*)(id, SEL))objc_msgSend)(vpSC, NSSelectorFromString(@"_copyAllFrameRateAssertionInfo"))), nil);+ }+ CFDictionaryRef vpDbg = ((CFDictionaryRef (*)(id, SEL))objc_msgSend)(vpD, NSSelectorFromString(@"_copyDebugProperties"));+ vpAdd(@"CADisplay._copyDebugProperties", @"private", [vpC stringByAppendingString:@"._copyDebugProperties"], vpDbg ? (__bridge id)vpDbg : nil, vpDbg ? nil : @"NULL");+}+NSObject *vpWS = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"CAWindowServer"), NSSelectorFromString(@"serverIfRunning"));+vpDump(vpWS, @"CAWindowServer", @"private", @"[CAWindowServer serverIfRunning]", nil);+NSArray *vpWSD = vpWS ? [vpWS valueForKey:@"displays"] : @[];+NSMutableDictionary *vpUUIDs = [NSMutableDictionary dictionary];+for (NSUInteger vi = 0; vi < vpWSD.count; vi++) {+ NSObject *vpD = vpWSD[vi];+ NSString *vpC = [NSString stringWithFormat:@"[CAWindowServer serverIfRunning].displays[%lu]<%@>", (unsigned long)vi, [vpD valueForKey:@"name"]];+ vpDump(vpD, @"CAWindowServerDisplay", @"private", vpC, nil);+ CGRect vpB = ((CGRect (*)(id, SEL))objc_msgSend)(vpD, @selector(bounds));+ unsigned int vpCtx = ((unsigned int (*)(id, SEL, CGPoint))objc_msgSend)(vpD, NSSelectorFromString(@"contextIdAtPosition:"), CGPointMake(CGRectGetMidX(vpB), CGRectGetMidY(vpB)));+ vpAdd(@"CAWindowServerDisplay.contextIdAtPosition:center", @"private", [vpC stringByAppendingString:@" contextIdAtPosition:(center of bounds)"], @(vpCtx), nil);+ NSString *vpU = [(NSObject *)[vpD valueForKey:@"uniqueId"] description];+ NSObject *vpUU = [vpD valueForKey:@"uuid"];+ vpUUIDs[[vpD valueForKey:@"name"]] = @{@"uniqueId": vpU ?: [NSNull null], @"uuid": vpUU ? [(NSUUID *)vpUU UUIDString] : [NSNull null]};+}+vpAdd(@"CAWindowServerDisplay.nameToIds", @"private", @"{name: {uniqueId, uuid}} over [CAWindowServer serverIfRunning].displays", vpUUIDs, nil);+NSObject *vpOrientCtl = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKDisplayOrientationController"), @selector(sharedInstance));+NSDictionary *vpOBU = [vpOrientCtl valueForKey:@"_orientationByDisplayUUID"];+vpAdd(@"BKDisplayOrientationController._orientationByDisplayUUID", @"private", @"[[BKDisplayOrientationController sharedInstance] valueForKey:@\"_orientationByDisplayUUID\"]", vpOBU, nil);+NSMutableOrderedSet *vpAllUUIDs = [NSMutableOrderedSet orderedSetWithArray:[vpOBU allKeys]];+for (NSObject *vpD in vpDisplays) { NSObject *vu = [vpD valueForKey:@"uniqueId"]; if (vu) [vpAllUUIDs addObject:vu]; NSObject *vuu = [vpD valueForKey:@"UUID"]; if (vuu) [vpAllUUIDs addObject:[(NSUUID *)vuu UUIDString]]; }+vpAdd(@"backboardd.displayUUIDsProbed", @"private", @"union of _orientationByDisplayUUID keys, CADisplay.uniqueId, CADisplay.UUID", [vpAllUUIDs array], nil);+NSObject *vpDC = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKDisplayController"), @selector(sharedInstance));+struct VPGeom { CGSize size; double scale; unsigned char orientation; CGRect rect; };+for (NSString *vpU in vpAllUUIDs) {+ long long vpIO = ((long long (*)(id, SEL, id))objc_msgSend)(vpOrientCtl, NSSelectorFromString(@"interfaceOrientationForDisplayUUID:"), vpU);+ vpAdd(@"BKDisplayOrientationController.interfaceOrientationForDisplayUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayOrientationController sharedInstance] interfaceOrientationForDisplayUUID:@\"%@\"]", vpU], @(vpIO), nil);+ NSObject *vpDD = ((id (*)(id, SEL, id))objc_msgSend)(vpDC, NSSelectorFromString(@"displayForUUID:"), vpU);+ vpAdd(@"BKDisplayController.displayForUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] displayForUUID:@\"%@\"]", vpU], vpDD ? [(NSObject *)vpDD description] : nil, vpDD ? nil : @"nil");+ struct VPGeom vpG = ((struct VPGeom (*)(id, SEL, id))objc_msgSend)(vpDC, NSSelectorFromString(@"geometryForDisplayUUID:"), vpU);+ vpAdd(@"BKDisplayController.geometryForDisplayUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] geometryForDisplayUUID:@\"%@\"] as {CGSize; double; uchar; CGRect}", vpU], @{@"size": vpSize(vpG.size), @"double": @(vpG.scale), @"uchar": @(vpG.orientation), @"rect": vpRect(vpG.rect)}, nil);+ BOOL vpBl = ((BOOL (*)(id, SEL, id))objc_msgSend)(vpDC, NSSelectorFromString(@"displayIsBlanked:"), vpU);+ vpAdd(@"BKDisplayController.displayIsBlanked:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] displayIsBlanked:@\"%@\"]", vpU], @(vpBl), nil);+}+NSObject *vpProv = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKSharedCADisplayProvider"), @selector(sharedInstance));+vpAdd(@"BKSharedCADisplayProvider.displays", @"private", @"[[BKSharedCADisplayProvider sharedInstance] displays]", [vpProv valueForKey:@"displays"], nil);+vpAdd(@"BKSharedCADisplayProvider.mainDisplay", @"private", @"[[BKSharedCADisplayProvider sharedInstance] mainDisplay]", [(NSObject *)[vpProv valueForKey:@"mainDisplay"] description], nil);+NSObject *vpOM = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKOrientationManager"), @selector(sharedInstance));+vpDump(vpOM, @"BKOrientationManager", @"private", @"[BKOrientationManager sharedInstance]", nil);+NSObject *vpBC = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKDisplayBrightnessController"), @selector(sharedInstance));+vpDump(vpBC, @"BKDisplayBrightnessController", @"private", @"[BKDisplayBrightnessController sharedInstance]", nil);+NSObject *vpOvM = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKDisplayRenderOverlayManager"), @selector(sharedInstance));+vpDump(vpOvM, @"BKDisplayRenderOverlayManager", @"private", @"[BKDisplayRenderOverlayManager sharedInstance]", nil);+vpAdd(@"BKDisplayRenderOverlayManager._frozenDisplayIDs", @"private", @"[[BKDisplayRenderOverlayManager sharedInstance] valueForKey:@\"_frozenDisplayIDs\"]", [(NSObject *)[vpOvM valueForKey:@"_frozenDisplayIDs"] description], nil);+NSArray *vpOverlays = [[(NSSet *)[vpOvM valueForKey:@"activeOverlays"] allObjects] copy];+for (NSUInteger vi = 0; vi < vpOverlays.count; vi++) vpDump(vpOverlays[vi], @"BKDisplayRenderOverlay", @"private", [NSString stringWithFormat:@"[[BKDisplayRenderOverlayManager sharedInstance] activeOverlays][%lu]", (unsigned long)vi], nil);+NSObject *vpReg = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKHIDEventProcessorRegistry"), @selector(sharedInstance));+NSDictionary *vpProcs = [vpReg valueForKey:@"_eventProcessorsByClassName"];+vpAdd(@"BKHIDEventProcessorRegistry._eventProcessorsByClassName.keys", @"private", @"[[[BKHIDEventProcessorRegistry sharedInstance] valueForKey:@\"_eventProcessorsByClassName\"] allKeys]", [[vpProcs allKeys] sortedArrayUsingSelector:@selector(compare:)], nil);+NSObject *vpDT = vpProcs[@"BKHIDDirectTouchEventProcessor"];+NSString *vpDTC = @"[[BKHIDEventProcessorRegistry sharedInstance] valueForKey:@\"_eventProcessorsByClassName\"][@\"BKHIDDirectTouchEventProcessor\"]";+vpAdd(@"BKHIDDirectTouchEventProcessor.description", @"private", [vpDTC stringByAppendingString:@".description"], vpDT ? [(NSObject *)vpDT description] : nil, vpDT ? nil : @"nil");+if (vpDT) {+ for (NSString *vpK in @[@"mainDisplayDigitizerService", @"mainDisplayAOPDigitizerService", @"mainDisplayPencilDigitizerService", @"chamoisDisplayUUID", @"shouldIgnoreTouchesWhileObjectInProximity", @"_queue_interfaceOrientation", @"_queue_chamoisDisplayUUID", @"_queue_serviceSenderIDToChamoisDisplayUUID", @"_queue_accessoryTouchscreenServices"]) {+ id vv = [vpDT valueForKey:vpK];+ vpAdd([@"BKHIDDirectTouchEventProcessor." stringByAppendingString:vpK], @"private", [NSString stringWithFormat:@"%@ valueForKey:@\"%@\"", vpDTC, vpK], vv, vv ? nil : @"nil");+ }+ NSDictionary *vpPDI = [vpDT valueForKey:@"_queue_perDisplayInfo"];+ vpAdd(@"BKHIDDirectTouchEventProcessor._queue_perDisplayInfo.keys", @"private", [vpDTC stringByAppendingString:@" valueForKey:@\"_queue_perDisplayInfo\"].allKeys"], [vpPDI allKeys], nil);+ for (id vpKey in vpPDI) {+ NSObject *vpInfo = vpPDI[vpKey];+ NSString *vpIC = [NSString stringWithFormat:@"%@._queue_perDisplayInfo[%@]", vpDTC, vpKey];+ vpAdd(@"BKDirectTouchPerDisplayInfo.description", @"private", [vpIC stringByAppendingString:@".description"], [(NSObject *)vpInfo description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._display", @"private", [vpIC stringByAppendingString:@"._display"], [(NSObject *)[vpInfo valueForKey:@"_display"] description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._touchStreams", @"private", [vpIC stringByAppendingString:@"._touchStreams"], [(NSObject *)[vpInfo valueForKey:@"_touchStreams"] description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._hitTestRegions", @"private", [vpIC stringByAppendingString:@"._hitTestRegions"], [vpInfo valueForKey:@"_hitTestRegions"], nil);+ NSDictionary *vpS2D = [vpInfo valueForKey:@"_serviceToDigitizer"];+ for (NSObject *vpSvc in vpS2D) {+ NSObject *vpState = vpS2D[vpSvc];+ NSString *vpSC = [NSString stringWithFormat:@"%@._serviceToDigitizer[%@]", vpIC, [vpSvc valueForKey:@"senderID"]];+ NSObject *vpMapped = ((id (*)(id, SEL, id))objc_msgSend)(vpDT, NSSelectorFromString(@"_queue_displayUUIDForDigitizerService:"), vpSvc);+ vpAdd(@"BKHIDDirectTouchEventProcessor._queue_displayUUIDForDigitizerService:", @"private", [NSString stringWithFormat:@"[%@ _queue_displayUUIDForDigitizerService:<service senderID %@>]", vpDTC, [vpSvc valueForKey:@"senderID"]], vpMapped, vpMapped ? nil : @"nil");+ vpAdd(@"BKIOHIDService.getters", @"private", [vpSC stringByAppendingString:@".(service).*"], vpObjDict(vpSvc), nil);+ vpAdd(@"BKDirectTouchState.description", @"private", [vpSC stringByAppendingString:@".description"], [(NSObject *)vpState description], nil);+ NSMutableDictionary *vpSt = [NSMutableDictionary dictionary];+ for (NSString *vpK in @[@"_displayUUID", @"_interfaceOrientation", @"_maximumPositionZ", @"_maxForce", @"_determinedMaxForce", @"_supportsPreciseLocations", @"_displayIntegrated", @"_builtIn", @"_hoverDisabled", @"_waitingForAllTouchesUp", @"_hitTestRegions"]) { id vv = [vpState valueForKey:vpK]; vpSt[vpK] = vv ? vpJSON(vv) : [NSNull null]; }+ vpAdd(@"BKDirectTouchState.ivars", @"private", [vpSC stringByAppendingString:@" valueForKey:<ivar>"], vpSt, nil);+ }+ }+}diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/footer.lldbfrag b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/footer.lldbfragnew file mode 100644index 00000000..7fd07ad6--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/footer.lldbfrag@@ -0,0 +1,4 @@+NSError *vpJErr = nil;+NSData *vpData = [NSJSONSerialization dataWithJSONObject:@{@"orientation": vpOrientation ?: [NSNull null], @"records": vpRecs} options:0 error:&vpJErr];+vpData ? [[NSString alloc] initWithData:vpData encoding:NSUTF8StringEncoding] : [vpJErr description]+diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/helpers.lldbfrag b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/helpers.lldbfragnew file mode 100644index 00000000..228bf11e--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/helpers.lldbfrag@@ -0,0 +1,134 @@+NSMutableArray *vpRecs = [NSMutableArray array];+void (^vpTrace)(NSString *) = ^(NSString *s) { [s writeToFile:@"/private/tmp/claude-501/-Users-Jacky--claude-spares-spare-SBbPAl/57b50db2-159e-4729-b15b-b24d84c6e854/scratchpad/vptrace.txt" atomically:NO encoding:NSUTF8StringEncoding error:nil]; };+NSDictionary *(^vpRect)(CGRect) = ^NSDictionary *(CGRect r) { return @{@"x": @(r.origin.x), @"y": @(r.origin.y), @"width": @(r.size.width), @"height": @(r.size.height)}; };+NSDictionary *(^vpSize)(CGSize) = ^NSDictionary *(CGSize s) { return @{@"width": @(s.width), @"height": @(s.height)}; };+NSDictionary *(^vpPoint)(CGPoint) = ^NSDictionary *(CGPoint p) { return @{@"x": @(p.x), @"y": @(p.y)}; };+__block id (^vpJSON)(id);+vpJSON = ^id(id vIn) { NSObject *v = (NSObject *)vIn;+ if (!v) return [NSNull null];+ if ([v isKindOfClass:[NSString class]]) return v;+ if ([v isKindOfClass:[NSNumber class]]) {+ double vd = [(NSNumber *)v doubleValue];+ if (vd != vd || vd == INFINITY || vd == -INFINITY) return [(NSObject *)v description];+ return v;+ }+ if ([v isKindOfClass:[NSValue class]]) {+ const char *vt = [(NSValue *)v objCType];+ if (strncmp(vt, "{CGRect=", 8) == 0) { CGRect r; [(NSValue *)v getValue:&r]; return vpRect(r); }+ if (strncmp(vt, "{CGSize=", 8) == 0) { CGSize s; [(NSValue *)v getValue:&s]; return vpSize(s); }+ if (strncmp(vt, "{CGPoint=", 9) == 0) { CGPoint p; [(NSValue *)v getValue:&p]; return vpPoint(p); }+ return [(NSObject *)v description];+ }+ if ([v isKindOfClass:[NSArray class]] || [v isKindOfClass:[NSSet class]] || [v isKindOfClass:[NSOrderedSet class]]) {+ NSMutableArray *va = [NSMutableArray array];+ for (id vx in (NSArray *)v) [va addObject:vpJSON(vx)];+ return va;+ }+ if ([v isKindOfClass:[NSDictionary class]]) {+ NSMutableDictionary *vm = [NSMutableDictionary dictionary];+ for (id vk in (NSDictionary *)v) vm[[(NSObject *)vk description]] = vpJSON([(NSDictionary *)v objectForKey:vk]);+ return vm;+ }+ if ([v isKindOfClass:[NSUUID class]]) return [(NSUUID *)v UUIDString];+ return [(NSObject *)v description];+};+void (^vpAdd)(NSString *, NSString *, NSString *, id, NSString *) = ^(NSString *api, NSString *kind, NSString *call, id value, NSString *error) {+ [vpRecs addObject:@{@"api": api, @"kind": kind, @"call": call, @"value": value ? vpJSON(value) : [NSNull null], @"error": error ?: (value ? (id)[NSNull null] : (id)@"nil")}];+};+NSArray *vpDenyExact = @[@"dealloc", @"invalidate", @"update", @"updateDisplays", @"_finalize", @"_invalidate", @"init", @"_init", @".cxx_destruct", @".cxx_construct", @"copy", @"mutableCopy", @"immutableCopy", @"freeze", @"acquireFrozenSurface", @"activateReplay", @"rebuildModeList", @"removeAllClones", @"resetConfiguration", @"disableDICOM", @"willUnblank", @"commitPreset", @"unregisterNotificationBlocks", @"unregisterSyncNotificationBlocks", @"clearUpdateMask", @"initializeClientPort", @"acquireWirelessDisplayStateControl", @"_detectDisplays", @"_detectSimDisplays", @"removeAllDisplays", @"enableOutOfProcessDisplayObservation", @"updateBandWidthInfoForAllDisplays", @"stopServer", @"new", @"alloc", @"class", @"self", @"retain", @"release", @"autorelease", @"retainCount", @"zone", @"hash", @"superclass", @"debugDescription", @"description", @"succinctDescription", @"succinctDescriptionBuilder", @"descriptionBuilder", @"_availableModesInternal", @"copyForSecureRendering", @"cancelTouchesOnMainDisplay", @"cancelTouchesOnAllDisplays", @"prepareForRestart", @"updateTransformsWithCompletion", @"_postInitialBookendObserverConnections", @"_cleanup", @"_freeze", @"_startAnimating", @"_stopAnimating", @"copyPrivateRepresentation", @"initForProtobufDecoding", @"_queue_resetTouchAuthenticationInitialSampleEvent", @"layoutIfNeeded", @"setNeedsLayout", @"_copyDebugProperties", @"_dragManager", @"_focusSystem", @"_interactiveHighlightEnvironment", @"focusItemContainer", @"focusedItem", @"focusedView", @"parentFocusEnvironment", @"preferredFocusEnvironments", @"preferredFocusedView", @"_preferredFocusedWindow", @"_preferredFocusedWindowScene", @"_boundingPathUtilities", @"_carSession", @"supportsFocus", @"_SwiftUITesting_currentScreenScale", @"_SwiftUITesting_wantsWideContentMargins", @"__ck_isFullscreen", @"pu_workImageSize", @"px_currentEDRHeadroom", @"px_potentialEDRHeadroom", @"ck_screenSizeCategory", @"_mapkit_display", @"postBookendConnections", @"bookendObserver", @"observers"];+NSArray *vpDenyPrefix = @[@"set", @"_set", @"remove", @"_remove", @"add", @"cancel", @"invalidate", @"_lock_", @"_workQueue_", @"_queue_", @"_post", @"_present", @"_dismiss", @"_update", @"_wrap", @"reevaluate", @"_begin", @"_end", @"begin", @"end", @"_prepare", @"_reset", @"reset", @"_flush", @"flush", @"_notify", @"_handle", @"_init", @"init", @"_copy", @"copy", @"_create", @"create", @"_install", @"_uninstall", @"_register", @"_unregister", @"register", @"unregister", @"_perform", @"perform", @"_apply", @"apply", @"_enable", @"_disable", @"_invalidate", @"_teardown", @"_start", @"_stop", @"start", @"stop", @"_send", @"send", @"_snapshot", @"snapshot", @"_dump", @"dump", @"_run", @"_schedule", @"_will", @"_did", @"_reload", @"reload", @"_force", @"_clear", @"clear", @"_release", @"_acquire", @"acquire", @"_take", @"_capture", @"_trigger", @"_request", @"request", @"_animate", @"_show", @"_hide", @"_attach", @"_detach", @"_connect", @"_disconnect", @"_present", @"_activate", @"_deactivate", @"_destroy", @"_purge", @"_close", @"_open", @"_save", @"_load", @"_make", @"make", @"_print", @"_log", @"_toggle", @"_test", @"_simulate", @"_fake", @"_debug"];+NSArray *vpThrowSels = @[@"secureIndicatorsEnabled"];+BOOL (^vpAllowed)(NSString *) = ^BOOL(NSString *sel) {+ if ([vpThrowSels containsObject:sel]) return NO;+ if ([sel rangeOfString:@":"].location != NSNotFound) return NO;+ if ([vpDenyExact containsObject:sel]) return NO;+ for (NSString *vp in vpDenyPrefix) if ([sel hasPrefix:vp]) return NO;+ return YES;+};+id (^vpCall)(id, NSString *, NSString **) = ^id(id obj, NSString *sel, NSString **err) {+ SEL vs = NSSelectorFromString(sel);+ if (![(NSObject *)obj respondsToSelector:vs]) { *err = @"does not respond"; return (id)nil; }+ Method vm = class_getInstanceMethod(object_getClass(obj), vs);+ if (!vm) { *err = @"no method"; return (id)nil; }+ if (method_getNumberOfArguments(vm) != 2) { *err = @"takes arguments"; return (id)nil; }+ char vt[256]; method_getReturnType(vm, vt, sizeof(vt));+ const char *vr = vt; while (*vr == 'r' || *vr == 'n' || *vr == 'N' || *vr == 'o' || *vr == 'O' || *vr == 'R' || *vr == 'V') vr++;+ switch (vr[0]) {+ case '@': if (vr[1] == '?') { *err = @"block"; return (id)nil; }+ { id vo = ((id (*)(id, SEL))objc_msgSend)(obj, vs); if (!vo) *err = @"nil"; return vo; }+ case '#': { Class vc = ((Class (*)(id, SEL))objc_msgSend)(obj, vs); return vc ? NSStringFromClass(vc) : (id)nil; }+ case 'B': return @(((BOOL (*)(id, SEL))objc_msgSend)(obj, vs) ? YES : NO);+ case 'c': return @(((signed char (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'C': return @(((unsigned char (*)(id, SEL))objc_msgSend)(obj, vs));+ case 's': return @(((short (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'S': return @(((unsigned short (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'i': return @(((int (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'I': return @(((unsigned int (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'l': return @(((long (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'L': return @(((unsigned long (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'q': return @(((long long (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'Q': return @(((unsigned long long (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'f': return @(((float (*)(id, SEL))objc_msgSend)(obj, vs));+ case 'd': return @(((double (*)(id, SEL))objc_msgSend)(obj, vs));+ case '{':+ if (strncmp(vr, "{CGRect=", 8) == 0) return vpRect(((CGRect (*)(id, SEL))objc_msgSend)(obj, vs));+ if (strncmp(vr, "{CGSize=", 8) == 0) return vpSize(((CGSize (*)(id, SEL))objc_msgSend)(obj, vs));+ if (strncmp(vr, "{CGPoint=", 9) == 0) return vpPoint(((CGPoint (*)(id, SEL))objc_msgSend)(obj, vs));+ if (strncmp(vr, "{UIEdgeInsets=", 14) == 0 || strncmp(vr, "{NSDirectionalEdgeInsets=", 25) == 0) { struct VPInsets { double a, b, c, d; } vi4 = ((struct VPInsets (*)(id, SEL))objc_msgSend)(obj, vs); return @{@"top": @(vi4.a), @"left": @(vi4.b), @"bottom": @(vi4.c), @"right": @(vi4.d)}; }+ if (strncmp(vr, "{CGAffineTransform=", 19) == 0) { CGAffineTransform vx = ((CGAffineTransform (*)(id, SEL))objc_msgSend)(obj, vs); return @[@(vx.a), @(vx.b), @(vx.c), @(vx.d), @(vx.tx), @(vx.ty)]; }+ if (strcmp(vr, "{?=ff}") == 0) { struct VPff { float a, b; } vf = ((struct VPff (*)(id, SEL))objc_msgSend)(obj, vs); return @[@(vf.a), @(vf.b)]; }+ if (strcmp(vr, "{?={?=ff}{?=ff}{?=ff}{?=ff}}") == 0) { struct VPf8 { float a[8]; } vf8 = ((struct VPf8 (*)(id, SEL))objc_msgSend)(obj, vs); return @[@(vf8.a[0]), @(vf8.a[1]), @(vf8.a[2]), @(vf8.a[3]), @(vf8.a[4]), @(vf8.a[5]), @(vf8.a[6]), @(vf8.a[7])]; }+ if (strncmp(vr, "{CAFrameRateRange=", 18) == 0) { struct VPfff { float a, b, c; } vf3 = ((struct VPfff (*)(id, SEL))objc_msgSend)(obj, vs); return @{@"minimum": @(vf3.a), @"maximum": @(vf3.b), @"preferred": @(vf3.c)}; }+ *err = [NSString stringWithFormat:@"unsupported struct return %.60s", vr]; return (id)nil;+ default: *err = [NSString stringWithFormat:@"unsupported return type %.60s", vr]; return (id)nil;+ }+};+NSArray *(^vpGetters)(Class, Class) = ^NSArray *(Class cls, Class stop) {+ char vrt[8];+ NSMutableOrderedSet *vs = [NSMutableOrderedSet orderedSet];+ for (Class vc = cls; vc && vc != stop && vc != [NSObject class]; vc = class_getSuperclass(vc)) {+ unsigned int vn = 0;+ objc_property_t *vp = class_copyPropertyList(vc, &vn);+ for (unsigned int vi = 0; vi < vn; vi++) {+ char *vg = property_copyAttributeValue(vp[vi], "G");+ NSString *vgs = vg ? [NSString stringWithUTF8String:vg] : [NSString stringWithUTF8String:property_getName(vp[vi])];+ if (vg) free(vg);+ if (vpAllowed(vgs)) [vs addObject:vgs];+ }+ free(vp);+ Method *vm = class_copyMethodList(vc, &vn);+ for (unsigned int vi = 0; vi < vn; vi++) {+ NSString *vsel = NSStringFromSelector(method_getName(vm[vi]));+ method_getReturnType(vm[vi], vrt, sizeof(vrt)); if (vrt[0] == 'v') continue;+ if (method_getNumberOfArguments(vm[vi]) == 2 && vpAllowed(vsel)) [vs addObject:vsel];+ }+ free(vm);+ }+ return [[vs array] sortedArrayUsingSelector:@selector(compare:)];+};+void (^vpDump)(id, NSString *, NSString *, NSString *, Class) = ^(id obj, NSString *apiClass, NSString *kind, NSString *callPrefix, Class stop) {+ if (!obj) { vpAdd([apiClass stringByAppendingString:@".(object)"], kind, callPrefix, nil, @"object is nil"); return; }+ vpAdd([apiClass stringByAppendingString:@".description"], kind, [callPrefix stringByAppendingString:@".description"], [(NSObject *)obj description], nil);+ vpAdd([apiClass stringByAppendingString:@".class"], kind, [callPrefix stringByAppendingString:@".class"], NSStringFromClass([(NSObject *)obj class]), nil);+ for (NSString *vsel in vpGetters([(NSObject *)obj class], stop)) {+ vpTrace([NSString stringWithFormat:@"%@ %@", callPrefix, vsel]);+ NSString *verr = nil;+ id vv = vpCall(obj, vsel, &verr);+ vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], vv, vv ? nil : verr);+ }+ for (NSString *vsel in vpThrowSels) if ([(NSObject *)obj respondsToSelector:NSSelectorFromString(vsel)]) vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], nil, @"raises an Objective-C exception in this process (not called)");+};+NSDictionary *(^vpObjDict)(id) = ^NSDictionary *(id objIn) {+ NSMutableDictionary *vd = [NSMutableDictionary dictionary];+ if (!objIn) return vd;+ for (NSString *vsel in vpGetters([(NSObject *)objIn class], nil)) { vpTrace([NSString stringWithFormat:@"objdict %@ %@", NSStringFromClass([(NSObject *)objIn class]), vsel]); NSString *verr = nil; id vv = vpCall(objIn, vsel, &verr); vd[vsel] = vv ? vpJSON(vv) : [NSString stringWithFormat:@"<error: %@>", verr]; }+ return vd;+};+void (^vpDumpSel)(id, NSString *, NSString *, NSString *, NSArray *) = ^(id obj, NSString *apiClass, NSString *kind, NSString *callPrefix, NSArray *sels) {+ if (!obj) { vpAdd([apiClass stringByAppendingString:@".(object)"], kind, callPrefix, nil, @"object is nil"); return; }+ for (NSString *vsel in sels) {+ NSString *verr = nil;+ id vv = vpCall(obj, vsel, &verr);+ vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], vv, vv ? nil : verr);+ }+};diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/safari.body b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/safari.bodynew file mode 100644index 00000000..d972e198--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/safari.body@@ -0,0 +1,13 @@+id vpOrientation = nil;+vpAdd(@"UIDevice.orientation", @"public", @"[[UIDevice currentDevice] orientation]", @((long)[[UIDevice currentDevice] orientation]), nil);+NSMutableArray *vpSceneList = [NSMutableArray array];+for (UIScene *vpSc in [[UIApplication sharedApplication] connectedScenes]) {+ UIWindowScene *vpW = (UIWindowScene *)vpSc;+ vpOrientation = @((long)vpW.interfaceOrientation);+ [vpSceneList addObject:@{@"class": NSStringFromClass([vpSc class]), @"interfaceOrientation": @((long)vpW.interfaceOrientation), @"screenName": [(NSObject *)[vpW.screen valueForKey:@"_name"] description] ?: @"", @"displayIdentity": [(NSObject *)[vpW.screen valueForKey:@"displayIdentity"] description] ?: @"", @"coordinateSpaceBounds": vpRect(((CGRect (*)(id, SEL))objc_msgSend)((id)vpW.coordinateSpace, @selector(bounds))), @"screenBounds": vpRect(vpW.screen.bounds), @"screenNativeBounds": vpRect(vpW.screen.nativeBounds)}];+}+vpAdd(@"UIApplication.connectedScenes.summary", @"private", @"MobileSafari [[UIApplication sharedApplication] connectedScenes] -> {class, interfaceOrientation, screen._name, displayIdentity, coordinateSpace.bounds, screen.bounds, screen.nativeBounds}", vpSceneList, nil);+NSArray *vpScreens = [UIScreen screens];+NSMutableArray *vpSL = [NSMutableArray array];+for (UIScreen *vpS in vpScreens) [vpSL addObject:@{@"name": [(NSObject *)[vpS valueForKey:@"_name"] description] ?: @"", @"bounds": vpRect(vpS.bounds), @"nativeBounds": vpRect(vpS.nativeBounds), @"scale": @(vpS.scale), @"displayIdentity": [(NSObject *)[vpS valueForKey:@"displayIdentity"] description] ?: @"", @"_interfaceOrientation": [vpS valueForKey:@"_interfaceOrientation"]}];+vpAdd(@"UIScreen.screens.summary", @"public", @"MobileSafari [UIScreen screens] -> {_name, bounds, nativeBounds, scale, displayIdentity, _interfaceOrientation}", vpSL, nil);diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/sbdiscover.body b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/sbdiscover.bodynew file mode 100644index 00000000..bccbfb6f--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/sbdiscover.body@@ -0,0 +1,18 @@+id vpOrientation = nil;+NSMutableString *vpS = [NSMutableString string];+for (NSString *vpName in @[@"UIScreen", @"FBSDisplayMonitor", @"FBDisplayManager", @"FBSDisplayConfiguration", @"FBSDisplayIdentity", @"FBSDisplayMode", @"UISDisplayContext", @"UITraitCollection", @"_UIScreenDisplayConfiguration", @"UIScreenMode"]) {+ Class vc = NSClassFromString(vpName);+ [vpS appendFormat:@"=== %@ %p\n", vpName, vc];+ if (!vc) continue;+ unsigned int vn = 0;+ Method *vm = class_copyMethodList(vc, &vn);+ NSMutableArray *vz = [NSMutableArray array];+ for (unsigned int vi = 0; vi < vn; vi++) if (method_getNumberOfArguments(vm[vi]) == 2) { char vt[64]; method_getReturnType(vm[vi], vt, sizeof(vt)); [vz addObject:[NSString stringWithFormat:@"%@ %s %@", NSStringFromSelector(method_getName(vm[vi])), vt, vpAllowed(NSStringFromSelector(method_getName(vm[vi]))) ? @"" : @"DENY"]]; }+ free(vm);+ [vpS appendString:[[vz sortedArrayUsingSelector:@selector(compare:)] componentsJoinedByString:@"\n"]];+ [vpS appendString:@"\n"];+ vm = class_copyMethodList(object_getClass(vc), &vn);+ for (unsigned int vi = 0; vi < vn; vi++) if (method_getNumberOfArguments(vm[vi]) == 2) [vpS appendFormat:@"+ %@\n", NSStringFromSelector(method_getName(vm[vi]))];+ free(vm);+}+vpAdd(@"x", @"x", @"x", vpS, nil);diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/display/src/springboard.body b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/springboard.bodynew file mode 100644index 00000000..62ef9cb8--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/display/src/springboard.body@@ -0,0 +1,110 @@+NSObject *vpSvc = [[UIApplication sharedApplication] valueForKey:@"_displayToolService"];+NSObject *vpDCM = [vpSvc valueForKey:@"_displayContentModeCoordinator"];+UIWindowScene *vpPrimary = (UIWindowScene *)[vpDCM valueForKey:@"primaryWindowScene"];+id vpOrientation = vpPrimary ? @(vpPrimary.interfaceOrientation) : nil;+for (UIWindowScene *vpWS in (NSArray *)[vpDCM valueForKey:@"_connectedWindowScenes"]) {+ long vpMode = ((long (*)(id, SEL, id))objc_msgSend)(vpDCM, @selector(displayContentModeForWindowScene:), vpWS);+ vpAdd(@"UIWindowScene.displaySummary", @"private", [NSString stringWithFormat:@"<scene %@>: interfaceOrientation, screen._name, displayIdentity, contentMode, isPrimary", vpWS.session.persistentIdentifier],+ @{@"persistentIdentifier": vpWS.session.persistentIdentifier ?: @"", @"interfaceOrientation": @(vpWS.interfaceOrientation), @"screenName": [(NSObject *)[vpWS.screen valueForKey:@"_name"] description] ?: @"", @"displayIdentity": [(NSObject *)[vpWS.screen valueForKey:@"displayIdentity"] description] ?: @"", @"displayContentMode": @(vpMode), @"isPrimaryWindowScene": @(vpWS == vpPrimary), @"coordinateSpaceBounds": vpRect(((CGRect (*)(id, SEL))objc_msgSend)((id)vpWS.coordinateSpace, @selector(bounds))), @"effectiveGeometryInterfaceOrientation": @(vpWS.effectiveGeometry.interfaceOrientation)}, nil);+}+Class vpUIS = [UIScreen class];+NSArray *vpScreens = [UIScreen screens];+vpAdd(@"UIScreen.screens", @"public", @"[UIScreen screens].count", @(vpScreens.count), nil);+vpAdd(@"UIScreen.screens.names", @"private", @"[[UIScreen screens] valueForKey:@\"_name\"]", [vpScreens valueForKey:@"_name"], nil);+vpAdd(@"UIScreen.mainScreen.indexInScreens", @"public", @"[[UIScreen screens] indexOfObjectIdenticalTo:[UIScreen mainScreen]]", @((long)[vpScreens indexOfObjectIdenticalTo:[UIScreen mainScreen]]), nil);+for (NSString *vpCS in @[@"_embeddedScreen", @"_carScreen", @"allActiveScreens", @"_shortScreensDescription", @"maxScreenScale", @"_screenHeightSizeClassForCurrentDevice", @"_isProbablyBeingRecorded", @"_shouldDisableJail", @"__displayConfigurationsForViewService", @"_mainScreenThreadSafeTraitCollection"]) {+ NSString *verr = nil;+ id vv = vpCall(vpUIS, vpCS, &verr);+ vpAdd([@"UIScreen+" stringByAppendingString:vpCS], @"private", [NSString stringWithFormat:@"[UIScreen %@]", vpCS], vv, vv ? nil : verr);+}+NSArray *vpTraitSels = @[@"displayScale", @"displayGamut", @"userInterfaceIdiom", @"horizontalSizeClass", @"verticalSizeClass", @"displayCornerRadius", @"layoutDirection", @"forceTouchCapability", @"userInterfaceStyle", @"userInterfaceLevel", @"artworkSubtype", @"touchLevel", @"_backlightLuminance", @"sceneCaptureState", @"imageDynamicRange", @"primaryInteractionModel", @"interactionModel", @"_windowSceneInterfaceOrientationBehavior", @"verticalBarEdge", @"accessibilityContrast", @"legibilityWeight", @"preferredContentSizeCategory", @"activeAppearance", @"hdrHeadroomUsageLimit", @"_headroomUsage", @"isSmallScreenDevice", @"_systemDisplayIdentifier", @"widthDesignation", @"heightDesignation", @"_userInterfaceRenderingMode", @"_vibrancy", @"_traitsDescription"];+NSMutableArray *vpScrList = [NSMutableArray arrayWithArray:vpScreens];+NSMutableArray *vpScrCalls = [NSMutableArray array];+for (NSUInteger vi = 0; vi < vpScreens.count; vi++) [vpScrCalls addObject:[NSString stringWithFormat:@"[UIScreen screens][%lu]<%@>", (unsigned long)vi, [(NSObject *)vpScreens[vi] valueForKey:@"_name"]]];+[vpScrList addObject:[UIScreen mainScreen]];+[vpScrCalls addObject:[NSString stringWithFormat:@"[UIScreen mainScreen]<%@>", [[UIScreen mainScreen] valueForKey:@"_name"]]];+NSMutableArray *vpConfigs = [NSMutableArray array];+NSMutableArray *vpConfigCalls = [NSMutableArray array];+for (NSUInteger vi = 0; vi < vpScrList.count; vi++) {+ UIScreen *vpS = vpScrList[vi];+ NSString *vpC = vpScrCalls[vi];+ vpDump(vpS, @"UIScreen", @"private", vpC, nil);+ vpAdd(@"UIScreen.coordinateSpace.bounds", @"public", [vpC stringByAppendingString:@".coordinateSpace.bounds"], vpRect(((CGRect (*)(id, SEL))objc_msgSend)((id)vpS.coordinateSpace, @selector(bounds))), nil);+ vpAdd(@"UIScreen.fixedCoordinateSpace.bounds", @"public", [vpC stringByAppendingString:@".fixedCoordinateSpace.bounds"], vpRect(((CGRect (*)(id, SEL))objc_msgSend)((id)vpS.fixedCoordinateSpace, @selector(bounds))), nil);+ CGRect vpFix = ((CGRect (*)(id, SEL, CGRect, id))objc_msgSend)((id)vpS.coordinateSpace, @selector(convertRect:toCoordinateSpace:), ((CGRect (*)(id, SEL))objc_msgSend)((id)vpS.coordinateSpace, @selector(bounds)), (id)vpS.fixedCoordinateSpace);+ vpAdd(@"UIScreen.coordinateSpace->fixedCoordinateSpace", @"public", [vpC stringByAppendingString:@" [coordinateSpace convertRect:coordinateSpace.bounds toCoordinateSpace:fixedCoordinateSpace]"], vpRect(vpFix), nil);+ vpDumpSel(vpS.traitCollection, @"UITraitCollection", @"public", [vpC stringByAppendingString:@".traitCollection"], vpTraitSels);+ NSObject *vpEx = [vpS valueForKey:@"_exclusionArea"];+ vpAdd(@"UIScreen._exclusionArea.rect", @"private", [vpC stringByAppendingString:@"._exclusionArea.rect"], vpEx && [vpEx respondsToSelector:@selector(rect)] ? vpRect(((CGRect (*)(id, SEL))objc_msgSend)(vpEx, @selector(rect))) : nil, vpEx ? ([vpEx respondsToSelector:@selector(rect)] ? nil : [NSString stringWithFormat:@"%@ has no -rect", NSStringFromClass([vpEx class])]) : @"nil");+ NSObject *vpDIP = [vpS valueForKey:@"_displayInfoProvider"];+ vpAdd(@"UIScreen._displayInfoProvider.getters", @"private", [vpC stringByAppendingString:@"._displayInfoProvider.*"], vpDIP ? vpObjDict(vpDIP) : nil, vpDIP ? nil : @"nil");+ NSObject *vpIDC = [vpS valueForKey:@"_initialDisplayContext"];+ vpAdd(@"UIScreen._initialDisplayContext.getters", @"private", [vpC stringByAppendingString:@" valueForKey:@\"_initialDisplayContext\" .*"], vpIDC ? vpObjDict(vpIDC) : nil, vpIDC ? nil : @"nil");+ NSObject *vpIDCEdge = vpIDC ? [vpIDC valueForKey:@"displayEdgeInfo"] : nil;+ vpAdd(@"UIScreen._initialDisplayContext.displayEdgeInfo.getters", @"private", [vpC stringByAppendingString:@" valueForKey:@\"_initialDisplayContext\" .displayEdgeInfo.*"], vpIDCEdge ? vpObjDict(vpIDCEdge) : nil, vpIDCEdge ? nil : @"nil");+ vpAdd(@"UIScreen.__eventDisplay", @"private", [vpC stringByAppendingString:@" valueForKey:@\"__eventDisplay\""], [vpS valueForKey:@"__eventDisplay"], nil);+ vpAdd(@"UIScreen._sceneProvidedCornerRadius", @"private", [vpC stringByAppendingString:@" valueForKey:@\"_sceneProvidedCornerRadius\""], [vpS valueForKey:@"_sceneProvidedCornerRadius"], nil);+ vpAdd(@"UIScreen._previousHardwareIdentifier", @"private", [vpC stringByAppendingString:@" valueForKey:@\"_previousHardwareIdentifier\""], [vpS valueForKey:@"_previousHardwareIdentifier"], nil);+ NSMutableArray *vpUM = [NSMutableArray array];+ for (UIScreenMode *vpM in vpS.availableModes) [vpUM addObject:@{@"size": vpSize(vpM.size), @"pixelAspectRatio": @(vpM.pixelAspectRatio)}];+ vpAdd(@"UIScreen.availableModes.sizes", @"public", [vpC stringByAppendingString:@".availableModes[*].{size,pixelAspectRatio}"], vpUM, nil);+ vpAdd(@"UIScreen.currentMode.size", @"public", [vpC stringByAppendingString:@".currentMode.size"], vpS.currentMode ? vpSize(vpS.currentMode.size) : nil, vpS.currentMode ? nil : @"nil");+ vpAdd(@"UIScreen.preferredMode.size", @"public", [vpC stringByAppendingString:@".preferredMode.size"], vpS.preferredMode ? vpSize(vpS.preferredMode.size) : nil, vpS.preferredMode ? nil : @"nil");+ if (vi < vpScreens.count) {+ NSObject *vpDC = [vpS valueForKey:@"displayConfiguration"];+ if (vpDC) { [vpConfigs addObject:vpDC]; [vpConfigCalls addObject:[vpC stringByAppendingString:@".displayConfiguration"]]; }+ }+}+NSObject *vpFBDM = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"FBDisplayManager"), @selector(sharedInstance));+vpDump(vpFBDM, @"FBDisplayManager", @"private", @"[FBDisplayManager sharedInstance]", nil);+for (NSString *vpCS in @[@"mainConfiguration", @"mainIdentity", @"alwaysConnectedIdentities"]) {+ NSString *verr = nil; id vv = vpCall(NSClassFromString(@"FBDisplayManager"), vpCS, &verr);+ vpAdd([@"FBDisplayManager+" stringByAppendingString:vpCS], @"private", [NSString stringWithFormat:@"[FBDisplayManager %@]", vpCS], vv, vv ? nil : verr);+}+NSArray *vpConn = [[(NSSet *)[vpFBDM valueForKey:@"connectedIdentities"] allObjects] sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"displayID" ascending:YES]]];+vpAdd(@"FBSDisplayMonitor.connectedIdentities.count", @"private", @"[[FBDisplayManager sharedInstance] connectedIdentities].count", @(vpConn.count), nil);+for (NSObject *vpId in vpConn) {+ NSObject *vpCfg = ((id (*)(id, SEL, id))objc_msgSend)(vpFBDM, NSSelectorFromString(@"configurationForIdentity:"), vpId);+ if (vpCfg) { [vpConfigs addObject:vpCfg]; [vpConfigCalls addObject:[NSString stringWithFormat:@"[[FBDisplayManager sharedInstance] configurationForIdentity:<%@>]", vpId]]; }+ else vpAdd(@"FBSDisplayMonitor.configurationForIdentity:", @"private", [NSString stringWithFormat:@"[[FBDisplayManager sharedInstance] configurationForIdentity:<%@>]", vpId], nil, @"nil");+}+NSObject *vpUISDC = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"UISDisplayContext"), @selector(defaultContext));+if (vpUISDC) { [vpConfigs addObject:[vpUISDC valueForKey:@"displayConfiguration"]]; [vpConfigCalls addObject:@"[UISDisplayContext defaultContext].displayConfiguration"]; }+NSMutableOrderedSet *vpHWIDs = [NSMutableOrderedSet orderedSet];+for (NSUInteger vi = 0; vi < vpConfigs.count; vi++) {+ NSObject *vpCfg = vpConfigs[vi];+ NSString *vpC = vpConfigCalls[vi];+ vpDump(vpCfg, @"FBSDisplayConfiguration", @"private", vpC, nil);+ vpAdd(@"FBSDisplayConfiguration.currentMode.getters", @"private", [vpC stringByAppendingString:@".currentMode.*"], vpObjDict([vpCfg valueForKey:@"currentMode"]), nil);+ vpAdd(@"FBSDisplayConfiguration.preferredMode.getters", @"private", [vpC stringByAppendingString:@".preferredMode.*"], vpObjDict([vpCfg valueForKey:@"preferredMode"]), nil);+ NSMutableArray *vpMs = [NSMutableArray array];+ for (id vpM in (NSSet *)[vpCfg valueForKey:@"availableModes"]) [vpMs addObject:vpObjDict(vpM)];+ vpAdd(@"FBSDisplayConfiguration.availableModes.getters", @"private", [vpC stringByAppendingString:@".availableModes[*].*"], vpMs, nil);+ vpAdd(@"FBSDisplayConfiguration.pixelDensity.getters", @"private", [vpC stringByAppendingString:@".pixelDensity.*"], vpObjDict([vpCfg valueForKey:@"pixelDensity"]), nil);+ NSObject *vpIdn = [vpCfg valueForKey:@"identity"];+ vpDump(vpIdn, @"FBSDisplayIdentity", @"private", [vpC stringByAppendingString:@".identity"], nil);+ NSObject *vpRoot = [vpIdn valueForKey:@"rootIdentity"];+ vpAdd(@"FBSDisplayIdentity.rootIdentity.getters", @"private", [vpC stringByAppendingString:@".identity.rootIdentity.*"], vpRoot ? vpObjDict(vpRoot) : nil, vpRoot ? nil : @"nil");+ id vpHW = [vpCfg valueForKey:@"hardwareIdentifier"];+ if (vpHW) [vpHWIDs addObject:vpHW];+}+vpDump(vpUISDC, @"UISDisplayContext", @"private", @"[UISDisplayContext defaultContext]", nil);+NSObject *vpEdge = vpUISDC ? [vpUISDC valueForKey:@"displayEdgeInfo"] : nil;+vpAdd(@"UISDisplayContext.displayEdgeInfo.getters", @"private", @"[UISDisplayContext defaultContext].displayEdgeInfo.*", vpEdge ? vpObjDict(vpEdge) : nil, vpEdge ? nil : @"nil");+NSObject *vpEA = vpUISDC ? [vpUISDC valueForKey:@"exclusionArea"] : nil;+vpAdd(@"UISDisplayContext.exclusionArea.rect", @"private", @"[UISDisplayContext defaultContext].exclusionArea.rect", vpEA && [vpEA respondsToSelector:@selector(rect)] ? vpRect(((CGRect (*)(id, SEL))objc_msgSend)(vpEA, @selector(rect))) : nil, vpEA ? nil : @"nil");+NSObject *vpBKS = ((id (*)(id, SEL))objc_msgSend)(NSClassFromString(@"BKSDisplayService"), @selector(sharedInstance));+for (NSString *vpHW in vpHWIDs) {+ NSObject *vpT = ((id (*)(id, SEL, id))objc_msgSend)(vpBKS, NSSelectorFromString(@"traitsForDisplayUUID:"), vpHW);+ vpAdd(@"BKSDisplayService.traitsForDisplayUUID:", @"private", [NSString stringWithFormat:@"[[BKSDisplayService sharedInstance] traitsForDisplayUUID:@\"%@\"]", vpHW], vpT ? @{@"description": [vpT description], @"surfaceType": @(((int (*)(id, SEL))objc_msgSend)(vpT, NSSelectorFromString(@"surfaceType")))} : nil, vpT ? nil : @"nil");+}+vpAdd(@"UIDevice.orientation", @"public", @"[[UIDevice currentDevice] orientation]", @((long)[[UIDevice currentDevice] orientation]), nil);+vpAdd(@"UIApplication.activeInterfaceOrientation", @"private", @"[[UIApplication sharedApplication] activeInterfaceOrientation]", @((long)[(UIApplication *)[UIApplication sharedApplication] activeInterfaceOrientation]), nil);+NSMutableArray *vpSceneList = [NSMutableArray array];+for (UIScene *vpSc in [[UIApplication sharedApplication] connectedScenes]) {+ UIWindowScene *vpW = (UIWindowScene *)vpSc;+ [vpSceneList addObject:@{@"persistentIdentifier": vpSc.session.persistentIdentifier ?: @"", @"class": NSStringFromClass([vpSc class]), @"interfaceOrientation": @((long)vpW.interfaceOrientation), @"screenName": [(NSObject *)[vpW.screen valueForKey:@"_name"] description] ?: @"", @"coordinateSpaceBounds": vpRect(((CGRect (*)(id, SEL))objc_msgSend)((id)vpW.coordinateSpace, @selector(bounds)))}];+}+vpAdd(@"UIApplication.connectedScenes.summary", @"private", @"[[UIApplication sharedApplication] connectedScenes] -> {persistentIdentifier, class, interfaceOrientation, screen._name, coordinateSpace.bounds}", [vpSceneList sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"persistentIdentifier" ascending:YES]]], nil);+NSObject *vpFG = [[UIApplication sharedApplication] respondsToSelector:NSSelectorFromString(@"_accessibilityFrontMostApplication")] ? [[UIApplication sharedApplication] valueForKey:@"_accessibilityFrontMostApplication"] : nil;+vpAdd(@"SpringBoard._accessibilityFrontMostApplication", @"private", @"[[UIApplication sharedApplication] _accessibilityFrontMostApplication].bundleIdentifier", vpFG ? [vpFG valueForKey:@"bundleIdentifier"] : nil, vpFG ? nil : @"nil (home screen or not available)");diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/sensors/run-sensors.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/sensors/run-sensors.zshnew file mode 100755index 00000000..32fac449--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/sensors/run-sensors.zsh@@ -0,0 +1,112 @@+#!/bin/zsh+# run-sensors.zsh snapshot <seq> <posture-label> full|light+# run-sensors.zsh posture <seq> <posture-label> full|light <posture.zsh args...>+# run-sensors.zsh assemble+#+# The sensors domain runner (hinge, pose, motion, device identity) for the duo-baseline-sensors+# simulator. `snapshot` runs the sensors probes in SpringBoard, backboardd and Preferences+# without changing anything, and writes the transcripts plus a tagged records.jsonl to+# snap/<seq>-<label>/. `full` adds the posture-independent probes (CoreMotion tables, identity,+# blocking device-state query). `posture` drives tools/posture.zsh, saves its JSON into+# snap/<seq>-<label>/posture.json, then takes a snapshot in the given mode. `assemble` merges every snapshot into ../../sensors.json.+set -euo pipefail+here=${0:a:h}+root=${here:h:h}+tools=$root/tools+probes=$root/probes+jq=/opt/homebrew/bin/jq+udid=C0EF5D72-68AE-4F00-8594-10039EADA1AC++tag() { # tag <probe-out.txt> <process> <posture> <default-orientation>+ grep -E '^\{"group"' $1 | $jq -c --arg proc $2 --arg posture $3 --argjson dflt ${4:-0} '+ def orient: {"0": "unknown", "1": "portrait", "2": "portraitUpsideDown", "3": "landscapeLeft", "4": "landscapeRight"}[tostring] // "unknown";+ . as $g | .records[] | {api, kind, process: $proc, posture: $posture,+ orientation: (($g.orientation // $dflt) | orient), call, value, error, group: $g.group}' || {+ print -u2 "run-sensors: no JSON in $1"; grep -v '^{"' $1 | head -20 >&2; }+}++run() { # run <dir> <process> <probe-name> [timeout]+ local dir=$1 proc=$2 name=$3+ PROBE_TIMEOUT=${4:-120} $tools/probe.zsh $udid $proc $probes/sensors-$name.lldb $dir/$proc-$name.txt 2>>$dir/probe-stderr.txt || print -u2 "run-sensors: $proc $name rc $?"+}++snapshot() {+ local seq=$1 label=$2 mode=$3+ local dir=$here/snap/$seq-$label+ mkdir -p $dir+ date -u +%Y-%m-%dT%H:%M:%SZ > $dir/started+ if ! $tools/sim.zsh pid $udid Preferences >/dev/null 2>&1; then+ xcrun simctl launch $udid com.apple.Preferences > $dir/preferences-relaunched.txt; sleep 4+ fi+ run $dir SpringBoard springboard+ local o=$(grep -E '^\{"group":"pose"' $dir/SpringBoard-springboard.txt | $jq -r '.orientation' || print 0)+ run $dir SpringBoard coremotion+ run $dir SpringBoard uikit+ run $dir backboardd backboardd+ run $dir Preferences app-hinge-register+ run $dir Preferences coremotion+ run $dir Preferences uikit+ if [[ $mode == full ]]; then+ run $dir SpringBoard cmtables+ run $dir SpringBoard identity+ run $dir SpringBoard cmquery 60+ run $dir Preferences cmtables+ run $dir Preferences identity+ run $dir Preferences cmquery 60+ fi+ : > $dir/records.jsonl+ for f in $dir/*-*.txt; do+ [[ $f == *.raw.txt || $f == */probe-stderr.txt || $f == *register* || $f == */preferences-relaunched.txt ]] && continue+ local proc=${${f:t}%%-*}+ tag $f $proc $label $o >> $dir/records.jsonl+ done+ date -u +%Y-%m-%dT%H:%M:%SZ > $dir/finished+ print -- "run-sensors: $label: $(wc -l < $dir/records.jsonl | tr -d ' ') records, SpringBoard orientation $o"+}++case ${1:-} in+ snapshot) snapshot $2 $3 $4 ;;+ posture)+ seq=$2 label=$3 mode=$4; shift 4+ dir=$here/snap/$seq-$label; mkdir -p $dir+ rc=0+ POSTURE_OUT=$here/posture $tools/posture.zsh $udid "$@" > $dir/posture.json || rc=$?+ print -- "{\"args\": \"$*\", \"exit\": $rc}" > $dir/posture-exit.json+ print -- "run-sensors: posture $* -> exit $rc: $($jq -c '{hinge: .springboard.hinge_state, pos: .springboard.position, policy: .springboard.prevailing_policy, lit: .screenshots.lit_panel, ok}' $dir/posture.json)"+ snapshot $seq $label $mode ;;+ assemble)+ out=$root/sensors.json+ runtime=$(xcrun simctl list runtimes -j | $jq -c '.runtimes[] | select(.identifier == "com.apple.CoreSimulator.SimRuntime.iOS-27-1") | {identifier, version, buildversion}')+ device=$(xcrun simctl list devices -j | $jq -c --arg u $udid '.devices[] | .[] | select(.udid == $u) | {name, udid, deviceTypeIdentifier}')+ xcode=$(xcodebuild -version | tr '\n' ' ' | sed 's/ *$//')+ work=$(mktemp -d -t sensors); trap 'rm -rf "$work"' EXIT+ : > $work/records.jsonl; : > $work/postures.jsonl+ for d in $here/snap/*(/); do+ label=${${d:t}#*-}+ cat $d/records.jsonl >> $work/records.jsonl+ if [[ -e $d/posture.json ]]; then+ $jq -c --arg label $label --arg snap ${d:t} --slurpfile ex $d/posture-exit.json '. + {snapshot: $snap, posture_label: $label, exit: $ex[0].exit}' $d/posture.json >> $work/postures.jsonl+ else+ print -- "{\"snapshot\": \"${d:t}\", \"posture_label\": \"$label\", \"note\": \"$( [[ $label == boot ]] && print "no swap: state right after boot" || print "no swap: the state the previous snapshot left" )\"}" >> $work/postures.jsonl+ fi+ done+ $jq -c -f $here/sim-notes.jq $work/records.jsonl > $work/flagged.jsonl+ $jq -n \+ --argjson runtime "$runtime" --argjson device "$device" --arg xcode "$xcode" \+ --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg host "$(sw_vers -productVersion) $(sysctl -n machdep.cpu.brand_string)" \+ --slurpfile postures $work/postures.jsonl --slurpfile recs $work/flagged.jsonl '+ {+ meta: {+ domain: "sensors", runtime: $runtime, device: $device, xcode: $xcode, host: $host, date: $date,+ posture_mechanism: "SBDisplayToolServiceCoordinator performDisplaySwapWithSettings: (tools/posture.zsh); snapshots in order, see postures[].snapshot",+ processes: ["SpringBoard", "backboardd", "Preferences"],+ orientation_field: "interface orientation of the scene the call ran under (SpringBoard: primary window scene; Preferences: its window scene). The device orientation passed to -deviceOrientation= is in the posture label, e.g. closed(landscapeLeft).",+ sim_note_field: "extra per-record field: why a value is synthetic or sim-only and must not be used as an alignment target for the VM; null when the value is a plain OS answer",+ group_field: "extra per-record field: the probe expression the record came from (probes/sensors-<group>.lldb; pose = probes/sensors-springboard.lldb, hid = probes/sensors-backboardd.lldb)",+ postures: $postures+ },+ records: $recs+ }' > $out+ print -- "run-sensors: $($jq '.records | length' $out) records -> $out" ;;+ *) sed -n '2,12p' ${0:a} | sed 's/^# \{0,1\}//'; exit 2 ;;+esacdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/springboard/discover-classes2.lldb b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/discover-classes2.lldbnew file mode 100644index 00000000..8716cfd9--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/discover-classes2.lldb@@ -0,0 +1,14 @@+expr -l objc -O --+NSMutableString *vpOut = [NSMutableString string];+NSArray *vpPrefixes = @[@"ResolutionPolicy", @"SBFResolved", @"TRAArbit", @"TRAParticipant", @"TRASettings", @"TRAPreferences", @"IdleTimer", @"SBLockScreenManager", @"SBLockState", @"Yoink", @"SBScreenSleep", @"SBDisplayContentMode", @"DeviceOrientation", @"OrientationLock", @"SBFDisplayTool", @"SBDisplayLayout", @"SBSwitcherController", @"SBAutoLock", @"SBUserAgent"];+unsigned int vpCount = 0;+Class *vpClasses = objc_copyClassList(&vpCount);+NSMutableArray *vpNames = [NSMutableArray array];+for (unsigned int vi = 0; vi < vpCount; vi++) {+ NSString *vpN = [NSString stringWithUTF8String:class_getName(vpClasses[vi])];+ for (NSString *vpP in vpPrefixes) { if ([vpN rangeOfString:vpP].location != NSNotFound) { [vpNames addObject:vpN]; break; } }+}+free(vpClasses);+[vpNames sortUsingSelector:@selector(compare:)];+[vpNames componentsJoinedByString:@"\n"]+diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/springboard/find-owners.lldb b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/find-owners.lldbnew file mode 100644index 00000000..fde286dd--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/find-owners.lldb@@ -0,0 +1,20 @@+expr -l objc -O --+NSArray *vpTypes = @[@"SBHingeMotion", @"SBWallpaperHinge", @"SBBacklightCoordinator", @"SBDisplayContentModeLockScreen", @"SBDisplayContentModeTransitionStyle", @"SBIdleTimerGlobalCoordinator", @"SBDisplayYoinkingCoordinator", @"SBContinuousFoldCoordinator", @"SBFDevicePoseProvider", @"SBWindowSceneManager", @"SBScreenSleepCoordinator", @"BLSHBacklight", @"SBLockScreenManager", @"PRUISHingeProgress"];+NSMutableString *vpOut = [NSMutableString string];+unsigned int vpCount = 0;+Class *vpClasses = objc_copyClassList(&vpCount);+for (unsigned int vi = 0; vi < vpCount; vi++) {+ const char *vpImg = class_getImageName(vpClasses[vi]);+ NSString *vpImgS = vpImg ? [NSString stringWithUTF8String:vpImg] : @""; if (!([vpImgS containsString:@"SpringBoard"] || [vpImgS containsString:@"Poster"])) continue;+ unsigned int vpN = 0;+ Ivar *vpIv = class_copyIvarList(vpClasses[vi], &vpN);+ for (unsigned int vj = 0; vj < vpN; vj++) {+ const char *vpT = ivar_getTypeEncoding(vpIv[vj]);+ if (!vpT) continue;+ for (NSString *vpTy in vpTypes) if ([[NSString stringWithUTF8String:vpT] containsString:vpTy]) { [vpOut appendFormat:@"%s.%s %s\n", class_getName(vpClasses[vi]), ivar_getName(vpIv[vj]), vpT]; break; }+ }+ free(vpIv);+}+free(vpClasses);+vpOut+diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/springboard/state-line.lldb b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/state-line.lldbnew file mode 100644index 00000000..3c2a23f3--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/springboard/state-line.lldb@@ -0,0 +1 @@+expr -l objc -O -- NSObject *vpL = (NSObject *)((id (*)(id, SEL))objc_msgSend)((id)NSClassFromString(@"SBLockScreenManager"), @selector(sharedInstance)); [NSString stringWithFormat:@"locked=%d aggregateBacklight=%@", ((BOOL (*)(id, SEL))objc_msgSend)(vpL, @selector(isUILocked)), [(NSObject *)[(NSObject *)[UIApplication sharedApplication] valueForKey:@"_backlightCoordinator"] valueForKey:@"aggregateBacklightState"]]diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/dbg.lldb b/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/dbg.lldbnew file mode 100644index 00000000..18540d9b--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/dbg.lldb@@ -0,0 +1,263 @@+expr -l objc -O --+void *vpMsg = (void *)objc_msgSend;+int (^vpStrncmp)(const char *, const char *, size_t) = ^int(const char *a, const char *b, size_t n) { for (size_t i = 0; i < n; i++) { if (a[i] != b[i]) return (unsigned char)a[i] - (unsigned char)b[i]; if (!a[i]) return 0; } return 0; };+int (^vpStrcmp)(const char *, const char *) = ^int(const char *a, const char *b) { return vpStrncmp(a, b, (size_t)-1); };+NSMutableArray *vpRecs = [NSMutableArray array];+void (^vpTrace)(NSString *) = ^(NSString *s) { [s writeToFile:@"/var/tmp/vptrace.txt" atomically:NO encoding:NSUTF8StringEncoding error:nil]; };+NSDictionary *(^vpRect)(CGRect) = ^NSDictionary *(CGRect r) { return @{@"x": @(r.origin.x), @"y": @(r.origin.y), @"width": @(r.size.width), @"height": @(r.size.height)}; };+NSDictionary *(^vpSize)(CGSize) = ^NSDictionary *(CGSize s) { return @{@"width": @(s.width), @"height": @(s.height)}; };+NSDictionary *(^vpPoint)(CGPoint) = ^NSDictionary *(CGPoint p) { return @{@"x": @(p.x), @"y": @(p.y)}; };+__block id (^vpJSON)(id);+vpJSON = ^id(id vIn) { NSObject *v = (NSObject *)vIn;+ if (!v) return [NSNull null];+ if ([v isKindOfClass:[NSString class]]) return v;+ if ([v isKindOfClass:[NSNumber class]]) {+ double vd = [(NSNumber *)v doubleValue];+ if (vd != vd || vd == INFINITY || vd == -INFINITY) return [(NSObject *)v description];+ return v;+ }+ if ([v isKindOfClass:[NSValue class]]) {+ const char *vt = [(NSValue *)v objCType];+ if (vpStrncmp(vt, "{CGRect=", 8) == 0) { CGRect r; [(NSValue *)v getValue:&r]; return vpRect(r); }+ if (vpStrncmp(vt, "{CGSize=", 8) == 0) { CGSize s; [(NSValue *)v getValue:&s]; return vpSize(s); }+ if (vpStrncmp(vt, "{CGPoint=", 9) == 0) { CGPoint p; [(NSValue *)v getValue:&p]; return vpPoint(p); }+ return [(NSObject *)v description];+ }+ if ([v isKindOfClass:[NSArray class]] || [v isKindOfClass:[NSSet class]] || [v isKindOfClass:[NSOrderedSet class]]) {+ NSMutableArray *va = [NSMutableArray array];+ for (id vx in (NSArray *)v) [va addObject:vpJSON(vx)];+ return va;+ }+ if ([v isKindOfClass:[NSDictionary class]]) {+ NSMutableDictionary *vm = [NSMutableDictionary dictionary];+ for (id vk in (NSDictionary *)v) vm[[(NSObject *)vk description]] = vpJSON([(NSDictionary *)v objectForKey:vk]);+ return vm;+ }+ if ([v isKindOfClass:[NSUUID class]]) return [(NSUUID *)v UUIDString];+ return [(NSObject *)v description];+};+void (^vpAdd)(NSString *, NSString *, NSString *, id, NSString *) = ^(NSString *api, NSString *kind, NSString *call, id value, NSString *error) {+ vpTrace([NSString stringWithFormat:@"add %@ %@", api, call]);+ [vpRecs addObject:@{@"api": api, @"kind": kind, @"call": call, @"value": value ? vpJSON(value) : [NSNull null], @"error": error ?: (value ? (id)[NSNull null] : (id)@"nil")}];+};+NSArray *vpDenyExact = @[@"dealloc", @"invalidate", @"update", @"updateDisplays", @"_finalize", @"_invalidate", @"init", @"_init", @".cxx_destruct", @".cxx_construct", @"copy", @"mutableCopy", @"immutableCopy", @"freeze", @"acquireFrozenSurface", @"activateReplay", @"rebuildModeList", @"removeAllClones", @"resetConfiguration", @"disableDICOM", @"willUnblank", @"commitPreset", @"unregisterNotificationBlocks", @"unregisterSyncNotificationBlocks", @"clearUpdateMask", @"initializeClientPort", @"acquireWirelessDisplayStateControl", @"_detectDisplays", @"_detectSimDisplays", @"removeAllDisplays", @"enableOutOfProcessDisplayObservation", @"updateBandWidthInfoForAllDisplays", @"stopServer", @"new", @"alloc", @"class", @"self", @"retain", @"release", @"autorelease", @"retainCount", @"zone", @"hash", @"superclass", @"debugDescription", @"description", @"succinctDescription", @"succinctDescriptionBuilder", @"descriptionBuilder", @"_availableModesInternal", @"copyForSecureRendering", @"cancelTouchesOnMainDisplay", @"cancelTouchesOnAllDisplays", @"prepareForRestart", @"updateTransformsWithCompletion", @"_postInitialBookendObserverConnections", @"_cleanup", @"_freeze", @"_startAnimating", @"_stopAnimating", @"copyPrivateRepresentation", @"initForProtobufDecoding", @"_queue_resetTouchAuthenticationInitialSampleEvent", @"layoutIfNeeded", @"setNeedsLayout", @"_copyDebugProperties", @"_dragManager", @"_focusSystem", @"_interactiveHighlightEnvironment", @"focusItemContainer", @"focusedItem", @"focusedView", @"parentFocusEnvironment", @"preferredFocusEnvironments", @"preferredFocusedView", @"_preferredFocusedWindow", @"_preferredFocusedWindowScene", @"_boundingPathUtilities", @"_carSession", @"supportsFocus", @"_SwiftUITesting_currentScreenScale", @"_SwiftUITesting_wantsWideContentMargins", @"__ck_isFullscreen", @"pu_workImageSize", @"px_currentEDRHeadroom", @"px_potentialEDRHeadroom", @"ck_screenSizeCategory", @"_mapkit_display", @"postBookendConnections", @"bookendObserver", @"observers"];+NSArray *vpDenyPrefix = @[@"set", @"_set", @"remove", @"_remove", @"add", @"cancel", @"invalidate", @"_lock_", @"_workQueue_", @"_queue_", @"_post", @"_present", @"_dismiss", @"_update", @"_wrap", @"reevaluate", @"_begin", @"_end", @"begin", @"end", @"_prepare", @"_reset", @"reset", @"_flush", @"flush", @"_notify", @"_handle", @"_init", @"init", @"_copy", @"copy", @"_create", @"create", @"_install", @"_uninstall", @"_register", @"_unregister", @"register", @"unregister", @"_perform", @"perform", @"_apply", @"apply", @"_enable", @"_disable", @"_invalidate", @"_teardown", @"_start", @"_stop", @"start", @"stop", @"_send", @"send", @"_snapshot", @"snapshot", @"_dump", @"dump", @"_run", @"_schedule", @"_will", @"_did", @"_reload", @"reload", @"_force", @"_clear", @"clear", @"_release", @"_acquire", @"acquire", @"_take", @"_capture", @"_trigger", @"_request", @"request", @"_animate", @"_show", @"_hide", @"_attach", @"_detach", @"_connect", @"_disconnect", @"_present", @"_activate", @"_deactivate", @"_destroy", @"_purge", @"_close", @"_open", @"_save", @"_load", @"_make", @"make", @"_print", @"_log", @"_toggle", @"_test", @"_simulate", @"_fake", @"_debug"];+NSArray *vpThrowSels = @[@"secureIndicatorsEnabled"];+BOOL (^vpAllowed)(NSString *) = ^BOOL(NSString *sel) {+ if ([vpThrowSels containsObject:sel]) return NO;+ if ([sel rangeOfString:@":"].location != NSNotFound) return NO;+ if ([vpDenyExact containsObject:sel]) return NO;+ for (NSString *vp in vpDenyPrefix) if ([sel hasPrefix:vp]) return NO;+ return YES;+};+id (^vpCall)(id, NSString *, NSString **) = ^id(id obj, NSString *sel, NSString **err) {+ SEL vs = NSSelectorFromString(sel);+ if (![(NSObject *)obj respondsToSelector:vs]) { *err = @"does not respond"; return (id)nil; }+ Method vm = class_getInstanceMethod(object_getClass(obj), vs);+ if (!vm) { *err = @"no method"; return (id)nil; }+ if (method_getNumberOfArguments(vm) != 2) { *err = @"takes arguments"; return (id)nil; }+ char vt[256]; method_getReturnType(vm, vt, sizeof(vt));+ const char *vr = vt; while (*vr == 'r' || *vr == 'n' || *vr == 'N' || *vr == 'o' || *vr == 'O' || *vr == 'R' || *vr == 'V') vr++;+ switch (vr[0]) {+ case '@': if (vr[1] == '?') { *err = @"block"; return (id)nil; }+ { id vo = ((id (*)(id, SEL))vpMsg)(obj, vs); if (!vo) *err = @"nil"; return vo; }+ case '#': { Class vc = ((Class (*)(id, SEL))vpMsg)(obj, vs); return vc ? NSStringFromClass(vc) : (id)nil; }+ case 'B': return @(((BOOL (*)(id, SEL))vpMsg)(obj, vs) ? YES : NO);+ case 'c': return @(((signed char (*)(id, SEL))vpMsg)(obj, vs));+ case 'C': return @(((unsigned char (*)(id, SEL))vpMsg)(obj, vs));+ case 's': return @(((short (*)(id, SEL))vpMsg)(obj, vs));+ case 'S': return @(((unsigned short (*)(id, SEL))vpMsg)(obj, vs));+ case 'i': return @(((int (*)(id, SEL))vpMsg)(obj, vs));+ case 'I': return @(((unsigned int (*)(id, SEL))vpMsg)(obj, vs));+ case 'l': return @(((long (*)(id, SEL))vpMsg)(obj, vs));+ case 'L': return @(((unsigned long (*)(id, SEL))vpMsg)(obj, vs));+ case 'q': return @(((long long (*)(id, SEL))vpMsg)(obj, vs));+ case 'Q': return @(((unsigned long long (*)(id, SEL))vpMsg)(obj, vs));+ case 'f': return @(((float (*)(id, SEL))vpMsg)(obj, vs));+ case 'd': return @(((double (*)(id, SEL))vpMsg)(obj, vs));+ case '{':+ if (vpStrncmp(vr, "{CGRect=", 8) == 0) return vpRect(((CGRect (*)(id, SEL))vpMsg)(obj, vs));+ if (vpStrncmp(vr, "{CGSize=", 8) == 0) return vpSize(((CGSize (*)(id, SEL))vpMsg)(obj, vs));+ if (vpStrncmp(vr, "{CGPoint=", 9) == 0) return vpPoint(((CGPoint (*)(id, SEL))vpMsg)(obj, vs));+ if (vpStrncmp(vr, "{UIEdgeInsets=", 14) == 0 || vpStrncmp(vr, "{NSDirectionalEdgeInsets=", 25) == 0) { struct VPInsets { double a, b, c, d; } vi4 = ((struct VPInsets (*)(id, SEL))vpMsg)(obj, vs); return @{@"top": @(vi4.a), @"left": @(vi4.b), @"bottom": @(vi4.c), @"right": @(vi4.d)}; }+ if (vpStrncmp(vr, "{CGAffineTransform=", 19) == 0) { CGAffineTransform vx = ((CGAffineTransform (*)(id, SEL))vpMsg)(obj, vs); return @[@(vx.a), @(vx.b), @(vx.c), @(vx.d), @(vx.tx), @(vx.ty)]; }+ if (vpStrcmp(vr, "{?=ff}") == 0) { struct VPff { float a, b; } vf = ((struct VPff (*)(id, SEL))vpMsg)(obj, vs); return @[@(vf.a), @(vf.b)]; }+ if (vpStrcmp(vr, "{?={?=ff}{?=ff}{?=ff}{?=ff}}") == 0) { struct VPf8 { float a[8]; } vf8 = ((struct VPf8 (*)(id, SEL))vpMsg)(obj, vs); return @[@(vf8.a[0]), @(vf8.a[1]), @(vf8.a[2]), @(vf8.a[3]), @(vf8.a[4]), @(vf8.a[5]), @(vf8.a[6]), @(vf8.a[7])]; }+ if (vpStrncmp(vr, "{CAFrameRateRange=", 18) == 0) { struct VPfff { float a, b, c; } vf3 = ((struct VPfff (*)(id, SEL))vpMsg)(obj, vs); return @{@"minimum": @(vf3.a), @"maximum": @(vf3.b), @"preferred": @(vf3.c)}; }+ *err = [NSString stringWithFormat:@"unsupported struct return %.60s", vr]; return (id)nil;+ default: *err = [NSString stringWithFormat:@"unsupported return type %.60s", vr]; return (id)nil;+ }+};+NSArray *(^vpGetters)(Class, Class) = ^NSArray *(Class cls, Class stop) {+ char vrt[8];+ NSMutableOrderedSet *vs = [NSMutableOrderedSet orderedSet];+ for (Class vc = cls; vc && vc != stop && vc != [NSObject class]; vc = class_getSuperclass(vc)) {+ unsigned int vn = 0;+ objc_property_t *vp = class_copyPropertyList(vc, &vn);+ for (unsigned int vi = 0; vi < vn; vi++) {+ char *vg = property_copyAttributeValue(vp[vi], "G");+ NSString *vgs = vg ? [NSString stringWithUTF8String:vg] : [NSString stringWithUTF8String:property_getName(vp[vi])];+ if (vg) free(vg);+ if (vpAllowed(vgs)) [vs addObject:vgs];+ }+ free(vp);+ Method *vm = class_copyMethodList(vc, &vn);+ for (unsigned int vi = 0; vi < vn; vi++) {+ NSString *vsel = NSStringFromSelector(method_getName(vm[vi]));+ method_getReturnType(vm[vi], vrt, sizeof(vrt)); if (vrt[0] == 'v') continue;+ if (method_getNumberOfArguments(vm[vi]) == 2 && vpAllowed(vsel)) [vs addObject:vsel];+ }+ free(vm);+ }+ return [[vs array] sortedArrayUsingSelector:@selector(compare:)];+};+void (^vpDump)(id, NSString *, NSString *, NSString *, Class) = ^(id obj, NSString *apiClass, NSString *kind, NSString *callPrefix, Class stop) {+ if (!obj) { vpAdd([apiClass stringByAppendingString:@".(object)"], kind, callPrefix, nil, @"object is nil"); return; }+ vpAdd([apiClass stringByAppendingString:@".description"], kind, [callPrefix stringByAppendingString:@".description"], [(NSObject *)obj description], nil);+ vpAdd([apiClass stringByAppendingString:@".class"], kind, [callPrefix stringByAppendingString:@".class"], NSStringFromClass([(NSObject *)obj class]), nil);+ for (NSString *vsel in vpGetters([(NSObject *)obj class], stop)) {+ vpTrace([NSString stringWithFormat:@"%@ %@", callPrefix, vsel]);+ NSString *verr = nil;+ id vv = vpCall(obj, vsel, &verr);+ vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], vv, vv ? nil : verr);+ }+ for (NSString *vsel in vpThrowSels) if ([(NSObject *)obj respondsToSelector:NSSelectorFromString(vsel)]) vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], nil, @"raises an Objective-C exception in this process (not called)");+};+NSDictionary *(^vpObjDict)(id) = ^NSDictionary *(id objIn) {+ NSMutableDictionary *vd = [NSMutableDictionary dictionary];+ if (!objIn) return vd;+ for (NSString *vsel in vpGetters([(NSObject *)objIn class], nil)) { vpTrace([NSString stringWithFormat:@"objdict %@ %@", NSStringFromClass([(NSObject *)objIn class]), vsel]); NSString *verr = nil; id vv = vpCall(objIn, vsel, &verr); vd[vsel] = vv ? vpJSON(vv) : [NSString stringWithFormat:@"<error: %@>", verr]; }+ return vd;+};+void (^vpDumpSel)(id, NSString *, NSString *, NSString *, NSArray *) = ^(id obj, NSString *apiClass, NSString *kind, NSString *callPrefix, NSArray *sels) {+ if (!obj) { vpAdd([apiClass stringByAppendingString:@".(object)"], kind, callPrefix, nil, @"object is nil"); return; }+ for (NSString *vsel in sels) {+ NSString *verr = nil;+ id vv = vpCall(obj, vsel, &verr);+ vpAdd([NSString stringWithFormat:@"%@.%@", apiClass, vsel], kind, [NSString stringWithFormat:@"%@.%@", callPrefix, vsel], vv, vv ? nil : verr);+ }+};+id vpOrientation = nil;+Class vpCADisplay = NSClassFromString(@"CADisplay");+Class vpCADisplayMode = NSClassFromString(@"CADisplayMode");+NSString *(^vpCStr)(char *) = ^NSString *(char *s) { if (!s) return (NSString *)nil; NSString *vs = [NSString stringWithUTF8String:s]; free(s); return vs; };+NSArray *vpDisplays = ((id (*)(id, SEL))vpMsg)(vpCADisplay, @selector(displays));+NSObject *vpMain = ((id (*)(id, SEL))vpMsg)(vpCADisplay, @selector(mainDisplay));+vpAdd(@"CADisplay.displays", @"private", @"[CADisplay displays].count", @(vpDisplays.count), nil);+vpAdd(@"CADisplay.displays.names", @"private", @"[[CADisplay displays] valueForKey:@\"name\"]", [vpDisplays valueForKey:@"name"], nil);+vpAdd(@"CADisplay.mainDisplay.indexInDisplays", @"private", @"[[CADisplay displays] indexOfObjectIdenticalTo:[CADisplay mainDisplay]]", @((long)[vpDisplays indexOfObjectIdenticalTo:vpMain]), nil);+NSObject *vpTV = ((id (*)(id, SEL))vpMsg)(vpCADisplay, NSSelectorFromString(@"TVOutDisplay"));+vpAdd(@"CADisplay.TVOutDisplay", @"private", @"[CADisplay TVOutDisplay]", vpTV ? [(NSObject *)vpTV description] : nil, vpTV ? nil : @"nil");+NSMutableArray *vpDispList = [NSMutableArray arrayWithArray:vpDisplays];+NSMutableArray *vpDispCalls = [NSMutableArray array];+for (NSUInteger vi = 0; vi < vpDisplays.count; vi++) [vpDispCalls addObject:[NSString stringWithFormat:@"[CADisplay displays][%lu]<%@>", (unsigned long)vi, [(NSObject *)vpDisplays[vi] valueForKey:@"name"]]];+if (vpMain) { [vpDispList addObject:vpMain]; [vpDispCalls addObject:[NSString stringWithFormat:@"[CADisplay mainDisplay]<%@>", [vpMain valueForKey:@"name"]]]; }+for (NSUInteger vi = 0; vi < vpDispList.count; vi++) {+ NSObject *vpD = vpDispList[vi];+ NSString *vpC = vpDispCalls[vi];+ vpDump(vpD, @"CADisplay", @"private", vpC, nil);+ NSObject *vpCur = [vpD valueForKey:@"currentMode"];+ vpAdd(@"CADisplay.currentMode.getters", @"private", [vpC stringByAppendingString:@".currentMode.*"], vpCur ? vpObjDict(vpCur) : nil, vpCur ? nil : @"nil");+ NSObject *vpPref = [vpD valueForKey:@"preferredMode"];+ vpAdd(@"CADisplay.preferredMode.getters", @"private", [vpC stringByAppendingString:@".preferredMode.*"], vpPref ? vpObjDict(vpPref) : nil, vpPref ? nil : @"nil");+ NSMutableArray *vpModes = [NSMutableArray array];+ for (id vpM in (NSArray *)[vpD valueForKey:@"availableModes"]) [vpModes addObject:vpObjDict(vpM)];+ vpAdd(@"CADisplay.availableModes.getters", @"private", [vpC stringByAppendingString:@".availableModes[*].*"], vpModes, nil);+ NSObject *vpPrefs = [vpD valueForKey:@"preferences"];+ vpAdd(@"CADisplay.preferences.getters", @"private", [vpC stringByAppendingString:@".preferences.*"], vpPrefs ? vpObjDict(vpPrefs) : nil, vpPrefs ? nil : @"nil");+ NSObject *vpExt = [vpD valueForKey:@"externalDisplayAttributes"];+ vpAdd(@"CADisplay.externalDisplayAttributes.getters", @"private", [vpC stringByAppendingString:@".externalDisplayAttributes.*"], vpExt ? vpObjDict(vpExt) : nil, vpExt ? nil : @"nil");+ NSObject *vpSC = [vpD valueForKey:@"stateControl"];+ vpDump(vpSC, @"CADisplayStateControl", @"private", [vpC stringByAppendingString:@".stateControl"], nil);+ if (vpSC) {+ vpAdd(@"CADisplayStateControl._copyStateInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyStateInfo"], vpCStr(((char *(*)(id, SEL))vpMsg)(vpSC, NSSelectorFromString(@"_copyStateInfo"))), nil);+ vpAdd(@"CADisplayStateControl._copyAllPowerAssertionInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyAllPowerAssertionInfo"], vpCStr(((char *(*)(id, SEL))vpMsg)(vpSC, NSSelectorFromString(@"_copyAllPowerAssertionInfo"))), nil);+ vpAdd(@"CADisplayStateControl._copyAllFrameRateAssertionInfo", @"private", [vpC stringByAppendingString:@".stateControl._copyAllFrameRateAssertionInfo"], vpCStr(((char *(*)(id, SEL))vpMsg)(vpSC, NSSelectorFromString(@"_copyAllFrameRateAssertionInfo"))), nil);+ }+ CFDictionaryRef vpDbg = NULL; /* VM: -[CADisplay _copyDebugProperties] aborts backboardd (SIGABRT) when the display has no stateControl; not called */+ vpAdd(@"CADisplay._copyDebugProperties", @"private", [vpC stringByAppendingString:@"._copyDebugProperties"], vpDbg ? (__bridge id)vpDbg : nil, vpDbg ? nil : @"NULL");+}+NSObject *vpWS = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"CAWindowServer"), NSSelectorFromString(@"serverIfRunning"));+vpDump(vpWS, @"CAWindowServer", @"private", @"[CAWindowServer serverIfRunning]", nil);+NSArray *vpWSD = vpWS ? [vpWS valueForKey:@"displays"] : @[];+NSMutableDictionary *vpUUIDs = [NSMutableDictionary dictionary];+for (NSUInteger vi = 0; vi < vpWSD.count; vi++) {+ NSObject *vpD = vpWSD[vi];+ NSString *vpC = [NSString stringWithFormat:@"[CAWindowServer serverIfRunning].displays[%lu]<%@>", (unsigned long)vi, [vpD valueForKey:@"name"]];+ vpDump(vpD, @"CAWindowServerDisplay", @"private", vpC, nil);+ CGRect vpB = ((CGRect (*)(id, SEL))vpMsg)(vpD, @selector(bounds));+ unsigned int vpCtx = ((unsigned int (*)(id, SEL, CGPoint))vpMsg)(vpD, NSSelectorFromString(@"contextIdAtPosition:"), CGPointMake(CGRectGetMidX(vpB), CGRectGetMidY(vpB)));+ vpAdd(@"CAWindowServerDisplay.contextIdAtPosition:center", @"private", [vpC stringByAppendingString:@" contextIdAtPosition:(center of bounds)"], @(vpCtx), nil);+ NSString *vpU = [(NSObject *)[vpD valueForKey:@"uniqueId"] description];+ NSObject *vpUU = [vpD valueForKey:@"uuid"];+ vpUUIDs[[vpD valueForKey:@"name"]] = @{@"uniqueId": vpU ?: [NSNull null], @"uuid": vpUU ? [(NSUUID *)vpUU UUIDString] : [NSNull null]};+}+vpAdd(@"CAWindowServerDisplay.nameToIds", @"private", @"{name: {uniqueId, uuid}} over [CAWindowServer serverIfRunning].displays", vpUUIDs, nil);+NSObject *vpOrientCtl = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"BKDisplayOrientationController"), @selector(sharedInstance));+NSDictionary *vpOBU = [vpOrientCtl valueForKey:@"_orientationByDisplayUUID"];+vpAdd(@"BKDisplayOrientationController._orientationByDisplayUUID", @"private", @"[[BKDisplayOrientationController sharedInstance] valueForKey:@\"_orientationByDisplayUUID\"]", vpOBU, nil);+NSMutableOrderedSet *vpAllUUIDs = [NSMutableOrderedSet orderedSetWithArray:[vpOBU allKeys]];+for (NSObject *vpD in vpDisplays) { NSObject *vu = [vpD valueForKey:@"uniqueId"]; if (vu) [vpAllUUIDs addObject:vu]; NSObject *vuu = [vpD valueForKey:@"UUID"]; if (vuu) [vpAllUUIDs addObject:[(NSUUID *)vuu UUIDString]]; }+vpAdd(@"backboardd.displayUUIDsProbed", @"private", @"union of _orientationByDisplayUUID keys, CADisplay.uniqueId, CADisplay.UUID", [vpAllUUIDs array], nil);+NSObject *vpDC = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"BKDisplayController"), @selector(sharedInstance));+struct VPGeom { CGSize size; double scale; unsigned char orientation; CGRect rect; };+for (NSString *vpU in vpAllUUIDs) {+ long long vpIO = ((long long (*)(id, SEL, id))vpMsg)(vpOrientCtl, NSSelectorFromString(@"interfaceOrientationForDisplayUUID:"), vpU);+ vpAdd(@"BKDisplayOrientationController.interfaceOrientationForDisplayUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayOrientationController sharedInstance] interfaceOrientationForDisplayUUID:@\"%@\"]", vpU], @(vpIO), nil);+ NSObject *vpDD = ((id (*)(id, SEL, id))vpMsg)(vpDC, NSSelectorFromString(@"displayForUUID:"), vpU);+ vpAdd(@"BKDisplayController.displayForUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] displayForUUID:@\"%@\"]", vpU], vpDD ? [(NSObject *)vpDD description] : nil, vpDD ? nil : @"nil");+ struct VPGeom vpG = ((struct VPGeom (*)(id, SEL, id))vpMsg)(vpDC, NSSelectorFromString(@"geometryForDisplayUUID:"), vpU);+ vpAdd(@"BKDisplayController.geometryForDisplayUUID:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] geometryForDisplayUUID:@\"%@\"] as {CGSize; double; uchar; CGRect}", vpU], @{@"size": vpSize(vpG.size), @"double": @(vpG.scale), @"uchar": @(vpG.orientation), @"rect": vpRect(vpG.rect)}, nil);+ BOOL vpBl = ((BOOL (*)(id, SEL, id))vpMsg)(vpDC, NSSelectorFromString(@"displayIsBlanked:"), vpU);+ vpAdd(@"BKDisplayController.displayIsBlanked:", @"private", [NSString stringWithFormat:@"[[BKDisplayController sharedInstance] displayIsBlanked:@\"%@\"]", vpU], @(vpBl), nil);+}+NSObject *vpProv = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"BKSharedCADisplayProvider"), @selector(sharedInstance));+vpAdd(@"BKSharedCADisplayProvider.displays", @"private", @"[[BKSharedCADisplayProvider sharedInstance] displays]", [vpProv valueForKey:@"displays"], nil);+vpAdd(@"BKSharedCADisplayProvider.mainDisplay", @"private", @"[[BKSharedCADisplayProvider sharedInstance] mainDisplay]", [(NSObject *)[vpProv valueForKey:@"mainDisplay"] description], nil);+NSObject *vpOM = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"BKOrientationManager"), @selector(sharedInstance));+vpDump(vpOM, @"BKOrientationManager", @"private", @"[BKOrientationManager sharedInstance]", nil);+NSObject *vpBC = nil; /* VM: +[BKDisplayBrightnessController sharedInstance] faults (EXC_BAD_INSTRUCTION 0xdac1a7fe, PACIBSPPC); not called */+vpDump(vpBC, @"BKDisplayBrightnessController", @"private", @"[BKDisplayBrightnessController sharedInstance]", nil);+NSObject *vpOvM = nil; /* VM: faults like BKDisplayBrightnessController; not called */+vpDump(vpOvM, @"BKDisplayRenderOverlayManager", @"private", @"[BKDisplayRenderOverlayManager sharedInstance]", nil);+vpAdd(@"BKDisplayRenderOverlayManager._frozenDisplayIDs", @"private", @"[[BKDisplayRenderOverlayManager sharedInstance] valueForKey:@\"_frozenDisplayIDs\"]", [(NSObject *)[vpOvM valueForKey:@"_frozenDisplayIDs"] description], nil);+NSArray *vpOverlays = [[(NSSet *)[vpOvM valueForKey:@"activeOverlays"] allObjects] copy];+for (NSUInteger vi = 0; vi < vpOverlays.count; vi++) vpDump(vpOverlays[vi], @"BKDisplayRenderOverlay", @"private", [NSString stringWithFormat:@"[[BKDisplayRenderOverlayManager sharedInstance] activeOverlays][%lu]", (unsigned long)vi], nil);+NSObject *vpReg = ((id (*)(id, SEL))vpMsg)(NSClassFromString(@"BKHIDEventProcessorRegistry"), @selector(sharedInstance));+NSDictionary *vpProcs = [vpReg valueForKey:@"_eventProcessorsByClassName"];+vpAdd(@"BKHIDEventProcessorRegistry._eventProcessorsByClassName.keys", @"private", @"[[[BKHIDEventProcessorRegistry sharedInstance] valueForKey:@\"_eventProcessorsByClassName\"] allKeys]", [[vpProcs allKeys] sortedArrayUsingSelector:@selector(compare:)], nil);+NSObject *vpDT = vpProcs[@"BKHIDDirectTouchEventProcessor"];+NSString *vpDTC = @"[[BKHIDEventProcessorRegistry sharedInstance] valueForKey:@\"_eventProcessorsByClassName\"][@\"BKHIDDirectTouchEventProcessor\"]";+vpAdd(@"BKHIDDirectTouchEventProcessor.description", @"private", [vpDTC stringByAppendingString:@".description"], vpDT ? [(NSObject *)vpDT description] : nil, vpDT ? nil : @"nil");+if (vpDT) {+ for (NSString *vpK in @[@"mainDisplayDigitizerService", @"mainDisplayAOPDigitizerService", @"mainDisplayPencilDigitizerService", @"chamoisDisplayUUID", @"shouldIgnoreTouchesWhileObjectInProximity", @"_queue_interfaceOrientation", @"_queue_chamoisDisplayUUID", @"_queue_serviceSenderIDToChamoisDisplayUUID", @"_queue_accessoryTouchscreenServices"]) {+ id vv = [vpDT valueForKey:vpK];+ vpAdd([@"BKHIDDirectTouchEventProcessor." stringByAppendingString:vpK], @"private", [NSString stringWithFormat:@"%@ valueForKey:@\"%@\"", vpDTC, vpK], vv, vv ? nil : @"nil");+ }+ NSDictionary *vpPDI = [vpDT valueForKey:@"_queue_perDisplayInfo"];+ vpAdd(@"BKHIDDirectTouchEventProcessor._queue_perDisplayInfo.keys", @"private", [vpDTC stringByAppendingString:@" valueForKey:@\"_queue_perDisplayInfo\"].allKeys"], [vpPDI allKeys], nil);+ for (id vpKey in vpPDI) {+ NSObject *vpInfo = vpPDI[vpKey];+ NSString *vpIC = [NSString stringWithFormat:@"%@._queue_perDisplayInfo[%@]", vpDTC, vpKey];+ vpAdd(@"BKDirectTouchPerDisplayInfo.description", @"private", [vpIC stringByAppendingString:@".description"], [(NSObject *)vpInfo description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._display", @"private", [vpIC stringByAppendingString:@"._display"], [(NSObject *)[vpInfo valueForKey:@"_display"] description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._touchStreams", @"private", [vpIC stringByAppendingString:@"._touchStreams"], [(NSObject *)[vpInfo valueForKey:@"_touchStreams"] description], nil);+ vpAdd(@"BKDirectTouchPerDisplayInfo._hitTestRegions", @"private", [vpIC stringByAppendingString:@"._hitTestRegions"], [vpInfo valueForKey:@"_hitTestRegions"], nil);+ NSDictionary *vpS2D = [vpInfo valueForKey:@"_serviceToDigitizer"];+ for (NSObject *vpSvc in vpS2D) {+ NSObject *vpState = vpS2D[vpSvc];+ NSString *vpSC = [NSString stringWithFormat:@"%@._serviceToDigitizer[%@]", vpIC, [vpSvc valueForKey:@"senderID"]];+ NSObject *vpMapped = ((id (*)(id, SEL, id))vpMsg)(vpDT, NSSelectorFromString(@"_queue_displayUUIDForDigitizerService:"), vpSvc);+ vpAdd(@"BKHIDDirectTouchEventProcessor._queue_displayUUIDForDigitizerService:", @"private", [NSString stringWithFormat:@"[%@ _queue_displayUUIDForDigitizerService:<service senderID %@>]", vpDTC, [vpSvc valueForKey:@"senderID"]], vpMapped, vpMapped ? nil : @"nil");+ vpAdd(@"BKIOHIDService.getters", @"private", [vpSC stringByAppendingString:@".(service).*"], vpObjDict(vpSvc), nil);+ vpAdd(@"BKDirectTouchState.description", @"private", [vpSC stringByAppendingString:@".description"], [(NSObject *)vpState description], nil);+ NSMutableDictionary *vpSt = [NSMutableDictionary dictionary];+ for (NSString *vpK in @[@"_displayUUID", @"_interfaceOrientation", @"_maximumPositionZ", @"_maxForce", @"_determinedMaxForce", @"_supportsPreciseLocations", @"_displayIntegrated", @"_builtIn", @"_hoverDisabled", @"_waitingForAllTouchesUp", @"_hitTestRegions"]) { id vv = [vpState valueForKey:vpK]; vpSt[vpK] = vv ? vpJSON(vv) : [NSNull null]; }+ vpAdd(@"BKDirectTouchState.ivars", @"private", [vpSC stringByAppendingString:@" valueForKey:<ivar>"], vpSt, nil);+ }+ }+}+NSError *vpJErr = nil;+NSData *vpData = [NSJSONSerialization dataWithJSONObject:@{@"orientation": vpOrientation ?: [NSNull null], @"records": vpRecs} options:0 error:&vpJErr];+vpData ? [[NSString alloc] initWithData:vpData encoding:NSUTF8StringEncoding] : [vpJErr description]+diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/iterate-vm.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/iterate-vm.zshnew file mode 100755index 00000000..84aaef29--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/display/iterate-vm.zsh@@ -0,0 +1,24 @@+#!/bin/zsh+# iterate-vm.zsh <process> <vm-probe.lldb>: the VM version of src/display/iterate.zsh. Run the+# probe; when it is interrupted (ObjC exception, SIGABRT, bad instruction), read the getter it+# traced last from the guest's /var/tmp/vptrace.txt, add its selector to vpThrowSels, retry.+# At most 10 rounds.+set -euo pipefail+here=${0:a:h}; root=${here:h:h:h}+proc=$1 probe=$2+R() { vphone-launchpad-cli guest rpc duobase-01 "$@" }+for i in {1..10}; do+ R files.remove '{"path":"/var/tmp/vptrace.txt"}' >/dev/null 2>&1 || true+ $root/tools/vm-probe.zsh duobase-01 $proc $probe $here/iterate-$proc.txt 2>/dev/null || true+ if grep -qE 'Expression execution was interrupted' $here/iterate-$proc.txt; then+ why=$(grep -m1 'interrupted' $here/iterate-$proc.txt)+ last=$(R files.read '{"path":"/var/tmp/vptrace.txt"}' | /opt/homebrew/bin/jq -r '.result.content // empty')+ sel=$(print -- $last | awk '{print $NF}')+ print -- "round $i: $why; last: $last"+ [[ -n $sel ]] || { print "no trace; giving up"; exit 1 }+ perl -pi -e "s/^NSArray \\*vpThrowSels = \\@\\[/NSArray *vpThrowSels = \\@[\\@\"$sel\", /" $probe+ else+ print -- "round $i: done, $(grep -c '^{"orientation' $here/iterate-$proc.txt) JSON line(s)"; exit 0+ fi+done+exit 1diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/merge-fix.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/merge-fix.zshnew file mode 100755index 00000000..76695b5e--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/merge-fix.zsh@@ -0,0 +1,37 @@+#!/bin/zsh+# merge-fix.zsh: append the fix re-measurement (raw/vm/steps/fx-*, listed in+# raw/vm/steps/ORDER.fix-9064efca) to vm-<domain>.json. Existing records are kept as they+# are (bundle 2.14.0-local.21dc0c06, meta.vm.bundle); every appended record carries+# "bundle": "2.14.0-local.9064efca" and "step": "fx-<label>", and each fx step's rpc.json goes+# to meta.steps with its bundle. meta.fix describes the second pass. Re-running replaces the+# fx records and steps instead of duplicating them. Addresses are normalised as in vm-merge.zsh.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+jq=/opt/homebrew/bin/jq+steps=$root/raw/vm/steps+order=$steps/ORDER.fix-9064efca+bundle=2.14.0-local.9064efca+for domain in springboard display sensors chrome appkit; do+ out=$root/vm-$domain.json+ recs=$(mktemp -t fxrecs); meta=$(mktemp -t fxmeta)+ : > $recs; : > $meta+ while read -r step; do+ [[ -n $step && -e $steps/fx-$step/records.jsonl ]] || continue+ $jq -c --arg d "$domain" --arg step "fx-$step" --arg b $bundle 'select(.probe | startswith($d + "-")) | . + {step: $step, bundle: $b}+ | walk(if type == "string" then gsub("0x[0-9a-fA-F]{6,}"; "0x*") else . end)' $steps/fx-$step/records.jsonl >> $recs+ if [[ -n $($jq -c --arg d "$domain" 'select(.probe | startswith($d + "-")) | .probe' $steps/fx-$step/records.jsonl | head -1) ]]; then+ $jq -c --arg step "fx-$step" '{step: $step} + .' $steps/fx-$step/rpc.json >> $meta+ fi+ done < $order+ tmp=$(mktemp -t fxout)+ $jq --arg b $bundle --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --slurpfile recs $recs --slurpfile steps $meta '+ .records = ([.records[] | select((.bundle // "") != $b)] + $recs)+ | .meta.steps = ([.meta.steps[] | select((.bundle // "") != $b)] + $steps)+ | .meta.fix = {bundle: $b, bundle_source: "branch duo-sim-align (worktree HEAD aa274dcc at measurement time, on upstream main 0499378c): V68 product-id, /product/display0+display1 panel nodes, CoreMotion relay through VPhone Host Controls",+ date: $date, steps: "raw/vm/steps/ORDER.fix-9064efca (directories raw/vm/steps/fx-<label>)",+ driver: "src/vm/run-fix.zsh", records: "appended records carry bundle and step fx-<label>; records without bundle are from meta.vm.bundle",+ posture_mechanism: "vphoned display.posture / display.rotation through CoreMotion (libvphonehinge host controls -> locationd CLDeviceStateRelay); no test-automation override, so display.pose (display_pose_stale in meta.steps) is not the pose; read SBFDevicePoseProvider"}' $out > $tmp+ mv $tmp $out+ print "$out: $($jq '[.records[] | select(.bundle == "'$bundle'")] | length' $out) fix records, $($jq '.records | length' $out) total"+ rm -f $recs $meta+donediff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-autolock.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-autolock.zshnew file mode 100755index 00000000..b25c7e4d--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-autolock.zsh@@ -0,0 +1,34 @@+#!/bin/zsh+# run-autolock.zsh: the "Power and auto-lock" rows on duobase-01.+# 1. open, unlocked, SpringBoard idle-timer assertions invalidated (vm-springboard-enable-autolock)+# so the real Auto-Lock (60 s) runs; wait 90 s; snapshot without unlocking.+# 2. fold to closed while auto-locked; snapshot without unlocking (which panel lights).+# 3. unlock, open, idle timer disabled again, simulated lock-button press, fold within ~3 s;+# snapshot without unlocking.+# 4. back to open, unlocked, idle timer disabled.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+run=$root/probes/vm-run.zsh+R() { vphone-launchpad-cli guest rpc duobase-01 "$@" }+P() { $root/tools/vm-probe.zsh duobase-01 SpringBoard $root/probes/$1.lldb $root/raw/vm/autolock/$2.txt 2>/dev/null || print "probe $1 rc $?"; grep -E 'disabled=|locked|simulated|requested' $root/raw/vm/autolock/$2.txt | tail -2 | cut -c1-200 }+SB=(SpringBoard:springboard-state SpringBoard:display-springboard)+print "== 1"; $run posture al-open '{"hinge":"open-flat","position":"open"}'; sleep 15+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .result+P vm-springboard-enable-autolock enable-1+sleep 90+VM_NO_UNLOCK=1 $run snap open-autolocked 'open(auto-locked)' $SB backboardd:display-backboardd 2>&1 | grep -v '^vm-probe'; print open-autolocked >> $root/raw/vm/steps/ORDER+print "== 2"; $run posture al-fold '{"hinge":"closed","position":"closed"}'; sleep 15+VM_NO_UNLOCK=1 $run snap closed-after-autolock-open 'closed(after auto-lock in open)' $SB backboardd:display-backboardd 2>&1 | grep -v '^vm-probe'; print closed-after-autolock-open >> $root/raw/vm/steps/ORDER+sleep 20+VM_NO_UNLOCK=1 $run snap closed-after-autolock-open-20s 'closed(after auto-lock in open, 20 s later)' SpringBoard:springboard-state 2>&1 | grep -v '^vm-probe'; print closed-after-autolock-open-20s >> $root/raw/vm/steps/ORDER+print "== 3"; $run posture al-open2 '{"hinge":"open-flat","position":"open"}'; sleep 15+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .result+P vm-springboard-disable-autolock disable-2+P vm-lock-press lockpress-1+sleep 3+$run posture al-fold2 '{"hinge":"closed","position":"closed"}'; sleep 12+VM_NO_UNLOCK=1 $run snap closed-after-lockbutton-open 'closed(after lock button in open)' $SB 2>&1 | grep -v '^vm-probe'; print closed-after-lockbutton-open >> $root/raw/vm/steps/ORDER+print "== 4"; $run posture al-restore '{"hinge":"open-flat","position":"open"}'; sleep 15+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .result+P vm-springboard-disable-autolock disable-3+P vm-autolock-state final-statediff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-final.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-final.zshnew file mode 100755index 00000000..18880318--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-final.zsh@@ -0,0 +1,35 @@+#!/bin/zsh+# run-final.zsh: the last steps on duobase-01.+# 1. closed, lock screen via a simulated lock button (lockUIFromSource:1 hit EXC_BREAKPOINT+# when closed, raw/vm/steps/closed-lockscreen-pose/lockcmd.txt): chrome-lock on the cover.+# 2. closed home screen rotated to landscapeRight (redo: the first try lost SpringBoard).+# 3. back to open, portrait (display.rotation 90 on the inner), unlocked, idle timer disabled.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+run=$root/probes/vm-run.zsh+R() { vphone-launchpad-cli guest rpc duobase-01 "$@" }+P() { $root/tools/vm-probe.zsh duobase-01 SpringBoard $root/probes/$1.lldb $root/raw/vm/autolock/$2.txt 2>/dev/null || print "probe $1 rc $?"; tail -2 $root/raw/vm/autolock/$2.txt | cut -c1-200 }+sbpid() { R processes.list '{"filter":"SpringBoard"}' | /opt/homebrew/bin/jq -r '[.result.processes[] | select(.name == "SpringBoard") | .pid] | first // empty' }+print "sb $(sbpid)"+R apps.terminate '{"bundle_id":"com.apple.mobilesafari"}' >/dev/null 2>&1 || true+R apps.terminate '{"bundle_id":"com.apple.Preferences"}' >/dev/null 2>&1 || true+$run posture fin-closed '{"hinge":"closed","position":"closed"}'; sleep 15+R screen.unlock '{}' >/dev/null 2>&1 || true+P vm-lock-press fin-lockpress; sleep 4+VM_NO_UNLOCK=1 $run snap closed-lockscreen-button 'closed(lock screen via lock button)' SpringBoard:chrome-lock SpringBoard:springboard-state 2>&1 | grep -v '^vm-probe'; print closed-lockscreen-button >> $root/raw/vm/steps/ORDER+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .result+P vm-springboard-disable-autolock fin-disable-1+print "sb $(sbpid)"+$run rpc fin-closed-home-rot90 display.rotation '{"orientation":"90"}'; sleep 25+$run snap closed-home-rot90 'closed[home, display.rotation 90 (landscapeRight)]' SpringBoard:springboard-state SpringBoard:sensors-springboard SpringBoard:display-springboard 2>&1 | grep -v '^vm-probe'; print closed-home-rot90 >> $root/raw/vm/steps/ORDER+$run rpc fin-closed-home-rot0 display.rotation '{"orientation":"0"}'; sleep 20+print "sb $(sbpid)"+$run posture fin-open '{"hinge":"open-flat","position":"open"}'; sleep 20+$run rpc fin-open-rot90 display.rotation '{"orientation":"90"}'; sleep 20+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .result+P vm-springboard-disable-autolock fin-disable-2+R display.pose '{}' | /opt/homebrew/bin/jq -c .result+R display.orientation '{}' | /opt/homebrew/bin/jq -c .result+R device.screen '{}' | /opt/homebrew/bin/jq -c .result+R display.auto_lock '{}' | /opt/homebrew/bin/jq -c .result+print "sb $(sbpid)"diff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-fix.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-fix.zshnew file mode 100755index 00000000..dbe16fde--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-fix.zsh@@ -0,0 +1,212 @@+#!/bin/zsh+# run-fix.zsh <phase>: re-measure the rows the duo-sim-align fix can affect, on duobase-01+# with bundle 2.14.0-local.9064efca (branch duo-sim-align). Same probes as run-plan.zsh, but+# each lldb attach is spaced (GAP seconds after the previous one ended, and never sooner than+# 6 s after a posture or rotation), because lldb stops SpringBoard and a burst of attaches+# got it killed once. The SpringBoard pid is checked before and after every attach.+# Steps land in raw/vm/steps/fx-<label>/ (rpc.json, shot.jpg, transcripts, records.jsonl+# with a "bundle" field); step order in raw/vm/steps/ORDER.fix-9064efca.+#+# display.pose reads SpringBoard's test-automation snapshot, which this bundle no longer+# sets, so rpc.json keeps it only as "display_pose_stale"; the pose comes from+# SBFDevicePoseProvider (sensors-springboard).+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+jq=/opt/homebrew/bin/jq+vm=duobase-01+bundle=2.14.0-local.9064efca+steps=$root/raw/vm/steps+order=$steps/ORDER.fix-9064efca+stamp=$here/.fix-last-attach+GAP=${GAP:-45}+R() { vphone-launchpad-cli guest rpc $vm "$@" }+sbpid() { R processes.list '{"filter":"SpringBoard"}' | $jq -r '[.result.processes[] | select(.name == "SpringBoard") | .pid] | first // empty' }+log() { print -r -- "fix $(date +%H:%M:%S): $*" }++# Wait until GAP seconds have passed since the last attach ended.+spacing() {+ local last=$(cat $stamp 2>/dev/null || print 0) now=$(date +%s)+ local wait=$(( last + GAP - now ))+ (( wait > 0 )) && { log "spacing ${wait}s"; sleep $wait }+ return 0+}+pose() { log "posture $1"; mkdir -p $steps/fx-$2; R display.posture "$1" > $steps/fx-$2/posture.json || true; $jq -c '.result // .' $steps/fx-$2/posture.json | cut -c1-300; sleep ${3:-20} }+rot() { log "rotation $1"; mkdir -p $steps/fx-$2; R display.rotation "{\"orientation\":\"$1\"}" > $steps/fx-$2/rotation.json || true; $jq -c '.result // .' $steps/fx-$2/rotation.json | cut -c1-300; sleep ${3:-25} }+app() { log "launch $1"; R screen.unlock '{}' >/dev/null 2>&1 || true; R apps.launch "{\"bundle_id\":\"$1\"}" | $jq -c '.result // .' | cut -c1-200; sleep 8 }++# keep: if SpringBoard was replaced since the idle-timer assertion was taken, stop. A new+# SpringBoard has no assertion, auto-locks after 60 s and darkens the screen, and a fold+# while dark is not published (see vm-notes.md); the caller re-takes it and resyncs.+keep() {+ local p=$(sbpid) held=$(cat $here/.fix-assertion-pid 2>/dev/null || true)+ [[ $p == $held ]] || { log "SpringBoard $p has no idle-timer assertion (held by ${held:-none}); stopping"; exit 3 }+}++# snap <label> <posture-label>: RPC snapshot + screenshot (no probes).+snap() {+ local label=$1 plabel=$2 dir=$steps/fx-$1+ keep+ mkdir -p $dir+ if [[ -z ${VM_NO_UNLOCK:-} ]]; then R screen.unlock '{}' > $dir/unlock.json 2>&1 || true; else print "VM_NO_UNLOCK: left as is" > $dir/unlock.json; fi+ sleep 1+ R screen.screenshot '{}' > $dir/shot.rpc.json || true+ $jq -r '.result.data' $dir/shot.rpc.json | base64 -d > $dir/shot.jpg 2>/dev/null || true+ local lit=$($root/tools/sim.zsh lit $dir/shot.jpg 2>/dev/null || print unknown)+ $jq -n --arg posture "$plabel" --arg lit "$lit" --arg bundle $bundle --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \+ --argjson pose "$(R display.pose '{}' | $jq -c '.result // .')" \+ --argjson orient "$(R display.orientation '{}' | $jq -c '.result // .')" \+ --argjson screen "$(R device.screen '{}' | $jq -c '.result // .')" \+ --argjson shot "$($jq -c '.result | {width, height, coordinate_scale}' $dir/shot.rpc.json)" \+ --argjson sb "$(sbpid)" \+ '{posture: $posture, bundle: $bundle, date: $date, display_pose_stale: $pose, display_orientation: $orient, device_screen: $screen, screenshot: ($shot + {lit: $lit}), springboard_pid: $sb}' > $dir/rpc.json+ rm -f $dir/shot.rpc.json+ touch $dir/records.jsonl+ print -- "$label" >> $order+ log "snap $label: $($jq -c '{deg: .display_orientation.degrees, shot: .screenshot, sb: .springboard_pid, screen: .device_screen}' $dir/rpc.json)"+}++# probe <label> <proc> <probe>: one spaced attach; records appended to the step.+probe() {+ local label=$1 proc=$2 name=$3 dir=$steps/fx-$1+ local file=$root/probes/vm-$name.lldb; [[ -e $file ]] || file=$root/probes/$name.lldb; [[ -e $here/$name.lldb ]] && file=$here/$name.lldb+ local plabel=$($jq -r .posture $dir/rpc.json)+ spacing+ local before=$(sbpid)+ log "attach $proc:$name ($label), SpringBoard $before"+ PROBE_TIMEOUT=${PROBE_TIMEOUT:-240} $root/tools/vm-probe.zsh $vm $proc $file $dir/$proc-$name.txt 2>>$dir/probe-stderr.txt || log "rc $? for $proc:$name"+ date +%s > $stamp+ local after=$(sbpid)+ if [[ $before != $after ]]; then+ log "SPRINGBOARD PID CHANGED $before -> $after during $proc:$name"+ print "$proc:$name $before -> $after" >> $dir/springboard-restarts.txt+ fi+ grep -E '^\{"(records|orientation|group)"' $dir/$proc-$name.txt | $jq -c --arg proc $proc --arg probe $name --arg posture "$plabel" --arg bundle $bundle '+ def orient: {"0": "unknown", "1": "portrait", "2": "portraitUpsideDown", "3": "landscapeLeft", "4": "landscapeRight"}[tostring] // "unknown";+ . as $g | .records[] | {api, kind, process: $proc, posture: $posture,+ orientation: (($g.orientation // 0) | orient), call, value, error, probe: $probe, bundle: $bundle}+ + (if $g.group then {group: $g.group} else {} end)' >> $dir/records.jsonl 2>/dev/null \+ || log "no JSON from $proc:$name ($(grep -m3 -E 'error|EXC_' $dir/$proc-$name.txt | tr '\n' ' ' | cut -c1-300))"+ log "$proc:$name -> $(grep -c "\"probe\":\"$name\"" $dir/records.jsonl) records"+}++SBP=(springboard-state sensors-springboard)+case ${1:-} in+ respring)+ # Starts open at inner portrait. Fold first so the start mirrors the sim's closed boot.+ rot 90 pre-rot90 10+ pose '{"hinge":"closed","position":"closed"}' pre-closed 20+ old=$(sbpid)+ log "respring (SpringBoard $old)"+ R system.respring '{"force":true}' > $steps/fx-pre-closed/respring.json 2>&1 || true+ new=""+ for i in {1..60}; do+ sleep 3+ new=$(sbpid 2>/dev/null || true)+ [[ -n $new && $new != $old ]] && break+ done+ log "SpringBoard $old -> ${new:-none}"+ [[ -n $new && $new != $old ]] || { log "SpringBoard did not come back within 180 s"; exit 1 }+ sleep 45+ R screen.unlock '{}' | $jq -c '.result // .' | cut -c1-200 || true+ sleep 5+ spacing+ $root/tools/vm-probe.zsh $vm SpringBoard $root/probes/vm-springboard-disable-autolock.lldb $root/raw/vm/autolock/fix-disable-pid$new.txt 2>/dev/null || true+ print $new > $here/.fix-assertion-pid+ date +%s > $stamp+ log "idle-timer assertion: $(tail -c 300 $root/raw/vm/autolock/fix-disable-pid$new.txt | tr '\n' ' ')" ;;+ postures)+ snap closed-sbstart 'closed(after SpringBoard start)'+ for p in $SBP; do probe closed-sbstart SpringBoard $p; done+ pose '{"hinge":"partially-open","position":"book"}' book-after-closed+ snap book-after-closed 'book(after-closed)'+ for p in $SBP; do probe book-after-closed SpringBoard $p; done+ pose '{"hinge":"open-flat","position":"open"}' open-after-book+ snap open-after-book 'open(after-book)'+ for p in $SBP display-springboard; do probe open-after-book SpringBoard $p; done+ probe open-after-book backboardd display-backboardd+ probe open-after-book backboardd sensors-backboardd+ probe open-after-book SpringBoard sensors-identity+ probe open-after-book SpringBoard chrome-state ;;+ postures2)+ pose '{"hinge":"closed","position":"closed"}' closed-after-open+ snap closed-after-open 'closed(after-open)'+ for p in $SBP display-springboard; do probe closed-after-open SpringBoard $p; done+ probe closed-after-open backboardd display-backboardd+ pose '{"hinge":"open-flat","position":"open"}' open-after-closed+ snap open-after-closed 'open(after-closed)'+ for p in $SBP; do probe open-after-closed SpringBoard $p; done+ pose '{"hinge":"partially-open","position":"book"}' book-after-open+ snap book-after-open 'book(after-open)'+ for p in $SBP; do probe book-after-open SpringBoard $p; done+ pose '{"hinge":"closed","position":"closed"}' closed-after-book+ snap closed-after-book 'closed(after-book)'+ for p in $SBP; do probe closed-after-book SpringBoard $p; done ;;+ statusbar)+ # Starts closed. Unfold, then inner interface orientation 1 (display.rotation 0) twice:+ # once right after the rotation, once after a round trip through 180 (the sim's -2 repeat).+ pose '{"hinge":"open-flat","position":"open"}' sb-open 20+ rot 0 open-rot0+ snap open-rot0 'open[home, display.rotation 0 (inner io 1)]'+ probe open-rot0 SpringBoard chrome-state+ probe open-rot0 SpringBoard sensors-springboard+ probe open-rot0 SpringBoard springboard-state+ rot 180 open-rot180+ snap open-rot180 'open[home, display.rotation 180 (inner io 2)]'+ probe open-rot180 SpringBoard sensors-springboard+ rot 0 open-rot0-2+ snap open-rot0-2 'open[home, display.rotation 0 (inner io 1), second time, after 180]'+ probe open-rot0-2 SpringBoard chrome-state+ probe open-rot0-2 SpringBoard springboard-state+ rot 90 open-rot90 ;;+ coremotion)+ # CoreMotion managers: Safari first (a canary for sharedManager now that isAvailable is+ # YES), then SpringBoard. Starts open, inner portrait.+ app com.apple.mobilesafari+ snap open-safari-cm 'open[app:MobileSafari](CoreMotion canary)'+ probe open-safari-cm MobileSafari sensors-coremotion+ probe open-safari-cm SpringBoard sensors-coremotion+ probe open-safari-cm SpringBoard sensors-cmtables ;;+ safari)+ # What an app sees, and the per-panel pose orientation on the cover. Safari in front.+ pose '{"hinge":"closed","position":"closed"}' safari-fold 20+ app com.apple.mobilesafari+ snap closed-safari 'closed[app:MobileSafari](after-open)'+ probe closed-safari MobileSafari appkit-scenes+ probe closed-safari SpringBoard sensors-springboard+ rot 90 closed-safari-rot90+ snap closed-safari-rot90 'closed[app:MobileSafari, display.rotation 90 (landscapeRight)]'+ probe closed-safari-rot90 SpringBoard sensors-springboard+ probe closed-safari-rot90 SpringBoard springboard-state+ probe closed-safari-rot90 MobileSafari appkit-scenes+ rot 270 closed-safari-rot270+ snap closed-safari-rot270 'closed[app:MobileSafari, display.rotation 270 (landscapeLeft)]'+ probe closed-safari-rot270 SpringBoard sensors-springboard+ probe closed-safari-rot270 MobileSafari appkit-scenes+ rot 0 closed-safari-rot0+ pose '{"hinge":"partially-open","position":"book"}' safari-book 20+ snap book-safari 'book[app:MobileSafari](after-closed)'+ probe book-safari MobileSafari appkit-scenes+ probe book-safari SpringBoard springboard-state+ pose '{"hinge":"open-flat","position":"open"}' safari-open 20+ snap open-safari 'open[app:MobileSafari](after-book)'+ probe open-safari MobileSafari appkit-scenes+ probe open-safari SpringBoard springboard-state ;;+ lock)+ # Lock-screen clock and poster on the cover. Starts closed on the home screen.+ R apps.terminate '{"bundle_id":"com.apple.mobilesafari"}' >/dev/null 2>&1 || true+ pose '{"hinge":"closed","position":"closed"}' lock-fold 20+ R input.button '{"name":"power"}' | $jq -c '.result // .' | cut -c1-200 || true+ sleep 4+ R input.button '{"name":"power"}' | $jq -c '.result // .' | cut -c1-200 || true+ sleep 4+ VM_NO_UNLOCK=1 snap closed-lockscreen 'closed(lock screen via two power presses)'+ probe closed-lockscreen SpringBoard chrome-lock ;;+ final)+ R screen.unlock '{}' | $jq -c '.result // .' | cut -c1-200 || true+ pose '{"hinge":"open-flat","position":"open"}' fin-open 20+ rot 90 fin-rot90 20+ R apps.terminate '{"bundle_id":"com.apple.mobilesafari"}' >/dev/null 2>&1 || true+ R screen.unlock '{}' | $jq -c '.result // .' | cut -c1-200 || true+ snap fin-open 'open(final state)' ;;+ *) print "phases: respring postures postures2 statusbar coremotion safari lock final"; exit 2 ;;+esacdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-lockchrome.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-lockchrome.zshnew file mode 100755index 00000000..7e7ed6d2--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-lockchrome.zsh@@ -0,0 +1,15 @@+#!/bin/zsh+# run-lockchrome.zsh <posture-json> <label> <posture-label>: lock the primary scene+# (vm-lock.lldb: lockUIFromSource:1, as chrome-run.zsh lock), run chrome-lock without+# unlocking, then unlock (screen.unlock). No notifications are pushed on the VM.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+run=$root/probes/vm-run.zsh+R() { vphone-launchpad-cli guest rpc duobase-01 "$@" }+$run posture $2-pose "$1"; sleep 15+R screen.unlock '{}' >/dev/null 2>&1 || true+$root/tools/vm-probe.zsh duobase-01 SpringBoard $root/probes/vm-lock.lldb $root/raw/vm/steps/$2-pose/lockcmd.txt 2>/dev/null || true+grep 'locked via' $root/raw/vm/steps/$2-pose/lockcmd.txt | tail -1+sleep 3+VM_NO_UNLOCK=1 $run snap $2 "$3" SpringBoard:chrome-lock 2>&1 | grep -v '^vm-probe'; print $2 >> $root/raw/vm/steps/ORDER+R screen.unlock '{}' | /opt/homebrew/bin/jq -c .resultdiff --git a/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-plan.zsh b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-plan.zshnew file mode 100755index 00000000..82ab6ed7--- /dev/null+++ b/Research/Guest/Evidence/duo-sim-baseline/src/vm/run-plan.zsh@@ -0,0 +1,126 @@+#!/bin/zsh+# run-plan.zsh <phase>: the duobase-01 measurement sequence, one phase at a time.+# Each step drives the guest (display.posture / display.rotation / apps.launch), waits for it+# to settle, keeps the guest unlocked with SpringBoard's idle timer disabled (re-taken after a+# SpringBoard restart), then runs probes/vm-run.zsh snap. Steps are appended to raw/vm/steps/ORDER.+set -euo pipefail+here=${0:a:h}; root=${here:h:h}+run=$root/probes/vm-run.zsh+R() { vphone-launchpad-cli guest rpc duobase-01 "$@" }+sbpid() { R processes.list '{"filter":"SpringBoard"}' | /opt/homebrew/bin/jq -r '[.result.processes[] | select(.name == "SpringBoard") | .pid] | first // empty' }+last=$(cat $here/.sbpid 2>/dev/null || true)+keep() {+ local p=$(sbpid)+ if [[ $p != $last ]]; then+ print "plan: SpringBoard pid $last -> $p; settling 60 s"; sleep 60+ R screen.unlock '{}' >/dev/null 2>&1 || true+ $root/tools/vm-probe.zsh duobase-01 SpringBoard $root/probes/vm-springboard-disable-autolock.lldb $root/raw/vm/autolock/disable-pid$p.txt 2>/dev/null || true+ last=$p; print $p > $here/.sbpid+ fi+}+pose() { print "plan: posture $1"; $run posture $2 "$1"; sleep ${3:-20} }+rot() { print "plan: rotation $1"; $run rpc $2 display.rotation "{\"orientation\":\"$1\"}"; sleep ${3:-25} }+app() { print "plan: launch $1"; R screen.unlock '{}' >/dev/null 2>&1 || true; R apps.launch "{\"bundle_id\":\"$1\"}" | /opt/homebrew/bin/jq -c '.result // .'; sleep 6 }+snap() { keep; local label=$1; shift; print "plan: snap $label"; $run snap $label "$@" 2>&1 | grep -v '^vm-probe'; print $label >> $root/raw/vm/steps/ORDER }+SB=(SpringBoard:springboard-state SpringBoard:display-springboard SpringBoard:sensors-springboard)+case $1 in+ postures)+ pose '{"hinge":"closed","position":"closed"}' closed-after-open+ snap closed-after-open 'closed(after-open)' $SB SpringBoard:chrome-state SpringBoard:sensors-uikit backboardd:display-backboardd+ pose '{"hinge":"partially-open","position":"book"}' book-after-closed+ snap book-after-closed 'book(after-closed)' $SB SpringBoard:chrome-state backboardd:display-backboardd+ pose '{"hinge":"open-flat","position":"open"}' open-after-book+ snap open-after-book 'open(after-book)' $SB SpringBoard:chrome-state backboardd:display-backboardd+ pose '{"hinge":"partially-open","position":"book"}' book-after-open+ snap book-after-open 'book(after-open)' $SB+ pose '{"hinge":"closed","position":"closed"}' closed-after-book+ snap closed-after-book 'closed(after-book)' $SB+ pose '{"hinge":"open-flat","position":"open"}' open-after-closed+ snap open-after-closed 'open(after-closed)' $SB SpringBoard:chrome-state ;;+ rotations)+ rot 0 open-rot0+ snap open-rot0 'open[inner io landscapeLeft via display.rotation 0]' $SB SpringBoard:chrome-state+ rot 180 open-rot180+ snap open-rot180 'open[inner io landscapeRight via display.rotation 180]' $SB+ rot 270 open-rot270+ snap open-rot270 'open[inner io upside-down via display.rotation 270]' $SB+ rot 90 open-rot90+ snap open-rot90 'open[inner io portrait via display.rotation 90]' $SB SpringBoard:chrome-state+ pose '{"hinge":"closed","position":"closed"}' closed-home-before-rot+ rot 90 closed-rot90+ snap closed-home-rot90 'closed[home, display.rotation 90 (landscapeRight)]' $SB+ rot 0 closed-rot0 ;;+ safari)+ app com.apple.mobilesafari+ snap closed-safari-portrait 'closed[app:MobileSafari](just launched)' $SB MobileSafari:appkit-scenes MobileSafari:display-safari+ rot 90 closed-safari-rot90+ snap closed-safari-rot90 'closed[app:MobileSafari, display.rotation 90 (landscapeRight)]' $SB MobileSafari:appkit-scenes+ rot 270 closed-safari-rot270+ snap closed-safari-rot270 'closed[app:MobileSafari, display.rotation 270 (landscapeLeft)]' $SB MobileSafari:appkit-scenes+ rot 0 closed-safari-rot0+ snap closed-safari-rot0 'closed[app:MobileSafari, back to portrait]' SpringBoard:springboard-state MobileSafari:appkit-scenes+ pose '{"hinge":"open-flat","position":"open"}' open-safari-unfold+ snap open-safari-after-closed 'open[app:MobileSafari](after-closed)' $SB MobileSafari:appkit-scenes MobileSafari:display-safari+ pose '{"hinge":"partially-open","position":"book"}' book-safari+ snap book-safari-after-open 'book[app:MobileSafari](after-open)' SpringBoard:springboard-state MobileSafari:appkit-scenes+ pose '{"hinge":"closed","position":"closed"}' closed-safari-fold+ snap closed-safari-after-book 'closed[app:MobileSafari](after-book)' SpringBoard:springboard-state SpringBoard:display-springboard MobileSafari:appkit-scenes ;;+ preferences)+ app com.apple.Preferences+ snap closed-prefs 'closed[app:Preferences](just launched)' SpringBoard:springboard-state Preferences:appkit-scenes+ rot 90 closed-prefs-rot90+ snap closed-prefs-rot90 'closed[app:Preferences, display.rotation 90 (landscapeRight)]' SpringBoard:springboard-state Preferences:appkit-scenes+ rot 0 closed-prefs-rot0+ pose '{"hinge":"partially-open","position":"book"}' book-prefs+ snap book-prefs-after-closed 'book[app:Preferences](after-closed)' SpringBoard:springboard-state Preferences:appkit-scenes+ pose '{"hinge":"open-flat","position":"open"}' open-prefs+ snap open-prefs-after-book 'open[app:Preferences](after-book)' SpringBoard:springboard-state Preferences:appkit-scenes+ pose '{"hinge":"closed","position":"closed"}' closed-prefs-fold+ snap closed-prefs-after-open 'closed[app:Preferences](after-open)' SpringBoard:springboard-state Preferences:appkit-scenes ;;+ rot2)+ # Rerun of every rotation step: the first runs passed the orientation as a JSON number,+ # which display.rotation ignores (it only reads a string); those steps are in+ # raw/vm/steps/discarded/*-numeric-orientation-ignored. Starts closed with Preferences in front.+ pose '{"hinge":"closed","position":"closed"}' r2-closed 15+ app com.apple.Preferences+ rot 90 r2-closed-prefs-rot90+ snap closed-prefs-rot90 'closed[app:Preferences, display.rotation 90 (landscapeRight)]' SpringBoard:springboard-state Preferences:appkit-scenes+ rot 0 r2-closed-prefs-rot0+ app com.apple.mobilesafari+ rot 90 r2-closed-safari-rot90+ snap closed-safari-rot90 'closed[app:MobileSafari, display.rotation 90 (landscapeRight)]' $SB MobileSafari:appkit-scenes+ rot 270 r2-closed-safari-rot270+ snap closed-safari-rot270 'closed[app:MobileSafari, display.rotation 270 (landscapeLeft)]' $SB MobileSafari:appkit-scenes+ rot 0 r2-closed-safari-rot0+ snap closed-safari-rot0 'closed[app:MobileSafari, back to portrait after landscapeLeft]' SpringBoard:springboard-state SpringBoard:display-springboard MobileSafari:appkit-scenes+ R apps.terminate '{"bundle_id":"com.apple.mobilesafari"}' >/dev/null 2>&1 || true+ R apps.terminate '{"bundle_id":"com.apple.Preferences"}' >/dev/null 2>&1 || true+ sleep 5+ rot 90 r2-closed-home-rot90+ snap closed-home-rot90 'closed[home, display.rotation 90 (landscapeRight)]' $SB+ rot 0 r2-closed-home-rot0+ pose '{"hinge":"open-flat","position":"open"}' r2-open 20+ rot 0 r2-open-rot0+ snap open-rot0 'open[home, display.rotation 0 (inner landscape-left)]' $SB SpringBoard:chrome-state+ rot 180 r2-open-rot180+ snap open-rot180 'open[home, display.rotation 180 (inner landscape-right)]' $SB+ rot 270 r2-open-rot270+ snap open-rot270 'open[home, display.rotation 270 (inner upside-down)]' $SB+ rot 90 r2-open-rot90+ snap open-rot90 'open[home, display.rotation 90 (inner portrait), after rotations]' $SB SpringBoard:chrome-state ;;+ hist)+ # History rows: cover UIScreen after a landscape app, app client orientation when launched+ # on the inner. Starts open, home screen, inner portrait.+ R apps.terminate '{"bundle_id":"com.apple.Preferences"}' >/dev/null 2>&1 || true+ app com.apple.Preferences+ snap open-prefs-launched-open 'open[app:Preferences](launched on the inner)' SpringBoard:springboard-state Preferences:appkit-scenes+ pose '{"hinge":"closed","position":"closed"}' h-prefs-fold 20+ snap closed-prefs-launched-open 'closed[app:Preferences](launched on the inner, folded)' SpringBoard:springboard-state Preferences:appkit-scenes+ app com.apple.mobilesafari+ rot 90 h-closed-safari-rot90+ pose '{"hinge":"open-flat","position":"open"}' h-safari-unfold-landscape 25+ snap open-after-cover-landscape 'open[app:MobileSafari](after the cover was landscapeRight)' SpringBoard:springboard-state SpringBoard:display-springboard MobileSafari:appkit-scenes+ rot 90 h-open-rot90+ snap open-after-cover-landscape-portrait 'open[app:MobileSafari, inner portrait](after the cover was landscapeRight)' SpringBoard:display-springboard ;;+ *) print "phases: postures rotations safari preferences rot2 hist"; exit 2 ;;+esacdiff --git a/Research/Guest/Evidence/duo-sim-baseline/vm-notes.md b/Research/Guest/Evidence/duo-sim-baseline/vm-notes.mdindex 11989db6..eff48ddf 100644--- a/Research/Guest/Evidence/duo-sim-baseline/vm-notes.md+++ b/Research/Guest/Evidence/duo-sim-baseline/vm-notes.md@@ -76,10 +76,10 @@ Preferences was killed once on purpose (tfix).have no `stateControl`), `+[BKDisplayBrightnessController sharedInstance]` and`+[BKDisplayRenderOverlayManager sharedInstance]` not called (both EXC_BAD_INSTRUCTION0xdac1a7fe, the same unlowered PAuth_LR code). Found with- `raw/vm/display/iterate-vm.zsh` (the VM version of `raw/display/iterate.zsh`: reads the+ `src/vm/display/iterate-vm.zsh` (the VM version of `src/display/iterate.zsh`: reads theguest's `/var/tmp/vptrace.txt`) and, because the last traced getter is not always theculprit (it walks backwards through the getter list when the fault comes later), a debug- copy that traces every record add (`raw/vm/display/dbg.lldb`). backboardd survived every+ copy that traces every record add (`src/vm/display/dbg.lldb`). backboardd survived everyinterrupted expression (pid 61 throughout).## How the VM column was measured@@ -94,8 +94,8 @@ Preferences was killed once on purpose (tfix).90 landscape-right, 270 landscape-left).- Each step: `probes/vm-run.zsh snap` (screen.unlock, display.pose, display.orientation,device.screen, a screen.screenshot with its size and lit/dark, the SpringBoard pid, then the- probes), driven by `raw/vm/run-plan.zsh` (phases postures, rotations, safari, preferences),- `raw/vm/run-autolock.zsh` and `raw/vm/run-lockchrome.zsh`. Step order: `raw/vm/steps/ORDER`.+ probes), driven by `src/vm/run-plan.zsh` (phases postures, rotations, safari, preferences),+ `src/vm/run-autolock.zsh` and `src/vm/run-lockchrome.zsh`. Step order: `raw/vm/steps/ORDER`.`probes/vm-retag.zsh` rebuilds each step's `records.jsonl` from the transcripts;`probes/vm-merge.zsh` writes `vm-<domain>.json`. Helpers used to read the results:`probes/vm-summary.zsh` (posture table), `vm-chrome-keys.zsh`, `vm-app-keys.zsh`,@@ -201,12 +201,12 @@ were measured; BASELINE.md marks them "2026-10-30" and keeps the first-pass valu### Method-- Driver `raw/vm/run-fix.zsh` (phases respring, postures, postures2, statusbar, coremotion,+- Driver `src/vm/run-fix.zsh` (phases respring, postures, postures2, statusbar, coremotion,safari, lock, final), same probes as before. Every lldb attach waits until 45 s have passedsince the previous one ended, postures settle 20 s and rotations 25 s before any attach,and the SpringBoard pid is read before and after each attach. Steps are`raw/vm/steps/fx-<label>/`, in order in `raw/vm/steps/ORDER.fix-9064efca`; logs- `raw/vm/plan-fix-*.log`. `raw/vm/merge-fix.zsh` appends them to `vm-*.json` with+ `raw/vm/plan-fix-*.log`. `src/vm/merge-fix.zsh` appends them to `vm-*.json` with`"bundle": "2.14.0-local.9064efca"` and `step` `fx-<label>` (meta: `meta.fix`, and thestep snapshots in `meta.steps` carry the bundle). Re-running it replaces the fx records.- `display.pose` reads SpringBoard's test-automation snapshot, which this bundle no longerdiff --git a/Research/Guest/iphone_duo_bringup.md b/Research/Guest/iphone_duo_bringup.mdindex 18876e33..520702ea 100644--- a/Research/Guest/iphone_duo_bringup.md+++ b/Research/Guest/iphone_duo_bringup.md@@ -4844,9 +4844,10 @@ Apple's iPhone Duo simulator (Xcode 27.1, iOS 27.1 24A94425, device type`LCD-1` 2007×2853 rotation 270 surface type 2) was probed over lldb in everyposture, through SpringBoard's own display-swap coordinator (the internalsuiatool path), and the same calls were run on a two-display guest-(`duobase-01`) through the guest's debugserver. The harness, the per-domain-records and the table are in `Research/Guest/Evidence/duo-sim-baseline/`-(`BASELINE.md`). Three of the differences had one cause each:+(`duobase-01`) through the guest's debugserver. The harness and the table are+in `Research/Guest/Evidence/duo-sim-baseline/` (`BASELINE.md`). The+simulator's fold tuning settings and MobileGestalt answers are in+`iphone_duo_simulator_reference.md`. Three of the differences had one cause each:- **MobileGestalt saw one display.** libMobileGestalt computes`MGGetLogicalDeviceDisplayCount` and `DisplayExtendedProperties` live fromdiff --git a/Research/Guest/iphone_duo_simulator_reference.md b/Research/Guest/iphone_duo_simulator_reference.mdnew file mode 100644index 00000000..b561974b--- /dev/null+++ b/Research/Guest/iphone_duo_simulator_reference.md@@ -0,0 +1,147 @@+# iPhone Duo: reference values from Apple's simulator++Values from Apple's iPhone Duo simulator (iPhone19,4, V68, iOS 27.1 24A94425,+Xcode 27.1 27A9275) that are worth keeping beside the vphone-duo work. They were+taken out of the baseline records before those records were deleted on+2026-10-30.++- Comparison table, sim against VM, row by row: `Evidence/duo-sim-baseline/BASELINE.md`.+- Per-domain findings: `Evidence/duo-sim-baseline/{display,springboard,sensors,appkit,chrome}.md`.+- Harness, probes and the drivers that made the records:+ `Evidence/duo-sim-baseline/{tools,probes,src}/` (README there).+- What the alignment changed and how to check it: `iphone_duo_bringup.md`, "2026-10-30".++The VM column below is `duobase-01` running bundle 2.14.0-local.9064efca+(branch duo-sim-align, with CoreMotion's VM relay and the panel nodes).++## What was deleted, and how to get it back++The records were about 240,000 calls across five domains. They sat in+`<domain>.json` and `vm-<domain>.json`, 2–63 MB each. Transcripts, posture+JSON and screenshots sat under `raw/`, about 1 GB. None of it was committed.++To regenerate:++1. Clone the harness simulator: `tools/sim.zsh clone`.+2. Run each domain's runner from `probes/` or `src/` (each domain doc names its+ runner).+3. For the VM, run `tools/vm-probe.zsh` with the `src/vm/run-*.zsh` drivers.++Values to ignore when comparing: UUIDs, pointers and seeds change on every boot+(`display.md`, "Volatile fields").++## SpringBoard fold tuning (sim = VM)++All 116 numeric and boolean settings below read the same on the VM as on the+simulator. They are SpringBoard's built-in defaults, so the device type does not+change them. Use them to check behaviour against SpringBoard's own thresholds;+there is nothing to align.++`SBFDevicePoseProvider->_settings` (`SBFDevicePosePTSettings`):++| setting | value |+| --- | --- |+| `openTransitionBeginBoundary` | 5° |+| `closeTransitionBeginBoundary` | 175° |+| `partiallyOpenToOpenFlatBoundary` | 175° |+| `swapDegreesForContinuousLiveStyle` | 85° |+| `swapDegreesForFadeInFadeOutStyle` | 85° |+| `swapDegreesForContinuousSnapshotStyleWhenClosing` | 85° |+| `swapDegreesForContinuousSnapshotStyleWhenOpening` | 20° |+| `likelyToOpenVelocityDegreesPerSecond` | 40 |+| `velocitySmoothingFactor` | 0.15 |+| `transitionAutoCompleteDuration` | 0.35 s |+| `autocompleteMinDelay` / `autocompleteMaxDelay` | 0.15 / 0.75 s |+| `enterFoldAvoidancePredictionWindow` / `sustainFoldAvoidancePredictionWindow` | 0.35 / 0.2625 s |+| `displayPrewarmDuration` | 3 s |+| `continuousFoldTransitionEnabled` | YES |++`[SBDisplayYoinkingPTSettingsDomain rootSettings]`:++- **Thresholds:** `swapThreshold` 0.2, `touchBlockingThreshold` 0.1, `requiresActiveCameraSession` YES, `revealLingerDuration` 6 s.+- **Dimming:** `showsDimmingBackdrop` YES, `dimmingBlurRadius` 200, `dimmingSaturation` 2, `dimmingTintAlphaAtRest` 0.74, `dimmingTintAlphaAtFullTravel` 0.6.+- **Slider:** `sliderTrackWidth` 290, `sliderHeight` 66.67, `sliderCenterBottomInset` 55, `sliderThumbInset` 3.5, `sliderFontSize` 18.25, `sliderSymbolSizeRatio` 0.369, `sliderTitleLeadingAir` 19.7, `sliderTitleTrailingAir` 40.7, `sliderTrackOpacity` 0.1.++`[SBDeviceContinuousFoldInteractionDomain rootSettings]`, without the debug switches and the spring animation objects:++- **Transition:** `appTransitionStyle` 1, `alwaysUsesDirectTracking` YES, `directTrackingThreshold` 0.15, `continuousSnapshotTransitionAvailable` YES, `displayTarget` 0, `maximumFrameRate` 80, `foldWidth` 80, `cylinderWidthRatio` 0.245.+- **Inner:** `innerTiltAmount` 40, `innerPivotOffset` 10, `innerStretchAmount` 1.1, `innerStretchRampExponent` 1, `innerNonlinearScaleExponent` 4, `innerNonlinearScaleIntensity` 0.5, `innerConeTopMaxScale` 1.2, `innerConeBottomMaxScale` 0.4, `innerConeOpacity` 1, `innerCylinderOpacity` 0.644, `innerBlurMaxRadius` 120, `innerCloakFadeThresholdAngle` 15°, `innerDimRampStart` 0.5, `innerFadeToBlackStart` 0.167, `innerFadeToBlackEnd` 0.+- **Outer:** `outerTiltAmount` 20, `outerStretchAmount` 1.1, `outerStretchRampExponent` 1, `outerNonlinearScaleExponent` 4, `outerNonlinearScaleIntensity` 1, `outerConeTopMaxScale` 0.5, `outerConeBottomMaxScale` 0.2, `outerConeOpacity` 1, `outerCylinderOpacity` 0.644, `outerBlurMaxRadius` 50, `outerCloakFadeThresholdAngle` 90°, `outerDimRampEnd` 0.444, `outerFadeToBlackStart` 0.2, `outerFadeToBlackEnd` 0.5.+- **Prolonged dim:** inner active 45°→15°, outer active 90°→120°.+- **Seam dim:** `seamDimThresholdAngle` 135°, `seamDimWidth` 50.45, `seamDimBlurRadius` 6.56, `seamDimMaxOpacity` 0.35, `seamDimLinearMax` 0.3, `seamDimLinearIntensity` 1, `seamDimNonlinearExponent` 2.078, `seamDimNonlinearIntensity` 0.52, `isSeamDimHiddenOnVirtualDevices` YES, `isSeamDimExcludedFromCaptures` YES.+- **Backdrop and morph:** `backdropMinScale` 0.3, `backdropMaxScale` 1, `backdropScaleRadiusLow` 3.333, `backdropScaleRadiusHigh` 16.667, `isAdjustBackdropScaleEnabled` NO, `dimScale` 0.95, `morphMaxBlurRadius` 10, `morphUsesSharedAnimationSettings` YES.+- **Z-stack fades:** in 0.6→0.8, out 0.2→0.4.+- **Orientation lock:** `isOrientationLockSettleEnabled` YES, `orientationLockSettleDuration` 0.35 s.+- **Substitute content:** `substituteContentFillMode` 2, `substituteContentStaticFillColor` 1, `isInstantAppContentHidden` NO.+- **Effect switches:** `isBlurEffectEnabled`, `isConeDimEnabled`, `isCornerMaskEnabled`, `isCylinderDimEnabled`, `isDimmingEnabled`, `isFadeToBlackEnabled`, `isMorphBlurEnabled` and `isPerspectiveTransformEnabled` are all YES.++`isSeamDimHiddenOnVirtualDevices` YES is one of the places where SpringBoard+checks for a virtual device. On the VM, MobileGestalt `IsVirtualDevice` is YES,+so the seam dim stays hidden there.++## MobileGestalt: where the sim answers and the VM differs++SpringBoard asked for 557 keys while open. Compared with the VM, 233 differ:++- **143:** the simulator answers nil, while the VM answers from the real V68+ device tree. Most are camera, AOP, haptics, ALS, AOD vibrancy and display+ rotation keys. These are not alignment targets: the simulator has no such+ hardware.+- **34:** answered from the simulator's device-type plist, or synthetic. The+ baseline marks them with `sim_note` (table below).+- **56:** real disagreements, in the next table.++| key | sim | VM |+| --- | --- | --- |+| **Sim YES, VM NO** (candidates to align) | | |+| `DeviceSupportsAlwaysOnDisplay`, `…Flipbook`, `DeviceSupportsAlwaysOnTime` | YES | NO |+| `DeviceSupportsDCP` | YES | NO |+| `ambient-light-sensor` | YES | NO |+| `DeviceSupportsGenerativeModelSystems`, `generative-model-systems` | YES | NO |+| `DeviceSupportsHandwritingSynthesisModel`, `DeviceSupportsInstructionFollowingPruningModels`, `DeviceSupportsPhotosInpainting` | YES | NO |+| `ExclaveCapability`, `AudioExclaveMicInputCapability` | YES | NO |+| `DeviceSupportsFairPlaySecureVideoPath` | YES | NO |+| `AV1DecodingCapability` | YES | NO |+| `DevicePrefersProceduralAntiAliasing` | YES | NO |+| `ScreenRecorderCapability` | YES | NO |+| **Performance class** | | |+| `PerfLevelCapability` / `MetalPerfLevelCapability` / `ADSCapability` | 2 / 1 / 2 | 0 / 0 / 0 |+| `DeviceSupportsSiriUnderstandingOnDevice` | 3 | 4 |+| `DeviceLaunchTimeLimitScale` / `DeviceSceneUpdateTimeLimitScale` / `FirstPartyLaunchTimeLimitScale` | 0 / 0 / 0 | 1 / 1 / 1 |+| `LaunchTimeLimitScaleSupported` | NO | YES |+| **Identity and finish** | | |+| `HWModelStr`, `HWModelUniqueStr` | `iPhone19,4` | `V68AP` |+| `DeviceEnclosureColor` / `DeviceHousingColor` / `DeviceCoverGlassCoating` | `"1"` / 1 / 1 | `"unknown"` / 0 / 0 |+| `FrontCameraOffsetFromDisplayCenter` | [0, 109.77, 2.26] | [67.013, 7.341, 5.493] |+| **Display rendering** | | |+| `CoastlineGlowRenderingCapability`, `DeviceSupportsHDRPhotoDisplay`, `DeviceSupportsRGB10`, `DeviceSupportsToneMapping`, `RenderWideGamutImagesAtDisplayTime` | NO | YES |+| `IOSurfaceFormatDictionary`: the five `universal-*-buffer-compression` entries | differ | differ |+| **Sim NO, VM YES** (the simulator lacks the hardware) | | |+| Camera and media: `DeviceSupports4k`, `DeviceSupportsCameraHaptics`, `DeviceSupportsLiveVideoRendering`, `DeviceSupportsPortraitLightEffectFilters`, `H264EncoderCapability`, `PhotoCapability`, `ForwardCameraCapability`, `RearFacingCamera60fpsVideoCaptureCapability`, `MedusaPIPCapability` | NO | YES |+| Other hardware and services: `StarkCapability`, `WirelessChargingCapability`, `DeviceSupportsBatteryModuleAuthentication`, `DeviceSupportsCCK`, `DeviceSupportsCrudeProx`, `DeviceSupportsDoNotDisturbWhileDriving`, `DeviceSupportsELabel`, `DeviceSupportsFindApplePencil`, `DeviceSupportsLandscapeFaceID` | NO | YES |+| `WiFiCallingCapability`, `WifiCallingSecondaryDeviceCapability` | NO | nil |++Synthetic or device-type answers (sim → VM). Do not align to the sim side of these:++| key | sim | VM |+| --- | --- | --- |+| `ModelNumber` / `RegulatoryModelNumber` | `A3447` / `A3447` | `VM0001` / nil |+| `HWModelDescriptionFor{Analytics,Audio,AutomatedTesting,Camera,PowerPerf,UserVisibility}` | `J714sAP` | `V68AP` |+| `ProductTypeDescFor…` (same six) | `Mac17,9` (the host) | `iPhone19,4` |+| `HardwarePlatform` | `t6050` | `vresearch1` |+| `IsSimulator` / `IsVirtualDevice` | YES / NO | NO / YES |+| `DeviceMemorySize` | 64 GiB (the host) | 8 GiB |+| `ProductHash` | zeros | the V68 token |+| `device-name` | `iPhone Simulator` | `iPhone` |+| `main-screen-orientation` | nil | 0 |+| `HEVCDecoder{8,10,12}bitSupported`, `DeviceSupports3DImagery`, `DeviceSupports3DMaps` | YES | NO |+| `accelerometer`, `bluetooth-le`, `cellular-data`, `contains-cellular-radio`, `touch-id` | YES | NO |+| `ArtworkTraits`, `screen-dimensions`, `DisplayExtendedProperties` | differ in detail | see `BASELINE.md` |++Not checked here: which of the "Sim YES, VM NO" rows the VM turns off itself,+through `IsVirtualDevice`, `HardwarePlatform vresearch1` or missing hardware+nodes, and which a real V68 also answers NO. Look at the libMobileGestalt+answer function for each key before aligning one.++Also from the records: `MGCopyAnswerForDisplayAtIndex` returns nil in the+simulator for every camera and button rect query on all three display indexes.