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 API-35 Beta 2. #8948

Merged
merged 2 commits into from
May 22, 2024
Merged

[Mono.Android] Bind API-35 Beta 2. #8948

merged 2 commits into from
May 22, 2024

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented May 15, 2024

Context: https://developer.android.com/about/versions/15
Context: https://android-developers.googleblog.com/2024/05/the-second-beta-of-android-15.html

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

  • Feb/Mar: Developer Previews
  • April/May: Unstable Betas
  • June/July: Stable Betas
  • ???: Final

This will be usable in its preview form to .NET 9 Preview users who explicitly target net9.0-android35.

@jpobst jpobst marked this pull request as ready for review May 15, 2024 22:40
@jpobst jpobst requested review from grendello and jonpryor as code owners May 15, 2024 22:40
@@ -1922,6 +1922,10 @@
<attr api-since="35" path="/api/package[@name='android.media']/class[@name='MediaRouter2']/method[@name='getRouteListingPreference' and count(parameter)=0]" name="propertyName"></attr>
<attr api-since="35" path="/api/package[@name='android.media']/class[@name='MediaRouter2']/method[@name='setRouteListingPreference' and count(parameter)=1 and parameter[1][@type='android.media.RouteListingPreference']]" name="propertyName"></attr>

<!-- These new default interface methods on a Listener interface cause duplicate named EventHandlers to be generated, change to a unique name. -->
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to add eventName metadata to explicitly name the event, vs. renaming the method name itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, it isn't the event itself that is the problem[1], it's the EventHandler name in the internal *ListenerImplementor that is the problem:

[global::Android.Runtime.Register ("mono/android/app/AppOpsManager_OnOpActiveChangedListenerImplementor", ApiSince = 30)]
internal sealed partial class IOnOpActiveChangedListenerImplementor : global::Java.Lang.Object, IOnOpActiveChangedListener
{
    public EventHandler<OpActiveChangedEventArgs>? OnOpActiveChangedHandler;

    public void OnOpActiveChanged (string op, int uid, string packageName, bool active)
    {
    	var __h = OnOpActiveChangedHandler;
    	if (__h != null)
    		__h (sender, new OpActiveChangedEventArgs (op, uid, packageName, active));
    }

    // Duplicate OnOpActiveChangedHandler
    public EventHandler<OpActiveChangedEventArgs>? OnOpActiveChangedHandler;

    public void OnOpActiveChanged (string op, int uid, string packageName, string? attributionTag, int virtualDeviceId, bool active, int attributionFlags, int attributionChainId)
    {
    	var __h = OnOpActiveChangedHandler;
    	if (__h != null)
    		__h (sender, new OpActiveChangedEventArgs (op, uid, packageName, attributionTag, virtualDeviceId, active, attributionFlags, attributionChainId));
    }
}

[1] I can't find anything that actually generates events for this listener (ie: no SetOnOpActiveChangedListener method anywhere). If that existed then the event name would likely also be a problem.

Copy link
Contributor Author

@jpobst jpobst May 16, 2024

Choose a reason for hiding this comment

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

Previously, we have also just removed these new methods, as they are default interface methods, so we could do that here as well:

https://github.com/xamarin/xamarin-android/blob/ef31401a44311ed49cee9df1e207918226b4c745/src/Mono.Android/metadata#L1701-L1703

@@ -1922,6 +1922,10 @@
<attr api-since="35" path="/api/package[@name='android.media']/class[@name='MediaRouter2']/method[@name='getRouteListingPreference' and count(parameter)=0]" name="propertyName"></attr>
<attr api-since="35" path="/api/package[@name='android.media']/class[@name='MediaRouter2']/method[@name='setRouteListingPreference' and count(parameter)=1 and parameter[1][@type='android.media.RouteListingPreference']]" name="propertyName"></attr>

<!-- These new default interface methods on a Listener interface cause duplicate named EventHandlers to be generated, change to a unique name. -->
<attr api-since="35" path="/api/package[@name='android.app']/interface[@name='AppOpsManager.OnOpActiveChangedListener']/method[@name='onOpActiveChanged' and count(parameter)=8]" name="managedName">OnOpActiveChanged2</attr>
Copy link
Member

Choose a reason for hiding this comment

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

Also not sure I like count(parameter)=8, as if they add an 8-parameter overload in the future, it'll match.

"Safer" would likely to use //method/@jni-signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use the "full" generated metadata path.

@jonpryor
Copy link
Member

Draft commit messages:

Context: https://developer.android.com/about/versions/15
Context: https://android-developers.googleblog.com/2024/05/the-second-beta-of-android-15.html
Context: d5b608e8e0c25816d4c5d8df6488ab4d021bd41c

Android 15 Beta 2 was released on 2024-May-15:

  * [API-VanillaIceCream Beta 2 vs. API-34][1]
  * [API-VanillaIceCream Beta 2 vs. Beta 1][2] (d5b608e8)

The Android 15 Developer Preview [Timeline and updates][0] section
suggests the following timeline:

  * Feb/Mar: Developer Previews
  * April/May: Unstable Betas
  * June/July: Stable Betas with a [Platform Stability milestone][3]
    expected in Beta 3
  * ???: Final

Beta 2 be usable in its preview form to .NET 9 Preview 5 users who
explicitly target `net9.0-android35`.

[0]: https://web.archive.org/web/20240514210701/https://developer.android.com/about/versions/15/overview#timeline
[1]: https://developer.android.com/sdk/api_diff/v-beta2/changes
[2]: https://developer.android.com/sdk/api_diff/v-beta2-incr/changes
[3]: https://web.archive.org/web/20240514210701/https://developer.android.com/about/versions/15/overview#platform_stability

@jonpryor jonpryor merged commit c993dee into main May 22, 2024
48 checks passed
@jonpryor jonpryor deleted the api-35-beta-2 branch May 22, 2024 18:41
grendello added a commit that referenced this pull request May 23, 2024
* main:
  Localized file check-in by OneLocBuild Task (#8974)
  Bump to xamarin/xamarin-android-binutils/L_18.1.6-8.0.0@97b574b (#8969)
  [Mono.Android] Bind API-VanillaIceCream Beta 2 (#8948)
  [ci] Update OneLocBuildToken (#8973)
  [s360] Ignore irrelevant lz4+Python warnings (#8962)
  LEGO: Merge pull request 8971
  Localized file check-in by OneLocBuild Task (#8963)
  [ci] Use long version for maestro publishing (#8964)
  Localized file check-in by OneLocBuild Task (#8957)
  LEGO: Merge pull request 8958
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2024
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.

2 participants