Skip to content

Commit ec203a4

Browse files
committed
[Mono.Android.dll] Fix [SupportedOSPlatform] warnings.
1 parent c22b2a8 commit ec203a4

File tree

10 files changed

+13
-4
lines changed

10 files changed

+13
-4
lines changed

src/Mono.Android/Android.Content/Context.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ public void StartActivity (Type type)
2020

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

27+
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
2628
public Intent? RegisterReceiver (BroadcastReceiver? receiver, IntentFilter? filter, string? broadcastPermission, Handler? scheduler, ReceiverFlags flags)
2729
=> RegisterReceiver (receiver, filter, broadcastPermission, scheduler, (ActivityFlags)flags);
2830
#endif

src/Mono.Android/Android.Media/AudioTrack.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ namespace Android.Media
44
{
55
public partial class AudioTrack
66
{
7+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android26.0")]
78
[Obsolete ("ChannelConfiguration is obsolete. Please use another overload with ChannelOut instead")]
89
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)
910
: this (streamType, sampleRateInHz, (ChannelOut) (int) channelConfig, audioFormat, bufferSizeInBytes, mode)
1011
{
1112
}
1213
#if ANDROID_9
14+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android26.0")]
1315
[Obsolete ("ChannelConfiguration is obsolete. Please use another overload with ChannelOut instead")]
1416
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)
1517
: this (streamType, sampleRateInHz, (ChannelOut) (int) channelConfig, audioFormat, bufferSizeInBytes, mode, sessionId)

src/Mono.Android/Android.OS/AsyncTask.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Android.OS {
99

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

src/Mono.Android/Android.OS/Handler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Android.OS {
55

66
public partial class Handler {
77

8+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")]
89
public Handler (Action<Message> handler)
910
: this (new ActionHandlerCallback (handler))
1011
{

src/Mono.Android/Android.OS/Vibrator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace Android.OS {
66

77
public partial class Vibrator {
88

9+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android31.0", "Use VibratorManager to retrieve the default system vibrator.")]
910
public static Vibrator? FromContext (Context context)
1011
{
1112
return context.GetSystemService (Context.VibratorService!) as Vibrator;

src/Mono.Android/Android.Runtime/AndroidEnvironment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ static void NotifyTimeZoneChanged ()
237237
//
238238
// Rationale
239239
// No longer called by the indicated caller, however we keep it for backward compatibility.
240+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android31.0")]
240241
static void GetDisplayDPI (out float x_dpi, out float y_dpi)
241242
{
242243
var wm = Application.Context.GetSystemService (Context.WindowService).JavaCast <IWindowManager> ();

src/Mono.Android/Android.Telecom/InCallService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public abstract partial class InCallService : Android.App.Service
77
{
88
#if ANDROID_23
99
[Obsolete ("Incorrect enum parameter, use the overload that takes a CallAudioRoute parameter instead.")]
10+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android34.0")]
1011
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android23.0")]
1112
public void SetAudioRoute ([global::Android.Runtime.GeneratedEnum] Android.Telecom.VideoQuality route)
1213
{

src/Mono.Android/Android.Telephony/CellInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@ public partial class CellInfo {
1111

1212
static Delegate? cb_getCellIdentity;
1313
#pragma warning disable 0169
14+
[global::System.Runtime.Versioning.SupportedOSPlatform ("android28.0")]
1415
static Delegate GetGetCellIdentityHandler ()
1516
{
1617
if (cb_getCellIdentity == null)
1718
cb_getCellIdentity = JNINativeWrapper.CreateDelegate ((Func<IntPtr, IntPtr, IntPtr>) n_GetCellIdentity);
1819
return cb_getCellIdentity;
1920
}
2021

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

30+
[global::System.Runtime.Versioning.SupportedOSPlatform ("android28.0")]
2831
public unsafe virtual Android.Telephony.CellIdentity CellIdentity {
2932
// Metadata.xml XPath method reference: path="/api/package[@name='android.telephony']/class[@name='CellInfo']/method[@name='getCellIdentity' and count(parameter)=0]"
3033
[Register ("getCellIdentity", "()Landroid/telephony/CellIdentity;", "GetGetCellIdentityHandler", ApiSince = 30)]

src/Mono.Android/Android.Views/View.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public void UnscheduleDrawable (Android.Graphics.Drawables.Drawable who, Action
7777

7878
#if ANDROID_11
7979
[Obsolete ("Please Use DispatchSystemUiVisibilityChanged(SystemUiFlags)")]
80+
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")]
8081
public void DispatchSystemUiVisibilityChanged (int visibility)
8182
{
8283
DispatchSystemUiVisibilityChanged ((SystemUiFlags) visibility);

src/Mono.Android/Mono.Android.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
<NoWarn>$(NoWarn);CS1572;CS1573;CS1574;CS1584;CS1587;CS1591;CS1658;</NoWarn>
4242
</PropertyGroup>
4343

44-
<PropertyGroup Condition=" '$(_EnableCodeAnalyzerPlatformWarnings)' == '' ">
45-
<NoWarn>$(NoWarn);CA1422;CA1416</NoWarn>
46-
</PropertyGroup>
47-
4844
<ItemGroup>
4945
<AdditionalFiles Include="PublicAPI\API-$(AndroidApiLevel)\PublicAPI.Shipped.txt" />
5046
<AdditionalFiles Include="PublicAPI\API-$(AndroidApiLevel)\PublicAPI.Unshipped.txt" />

0 commit comments

Comments
 (0)