Commit cca997a
[Mono.Android] Fix incorrect Bluetooth enumification (#6214)
Fixes: https://developercommunity2.visualstudio.com/t/xamarin-android-bluetooth-the-advertisin/841102
Fixes: #2595
Update enumification of various
`Android.Bluetooth.LE.AdvertisingSetParameters.Builder` and
`Android.Bluetooth.BluetoothDevice` methods to use the
`Android.Bluetooth.BluetoothPhy` enum instead of the
`Android.Bluetooth.LE.ScanSettingsPhy` enum, introduced in e33eb53.
Backwards compatibility is achieved by creating overloads for the
existing methods in `Additions`, and marking them as `[Obsolete]`.
The API "breakage" is because the `[Register]` attribute has moved
from the incorrect methods to the correct methods. As the signature
change is an enum, the marshalled type is still an `int`, so moving
the `[Register]` should not cause issues.
For example:
// Current
[Register]
public void DoSomething (BadEnum value) { ... }
// Fixed
[Register]
public void DoSomething (GoodEnum value) { ... }
[Obsolete ("Use DoSomething(GoodEnum)")]
public void DoSomething (BadEnum value) => DoSomething ((GoodEnum)value);
Note: this is only generally save to do when `DoSomething()` is a
*non-`virtual`* method (i.e. Java `final` method). Fortunately, this
is the case with the methods involved here.1 parent ed5ad12 commit cca997a
File tree
5 files changed
+54
-3
lines changed- src/Mono.Android
- Android.Bluetooth
- tests/api-compatibility
5 files changed
+54
-3
lines changedLines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2189 | 2189 | | |
2190 | 2190 | | |
2191 | 2191 | | |
2192 | | - | |
2193 | | - | |
| 2192 | + | |
| 2193 | + | |
2194 | 2194 | | |
2195 | 2195 | | |
2196 | 2196 | | |
| |||
2205 | 2205 | | |
2206 | 2206 | | |
2207 | 2207 | | |
2208 | | - | |
| 2208 | + | |
2209 | 2209 | | |
2210 | 2210 | | |
2211 | 2211 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments