Skip to content

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

Merged
jonpryor merged 2 commits into
mainfrom
api-35-beta-2
May 22, 2024
Merged

[Mono.Android] Bind API-35 Beta 2.#8948
jonpryor merged 2 commits into
mainfrom
api-35-beta-2

Conversation

@jpobst

@jpobstjpobst commented May 15, 2024

Copy link
Copy Markdown
Contributor

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
<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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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)]internalsealedpartialclassIOnOpActiveChangedListenerImplementor:global::Java.Lang.Object,IOnOpActiveChangedListener{publicEventHandler<OpActiveChangedEventArgs>?OnOpActiveChangedHandler;publicvoidOnOpActiveChanged(stringop,intuid,stringpackageName,boolactive){var__h=OnOpActiveChangedHandler;if(__h!=null)__h(sender,newOpActiveChangedEventArgs(op,uid,packageName,active));}// Duplicate OnOpActiveChangedHandlerpublicEventHandler<OpActiveChangedEventArgs>?OnOpActiveChangedHandler;publicvoidOnOpActiveChanged(stringop,intuid,stringpackageName,string?attributionTag,intvirtualDeviceId,boolactive,intattributionFlags,intattributionChainId){var__h=OnOpActiveChangedHandler;if(__h!=null)__h(sender,newOpActiveChangedEventArgs(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.

@jpobstjpobstMay 16, 2024

Copy link
Copy Markdown
ContributorAuthor

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

Comment threadsrc/Mono.Android/metadata Outdated
<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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

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 mainMay 22, 2024
@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-actionsgithub-actionsBot locked and limited conversation to collaborators Jun 22, 2024
Sign up for freeto 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

@jpobst@jonpryor