Skip to content

Commit c57ca14

Browse files
authored
[Mono.Android] Bind and enumify API-35 (#9043)
Context: https://developer.android.com/about/versions/15 Context: https://android-developers.googleblog.com/2024/06/the-third-beta-of-android-15.html Context: https://github.com/xamarin/android-sdk-installer/commit/785c9f75240e4cf64c379a9db64bc70a9bb33a02 Android 15 Developer Preview 3 has been released. * [API diff vs. API-34][0] * [API diff vs. API-VanillaIceCream Beta 2][1] (c993dee) The Android 15 Developer Preview Program Overview [Timeline and updates][2] section suggests the following timeline: * Feb/Mar: Developer Previews * April/May: Unstable Betas * June/July: Stable Betas * ???: Final Additionally, enumify and mark API-35 as "stable", which changes `net9.0-android` to default to `net9.0-android35`. Notes: - The `Xamarin` component manifest is in the process of being updated to contain API-35 components; see also xamarin/android-sdk-installer@785c9f75. This change has not yet "flowed" to dotnet/android yet. Consequently, our existing `AndroidDependenciesTests.InstallAndroidDependenciesTest()` unit test fails. Update the test to have a `xamarin_manifest_needs_updating` toggle set to `true`; while `true` it asserts that the test fails. Once the `Xamarin` manifest update makes it to dotnet/android, this test will fail and it will need to toggled to `false` so that the normal checks occur. - The MAUI tests fail because 2 APIs that it uses have been marked as `[Obsolete]` in API-35: `Path.ComputeBounds(RectF, bool)` and `Window.SetStatusBarColor(Color)`. MAUI will need to change the API they use or suppress these "warnings as errors". - APICompat reports that several `[Android.Runtime.RequiresPermissionAttribute]` custom attributes have been removed. As we do not consume this attribute, it does not cause any API breakage. [0]: https://developer.android.com/sdk/api_diff/35/changes [1]: https://developer.android.com/sdk/api_diff/35-incr/changes [2]: https://developer.android.com/about/versions/15/overview
1 parent 35f41dc commit c57ca14

File tree

24 files changed

+3242
-327172
lines changed

24 files changed

+3242
-327172
lines changed

Configuration.Override.props.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
kept consistent with each other, lest Bad Things Happen™
77
-->
88
<!-- The default Android API level to bind in src/Mono.Android -->
9-
<AndroidApiLevel>34</AndroidApiLevel>
9+
<AndroidApiLevel>35</AndroidApiLevel>
1010
<!-- The Xamarin.Android $(TargetFrameworkVersion) value that corresponds to $(AndroidApiLevel) -->
11-
<AndroidFrameworkVersion>v14.0</AndroidFrameworkVersion>
11+
<AndroidFrameworkVersion>v15.0</AndroidFrameworkVersion>
1212
<!-- The default Android API "id" that corresponds to $(AndroidApiLevel) -->
13-
<AndroidPlatformId>34</AndroidPlatformId>
13+
<AndroidPlatformId>35</AndroidPlatformId>
1414

1515
<!--
1616
Colon-separated list of ABIs to build the mono JIT for.

Configuration.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<!-- The min API level supported by Microsoft.Android.Sdk -->
2626
<AndroidMinimumDotNetApiLevel Condition="'$(AndroidMinimumDotNetApiLevel)' == ''">21</AndroidMinimumDotNetApiLevel>
2727
<!-- *Latest* *stable* API level binding that we support; used when building src/Xamarin.Android.Build.Tasks -->
28-
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">34</AndroidLatestStableApiLevel>
28+
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">35</AndroidLatestStableApiLevel>
2929
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
30-
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v14.0</AndroidLatestStableFrameworkVersion>
30+
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v15.0</AndroidLatestStableFrameworkVersion>
3131
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
32-
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">35</AndroidLatestUnstableApiLevel>
33-
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">VanillaIceCream</AndroidLatestUnstablePlatformId>
34-
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v14.0.99</AndroidLatestUnstableFrameworkVersion>
32+
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestUnstableApiLevel>
33+
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">$(AndroidLatestStablePlatformId)</AndroidLatestUnstablePlatformId>
34+
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">$(AndroidLatestStableFrameworkVersion)</AndroidLatestUnstableFrameworkVersion>
3535
<!-- The default API level used for $(TargetPlatformVersion) -->
3636
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidDefaultTargetDotnetApiLevel>
3737
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Major/Minor match Android stable API level, such as 30.0 for API 30.
3636
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
3737
-->
38-
<AndroidPackVersion>34.99.0</AndroidPackVersion>
38+
<AndroidPackVersion>35.0.0</AndroidPackVersion>
3939
<AndroidPackVersionSuffix>preview.7</AndroidPackVersionSuffix>
4040
</PropertyGroup>
4141

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +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" },
35+
{ "v15.0", "v14.0" },
3636
};
3737

3838
static readonly string assemblyToValidate = "Mono.Android.dll";
@@ -70,7 +70,6 @@ public sealed class CheckApiCompatibility : Task
7070
public override bool Execute ()
7171
{
7272
Log.LogMessage (MessageImportance.High, $"CheckApiCompatibility for ApiLevel: {ApiLevel}");
73-
Log.LogWarning ($"# jonp: TargetFramework={TargetFramework}");
7473

7574
// Check to see if Api has a previous Api defined.
7675
if (!api_versions.TryGetValue (ApiLevel, out string previousApiLevel)) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +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" />
26+
<File Path="api-35.xml.in" Level="35" />
2727
</Inputs>
2828
<Outputs>
29-
<File Path="api-VanillaIceCream.xml" LastLevel="35" />
29+
<File Path="api-35.xml" LastLevel="35" />
3030
</Outputs>
3131
</Configuration>

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,VanillaIceCream
54+
value: 35
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +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),
48+
new AndroidPlatform (apiName: "VanillaIceCream", apiLevel: 35, platformID: "35", include: "v15.0", framework: "v15.0"),
4949
};
5050

5151
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public AndroidToolchain ()
7070
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
7171
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
7272
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
73-
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
74-
new AndroidPlatformComponent ("platform-VanillaIceCream_r04", apiLevel: "VanillaIceCream", pkgRevision: "4", isLatestStable: true),
73+
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2"),
74+
new AndroidPlatformComponent ("platform-35_r01", apiLevel: "35", pkgRevision: "1", isLatestStable: true),
7575

7676
new AndroidToolchainComponent ("sources-34_r01",
7777
destDir: Path.Combine ("sources", "android-34"),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Android.Runtime;
3+
4+
namespace Android.Net.Wifi.P2p
5+
{
6+
// This was converted to an enum in .NET 9
7+
partial class WifiP2pManager
8+
{
9+
// Metadata.xml XPath field reference: path="/api/package[@name='android.net.wifi.p2p']/class[@name='WifiP2pManager']/field[@name='WIFI_P2P_DISCOVERY_STARTED']"
10+
[Register ("WIFI_P2P_DISCOVERY_STARTED")]
11+
public const int WifiP2pDiscoveryStarted = (int) 2;
12+
13+
// Metadata.xml XPath field reference: path="/api/package[@name='android.net.wifi.p2p']/class[@name='WifiP2pManager']/field[@name='WIFI_P2P_DISCOVERY_STOPPED']"
14+
[Register ("WIFI_P2P_DISCOVERY_STOPPED")]
15+
public const int WifiP2pDiscoveryStopped = (int) 1;
16+
}
17+
}

src/Mono.Android/Mono.Android.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<Compile Include="Android.Icu\ListFormatter.cs" />
9292
<Compile Include="Android.Icu\RelativeDateTimeFormatter.cs" />
9393
<Compile Include="Android.Icu\DateIntervalFormat.cs" />
94+
<Compile Include="Android.Net.Wifi.P2p\WifiP2pManager.cs" />
9495
<Compile Include="Android.Runtime\DynamicMethodNameCounter.cs" />
9596
<Compile Include="Android.Runtime\IJavaObjectValueMarshaler.cs" />
9697
<Compile Include="Android.Telecom\InCallService.cs" />

0 commit comments

Comments
 (0)