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
[Mono.Android] Fix incorrect Bluetooth enumification.
  • Loading branch information
jpobst committed Aug 24, 2021
commit 1edb14c800fffce0d883251885a15188e980bb30
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#if ANDROID_26

namespace Android.Bluetooth.LE
{
public sealed partial class AdvertisingSetParameters
{
public sealed partial class Builder
{
// These methods were obsoleted as a warning in API-31
[global::System.Obsolete ("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public unsafe Android.Bluetooth.LE.AdvertisingSetParameters.Builder? SetPrimaryPhy ([global::Android.Runtime.GeneratedEnum] Android.Bluetooth.LE.ScanSettingsPhy primaryPhy)
=> SetPrimaryPhy ((Android.Bluetooth.BluetoothPhy) primaryPhy);

[global::System.Obsolete ("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public unsafe Android.Bluetooth.LE.AdvertisingSetParameters.Builder? SetSecondaryPhy ([global::Android.Runtime.GeneratedEnum] Android.Bluetooth.LE.ScanSettingsPhy secondaryPhy)
=> SetSecondaryPhy ((Android.Bluetooth.BluetoothPhy) secondaryPhy);
}
}
}

#endif

21 changes: 21 additions & 0 deletions src/Mono.Android/Android.Bluetooth/BluetoothDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if ANDROID_26

namespace Android.Bluetooth
{
public sealed partial class BluetoothDevice
{
// These methods were obsoleted as a warning in API-31
[global::System.Obsolete ("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public unsafe Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? @callback, [global::Android.Runtime.GeneratedEnum] Android.Bluetooth.BluetoothTransports transport, [global::Android.Runtime.GeneratedEnum] Android.Bluetooth.LE.ScanSettingsPhy phy)
=> ConnectGatt (context, autoConnect, @callback, transport, (Android.Bluetooth.BluetoothPhy) phy);

[global::System.Obsolete ("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android26.0")]
public unsafe Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? @callback, [global::Android.Runtime.GeneratedEnum] Android.Bluetooth.BluetoothTransports transport, [global::Android.Runtime.GeneratedEnum] Android.Bluetooth.LE.ScanSettingsPhy phy, Android.OS.Handler? handler)
=> ConnectGatt (context, autoConnect, @callback, transport, (Android.Bluetooth.BluetoothPhy) phy, handler);
}
}

#endif

2 changes: 2 additions & 0 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
<Compile Include="Android.App\UsesLibraryAttribute.cs" />
<Compile Include="Android.App\UsesPermissionAttribute.cs" />
<Compile Include="Android.App.Admin\DevicePolicyManager.cs" />
<Compile Include="Android.Bluetooth\AdvertisingSetParametersBuilder.cs" />
<Compile Include="Android.Bluetooth\BluetoothDevice.cs" />
<Compile Include="Android.Bluetooth\BluetoothGattServer.cs" />
<Compile Include="Android.Bluetooth\BluetoothGattServerCallback.cs" />
<Compile Include="Android.Content\ContentProvider.cs" />
Expand Down
6 changes: 3 additions & 3 deletions src/Mono.Android/methodmap.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,8 @@
26, android.bluetooth, BluetoothGatt, setPreferredPhy, phyOptions, Android.Bluetooth.BluetoothPhyOption
26, android.bluetooth.le, ScanSettings.Builder, setPhy, phy, Android.Bluetooth.BluetoothPhy
26, android.bluetooth.le, ScanSettings, getPhy, return, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth.le, AdvertisingSetParameters.Builder, setPrimaryPhy, primaryPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth.le, AdvertisingSetParameters.Builder, setSecondaryPhy, secondaryPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth.le, AdvertisingSetParameters.Builder, setPrimaryPhy, primaryPhy, Android.Bluetooth.BluetoothPhy
26, android.bluetooth.le, AdvertisingSetParameters.Builder, setSecondaryPhy, secondaryPhy, Android.Bluetooth.BluetoothPhy
26, android.bluetooth.le, AdvertisingSetParameters.Builder, setTxPowerLevel, txPowerLevel, Android.Bluetooth.LE.AdvertiseTxPower
26, android.bluetooth.le, ScanResult, ctor, primaryPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth.le, ScanResult, ctor, secondaryPhy, Android.Bluetooth.LE.ScanSettingsPhy
Expand All @@ -2205,7 +2205,7 @@
26, android.bluetooth, BluetoothGattServerCallback, onPhyUpdate, txPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth, BluetoothGattServerCallback, onPhyUpdate, rxPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth, BluetoothGattServerCallback, onPhyUpdate, status, Android.Bluetooth.GattStatus
26, android.bluetooth, BluetoothDevice, connectGatt, phy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth, BluetoothDevice, connectGatt, phy, Android.Bluetooth.BluetoothPhy
26, android.bluetooth, BluetoothDevice, connectGatt, transport, Android.Bluetooth.BluetoothTransports
26, android.bluetooth, BluetoothGattCallback, onPhyRead, txPhy, Android.Bluetooth.LE.ScanSettingsPhy
26, android.bluetooth, BluetoothGattCallback, onPhyRead, rxPhy, Android.Bluetooth.LE.ScanSettingsPhy
Expand Down
4 changes: 4 additions & 0 deletions tests/api-compatibility/acceptable-breakages-vReference.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Compat issues with assembly Mono.Android:
CannotRemoveAttribute : Attribute 'Android.Runtime.RegisterAttribute' exists on 'Android.Bluetooth.BluetoothDevice.ConnectGatt(Android.Content.Context, System.Boolean, Android.Bluetooth.BluetoothGattCallback, Android.Bluetooth.BluetoothTransports, Android.Bluetooth.LE.ScanSettingsPhy)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RegisterAttribute' exists on 'Android.Bluetooth.BluetoothDevice.ConnectGatt(Android.Content.Context, System.Boolean, Android.Bluetooth.BluetoothGattCallback, Android.Bluetooth.BluetoothTransports, Android.Bluetooth.LE.ScanSettingsPhy, Android.OS.Handler)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RegisterAttribute' exists on 'Android.Bluetooth.LE.AdvertisingSetParameters.Builder.SetPrimaryPhy(Android.Bluetooth.LE.ScanSettingsPhy)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RegisterAttribute' exists on 'Android.Bluetooth.LE.AdvertisingSetParameters.Builder.SetSecondaryPhy(Android.Bluetooth.LE.ScanSettingsPhy)' in the contract but not the implementation.