Skip to content

Commit

Permalink
[Mono.Android] Bind API-Sv2 Developer Preview 1 (#6452)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jpobst committed Nov 9, 2021
1 parent 0df457a commit ef01121
Show file tree
Hide file tree
Showing 10 changed files with 34,444 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public sealed class CheckApiCompatibility : Task
{ "v10.0", "v9.0" },
{ "v11.0", "v10.0" },
{ "v12.0", "v11.0" },
{ "v12.0.99", "v12.0" },
};

static readonly string assemblyToValidate = "Mono.Android.dll";
Expand Down
2 changes: 2 additions & 0 deletions build-tools/api-merge/merge-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<File Path="api-29.xml.in" Level="29" />
<File Path="api-30.xml.in" Level="30" />
<File Path="api-31.xml.in" Level="31" />
<File Path="api-Sv2.xml.in" Level="Sv2" />
</Inputs>
<Outputs>
<File Path="android-19\mcw\api.xml" LastLevel="19" />
Expand All @@ -35,5 +36,6 @@
<File Path="android-29\mcw\api.xml" LastLevel="29" />
<File Path="android-30\mcw\api.xml" LastLevel="30" />
<File Path="android-31\mcw\api.xml" LastLevel="31" />
<File Path="android-Sv2\mcw\api.xml" LastLevel="Sv2" />
</Outputs>
</Configuration>
2 changes: 1 addition & 1 deletion build-tools/api-xml-adjuster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
RUNTIME = mono --debug
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Sv2

XML_OUTPUT_DIR = .

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class BuildAndroidPlatforms
new AndroidPlatform (apiName: "Q", apiLevel: 29, platformID: "29", include: "v10.0", framework: "v10.0"),
new AndroidPlatform (apiName: "R", apiLevel: 30, platformID: "30", include: "v11.0", framework: "v11.0"),
new AndroidPlatform (apiName: "S", apiLevel: 31, platformID: "31", include: "v12.0", framework: "v12.0"),
new AndroidPlatform (apiName: "Sv2", apiLevel: 32, platformID: "Sv2", include: "v12.0.99",framework: "v12.0.99", stable: false),
};

// These are here until we can drop "legacy" targets and use only .NET6+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public AndroidToolchain ()
new AndroidPlatformComponent ("platform-28_r04", apiLevel: "28", pkgRevision: "4"),
new AndroidPlatformComponent ("platform-29_r01", apiLevel: "29", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-30_r01", apiLevel: "30", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-Sv2_r01", apiLevel: "Sv2", pkgRevision: "1"),

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

Expand Down
34,416 changes: 34,416 additions & 0 deletions src/Mono.Android/Profiles/api-Sv2.params.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2343,13 +2343,6 @@ public class MainActivity : Activity
int maxApiLevel = AndroidSdkResolver.GetMaxInstalledPlatform ();
string apiLevel;
proj.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);

// TODO: We aren't sure how to support preview bindings in .NET6 yet.
if (Builder.UseDotNet && apiLevel == "31") {
apiLevel = "30";
proj.TargetFrameworkVersion = "v11.0";
}

if (int.TryParse (apiLevel, out int a) && a < maxApiLevel)
disabledIssues += ",OldTargetApi";
proj.SetProperty ("AndroidLintDisabledIssues", disabledIssues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public string LatestTargetFrameworkVersion () {

public string LatestTargetFrameworkVersion (out string apiLevel) {
GetTargetFrameworkVersionRange (out string _, out string _, out apiLevel, out string lastFrameworkVersion, out string [] _);
// TODO: We aren't sure how to support preview bindings in .NET6 yet.
if (UseDotNet && apiLevel == "32") {
apiLevel = "31";
return "v12.0";
}
return lastFrameworkVersion;
}

Expand Down
18 changes: 0 additions & 18 deletions tests/MSBuildDeviceIntegration/Tests/DeploymentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ public void BeforeDeploymentTests ()
string apiLevel;
proj.TargetFrameworkVersion = builder.LatestTargetFrameworkVersion (out apiLevel);

// TODO: We aren't sure how to support preview bindings in .NET6 yet.
if (Builder.UseDotNet && apiLevel == "31") {
apiLevel = "30";
proj.TargetFrameworkVersion = "v11.0";
}

proj.PackageName = "Xamarin.TimeZoneTest";
proj.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""Xamarin.TimeZoneTest"">
Expand Down Expand Up @@ -125,12 +119,6 @@ public void CheckResouceIsOverridden ([Values (true, false)] bool useAapt2)
string apiLevel;
app.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);

// TODO: We aren't sure how to support preview bindings in .NET6 yet.
if (Builder.UseDotNet && apiLevel == "31") {
apiLevel = "30";
app.TargetFrameworkVersion = "v11.0";
}

app.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""{app.PackageName}"">
<uses-sdk android:minSdkVersion=""24"" android:targetSdkVersion=""{apiLevel}"" />
Expand Down Expand Up @@ -166,12 +154,6 @@ public void CheckResouceIsOverridden ([Values (true, false)] bool useAapt2)
app.LayoutMain = app.LayoutMain.Replace ("@string/hello", "@string/hello_me");
app.TargetFrameworkVersion = b.LatestTargetFrameworkVersion (out apiLevel);

// TODO: We aren't sure how to support preview bindings in .NET6 yet.
if (Builder.UseDotNet && apiLevel == "31") {
apiLevel = "30";
app.TargetFrameworkVersion = "v11.0";
}

app.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""{app.PackageName}"">
<uses-sdk android:minSdkVersion=""24"" android:targetSdkVersion=""{apiLevel}"" />
Expand Down
16 changes: 16 additions & 0 deletions tests/api-compatibility/acceptable-breakages-v12.0.99.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Compat issues with assembly Mono.Android:
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.OS.Environment.ExternalStorageDirectory' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.OS.Environment.GetExternalStoragePublicDirectory(System.String)' in the contract but not the implementation.
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.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Genres.Members.InterfaceConsts.Data' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Media.InterfaceConsts.Data' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Audio.Playlists.Members.InterfaceConsts.Data' in the contract but not the implementation.
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.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Downloads.InterfaceConsts.Data' in the contract but not the implementation.
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.
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.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.IMediaColumns.Data' in the contract but not the implementation.
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.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'System.String Android.Provider.MediaStore.Video.Media.InterfaceConsts.Data' in the contract but not the implementation.
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 comments on commit ef01121

Please sign in to comment.