Skip to content

[Mono.Android] Bind Android API-36 Beta 3 #9914

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

Merged
merged 1 commit into from
Mar 19, 2025
Merged

[Mono.Android] Bind Android API-36 Beta 3 #9914

merged 1 commit into from
Mar 19, 2025

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Mar 13, 2025

Context: https://developer.android.com/about/versions/16
Context: https://android-developers.googleblog.com/2025/03/the-third-beta-of-android-16.html

Android 16 Beta 3 has been released. The Android 16
Developer Preview Program Overview Timeline and updates section
suggests the following timeline:

  • Nov/Dec: Developer Previews
  • Jan/Feb: Unstable Betas
  • Mar/Apr: Stable Betas
  • ???: Final

Additionally, enumify and mark API-36 as "stable", which changes net10.0-android to default to net10.0-android36.0.

Notes:

APICompat

  • There are several Android.Runtime.RequiresPermissionAttribute that have been removed. As we do not consume this attribute, it does not cause any API breakage.
  • Several [ObsoletedOSPlatformAttribute] attributes are missing. These have all been documented as "undeprecated" in Android's change list: https://developer.android.com/sdk/api_diff/36/changes

PublicAPI

  • NRT attribute changes (? -> !)
  • Method parameter name changes, technically a source breaking change, but something we've never tracked or fixed before
  • Some consts changed "values" in PublicApi.txt like from MediaCodecProfileType.Av1profilemain10hdr10 to MediaCodecProfileType.Apvprofile42210hdr10.
- const Android.Media.MediaCodecInfo.CodecProfileLevel.AV1ProfileMain10HDR10 = Android.Media.MediaCodecProfileType.Av1profilemain10hdr10 -> Android.Media.MediaCodecProfileType
+ const Android.Media.MediaCodecInfo.CodecProfileLevel.AV1ProfileMain10HDR10 = Android.Media.MediaCodecProfileType.Apvprofile42210hdr10 -> Android.Media.MediaCodecProfileType

This is a weird enum that has lots of members with the same values, and the PublicAPI tooling likely chooses the first alphabetically. The const value did not actually change, just the way it is listed in PublicApi.txt.

public enum Android.Media.MediaCodecProfileType {
  [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android36.0")]
  Apvprofile42210hdr10 = 4096,

  [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android29.0")]
  Av1profilemain10hdr10 = 4096,
  ...
}

MAUI Integration Tests

It looks like the MAUI Integration tests are broken because they explicitly target net10.0-android35.0 instead of net10.0-android:

https://github.com/dotnet/maui/blob/c451130571777aef5d9fa2737789dd987430e6dc/Directory.Build.props#L158

They will need to update this when our changes flow to them.

@jpobst jpobst force-pushed the dev/jpobst/api-36 branch 7 times, most recently from 8787121 to a282f10 Compare March 18, 2025 17:58
@jpobst jpobst force-pushed the dev/jpobst/api-36 branch from a282f10 to 219fea4 Compare March 18, 2025 18:01
@jpobst jpobst marked this pull request as ready for review March 19, 2025 18:38
@@ -96,6 +96,10 @@
<a name='knownActivityEmbeddingCerts' api-level='33' />
<a name='enableOnBackInvokedCallback' format='boolean' api-level='33' />
<a name='allowCrossUidActivitySwitchFromBelow' format='boolean' api-level='35' />
<a name='pageSizeCompat' api-level='36' />
<a name='intentMatchingFlags' api-level='36' />
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be exposed as properties on ApplicationAttribute? That's not in this PR, though PageSizeCompat is here. How do we decide which ones should be exposed on attributes?

Copy link
Contributor Author

@jpobst jpobst Mar 19, 2025

Choose a reason for hiding this comment

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

How do we decide which ones should be exposed on attributes?

It is definitely arbitrary. None of them are documented (yet?), so it's hard to know what's intended for common use and what is intended to be "undocumented". In general, we tend to wait for people to request them. (This is the first time we've ever proactively looked at them when binding a new API level.)

pageSizeCompat is at least documented in the behavior changes documentation and seemed like it might be useful if 16KB support actually becomes an issue, so I added it.

@jonpryor
Copy link
Contributor

Draft commit message:

[Mono.Android] Bind and enumify API-36 (#9814)

Context: https://developer.android.com/about/versions/16
Context: https://android-developers.googleblog.com/2025/03/the-third-beta-of-android-16.html

Android 16 Beta 3 has been released.

  * [API-36 Beta 3 vs. API-35][0]
  * [API-36 Beta 3 vs. API-Baklava Beta 2][1]

The Android 16 Preview Program Overview [Timeline and updates][2]
section suggests the following timeline:

  * Nov/Dec: Developer Previews
  * Jan/Feb: Unstable Betas
  * Mar/Apr: Stable Betas
  * ???: Final

Additionally, enumify and mark API-36 as "stable", which changes
`net10.0-android` to default to `net10.0-android36.0`.

We still need to decide on our strategy for backporting this to
.NET 9 service releases.

## Notes

APICompat:

  - There are several `Android.Runtime.RequiresPermissionAttribute`
    fields that have been removed.  As we do not consume this
    attribute, it does not cause any API breakage.

  - Several `[ObsoletedOSPlatformAttribute]` attributes are missing.
    These have all been documented as "undeprecated" in Android's
    change list: https://developer.android.com/sdk/api_diff/36/changes

PublicAPI:

  - Nullable reference type attribute changes (`T?` -> `T!`)

  - Method parameter name changes.  This is technically a source
    breaking change, but something we've never tracked or fixed before.

  - Some consts changed "values" in `PublicAPI*.txt` like from
    `MediaCodecProfileType.Av1profilemain10hdr10` to
    `MediaCodecProfileType.Apvprofile42210hdr10`:

        - const Android.Media.MediaCodecInfo.CodecProfileLevel.AV1ProfileMain10HDR10 = Android.Media.MediaCodecProfileType.Av1profilemain10hdr10 -> Android.Media.MediaCodecProfileType
        + const Android.Media.MediaCodecInfo.CodecProfileLevel.AV1ProfileMain10HDR10 = Android.Media.MediaCodecProfileType.Apvprofile42210hdr10 -> Android.Media.MediaCodecProfileType

    This is a weird enum that has lots of members with the same values,
    and the PublicAPI tooling likely chooses the first alphabetically.
    The const *value* did not actually change, just the way it is
    listed in `PublicAPI*.txt`:

        public enum Android.Media.MediaCodecProfileType {
          [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android36.0")]
          Apvprofile42210hdr10 = 4096,
        
          [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android29.0")]
          Av1profilemain10hdr10 = 4096,
          // …
        }

MAUI Integration Tests:

  - It looks like the MAUI Integration tests are broken because they
    [explicitly target net10.0-android35.0][3] instead of
    `net10.0-android`.

    The MAUI team will need to update this when our changes
    flow to them.

[0]: https://developer.android.com/sdk/api_diff/36/changes
[1]: https://developer.android.com/sdk/api_diff/36-incr/changes
[2]: https://developer.android.com/about/versions/16/overview
[3]: https://github.com/dotnet/maui/blob/c451130571777aef5d9fa2737789dd987430e6dc/Directory.Build.props#L158

@jonpryor jonpryor merged commit d5152b6 into main Mar 19, 2025
56 of 58 checks passed
@jonpryor jonpryor deleted the dev/jpobst/api-36 branch March 19, 2025 20:58
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants