xamarin / java.interop

Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing SupportedOSPlatformAttribute for enum members, const members

rgroenewoudt opened this issue · comments

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.3.3

Description

In .NET 6 Android the consts are missing SupportedOSPlatformAttribute.

Examples:

  • Manifest.Permission.PostNotifications:
  • Vibrator.VibrationEffectSupportNo
  • TelecomManager.ActionPostCall

APILevel is already present in RegisterAttribute.ApiSince.

[Register("ACTION_POST_CALL", ApiSince=30)]
public const string ActionPostCall = "android.telecom.action.POST_CALL";

I would also expect that the new enum VibrationEffectSupport also has the SupportedOSPlatformAttribute as the values are only available since API 30.

public enum VibrationEffectSupport
{
  [IntDefinition("Android.OS.Vibrator.VibrationEffectSupportUnknown", JniField="android/os/Vibrator.VIBRATION_EFFECT_SUPPORT_UNKNOWN")]
  Unknown = 0,
  [IntDefinition("Android.OS.Vibrator.VibrationEffectSupportYes", JniField="android/os/Vibrator.VIBRATION_EFFECT_SUPPORT_YES")]
  Yes = 1,
  [IntDefinition("Android.OS.Vibrator.VibrationEffectSupportNo", JniField="android/os/Vibrator.VIBRATION_EFFECT_SUPPORT_NO")]
  No = 2
}

Steps to Reproduce

Create new .NET 6 Android project and use Android consts/enums.

Did you find any workaround?

No response

Relevant log output

No response

Yep, we should add support for these attributes for const's and enum's in generator.

ObsoletedInOSPlatformAttribute would also be good to have.