@@ -27,7 +27,7 @@ namespace osu.Android
2727 // frame — the SurfaceView is sized correctly on creation and there is no orientation-change
2828 // event during startup. This is defensive hardening alongside the main fix in osu.Android.props
2929 // (disabling trimming + profiled AOT, which was the actual cause of the startup crash).
30- [ Activity ( ResizeableActivity = true , ScreenOrientation = ScreenOrientation . SensorLandscape , ConfigurationChanges = ConfigChanges . Orientation | ConfigChanges . ScreenSize | ConfigChanges . UiMode | ConfigChanges . SmallestScreenSize | ConfigChanges . ScreenLayout | ConfigChanges . ColorMode | ConfigChanges . Density | ConfigChanges . Touchscreen | ConfigChanges . Keyboard | ConfigChanges . KeyboardHidden | ConfigChanges . Navigation , Exported = true , LaunchMode = DEFAULT_LAUNCH_MODE , MainLauncher = true ) ]
30+ [ Activity ( ResizeableActivity = true , ScreenOrientation = ScreenOrientation . Landscape , ConfigurationChanges = ConfigChanges . Orientation | ConfigChanges . ScreenSize | ConfigChanges . UiMode | ConfigChanges . SmallestScreenSize | ConfigChanges . ScreenLayout | ConfigChanges . ColorMode | ConfigChanges . Density | ConfigChanges . Touchscreen | ConfigChanges . Keyboard | ConfigChanges . KeyboardHidden | ConfigChanges . Navigation , Exported = true , LaunchMode = DEFAULT_LAUNCH_MODE , MainLauncher = true ) ]
3131 [ IntentFilter ( new [ ] { Intent . ActionView } , Categories = new [ ] { Intent . CategoryDefault } , DataScheme = "content" , DataPathPattern = ".*\\ .osz" , DataHost = "*" , DataMimeType = "*/*" ) ]
3232 [ IntentFilter ( new [ ] { Intent . ActionView } , Categories = new [ ] { Intent . CategoryDefault } , DataScheme = "content" , DataPathPattern = ".*\\ .osk" , DataHost = "*" , DataMimeType = "*/*" ) ]
3333 [ IntentFilter ( new [ ] { Intent . ActionView } , Categories = new [ ] { Intent . CategoryDefault } , DataScheme = "content" , DataPathPattern = ".*\\ .osr" , DataHost = "*" , DataMimeType = "*/*" ) ]
@@ -83,6 +83,9 @@ 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 ;
88+
8689 // Crash diagnostics first. The native handler write target is internal storage
8790 // (FilesDir/native_crash.log); a one-shot mirror copies it to external storage
8891 // here on the *next* normal startup so the user can pull it without root.
@@ -166,7 +169,7 @@ protected override void OnCreate(Bundle? savedInstanceState)
166169 if ( Resources ? . Configuration != null )
167170 IsTablet = Resources . Configuration . SmallestScreenWidthDp >= 600 ;
168171
169- // Phones: manifest already requests SensorLandscape ; do not re-assign at runtime —
172+ // Phones: manifest already requests Landscape ; do not re-assign at runtime —
170173 // a no-op assignment is harmless on most devices but a redundant RequestedOrientation
171174 // write can still nudge the SurfaceView into a recreate cycle on some OEMs while the
172175 // SDL draw thread is mid-Vulkan-init. Tablets get a more permissive policy applied
@@ -175,7 +178,7 @@ protected override void OnCreate(Bundle? savedInstanceState)
175178 if ( IsTablet )
176179 RequestedOrientation = DefaultOrientation = ScreenOrientation . FullUser ;
177180 else
178- DefaultOrientation = ScreenOrientation . SensorLandscape ;
181+ DefaultOrientation = ScreenOrientation . Landscape ;
179182
180183 foreach ( string asm in new [ ] { "osu.Game.Rulesets.Osu" , "osu.Game.Rulesets.Taiko" , "osu.Game.Rulesets.Catch" , "osu.Game.Rulesets.Mania" } )
181184 {
@@ -397,13 +400,22 @@ public void SurfaceCreated(ISurfaceHolder holder)
397400 if ( oldRef != IntPtr . Zero )
398401 global ::Android . Runtime . JNIEnv . DeleteGlobalRef ( oldRef ) ;
399402
400- surfaceEvent . Set ( ) ;
401- Debug . WriteLine ( "[osu!] Native surface JNI global reference created" ) ;
403+ Debug . WriteLine ( "[osu!] Native surface JNI global reference created (waiting for SurfaceChanged for signal)" ) ;
402404 }
403405 }
404406
405407 public void SurfaceChanged ( ISurfaceHolder holder , global ::Android . Graphics . Format format , int width , int height )
406408 {
409+ if ( width > 0 && height > 0 )
410+ {
411+ surfaceEvent . Set ( ) ;
412+ Debug . WriteLine ( $ "[osu!] Native surface signal set (size: { width } x{ height } )") ;
413+ }
414+ else
415+ {
416+ surfaceEvent . Reset ( ) ;
417+ Debug . WriteLine ( "[osu!] Native surface signal reset (invalid size)" ) ;
418+ }
407419 }
408420
409421 public void SurfaceDestroyed ( ISurfaceHolder holder )
0 commit comments