Skip to content

Commit 00256b6

Browse files
[Mono.Android] Bind API-VanillaIceCream Developer Preview 2 (#8741)
Context: https://developer.android.com/about/versions/15 Android 15 [Developer Preview 2][0] has been released: * [API diff vs. API-34][1] The Android 15 Developer Preview [Timeline and updates][2] section suggests the following timeline: * Feb/Mar: Developer Previews * April/May: Unstable Betas * June/July: Stable Betas with a [Platform Stability milestone][3] expected in Beta 3. * ???: Final This will be usable in its preview form to .NET 9 Preview users who explicitly target `net9.0-android35`. ~~ Acceptable Breakages ~~ `PublicApiAnalyzers` reports 3 categories of API changes within `PublicAPI.Shipped.txt`: - NRT attribute changes (`?` -> `!`) (Not an ABI break, and won't break existing source code.) - Method parameter name changes This is technically a source breaking change, but something we've never tracked or fixed before - Some methods went from `virtual` to `override` due to implementation being provided by base class. [0]: https://android-developers.googleblog.com/2024/03/the-second-developer-preview-of-android-15.html [1]: https://web.archive.org/web/20240401094044/https://developer.android.com/sdk/api_diff/v-dp2/changes [2]: https://web.archive.org/web/20240402055530/https://developer.android.com/about/versions/15/overview#timeline [3]: https://web.archive.org/web/20240402055530/https://developer.android.com/about/versions/15/overview#platform_stability Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
1 parent 0de3f30 commit 00256b6

File tree

19 files changed

+244761
-79
lines changed

19 files changed

+244761
-79
lines changed

Configuration.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
3030
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v14.0</AndroidLatestStableFrameworkVersion>
3131
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
32-
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">34</AndroidLatestUnstableApiLevel>
33-
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestUnstablePlatformId>
34-
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v14.0</AndroidLatestUnstableFrameworkVersion>
32+
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">35</AndroidLatestUnstableApiLevel>
33+
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">VanillaIceCream</AndroidLatestUnstablePlatformId>
34+
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v14.0.99</AndroidLatestUnstableFrameworkVersion>
3535
<!-- The default API level used for $(TargetPlatformVersion) -->
36-
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">34</AndroidDefaultTargetDotnetApiLevel>
36+
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidDefaultTargetDotnetApiLevel>
3737
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
3838
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
3939
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>

Documentation/workflow/HowToAddNewApiLevel.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ the new platform will be downloaded to your local Android SDK.
1919
### Generate `params.txt` File
2020

2121
- In `/external/Java.Interop/tools/param-name-importer`:
22-
- Add new level to `generate.sh` and run
23-
- *or* run manually: `param-name-importer.exe -source-stub-zip C:/Users/USERNAME/android-toolchain/sdk/platforms/android-S/android-stubs-src.jar -output-text api-S.params.txt -output-xml api-S.params.xml -verbose -framework-only`
22+
- Run: `dotnet run -source-stub-zip C:/Users/USERNAME/android-toolchain/platforms/android-35/android-stubs-src.jar -output-text api-35.params.txt -output-xml api-35.params.xml -verbose -framework-only`
2423
- Copy the produced `api-X.params.txt` file to `/src/Mono.Android/Profiles/`
2524

2625
### Generate `api.xml` File

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public sealed class CheckApiCompatibility : Task
3232
{ "v12.1", "v12.0" },
3333
{ "v13.0", "v12.1" },
3434
{ "v14.0", "v13.0" },
35+
{ "v14.0.99", "v14.0" },
3536
};
3637

3738
static readonly string assemblyToValidate = "Mono.Android.dll";

build-tools/api-merge/merge-configuration.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
<File Path="api-32.xml.in" Level="32" />
2424
<File Path="api-33.xml.in" Level="33" />
2525
<File Path="api-34.xml.in" Level="34" />
26+
<File Path="api-VanillaIceCream.xml.in" Level="35" />
2627
</Inputs>
2728
<Outputs>
28-
<File Path="api-34.xml" LastLevel="34" />
29+
<File Path="api-VanillaIceCream.xml" LastLevel="35" />
2930
</Outputs>
3031
</Configuration>

build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ stages:
8888
avdAbi: x86
8989
avdType: android-wear
9090
deviceName: wear_square
91-
androidSdkPlatforms: 34
9291
pool:
9392
name: Azure Pipelines
9493
vmImage: $(HostedMacImage)

build-tools/automation/yaml-templates/variables.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ variables:
5151
- name: IsRelOrTargetingRel
5252
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/'))]
5353
- name: DefaultTestSdkPlatforms # Comma-separated SDK Platform(s) to install on test agents (no spaces)
54-
value: 34
54+
value: 34,VanillaIceCream
5555
- name: ExcludedNightlyNUnitCategories
5656
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
5757
- name: RunMAUITestJob

build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class BuildAndroidPlatforms
4545
new AndroidPlatform (apiName: "Sv2", apiLevel: 32, platformID: "32", include: "v12.1"),
4646
new AndroidPlatform (apiName: "Tiramisu", apiLevel: 33, platformID: "33", include: "v13.0", framework: "v13.0"),
4747
new AndroidPlatform (apiName: "UpsideDownCake", apiLevel: 34, platformID: "34", include: "v14.0", framework: "v14.0"),
48+
new AndroidPlatform (apiName: "VanillaIceCream", apiLevel: 35, platformID: "VanillaIceCream", include: "v14.0.99", framework: "v14.0.99", stable: false),
4849
};
4950

5051
}

build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public AndroidToolchain ()
7171
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
7272
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
7373
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
74+
new AndroidPlatformComponent ("platform-VanillaIceCream_r02", apiLevel: "VanillaIceCream", pkgRevision: "2", isLatestStable: true),
7475

7576
new AndroidToolchainComponent ("sources-34_r01",
7677
destDir: Path.Combine ("sources", "android-34"),

src/Mono.Android/Java.Util/IList.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using Android.Runtime;
3+
4+
namespace Java.Util;
5+
6+
#if ANDROID_35
7+
public partial interface IList
8+
{
9+
private static Delegate? cb_reversed;
10+
11+
#pragma warning disable 0169
12+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
13+
private static Delegate GetReversedHandler ()
14+
{
15+
if (cb_reversed == null)
16+
cb_reversed = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Reversed));
17+
return cb_reversed;
18+
}
19+
20+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
21+
private static IntPtr n_Reversed (IntPtr jnienv, IntPtr native__this)
22+
{
23+
var __this = global::Java.Lang.Object.GetObject<Java.Util.IList> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
24+
return JNIEnv.ToLocalJniHandle (__this.Reversed ());
25+
}
26+
#pragma warning restore 0169
27+
28+
// This gets generated as:
29+
// return Android.Runtime.JavaList.FromJniHandle (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
30+
// instead of:
31+
// return global::Java.Lang.Object.GetObject<Java.Util.ISequencedCollection> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
32+
33+
// Metadata.xml XPath method reference: path="/api/package[@name='java.util']/interface[@name='List']/method[@name='reversed' and count(parameter)=0]"
34+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
35+
[Register ("reversed", "()Ljava/util/List;", "GetReversedHandler:Java.Util.IList, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince = 35)]
36+
unsafe Java.Util.ISequencedCollection Java.Util.ISequencedCollection.Reversed ()
37+
{
38+
const string __id = "reversed.()Ljava/util/List;";
39+
try {
40+
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null);
41+
return global::Java.Lang.Object.GetObject<Java.Util.ISequencedCollection> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
42+
} finally {
43+
}
44+
}
45+
}
46+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using Android.Runtime;
3+
4+
namespace Java.Util;
5+
6+
#if ANDROID_35
7+
public partial interface ISortedMap
8+
{
9+
private static Delegate? cb_reversed;
10+
11+
#pragma warning disable 0169
12+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
13+
private static Delegate GetReversedHandler ()
14+
{
15+
if (cb_reversed == null)
16+
cb_reversed = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Reversed));
17+
return cb_reversed;
18+
}
19+
20+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
21+
private static IntPtr n_Reversed (IntPtr jnienv, IntPtr native__this)
22+
{
23+
var __this = global::Java.Lang.Object.GetObject<Java.Util.ISortedMap> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
24+
return JNIEnv.ToLocalJniHandle (__this.Reversed ());
25+
}
26+
#pragma warning restore 0169
27+
28+
// This gets generated as:
29+
// return Android.Runtime.JavaDictionary.FromJniHandle (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
30+
// instead of:
31+
// return global::Java.Lang.Object.GetObject<Java.Util.ISequencedMap> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
32+
33+
// Metadata.xml XPath method reference: path="/api/package[@name='java.util']/interface[@name='SortedMap']/method[@name='reversed' and count(parameter)=0]"
34+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
35+
[Register ("reversed", "()Ljava/util/SortedMap;", "GetReversedHandler:Java.Util.ISortedMap, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince = 35)]
36+
unsafe Java.Util.ISequencedMap Java.Util.ISequencedMap.Reversed ()
37+
{
38+
const string __id = "reversed.()Ljava/util/SortedMap;";
39+
try {
40+
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null);
41+
return global::Java.Lang.Object.GetObject<Java.Util.ISequencedMap> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
42+
} finally {
43+
}
44+
}
45+
}
46+
#endif

src/Mono.Android/Mono.Android.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
<Compile Include="Java.Time\ZonedDateTime.cs" />
9898
<Compile Include="Java.Time\LocalDateTime.cs" />
9999
<Compile Include="Java.Time\LocalDate.cs" />
100+
<Compile Include="Java.Util\ISortedMap.cs" />
101+
<Compile Include="Java.Util\IList.cs" />
100102
</ItemGroup>
101103

102104
<Import Project="..\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('..\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />

0 commit comments

Comments
 (0)