Skip to content

iOS: tell UIKit when unlockOrientation() changes the supported mask (#6089) - #6093

Merged
shai-almog merged 2 commits into
masterfrom
ios-unlock-orientation-refresh-6089
Oct 24, 2026
Merged

shai-almog merged 2 commits into
masterfrom
ios-unlock-orientation-refresh-6089

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Fixes #6089.

unlockOrientation() only reset orientationLock. Since iOS 16 UIKit caches the root controller's supportedInterfaceOrientations and re-reads it only when asked, so after a lock (here, one held across the native camera as a workaround for #6080) autorotation stayed off until the app was restarted.

Fix

On the main queue, unlock now calls setNeedsUpdateOfSupportedInterfaceOrientations on the root controller. When no native modal is presented, it also asks the window scene to rotate to the physical device orientation, provided both the controller and the app allow it. Before iOS 16 it calls attemptRotationToDeviceOrientation. While a modal is up, only the invalidation is sent: the modal owns the orientation, and UIKit re-reads the root mask when the modal is dismissed.

Test

No automated test. A simulator can't physically rotate after an unlock, so the existing NativeModalRotationTest path can't observe this. It needs a check on a physical device using the reproducer attached to #6089.

🤖 Generated with Claude Code

shai-almog and others added 2 commits October 24, 2026 06:10
…6089)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
  • ✅ PMD: 0 findings (no issues) [Report archive]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 176 screenshots: 176 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 1898 seconds

Build and Run Timing

Metric Duration
Simulator Boot 89000 ms
Simulator Boot (Run) 1000 ms
App Install 17000 ms
App Launch 3000 ms
Test Execution 447000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 363ms / native 6ms = 60.5x speedup
SIMD float-mul (64K x300) java 97ms / native 6ms = 16.1x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 79.000 ms
Base64 CN1 decode 76.000 ms
Base64 native encode 1676.000 ms
Base64 encode ratio (CN1/native) 0.047x (95.3% faster)
Base64 native decode 1240.000 ms
Base64 decode ratio (CN1/native) 0.061x (93.9% faster)
Base64 SIMD encode 121.000 ms
Base64 encode ratio (SIMD/CN1) 1.532x (53.2% slower)
Base64 SIMD decode 68.000 ms
Base64 decode ratio (SIMD/CN1) 0.895x (10.5% faster)
Base64 encode ratio (SIMD/native) 0.072x (92.8% faster)
Base64 decode ratio (SIMD/native) 0.055x (94.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 7.000 ms
Image createMask (SIMD on) 3.000 ms
Image createMask ratio (SIMD on/off) 0.429x (57.1% faster)
Image applyMask (SIMD off) 36.000 ms
Image applyMask (SIMD on) 34.000 ms
Image applyMask ratio (SIMD on/off) 0.944x (5.6% faster)
Image modifyAlpha (SIMD off) 73.000 ms
Image modifyAlpha (SIMD on) 69.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.945x (5.5% faster)
Image modifyAlpha removeColor (SIMD off) 47.000 ms
Image modifyAlpha removeColor (SIMD on) 39.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.830x (17.0% faster)

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 236 screenshots: 236 matched.
✅ Native Apple Watch (watchOS, Core Graphics) screenshot tests passed.

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 175 screenshots: 175 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 599 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 58ms / native 3ms = 19.3x speedup
SIMD float-mul (64K x300) java 57ms / native 3ms = 19.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 56.000 ms
Base64 CN1 decode 56.000 ms
Base64 native encode 876.000 ms
Base64 encode ratio (CN1/native) 0.064x (93.6% faster)
Base64 native decode 294.000 ms
Base64 decode ratio (CN1/native) 0.190x (81.0% faster)
Base64 SIMD encode 64.000 ms
Base64 encode ratio (SIMD/CN1) 1.143x (14.3% slower)
Base64 SIMD decode 47.000 ms
Base64 decode ratio (SIMD/CN1) 0.839x (16.1% faster)
Base64 encode ratio (SIMD/native) 0.073x (92.7% faster)
Base64 decode ratio (SIMD/native) 0.160x (84.0% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 13.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.154x (84.6% faster)
Image applyMask (SIMD off) 55.000 ms
Image applyMask (SIMD on) 62.000 ms
Image applyMask ratio (SIMD on/off) 1.127x (12.7% slower)
Image modifyAlpha (SIMD off) 58.000 ms
Image modifyAlpha (SIMD on) 55.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.948x (5.2% faster)
Image modifyAlpha removeColor (SIMD off) 79.000 ms
Image modifyAlpha removeColor (SIMD on) 109.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.380x (38.0% slower)

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 171 screenshots: 171 matched.
✅ Native Apple TV (tvOS, Metal) screenshot tests passed.

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 176 screenshots: 176 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 1625 seconds

Build and Run Timing

Metric Duration
Simulator Boot 87000 ms
Simulator Boot (Run) 0 ms
App Install 12000 ms
App Launch 1000 ms
Test Execution 425000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 205ms / native 4ms = 51.2x speedup
SIMD float-mul (64K x300) java 136ms / native 6ms = 22.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 86.000 ms
Base64 CN1 decode 130.000 ms
Base64 native encode 440.000 ms
Base64 encode ratio (CN1/native) 0.195x (80.5% faster)
Base64 native decode 469.000 ms
Base64 decode ratio (CN1/native) 0.277x (72.3% faster)
Base64 SIMD encode 124.000 ms
Base64 encode ratio (SIMD/CN1) 1.442x (44.2% slower)
Base64 SIMD decode 68.000 ms
Base64 decode ratio (SIMD/CN1) 0.523x (47.7% faster)
Base64 encode ratio (SIMD/native) 0.282x (71.8% faster)
Base64 decode ratio (SIMD/native) 0.145x (85.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 39.000 ms
Image createMask (SIMD on) 12.000 ms
Image createMask ratio (SIMD on/off) 0.308x (69.2% faster)
Image applyMask (SIMD off) 73.000 ms
Image applyMask (SIMD on) 59.000 ms
Image applyMask ratio (SIMD on/off) 0.808x (19.2% faster)
Image modifyAlpha (SIMD off) 266.000 ms
Image modifyAlpha (SIMD on) 54.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.203x (79.7% faster)
Image modifyAlpha removeColor (SIMD off) 118.000 ms
Image modifyAlpha removeColor (SIMD on) 70.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.593x (40.7% faster)

@shai-almog

shai-almog commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 179 screenshots: 179 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 345 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 69ms / native 3ms = 23.0x speedup
SIMD float-mul (64K x300) java 59ms / native 3ms = 19.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 56.000 ms
Base64 CN1 decode 54.000 ms
Image encode benchmark iterations 100
Image createMask (SIMD off) 6.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.667x (33.3% faster)
Image applyMask (SIMD off) 52.000 ms
Image applyMask (SIMD on) 48.000 ms
Image applyMask ratio (SIMD on/off) 0.923x (7.7% faster)
Image modifyAlpha (SIMD off) 48.000 ms
Image modifyAlpha (SIMD on) 61.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.271x (27.1% slower)
Image modifyAlpha removeColor (SIMD off) 83.000 ms
Image modifyAlpha removeColor (SIMD on) 75.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.904x (9.6% faster)

ParparVM vs HotSpot (JDK 25): macOS arm64

Runner CPU: Apple M1 (Virtual) (baseline macos-arm64)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (HelloCodenameOne) 3 0.90x (base 0.96x, -6.1%) 0.91x (base 0.93x, -1.8%) ok
translator (self) 3 0.65x (base 0.62x, +3.9%) 0.74x (base 0.58x, +28.4%) ok
intArithmetic 3 1.04x (base 1.03x, +0.5%) 0.12x (base 0.12x, +1.1%) ok
longArithmetic 3 1.03x (base 1.03x, +0.7%) 0.12x (base 0.07x, +64.9%) ok
mathTranscendental 3 0.96x (base 1.01x, -4.2%) 0.12x (base 0.12x, +1.7%) ok
arraySequential 3 0.45x (base 0.42x, +6.6%) 0.53x (base 0.53x, +0.6%) ok
arrayRandom 3 0.99x (base 0.99x, -0.1%) 0.32x (base 0.32x, -0.0%) ok
objectAllocation 3 1.12x (base 1.11x, +1.3%) 0.83x (base 0.72x, +14.3%) ok
valueEscape 3 0.51x (base 0.51x, -0.0%) 0.09x (base 0.09x, +0.4%) ok
hashMapChurn 3 1.08x (base 1.18x, -7.8%) 0.07x (base 0.07x, +10.0%) ok
stringBuilding 3 0.97x (base 0.84x, +15.6%) 0.47x (base 0.46x, +0.8%) ok
recursion 3 1.22x (base 1.24x, -0.8%) 0.12x (base 0.12x, +1.7%) ok
quicksort 3 0.99x (base 1.01x, -2.6%) 0.11x (base 0.11x, +1.5%) ok

Result: no regression

@shai-almog
shai-almog merged commit 281010f into master Oct 24, 2026
37 checks passed
@shai-almog
shai-almog deleted the ios-unlock-orientation-refresh-6089 branch October 24, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Display.unlockOrientation() does not restore autorotation after camera capture until UIKit orientation state is refreshed

1 participant