Skip to content
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
7 changes: 7 additions & 0 deletions src/Mono.Android/Android.Content/ContentValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public short GetAsShort (string key)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Boolean_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Boolean;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, bool value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Boolean_ == IntPtr.Zero)
Expand All @@ -134,6 +135,7 @@ public void Put (string key, bool value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Byte_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Byte;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, sbyte value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Byte_ == IntPtr.Zero)
Expand All @@ -149,6 +151,7 @@ public void Put (string key, sbyte value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Short_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Short;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, short value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Short_ == IntPtr.Zero)
Expand All @@ -164,6 +167,7 @@ public void Put (string key, short value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Integer_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Integer;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, int value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Integer_ == IntPtr.Zero)
Expand All @@ -179,6 +183,7 @@ public void Put (string key, int value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Long_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Long;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, long value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Long_ == IntPtr.Zero)
Expand All @@ -194,6 +199,7 @@ public void Put (string key, long value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Float_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Float;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, float value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Float_ == IntPtr.Zero)
Expand All @@ -209,6 +215,7 @@ public void Put (string key, float value)

static IntPtr id_put_Ljava_lang_String_Ljava_lang_Double_;
[Register ("put", "(Ljava/lang/String;Ljava/lang/Double;)V", "")]
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public void Put (string key, double value)
{
if (id_put_Ljava_lang_String_Ljava_lang_Double_ == IntPtr.Zero)
Expand Down
2 changes: 2 additions & 0 deletions src/Mono.Android/Android.Content/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ public void StartActivity (Type type)

#if ANDROID_34
// Add correctly enumified overloads
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public Intent? RegisterReceiver (BroadcastReceiver? receiver, IntentFilter? filter, ReceiverFlags flags)
=> RegisterReceiver (receiver, filter, (ActivityFlags)flags);

[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public Intent? RegisterReceiver (BroadcastReceiver? receiver, IntentFilter? filter, string? broadcastPermission, Handler? scheduler, ReceiverFlags flags)
=> RegisterReceiver (receiver, filter, broadcastPermission, scheduler, (ActivityFlags)flags);
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/Mono.Android/Android.Media/AudioTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ namespace Android.Media
{
public partial class AudioTrack
{
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android26.0")]
[Obsolete ("ChannelConfiguration is obsolete. Please use another overload with ChannelOut instead")]
public AudioTrack ([global::Android.Runtime.GeneratedEnum] Android.Media.Stream streamType, int sampleRateInHz, [global::Android.Runtime.GeneratedEnum] Android.Media.ChannelConfiguration channelConfig, [global::Android.Runtime.GeneratedEnum] Android.Media.Encoding audioFormat, int bufferSizeInBytes, [global::Android.Runtime.GeneratedEnum] Android.Media.AudioTrackMode mode)
: this (streamType, sampleRateInHz, (ChannelOut) (int) channelConfig, audioFormat, bufferSizeInBytes, mode)
{
}
#if ANDROID_9
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android26.0")]
[Obsolete ("ChannelConfiguration is obsolete. Please use another overload with ChannelOut instead")]
public AudioTrack ([global::Android.Runtime.GeneratedEnum] Android.Media.Stream streamType, int sampleRateInHz, [global::Android.Runtime.GeneratedEnum] Android.Media.ChannelConfiguration channelConfig, [global::Android.Runtime.GeneratedEnum] Android.Media.Encoding audioFormat, int bufferSizeInBytes, [global::Android.Runtime.GeneratedEnum] Android.Media.AudioTrackMode mode, int sessionId)
: this (streamType, sampleRateInHz, (ChannelOut) (int) channelConfig, audioFormat, bufferSizeInBytes, mode, sessionId)
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.OS/AsyncTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Android.OS {

[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")]
[Register ("android/os/AsyncTask", DoNotGenerateAcw=true)]
public abstract class AsyncTask<TParams, TProgress, TResult> : AsyncTask {

Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.OS/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Android.OS {

public partial class Handler {

[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")]
public Handler (Action<Message> handler)
: this (new ActionHandlerCallback (handler))
{
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.OS/Vibrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Android.OS {

public partial class Vibrator {

[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android31.0", "Use VibratorManager to retrieve the default system vibrator.")]
public static Vibrator? FromContext (Context context)
{
return context.GetSystemService (Context.VibratorService!) as Vibrator;
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.Runtime/AndroidEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ static void NotifyTimeZoneChanged ()
//
// Rationale
// No longer called by the indicated caller, however we keep it for backward compatibility.
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android31.0")]
static void GetDisplayDPI (out float x_dpi, out float y_dpi)
{
var wm = Application.Context.GetSystemService (Context.WindowService).JavaCast <IWindowManager> ();
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.Runtime/JavaObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Android.Runtime {
[Register ("mono/android/runtime/JavaObject")]
internal sealed class JavaObject : Java.Lang.Object {

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static IntPtr GetHandle (object obj)
{
if (obj == null)
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.Telecom/InCallService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public abstract partial class InCallService : Android.App.Service
{
#if ANDROID_23
[Obsolete ("Incorrect enum parameter, use the overload that takes a CallAudioRoute parameter instead.")]
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android34.0")]
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android23.0")]
public void SetAudioRoute ([global::Android.Runtime.GeneratedEnum] Android.Telecom.VideoQuality route)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Mono.Android/Android.Telephony/CellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ public partial class CellInfo {

static Delegate? cb_getCellIdentity;
#pragma warning disable 0169
[global::System.Runtime.Versioning.SupportedOSPlatform ("android28.0")]
static Delegate GetGetCellIdentityHandler ()
{
if (cb_getCellIdentity == null)
cb_getCellIdentity = JNINativeWrapper.CreateDelegate ((Func<IntPtr, IntPtr, IntPtr>) n_GetCellIdentity);
return cb_getCellIdentity;
}

[global::System.Runtime.Versioning.SupportedOSPlatform ("android28.0")]
static IntPtr n_GetCellIdentity (IntPtr jnienv, IntPtr native__this)
{
var __this = global::Java.Lang.Object.GetObject<Android.Telephony.CellInfo> (jnienv, native__this, JniHandleOwnership.DoNotTransfer)!;
return JNIEnv.ToLocalJniHandle (__this.CellIdentity);
}
#pragma warning restore 0169

[global::System.Runtime.Versioning.SupportedOSPlatform ("android28.0")]
public unsafe virtual Android.Telephony.CellIdentity CellIdentity {
// Metadata.xml XPath method reference: path="/api/package[@name='android.telephony']/class[@name='CellInfo']/method[@name='getCellIdentity' and count(parameter)=0]"
[Register ("getCellIdentity", "()Landroid/telephony/CellIdentity;", "GetGetCellIdentityHandler", ApiSince = 30)]
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Android.Views/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void UnscheduleDrawable (Android.Graphics.Drawables.Drawable who, Action

#if ANDROID_11
[Obsolete ("Please Use DispatchSystemUiVisibilityChanged(SystemUiFlags)")]
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")]
public void DispatchSystemUiVisibilityChanged (int visibility)
{
DispatchSystemUiVisibilityChanged ((SystemUiFlags) visibility);
Expand Down
2 changes: 2 additions & 0 deletions src/Mono.Android/Java.Interop/JavaConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ static Func<IntPtr, JniHandleOwnership, object> GetJniHandleConverterForType ([D
return Convert.ChangeType (value, targetType, CultureInfo.InvariantCulture);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
static Dictionary<Type, Func<object, IJavaObject>> JavaObjectConverters = new Dictionary<Type, Func<object, IJavaObject>>() {
{ typeof (bool), value => new Java.Lang.Boolean ((bool) value) },
{ typeof (byte), value => new Java.Lang.Byte ((sbyte) (byte) value) },
Expand Down Expand Up @@ -306,6 +307,7 @@ static Func<IntPtr, JniHandleOwnership, object> GetJniHandleConverterForType ([D
return new Android.Runtime.JavaObject (value);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
static Dictionary<Type, Func<object, IntPtr>> LocalJniHandleConverters = new Dictionary<Type, Func<object, IntPtr>> {
{ typeof (bool), value => {
using (var v = new Java.Lang.Boolean ((bool) value))
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Java.Interop/TypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Java.Interop.Tools.TypeNameMappings;

using Android.Runtime;
using System.Diagnostics.CodeAnalysis;

namespace Java.Interop {

Expand Down
7 changes: 7 additions & 0 deletions src/Mono.Android/Java.Lang/Object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ protected void SetHandle (IntPtr value, JniHandleOwnership transfer)
return new Java.Lang.Object (JNIEnv.NewArray (value), JniHandleOwnership.TransferLocalRef);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (bool value)
{
return new Java.Lang.Boolean (value);
Expand All @@ -327,11 +328,13 @@ public static implicit operator Java.Lang.Object (byte value)
throw new InvalidOperationException ("Should not be reached");
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (sbyte value)
{
return new Java.Lang.Byte (value);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (char value)
{
return new Java.Lang.Character (value);
Expand All @@ -343,6 +346,7 @@ public static implicit operator Java.Lang.Object (uint value)
throw new InvalidOperationException ("Should not be reached");
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (int value)
{
return new Java.Lang.Integer (value);
Expand All @@ -354,16 +358,19 @@ public static implicit operator Java.Lang.Object (ulong value)
throw new InvalidOperationException ("Should not be reached");
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (long value)
{
return new Java.Lang.Long (value);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (float value)
{
return new Java.Lang.Float (value);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Interoperability", "CA1422:Validate platform compatibility", Justification = "Suggested replacement uses instance sharing")]
public static implicit operator Java.Lang.Object (double value)
{
return new Java.Lang.Double (value);
Expand Down
4 changes: 0 additions & 4 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
<NoWarn>$(NoWarn);CS1572;CS1573;CS1574;CS1584;CS1587;CS1591;CS1658;</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(_EnableCodeAnalyzerPlatformWarnings)' == '' ">
<NoWarn>$(NoWarn);CA1422;CA1416</NoWarn>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="PublicAPI\API-$(AndroidApiLevel)\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\API-$(AndroidApiLevel)\PublicAPI.Unshipped.txt" />
Expand Down