Skip to content

[Mono.Android] API-UpsideDownCake Beta 1 #7980

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
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public AndroidToolchain ()
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-33_r01", apiLevel: "33", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-UpsideDownCake_r01", apiLevel: "UpsideDownCake", pkgRevision: "1"),
new AndroidPlatformComponent ("platform-UpsideDownCake_r03", apiLevel: "UpsideDownCake", pkgRevision: "3"),

new AndroidToolchainComponent ("sources-33_r01",
destDir: Path.Combine ("sources", "android-33"),
Expand Down
9 changes: 6 additions & 3 deletions src/Mono.Android/metadata
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,9 @@
<attr path="/api/package[@name='android.content.pm']/class[@name='PackageManager']/method[@name='resolveActivity' and count(parameter)=2 and parameter[1][@type='android.content.Intent'] and parameter[2][@type='int']]/parameter[@name='flags']" name="enumType">Android.Content.PM.PackageInfoFlags</attr>
<attr path="/api/package[@name='android.content.pm']/class[@name='PackageManager']/method[@name='resolveContentProvider' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='int']]/parameter[@name='flags']" name="enumType">Android.Content.PM.PackageInfoFlags</attr>
<attr path="/api/package[@name='android.content.pm']/class[@name='PackageManager']/method[@name='resolveService' and count(parameter)=2 and parameter[1][@type='android.content.Intent'] and parameter[2][@type='int']]/parameter[@name='flags']" name="enumType">Android.Content.PM.PackageInfoFlags</attr>
<attr api-since="26" path="/api/package[@name='android.app.admin']/class[@name='DevicePolicyManager']/method[@name='bindDeviceAdminServiceAsUser' and count(parameter)=5 and parameter[1][@type='android.content.ComponentName'] and parameter[2][@type='android.content.Intent'] and parameter[3][@type='android.content.ServiceConnection'] and parameter[4][@type='int'] and parameter[5][@type='android.os.UserHandle']]/parameter[@name='flags']" name="enumType">Android.Content.Bind</attr>
<attr path="/api/package[@name='android.content']/class[@name='Context']/method[@name='bindService' and count(parameter)=3 and parameter[1][@type='android.content.Intent'] and parameter[2][@type='android.content.ServiceConnection'] and parameter[3][@type='int']]/parameter[@name='flags']" name="enumType">Android.Content.Bind</attr>
<attr api-since="29" path="/api/package[@name='android.content']/class[@name='Context']/method[@name='bindService' and count(parameter)=4 and parameter[1][@type='android.content.Intent'] and parameter[2][@type='int'] and parameter[3][@type='java.util.concurrent.Executor'] and parameter[4][@type='android.content.ServiceConnection']]/parameter[@name='flags']" name="enumType">Android.Content.Bind</attr>

<!-- These parameters that we enumify changed names. Change them back so the enumification process can still find them. -->
<attr api-since="33" path="/api/package[@name='android.app']/class[@name='Service']/method[@name='stopForeground' and count(parameter)=1 and parameter[1][@type='int']]/parameter[@name='notificationBehavior']" name="name">flags</attr>
Expand Down Expand Up @@ -1788,9 +1791,9 @@
<attr api-since="34" path="/api/package[@name='android.app.appsearch.util']" name="managedName">Android.App.AppSearch.Util</attr>
<attr api-since="34" path="/api/package[@name='android.app.sdksandbox.sdkprovider']" name="managedName">Android.App.SdkSandbox.SdkProvider</attr>
<attr api-since="34" path="/api/package[@name='android.devicelock']" name="managedName">Android.DeviceLock</attr>
<attr api-since="34" path="/api/package[@name='android.healthconnect']" name="managedName">Android.HealthConnect</attr>
<attr api-since="34" path="/api/package[@name='android.healthconnect.datatypes']" name="managedName">Android.HealthConnect.DataTypes</attr>
<attr api-since="34" path="/api/package[@name='android.healthconnect.datatypes.units']" name="managedName">Android.HealthConnect.DataTypes.Units</attr>
<attr api-since="34" path="/api/package[@name='android.health.connect.changelog']" name="managedName">Android.Health.Connect.ChangeLog</attr>
<attr api-since="34" path="/api/package[@name='android.health.connect.datatypes']" name="managedName">Android.Health.Connect.DataTypes</attr>
<attr api-since="34" path="/api/package[@name='android.health.connect.datatypes.units']" name="managedName">Android.Health.Connect.DataTypes.Units</attr>
<attr api-since="34" path="/api/package[@name='android.location.altitude']" name="managedName">Android.Locations.Altitude</attr>

<!--
Expand Down
2 changes: 0 additions & 2 deletions src/Mono.Android/methodmap.csv
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
5, android.bluetooth,BluetoothClass,getMajorDeviceClass,return,Android.Bluetooth.MajorDeviceClass
5, android.bluetooth,BluetoothClass,hasService,service,Android.Bluetooth.ServiceClass
5, android.bluetooth,BluetoothDevice,getBondState,return,Android.Bluetooth.Bond
0, android.content,Context,bindService,flags,Android.Content.Bind
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that these removals were made because they were "duplicative" of the metadata additions, e.g.

<attr 
    path="/api/package[@name='android.content']/class[@name='Context']/method[@name='bindService' and count(parameter)=3 and parameter[1][@type='android.content.Intent'] and parameter[2][@type='android.content.ServiceConnection'] and parameter[3][@type='int']]/parameter[@name='flags']" 
    name="enumType">Android.Content.Bind</attr>

Is my assumption correct?

Is there a reason to prefer the metadata approach vs. the methodmap.csv approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, the metadata lines were placed in a section that describes why they are used, but that doesn't show up in the PR diff: https://github.com/xamarin/xamarin-android/pull/7980/files#diff-dbf22a7169e51cdd444864d89c196068bd583e320486401e528bf3b28917569cL1670-L1672

  <!-- We have 2 methods with the same name and the same parameter name. One needs to be enumified but not the other.
       Our methodmap.csv isn't capable of only choosing 1 of the methods, so it sets them both as the enum, making both have the
       same signature. So we are going to set the enum transformation here instead, where we can specify a path that only affects a single method. -->

0, android.content,Context,createPackageContext,flags,Android.Content.PackageContextFlags
0, android.content,Context,getDir,mode,Android.Content.FileCreationMode
0, android.content,Context,getSharedPreferences,mode,Android.Content.FileCreationMode
Expand Down Expand Up @@ -2277,7 +2276,6 @@
26, android.icu.util, UniversalTimeScale, toLong, timeScale, Android.Icu.Util.UniversalTimeScaleType
26, android.icu.util, UniversalTimeScale, getTimeScaleValue, value, Android.Icu.Util.UniversalTimeScaleValue

26, android.app.admin, DevicePolicyManager, bindDeviceAdminServiceAsUser, flags, Android.Content.Bind
26, android.app.admin, DevicePolicyManager, resetPasswordWithToken, flags, Android.App.Admin.ResetPasswordFlags
26, android.app.admin, DevicePolicyManager, lockNow, flags, Android.App.Admin.DevicePolicyManagerFlags
26, android.app.assist, AssistStructure.ViewNode, getAutofillType, return, Android.Views.AutofillType
Expand Down