Bug 29731 - [XA 5.1] Android.Bluetooth.BluetoothAdapter.Enable is incorrectly marked as [Obsolete("deprecated")]
Summary: [XA 5.1] Android.Bluetooth.BluetoothAdapter.Enable is incorrectly marked as [...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: 5.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: 6.1 (C7)
Assignee: dean.ellis
URL:
: 29684 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-04 23:42 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-05-19 17:38 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-05-04 23:42:12 UTC
[XA 5.1] Android.Bluetooth.BluetoothAdapter.Enable is incorrectly marked as [Obsolete("deprecated")] for API level 20 and higher




## Current status of the APIs

As shown on [1] and [2], the `Enable()` and `Disable()` methods for BluetoothAdapter have been marked as [Obsolete("deprecated")] for API level 20 and higher starting in Xamarin.Android 5.1.

> [1] http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/level_20_diff/mono.android.dll/#Type_Changed_Android.Bluetooth.BluetoothAdapter
> [2] http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/level_21_diff/mono.android.dll/#Type_Changed_Android.Bluetooth.BluetoothAdapter




## Expected status of the APIs

Neither the `Enable()` nor `Disable()` method should be marked deprecated.



### Additional information

The `enable()` [3] and `disable()` [4] methods are _not_ marked deprecated in the Android API docs.

> [3] http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#enable()
> [4] http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#disable()


And if I'm not mis-understanding the output from `javap`, it looks the Java bytecode doesn't contain a "deprecated" annotation for either of these methods either.

From:

> $ javap -public -v -classpath ~/Library/Developer/Xamarin/android-sdk-macosx/platforms/android-21/android.jar android.bluetooth.BluetoothAdapter


... compare some methods that _are_ deprecated:

>  public boolean startLeScan(java.util.UUID[], android.bluetooth.BluetoothAdapter$LeScanCallback);
>    Deprecated: true
>  public void stopLeScan(android.bluetooth.BluetoothAdapter$LeScanCallback);
>    Deprecated: true

... against `enable()` and `disable()`:

>  public boolean enable();
>  public boolean disable();



## Version information

Xamarin.Android 5.1.0.115 (d23da36)
Comment 2 Jonathan Pryor 2015-05-05 13:17:28 UTC
This is presumably a bug in jar2xml, and I'm not sure I want to fix.

The underlying bug will be fixed when we migrate to class-parse.

Also note that this issue isn't limited to BluetoothAdapter.enable(); it's present on *lots* of methods, e.g. Android.App.Service.OnStartCommand():

https://xamarinhq.slack.com/archives/android/p1429871801022092

I have no idea how many methods are erroneously marked as deprecated, but it's clearly at least 2.
Comment 3 Brandon Lyn 2015-05-05 14:58:08 UTC
Thanks for the insight.  Are you able to provide any more information then about when you think this issue will be fixed?
Comment 4 Jonathan Pryor 2015-05-05 16:56:24 UTC
> when [do] you think this issue will be fixed?

The original plan was to work on class-parse integration for 5.1 and make it the default in 5.2.

That got punted to instead work on improving our MSBuild task speed and behavior, so that e.g. rebuilds with no changes should be faster.

So...lol. I have no idea.
Comment 5 Jonathan Pryor 2015-05-26 11:00:02 UTC
*** Bug 29684 has been marked as a duplicate of this bug. ***
Comment 6 Udham Singh 2015-07-01 10:12:05 UTC
I have checked this issue and observed the same behaviour mentioned in bug description. Please refer the screencast : http://www.screencast.com/t/LKQurYOtY

Environment Info :

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.Android ===

Version: 5.1.4.16 (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 7 Atsushi Eno 2015-08-03 11:58:23 UTC
Fixed in [master c90a67a]. So as...

Android.App.Service
	OnStartCommand()
Android.Bluetooth.BluetoothAdapter
	Disable()
	Enable()
Android.DataBase.Sqlite.SQLiteOpenHelper
	ReadableDatabase
	WritableDatabase
Android.Hardware.Camera
	Open()
Android.Locations.SettingInjectorService
	OnStartCommand()
Android.Net.SSLCertificateSocketFactory
	CreateSocket()
	GetInsecure()
Android.OS.Parcel
	WriteFileDescriptor()
	WriteValue()
Comment 8 Jonathan Pryor 2015-08-25 17:46:13 UTC
I believe that c90a67a was reverted, and the fix needs to be re-thought.
Comment 9 Atsushi Eno 2015-08-25 23:50:13 UTC
Weird, it should NOT be reverted on that part. I'll check why those Obsolete attributes are back now.
Comment 10 Jonathan Pryor 2016-02-02 19:18:45 UTC
Should be fixed after the migration to class-parse (commit 9d3be1d3).
Comment 11 Abhishek 2016-05-19 17:38:42 UTC
I have checked this issue with latest C7 build:
xamarin.android-6.1.0-63_5eb9ddcb8cc975c6e866fc389a2524bcaa8c31fb. As per comment 7 , I am able to see the method on assemblies browser windows. Here is the screencast for the same: http://www.screencast.com/t/Ir4ryMfyv7Ev

Hence closing this issue.

Thanks!