java.interop icon indicating copy to clipboard operation
java.interop copied to clipboard

Missing SupportedOSPlatformAttribute for enum members, const members

Open rgroenewoudt opened this issue 3 years ago • 2 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

rgroenewoudt avatar Sep 15 '22 09:09 rgroenewoudt

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

jpobst avatar Sep 15 '22 15:09 jpobst

ObsoletedInOSPlatformAttribute would also be good to have.

rgroenewoudt avatar Sep 20 '22 09:09 rgroenewoudt