Skip to content

Commit 4c2868a

Browse files
Remove redundant RequestedOrientation write in OnCreate that triggers SurfaceView recreate during Vulkan-init
Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/0e3fd697-aaa5-41a9-938f-942bcf040a08 Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent 181e6ad commit 4c2868a

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

osu.Android/OsuGameActivity.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,19 @@ public OsuGameActivity()
8383

8484
protected override void OnCreate(Bundle? savedInstanceState)
8585
{
86-
// Force orientation immediately to prevent unnecessary surface recreation on startup.
87-
RequestedOrientation = ScreenOrientation.Landscape;
86+
// NOTE: do NOT assign RequestedOrientation here. The `[Activity]` attribute on this
87+
// class already declares `ScreenOrientation = ScreenOrientation.Landscape`, so the
88+
// activity is created in landscape from the very first frame. A runtime re-assignment
89+
// *before* `base.OnCreate` (which is where SDL constructs the SurfaceView) gets
90+
// queued by Android and delivered exactly during initial SurfaceView setup, nudging
91+
// the SurfaceView into a destroy/recreate cycle on some OEMs while the SDL draw
92+
// thread is mid-Vulkan-init. The framework's `VeldridDevice` then either times out
93+
// its 5s `SurfaceHandle` poll (constructor throws, renderer never comes up) or hands
94+
// a stale handle to `vkCreateAndroidSurfaceKHR` (driver SIGSEGV) — either way the
95+
// game never renders a frame and the user is left staring at a black screen while
96+
// the per-frame retry / FirstChanceException pipeline floods the log. The same
97+
// invariant is documented further down in this method (see the "Phones: manifest
98+
// already requests Landscape; do not re-assign at runtime" block).
8899

89100
// Crash diagnostics first. The native handler write target is internal storage
90101
// (FilesDir/native_crash.log); a one-shot mirror copies it to external storage

0 commit comments

Comments
 (0)