Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono.Android] Bind Android 15 DP 2 #8741

Merged
merged 4 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v14.0</AndroidLatestStableFrameworkVersion>
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">34</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v14.0</AndroidLatestUnstableFrameworkVersion>
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">35</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">VanillaIceCream</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v14.0.99</AndroidLatestUnstableFrameworkVersion>
<!-- The default API level used for $(TargetPlatformVersion) -->
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">34</AndroidDefaultTargetDotnetApiLevel>
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidDefaultTargetDotnetApiLevel>
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>
Expand Down
3 changes: 1 addition & 2 deletions Documentation/workflow/HowToAddNewApiLevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ the new platform will be downloaded to your local Android SDK.
### Generate `params.txt` File

- In `/external/Java.Interop/tools/param-name-importer`:
- Add new level to `generate.sh` and run
- *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`
- 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`
- Copy the produced `api-X.params.txt` file to `/src/Mono.Android/Profiles/`

### Generate `api.xml` File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public sealed class CheckApiCompatibility : Task
{ "v12.1", "v12.0" },
{ "v13.0", "v12.1" },
{ "v14.0", "v13.0" },
{ "v14.0.99", "v14.0" },
};

static readonly string assemblyToValidate = "Mono.Android.dll";
Expand Down
3 changes: 2 additions & 1 deletion build-tools/api-merge/merge-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
<File Path="api-32.xml.in" Level="32" />
<File Path="api-33.xml.in" Level="33" />
<File Path="api-34.xml.in" Level="34" />
<File Path="api-VanillaIceCream.xml.in" Level="35" />
</Inputs>
<Outputs>
<File Path="api-34.xml" LastLevel="34" />
<File Path="api-VanillaIceCream.xml" LastLevel="35" />
</Outputs>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ stages:
avdAbi: x86
avdType: android-wear
deviceName: wear_square
androidSdkPlatforms: 34
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
Expand Down
2 changes: 1 addition & 1 deletion build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ variables:
- name: IsRelOrTargetingRel
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/'))]
- name: DefaultTestSdkPlatforms # Comma-separated SDK Platform(s) to install on test agents (no spaces)
value: 34
value: 34,VanillaIceCream
- name: ExcludedNightlyNUnitCategories
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
- name: RunMAUITestJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class BuildAndroidPlatforms
new AndroidPlatform (apiName: "Sv2", apiLevel: 32, platformID: "32", include: "v12.1"),
new AndroidPlatform (apiName: "Tiramisu", apiLevel: 33, platformID: "33", include: "v13.0", framework: "v13.0"),
new AndroidPlatform (apiName: "UpsideDownCake", apiLevel: 34, platformID: "34", include: "v14.0", framework: "v14.0"),
new AndroidPlatform (apiName: "VanillaIceCream", apiLevel: 35, platformID: "VanillaIceCream", include: "v14.0.99", framework: "v14.0.99", stable: false),
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public AndroidToolchain ()
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
new AndroidPlatformComponent ("platform-VanillaIceCream_r02", apiLevel: "VanillaIceCream", pkgRevision: "2", isLatestStable: true),

new AndroidToolchainComponent ("sources-34_r01",
destDir: Path.Combine ("sources", "android-34"),
Expand Down
45 changes: 45 additions & 0 deletions src/Mono.Android/Java.Util/IList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using Android.Runtime;

namespace Java.Util;

#if ANDROID_35
public partial interface IList
{
// This gets generated as:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment. Do you mean the body of n_Reversed()? If so, should the comment be moved there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

// return Android.Runtime.JavaList.FromJniHandle (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
// instead of:
// return global::Java.Lang.Object.GetObject<Java.Util.ISequencedCollection> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
private static Delegate? cb_reversed;

#pragma warning disable 0169
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
private static Delegate GetReversedHandler ()
{
if (cb_reversed == null)
cb_reversed = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Reversed));
return cb_reversed;
}

[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
private static IntPtr n_Reversed (IntPtr jnienv, IntPtr native__this)
{
var __this = global::Java.Lang.Object.GetObject<Java.Util.IList> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
return JNIEnv.ToLocalJniHandle (__this.Reversed ());
}
#pragma warning restore 0169

// Metadata.xml XPath method reference: path="/api/package[@name='java.util']/interface[@name='List']/method[@name='reversed' and count(parameter)=0]"
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
[Register ("reversed", "()Ljava/util/List;", "GetReversedHandler:Java.Util.IList, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince = 35)]
unsafe Java.Util.ISequencedCollection Java.Util.ISequencedCollection.Reversed ()
{
const string __id = "reversed.()Ljava/util/List;";
try {
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null);
return global::Java.Lang.Object.GetObject<Java.Util.ISequencedCollection> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
} finally {
}
}
}
#endif
45 changes: 45 additions & 0 deletions src/Mono.Android/Java.Util/ISortedMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using Android.Runtime;

namespace Java.Util;

#if ANDROID_35
public partial interface ISortedMap
{
// This gets generated as:
// return Android.Runtime.JavaDictionary.FromJniHandle (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
// instead of:
// return global::Java.Lang.Object.GetObject<Java.Util.ISequencedMap> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
private static Delegate? cb_reversed;

#pragma warning disable 0169
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
private static Delegate GetReversedHandler ()
{
if (cb_reversed == null)
cb_reversed = JNINativeWrapper.CreateDelegate (new _JniMarshal_PP_L (n_Reversed));
return cb_reversed;
}

[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
private static IntPtr n_Reversed (IntPtr jnienv, IntPtr native__this)
{
var __this = global::Java.Lang.Object.GetObject<Java.Util.ISortedMap> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
return JNIEnv.ToLocalJniHandle (__this.Reversed ());
}
#pragma warning restore 0169

// Metadata.xml XPath method reference: path="/api/package[@name='java.util']/interface[@name='SortedMap']/method[@name='reversed' and count(parameter)=0]"
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android35.0")]
[Register ("reversed", "()Ljava/util/SortedMap;", "GetReversedHandler:Java.Util.ISortedMap, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince = 35)]
unsafe Java.Util.ISequencedMap Java.Util.ISequencedMap.Reversed ()
{
const string __id = "reversed.()Ljava/util/SortedMap;";
try {
var __rm = _members.InstanceMethods.InvokeVirtualObjectMethod (__id, this, null);
return global::Java.Lang.Object.GetObject<Java.Util.ISequencedMap> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!;
} finally {
}
}
}
#endif
2 changes: 2 additions & 0 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
<Compile Include="Java.Time\ZonedDateTime.cs" />
<Compile Include="Java.Time\LocalDateTime.cs" />
<Compile Include="Java.Time\LocalDate.cs" />
<Compile Include="Java.Util\ISortedMap.cs" />
<Compile Include="Java.Util\IList.cs" />
</ItemGroup>

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