@@ -27,28 +27,34 @@ public partial class OsuGameAndroid : OsuGame
2727 [ Cached ]
2828 private readonly OsuGameActivity gameActivity ;
2929
30+ private readonly object packageInfoLock = new object ( ) ;
3031 private PackageInfo ? packageInfo ;
3132 private bool packageInfoChecked ;
3233
3334 private PackageInfo ? getPackageInfo ( )
3435 {
35- if ( packageInfoChecked )
36- return packageInfo ;
37-
38- try
39- {
40- packageInfo = gameActivity . PackageManager ? . GetPackageInfo ( gameActivity . PackageName ! , 0 ) ;
41- }
42- catch ( Exception e )
36+ lock ( packageInfoLock )
4337 {
44- Debug . WriteLine ( $ "[osu!] Failed to retrieve package info: { e . Message } ") ;
45- }
46- finally
47- {
48- packageInfoChecked = true ;
49- }
38+ if ( packageInfoChecked )
39+ return packageInfo ;
5040
51- return packageInfo ;
41+ try
42+ {
43+ // Use the activity instance directly instead of Application.Context to ensure
44+ // the PackageManager is accessible even on newer/stricter Android versions.
45+ packageInfo = gameActivity . PackageManager ? . GetPackageInfo ( gameActivity . PackageName ! , 0 ) ;
46+ }
47+ catch ( Exception e )
48+ {
49+ Debug . WriteLine ( $ "[osu!] Failed to retrieve package info: { e . Message } ") ;
50+ }
51+ finally
52+ {
53+ packageInfoChecked = true ;
54+ }
55+
56+ return packageInfo ;
57+ }
5258 }
5359
5460 public override Vector2 ScalingContainerTargetDrawSize => DrawWidth > 0 && DrawHeight > 0
@@ -109,12 +115,12 @@ public override Version AssemblyVersion
109115 }
110116
111117 [ BackgroundDependencyLoader ]
112- private void load ( OsuConfigManager config )
118+ private void load ( )
113119 {
114- config . BindWith ( OsuSetting . AndroidPerformanceMode , performanceMode ) ;
115- config . BindWith ( OsuSetting . AndroidLowLatencyAudio , lowLatencyAudio ) ;
116- config . BindWith ( OsuSetting . AndroidVulkanProbe , vulkanProbeEnabled ) ;
117- config . BindWith ( OsuSetting . AudioOffset , audioOffset ) ;
120+ LocalConfig . BindWith ( OsuSetting . AndroidPerformanceMode , performanceMode ) ;
121+ LocalConfig . BindWith ( OsuSetting . AndroidLowLatencyAudio , lowLatencyAudio ) ;
122+ LocalConfig . BindWith ( OsuSetting . AndroidVulkanProbe , vulkanProbeEnabled ) ;
123+ LocalConfig . BindWith ( OsuSetting . AudioOffset , audioOffset ) ;
118124 }
119125
120126 protected override void LoadComplete ( )
0 commit comments