Skip to content

Commit ef01121

Browse files
authored
[Mono.Android] Bind API-Sv2 Developer Preview 1 (#6452)
Context: https://developer.android.com/about/versions/12/12L Context: https://android-developers.googleblog.com/2021/10/12L-preview-large-screens.html Android 12L [Developer Preview 1 has been released][0]. * [API diff vs. API-31][1] The Android 12L Developer Preview Program Overview [Timeline, milestones, and updates][2] section suggests the following timeline: * October: Developer Preview 1 * December: Beta 1 * January: Beta 2 (Final APIs) * February: Beta 3 * Q1 2022: Final Release [0]: https://android-developers.googleblog.com/2021/10/12L-preview-large-screens.html [1]: https://developer.android.com/sdk/api_diff/sv2-dp1/changes [2]: https://web.archive.org/web/20211101144209/https://developer.android.com/about/versions/12/12L/overview
1 parent 0df457a commit ef01121

File tree

10 files changed

+34444
-27
lines changed

10 files changed

+34444
-27
lines changed

Diff for: build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public sealed class CheckApiCompatibility : Task
2929
{ "v10.0", "v9.0" },
3030
{ "v11.0", "v10.0" },
3131
{ "v12.0", "v11.0" },
32+
{ "v12.0.99", "v12.0" },
3233
};
3334

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

Diff for: build-tools/api-merge/merge-configuration.xml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<File Path="api-29.xml.in" Level="29" />
2121
<File Path="api-30.xml.in" Level="30" />
2222
<File Path="api-31.xml.in" Level="31" />
23+
<File Path="api-Sv2.xml.in" Level="Sv2" />
2324
</Inputs>
2425
<Outputs>
2526
<File Path="android-19\mcw\api.xml" LastLevel="19" />
@@ -35,5 +36,6 @@
3536
<File Path="android-29\mcw\api.xml" LastLevel="29" />
3637
<File Path="android-30\mcw\api.xml" LastLevel="30" />
3738
<File Path="android-31\mcw\api.xml" LastLevel="31" />
39+
<File Path="android-Sv2\mcw\api.xml" LastLevel="Sv2" />
3840
</Outputs>
3941
</Configuration>

Diff for: build-tools/api-xml-adjuster/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
1717
RUNTIME = mono --debug
1818
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
1919
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
20-
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
20+
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Sv2
2121

2222
XML_OUTPUT_DIR = .
2323

Diff for: build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class BuildAndroidPlatforms
4040
new AndroidPlatform (apiName: "Q", apiLevel: 29, platformID: "29", include: "v10.0", framework: "v10.0"),
4141
new AndroidPlatform (apiName: "R", apiLevel: 30, platformID: "30", include: "v11.0", framework: "v11.0"),
4242
new AndroidPlatform (apiName: "S", apiLevel: 31, platformID: "31", include: "v12.0", framework: "v12.0"),
43+
new AndroidPlatform (apiName: "Sv2", apiLevel: 32, platformID: "Sv2", include: "v12.0.99",framework: "v12.0.99", stable: false),
4344
};
4445

4546
// These are here until we can drop "legacy" targets and use only .NET6+

Diff for: build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public AndroidToolchain ()
6262
new AndroidPlatformComponent ("platform-28_r04", apiLevel: "28", pkgRevision: "4"),
6363
new AndroidPlatformComponent ("platform-29_r01", apiLevel: "29", pkgRevision: "1"),
6464
new AndroidPlatformComponent ("platform-30_r01", apiLevel: "30", pkgRevision: "1"),
65-
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
65+
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
66+
new AndroidPlatformComponent ("platform-Sv2_r01", apiLevel: "Sv2", pkgRevision: "1"),
6667

6768
new AndroidToolchainComponent ("sources-31_r01", destDir: Path.Combine ("platforms", $"android-31", "src"), pkgRevision: "1", dependencyType: AndroidToolchainComponentType.BuildDependency),
6869

Diff for: src/Mono.Android/Profiles/api-Sv2.params.txt

+34,416
Large diffs are not rendered by default.

Diff for: src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

-7
Original file line numberDiff line numberDiff line change
@@ -2343,13 +2343,6 @@ public class MainActivity : Activity
23432343
int maxApiLevel = AndroidSdkResolver.GetMaxInstalledPlatform ();
23442344
string apiLevel;
23452345
proj.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);
2346-
2347-
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
2348-
if (Builder.UseDotNet && apiLevel == "31") {
2349-
apiLevel = "30";
2350-
proj.TargetFrameworkVersion = "v11.0";
2351-
}
2352-
23532346
if (int.TryParse (apiLevel, out int a) && a < maxApiLevel)
23542347
disabledIssues += ",OldTargetApi";
23552348
proj.SetProperty ("AndroidLintDisabledIssues", disabledIssues);

Diff for: src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs

+5
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ public string LatestTargetFrameworkVersion () {
172172

173173
public string LatestTargetFrameworkVersion (out string apiLevel) {
174174
GetTargetFrameworkVersionRange (out string _, out string _, out apiLevel, out string lastFrameworkVersion, out string [] _);
175+
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
176+
if (UseDotNet && apiLevel == "32") {
177+
apiLevel = "31";
178+
return "v12.0";
179+
}
175180
return lastFrameworkVersion;
176181
}
177182

Diff for: tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs

-18
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ public void BeforeDeploymentTests ()
5252
string apiLevel;
5353
proj.TargetFrameworkVersion = builder.LatestTargetFrameworkVersion (out apiLevel);
5454

55-
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
56-
if (Builder.UseDotNet && apiLevel == "31") {
57-
apiLevel = "30";
58-
proj.TargetFrameworkVersion = "v11.0";
59-
}
60-
6155
proj.PackageName = "Xamarin.TimeZoneTest";
6256
proj.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
6357
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""Xamarin.TimeZoneTest"">
@@ -125,12 +119,6 @@ public void CheckResouceIsOverridden ([Values (true, false)] bool useAapt2)
125119
string apiLevel;
126120
app.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);
127121

128-
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
129-
if (Builder.UseDotNet && apiLevel == "31") {
130-
apiLevel = "30";
131-
app.TargetFrameworkVersion = "v11.0";
132-
}
133-
134122
app.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
135123
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""{app.PackageName}"">
136124
<uses-sdk android:minSdkVersion=""24"" android:targetSdkVersion=""{apiLevel}"" />
@@ -166,12 +154,6 @@ public void CheckResouceIsOverridden ([Values (true, false)] bool useAapt2)
166154
app.LayoutMain = app.LayoutMain.Replace ("@string/hello", "@string/hello_me");
167155
app.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);
168156

169-
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
170-
if (Builder.UseDotNet && apiLevel == "31") {
171-
apiLevel = "30";
172-
app.TargetFrameworkVersion = "v11.0";
173-
}
174-
175157
app.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
176158
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""{app.PackageName}"">
177159
<uses-sdk android:minSdkVersion=""24"" android:targetSdkVersion=""{apiLevel}"" />
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Compat issues with assembly Mono.Android:
2+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.OS.Environment.ExternalStorageDirectory' in the contract but not the implementation.
3+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.OS.Environment.GetExternalStoragePublicDirectory(System.String)' in the contract but not the implementation.
4+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.Audio.AudioColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.
5+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Genres.Members.InterfaceConsts.Data' in the contract but not the implementation.
6+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Media.InterfaceConsts.Data' in the contract but not the implementation.
7+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Playlists.Members.InterfaceConsts.Data' in the contract but not the implementation.
8+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.DownloadColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.
9+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Downloads.InterfaceConsts.Data' in the contract but not the implementation.
10+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.Files.FileColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.
11+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.Images.ImageColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.
12+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data' in the contract but not the implementation.
13+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.IMediaColumns.Data' in the contract but not the implementation.
14+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.MediaColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.
15+
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Video.Media.InterfaceConsts.Data' in the contract but not the implementation.
16+
CannotChangeAttribute : Attribute 'System.ObsoleteAttribute' on 'System.String Android.Provider.MediaStore.Video.VideoColumns.Data' changed from '[ObsoleteAttribute("deprecated")]' in the contract to '[ObsoleteAttribute("Use 'Android.Provider.MediaStore.IMediaColumns.Data'. This class will be removed in a future release.")]' in the implementation.

0 commit comments

Comments
 (0)