Skip to content

Commit 9044de3

Browse files
authored
Merge pull request #196 from winnerspiros/android-cert-parse-fix-revert-sdk35-7003829841748354868
Fix Android APK certificate collection failure
2 parents 4b7e6f6 + e5caf31 commit 9044de3

10 files changed

Lines changed: 47 additions & 11 deletions

File tree

build/PatchElfPageSize.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,6 @@ finally
269269
<ItemGroup>
270270
<_NuGetNativeLibs Include="$(NuGetPackageRoot)/**/runtimes/android-*/native/*.so" />
271271
</ItemGroup>
272-
<PatchElfPageSize FilePath="%(Identity)" Condition="'@(_NuGetNativeLibs)' != ''" />
272+
<PatchElfPageSize FilePath="%(Identity)" Condition="'$(PatchElfPageSizeEnabled)' != 'false' AND '@(_NuGetNativeLibs)' != ''" />
273273
</Target>
274274
</Project>

osu.Android.props

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,33 @@
1313
the patch in some build orderings. This suppression is harmless since we do fix them. -->
1414
<AndroidPageSize16KBCompatibilityCheck>false</AndroidPageSize16KBCompatibilityCheck>
1515
</PropertyGroup>
16+
1617
<!-- Patch NuGet-provided .so files that ship with 4 KB ELF alignment to 16 KB.
1718
See build/PatchElfPageSize.targets for details.
1819
TODO: Remove once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries. -->
1920
<Import Project="$(MSBuildThisFileDirectory)build\PatchElfPageSize.targets" />
21+
2022
<!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK.
2123
Suppress trim analysis warnings because the project uses reflection extensively
2224
(Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). -->
2325
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
2426
<RunAOTCompilation>true</RunAOTCompilation>
2527
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
2628
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
29+
<!-- Disable ELF patching in Release to prevent signature corruption -->
30+
<PatchElfPageSizeEnabled>false</PatchElfPageSizeEnabled>
31+
<PublishTrimmed>true</PublishTrimmed>
32+
<TrimMode>partial</TrimMode>
2733
</PropertyGroup>
34+
35+
<ItemGroup Condition="'$(Configuration)' == 'Release'">
36+
<!-- Force Microsoft.CSharp into the trimmer input graph (.NET 10+). -->
37+
<!-- A bare TrimmerRootAssembly is ignored if the assembly is not in the -->
38+
<!-- linker's input set; adding this reference ensures it is included. -->
39+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" NoWarn="NU1510" />
40+
<TrimmerRootAssembly Include="Microsoft.CSharp" RootMode="all" />
41+
</ItemGroup>
42+
2843
<ItemGroup>
2944
<!-- IMPORTANT: ppy.osu.Framework.Android v2026.318.0 only ships net8.0-android34.0 assets.
3045
NuGet silently falls back to those assets when the app targets net10.0-android (API 36).
@@ -33,9 +48,23 @@
3348
TODO: Remove this comment once ppy.osu.Framework.Android ships net10.0-android assets. -->
3449
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.318.0" />
3550
</ItemGroup>
51+
3652
<PropertyGroup>
3753
<!-- Fody does not handle Android build well, and warns when unchanged.
3854
Since Realm objects are not declared directly in Android projects, simply disable Fody. -->
3955
<DisableFody>true</DisableFody>
4056
</PropertyGroup>
57+
58+
<!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack.
59+
This is critical for Android 16 (API 36) which has stricter manifest/parsing rules. -->
60+
<Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish;ComputeResolvedFilesToPublishList">
61+
<ItemGroup>
62+
<RuntimePackAsset Update="@(RuntimePackAsset)" Condition="'%(Extension)' != '.dll'">
63+
<AssetType>native</AssetType>
64+
</RuntimePackAsset>
65+
<ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(Extension)' != '.dll'">
66+
<AssetType>native</AssetType>
67+
</ResolvedFileToPublish>
68+
</ItemGroup>
69+
</Target>
4170
</Project>

osu.Android/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version='1.0' encoding='utf-8'?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sh.ppy.osulazer" android:installLocation="auto">
33
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
4-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher" android:largeHeap="true">
4+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher" android:largeHeap="true">
55
<provider android:name="androidx.core.content.FileProvider" android:authorities="sh.ppy.osulazer.fileprovider" android:grantUriPermissions="true" android:exported="false">
66
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" />
77
</provider>

osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<!-- using a different name because package name cannot contain 'catch' -->
33
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Catch_Tests.Android" android:installLocation="auto">
44
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
5-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!catch Test" />
5+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!catch Test" />
66
</manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Mania.Tests.Android" android:installLocation="auto">
33
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
4-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!mania Test" />
4+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!mania Test" />
55
</manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Osu.Tests.Android" android:installLocation="auto">
33
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
4-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!standard Test" />
4+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!standard Test" />
55
</manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Taiko.Tests.Android" android:installLocation="auto">
33
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
4-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!taiko Test" />
4+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!taiko Test" />
55
</manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Tests.Android" android:installLocation="auto">
33
<uses-sdk android:minSdkVersion="33" android:targetSdkVersion="36" />
4-
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!visual Test" />
4+
<application android:extractNativeLibs="true" android:allowBackup="true" android:supportsRtl="true" android:label="osu!visual Test" />
55
</manifest>

osu.Game/Online/Spectator/SpectatorClient.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ public void BeginPlaying(long? scoreToken, GameplayState state, Score score)
214214
Schedule(() =>
215215
{
216216
if (isPlaying)
217-
throw new InvalidOperationException($"Cannot invoke {nameof(BeginPlaying)} when already playing");
218-
217+
{
218+
Logger.Log($"Cannot invoke {nameof(BeginPlaying)} when already playing. Ignoring.");
219+
return;
220+
}
219221
isPlaying = true;
220222

221223
// transfer state at point of beginning play

osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ public async Task SendUserMatchRequest(int userId, MatchUserRequest request)
432432
break;
433433

434434
case StopCountdownRequest stopCountdown:
435-
await StopCountdown(ServerRoom.ActiveCountdowns.First(c => c.ID == stopCountdown.ID)).ConfigureAwait(false);
435+
var countdownToRemove = ServerRoom.ActiveCountdowns.FirstOrDefault(c => c.ID == stopCountdown.ID);
436+
if (countdownToRemove != null)
437+
await StopCountdown(countdownToRemove).ConfigureAwait(false);
436438
break;
437439

438440
case RollRequest rollRequest:
@@ -487,7 +489,10 @@ public async Task StopCountdown(MultiplayerCountdown countdown)
487489
Debug.Assert(ServerRoom != null);
488490
Debug.Assert(LocalUser != null);
489491

490-
ServerRoom.ActiveCountdowns.Remove(ServerRoom.ActiveCountdowns.First(c => c.ID == countdown.ID));
492+
var existing = ServerRoom.ActiveCountdowns.FirstOrDefault(c => c.ID == countdown.ID);
493+
494+
if (existing != null)
495+
ServerRoom.ActiveCountdowns.Remove(existing);
491496
await ((IMultiplayerClient)this).MatchEvent(clone(new CountdownStoppedEvent(countdown.ID))).ConfigureAwait(false);
492497
}
493498

0 commit comments

Comments
 (0)