Loading api/current.xml +11 −11 Original line number Original line Diff line number Diff line Loading @@ -25550,6 +25550,17 @@ visibility="public" visibility="public" > > </method> </method> <method name="getDefaultAdapter" return="android.bluetooth.BluetoothAdapter" abstract="false" native="false" synchronized="true" static="true" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getName" <method name="getName" return="java.lang.String" return="java.lang.String" abstract="false" abstract="false" Loading Loading @@ -31505,17 +31516,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="BLUETOOTH_SERVICE" type="java.lang.String" transient="false" volatile="false" value=""bluetooth"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CLIPBOARD_SERVICE" <field name="CLIPBOARD_SERVICE" type="java.lang.String" type="java.lang.String" transient="false" transient="false" core/java/android/app/ApplicationContext.java +0 −18 Original line number Original line Diff line number Diff line Loading @@ -22,8 +22,6 @@ import com.google.android.collect.Maps; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; import android.bluetooth.BluetoothAdapter; import android.bluetooth.IBluetooth; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentResolver; Loading Loading @@ -182,8 +180,6 @@ class ApplicationContext extends Context { private StatusBarManager mStatusBarManager = null; private StatusBarManager mStatusBarManager = null; private TelephonyManager mTelephonyManager = null; private TelephonyManager mTelephonyManager = null; private ClipboardManager mClipboardManager = null; private ClipboardManager mClipboardManager = null; private boolean mIsBluetoothAdapterCached = false; private BluetoothAdapter mBluetoothAdapter; private boolean mRestricted; private boolean mRestricted; private AccountManager mAccountManager; // protected by mSync private AccountManager mAccountManager; // protected by mSync Loading Loading @@ -883,8 +879,6 @@ class ApplicationContext extends Context { return getSearchManager(); return getSearchManager(); } else if (SENSOR_SERVICE.equals(name)) { } else if (SENSOR_SERVICE.equals(name)) { return getSensorManager(); return getSensorManager(); } else if (BLUETOOTH_SERVICE.equals(name)) { return getBluetoothAdapter(); } else if (VIBRATOR_SERVICE.equals(name)) { } else if (VIBRATOR_SERVICE.equals(name)) { return getVibrator(); return getVibrator(); } else if (STATUS_BAR_SERVICE.equals(name)) { } else if (STATUS_BAR_SERVICE.equals(name)) { Loading Loading @@ -1034,18 +1028,6 @@ class ApplicationContext extends Context { return mSearchManager; return mSearchManager; } } private synchronized BluetoothAdapter getBluetoothAdapter() { if (!mIsBluetoothAdapterCached) { mIsBluetoothAdapterCached = true; IBinder b = ServiceManager.getService(BLUETOOTH_SERVICE); if (b != null) { IBluetooth service = IBluetooth.Stub.asInterface(b); mBluetoothAdapter = new BluetoothAdapter(service); } } return mBluetoothAdapter; } private SensorManager getSensorManager() { private SensorManager getSensorManager() { synchronized (mSync) { synchronized (mSync) { if (mSensorManager == null) { if (mSensorManager == null) { Loading core/java/android/bluetooth/BluetoothAdapter.java +33 −5 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; import android.os.Binder; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Message; import android.os.ParcelUuid; import android.os.ParcelUuid; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import android.util.Log; import java.io.IOException; import java.io.IOException; Loading @@ -36,10 +38,8 @@ import java.util.UUID; /** /** * Represents the local Bluetooth adapter. * Represents the local Bluetooth adapter. * * * <p>Use {@link android.content.Context#getSystemService} with {@link * <p>Use {@link #getDefaultAdapter} to get the default local Bluetooth * android.content.Context#BLUETOOTH_SERVICE} to get the default local * adapter. * Bluetooth adapter. On most Android devices there is only one local * Bluetotoh adapter. * * * <p>Use the {@link BluetoothDevice} class for operations on remote Bluetooth * <p>Use the {@link BluetoothDevice} class for operations on remote Bluetooth * devices. * devices. Loading Loading @@ -257,12 +257,40 @@ public final class BluetoothAdapter { */ */ public static final String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME"; public static final String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME"; /** @hide */ public static final String BLUETOOTH_SERVICE = "bluetooth"; private static final int ADDRESS_LENGTH = 17; private static final int ADDRESS_LENGTH = 17; /** * Lazyily initialized singleton. Guaranteed final after first object * constructed. */ private static BluetoothAdapter sAdapter; private final IBluetooth mService; private final IBluetooth mService; /** /** * Do not use this constructor. Use Context.getSystemService() instead. * Get a handle to the default local Bluetooth adapter. * <p>Currently Android only supports one Bluetooth adapter, but the API * could be extended to support more. This will always return the default * adapter. * @return the default local adapter, or null if Bluetooth is not supported * on this hardware platform */ public static synchronized BluetoothAdapter getDefaultAdapter() { if (sAdapter == null) { IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); if (b != null) { IBluetooth service = IBluetooth.Stub.asInterface(b); sAdapter = new BluetoothAdapter(service); } } return sAdapter; } /** * Use {@link #getDefaultAdapter} to get the BluetoothAdapter instance. * @hide * @hide */ */ public BluetoothAdapter(IBluetooth service) { public BluetoothAdapter(IBluetooth service) { Loading core/java/android/bluetooth/BluetoothDevice.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.bluetooth; import android.annotation.SdkConstant; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.content.Context; import android.os.IBinder; import android.os.IBinder; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; Loading Loading @@ -328,7 +327,7 @@ public final class BluetoothDevice implements Parcelable { /*package*/ static IBluetooth getService() { /*package*/ static IBluetooth getService() { synchronized (BluetoothDevice.class) { synchronized (BluetoothDevice.class) { if (sService == null) { if (sService == null) { IBinder b = ServiceManager.getService(Context.BLUETOOTH_SERVICE); IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); if (b == null) { if (b == null) { throw new RuntimeException("Bluetooth service not available"); throw new RuntimeException("Bluetooth service not available"); } } Loading core/java/android/content/Context.java +0 −8 Original line number Original line Diff line number Diff line Loading @@ -1217,14 +1217,6 @@ public abstract class Context { * @see android.hardware.SensorManager * @see android.hardware.SensorManager */ */ public static final String SENSOR_SERVICE = "sensor"; public static final String SENSOR_SERVICE = "sensor"; /** * Use with {@link #getSystemService} to retrieve a {@link * android.bluetooth.BluetoothAdapter} for using Bluetooth. * * @see #getSystemService * @see android.bluetooth.BluetoothAdapter */ public static final String BLUETOOTH_SERVICE = "bluetooth"; /** /** * Use with {@link #getSystemService} to retrieve a * Use with {@link #getSystemService} to retrieve a * com.android.server.WallpaperService for accessing wallpapers. * com.android.server.WallpaperService for accessing wallpapers. Loading Loading
api/current.xml +11 −11 Original line number Original line Diff line number Diff line Loading @@ -25550,6 +25550,17 @@ visibility="public" visibility="public" > > </method> </method> <method name="getDefaultAdapter" return="android.bluetooth.BluetoothAdapter" abstract="false" native="false" synchronized="true" static="true" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getName" <method name="getName" return="java.lang.String" return="java.lang.String" abstract="false" abstract="false" Loading Loading @@ -31505,17 +31516,6 @@ visibility="public" visibility="public" > > </field> </field> <field name="BLUETOOTH_SERVICE" type="java.lang.String" transient="false" volatile="false" value=""bluetooth"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CLIPBOARD_SERVICE" <field name="CLIPBOARD_SERVICE" type="java.lang.String" type="java.lang.String" transient="false" transient="false"
core/java/android/app/ApplicationContext.java +0 −18 Original line number Original line Diff line number Diff line Loading @@ -22,8 +22,6 @@ import com.google.android.collect.Maps; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; import android.bluetooth.BluetoothAdapter; import android.bluetooth.IBluetooth; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentResolver; Loading Loading @@ -182,8 +180,6 @@ class ApplicationContext extends Context { private StatusBarManager mStatusBarManager = null; private StatusBarManager mStatusBarManager = null; private TelephonyManager mTelephonyManager = null; private TelephonyManager mTelephonyManager = null; private ClipboardManager mClipboardManager = null; private ClipboardManager mClipboardManager = null; private boolean mIsBluetoothAdapterCached = false; private BluetoothAdapter mBluetoothAdapter; private boolean mRestricted; private boolean mRestricted; private AccountManager mAccountManager; // protected by mSync private AccountManager mAccountManager; // protected by mSync Loading Loading @@ -883,8 +879,6 @@ class ApplicationContext extends Context { return getSearchManager(); return getSearchManager(); } else if (SENSOR_SERVICE.equals(name)) { } else if (SENSOR_SERVICE.equals(name)) { return getSensorManager(); return getSensorManager(); } else if (BLUETOOTH_SERVICE.equals(name)) { return getBluetoothAdapter(); } else if (VIBRATOR_SERVICE.equals(name)) { } else if (VIBRATOR_SERVICE.equals(name)) { return getVibrator(); return getVibrator(); } else if (STATUS_BAR_SERVICE.equals(name)) { } else if (STATUS_BAR_SERVICE.equals(name)) { Loading Loading @@ -1034,18 +1028,6 @@ class ApplicationContext extends Context { return mSearchManager; return mSearchManager; } } private synchronized BluetoothAdapter getBluetoothAdapter() { if (!mIsBluetoothAdapterCached) { mIsBluetoothAdapterCached = true; IBinder b = ServiceManager.getService(BLUETOOTH_SERVICE); if (b != null) { IBluetooth service = IBluetooth.Stub.asInterface(b); mBluetoothAdapter = new BluetoothAdapter(service); } } return mBluetoothAdapter; } private SensorManager getSensorManager() { private SensorManager getSensorManager() { synchronized (mSync) { synchronized (mSync) { if (mSensorManager == null) { if (mSensorManager == null) { Loading
core/java/android/bluetooth/BluetoothAdapter.java +33 −5 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,11 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; import android.os.Binder; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Message; import android.os.ParcelUuid; import android.os.ParcelUuid; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import android.util.Log; import java.io.IOException; import java.io.IOException; Loading @@ -36,10 +38,8 @@ import java.util.UUID; /** /** * Represents the local Bluetooth adapter. * Represents the local Bluetooth adapter. * * * <p>Use {@link android.content.Context#getSystemService} with {@link * <p>Use {@link #getDefaultAdapter} to get the default local Bluetooth * android.content.Context#BLUETOOTH_SERVICE} to get the default local * adapter. * Bluetooth adapter. On most Android devices there is only one local * Bluetotoh adapter. * * * <p>Use the {@link BluetoothDevice} class for operations on remote Bluetooth * <p>Use the {@link BluetoothDevice} class for operations on remote Bluetooth * devices. * devices. Loading Loading @@ -257,12 +257,40 @@ public final class BluetoothAdapter { */ */ public static final String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME"; public static final String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME"; /** @hide */ public static final String BLUETOOTH_SERVICE = "bluetooth"; private static final int ADDRESS_LENGTH = 17; private static final int ADDRESS_LENGTH = 17; /** * Lazyily initialized singleton. Guaranteed final after first object * constructed. */ private static BluetoothAdapter sAdapter; private final IBluetooth mService; private final IBluetooth mService; /** /** * Do not use this constructor. Use Context.getSystemService() instead. * Get a handle to the default local Bluetooth adapter. * <p>Currently Android only supports one Bluetooth adapter, but the API * could be extended to support more. This will always return the default * adapter. * @return the default local adapter, or null if Bluetooth is not supported * on this hardware platform */ public static synchronized BluetoothAdapter getDefaultAdapter() { if (sAdapter == null) { IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); if (b != null) { IBluetooth service = IBluetooth.Stub.asInterface(b); sAdapter = new BluetoothAdapter(service); } } return sAdapter; } /** * Use {@link #getDefaultAdapter} to get the BluetoothAdapter instance. * @hide * @hide */ */ public BluetoothAdapter(IBluetooth service) { public BluetoothAdapter(IBluetooth service) { Loading
core/java/android/bluetooth/BluetoothDevice.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.bluetooth; import android.annotation.SdkConstant; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SdkConstant.SdkConstantType; import android.content.Context; import android.os.IBinder; import android.os.IBinder; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; Loading Loading @@ -328,7 +327,7 @@ public final class BluetoothDevice implements Parcelable { /*package*/ static IBluetooth getService() { /*package*/ static IBluetooth getService() { synchronized (BluetoothDevice.class) { synchronized (BluetoothDevice.class) { if (sService == null) { if (sService == null) { IBinder b = ServiceManager.getService(Context.BLUETOOTH_SERVICE); IBinder b = ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE); if (b == null) { if (b == null) { throw new RuntimeException("Bluetooth service not available"); throw new RuntimeException("Bluetooth service not available"); } } Loading
core/java/android/content/Context.java +0 −8 Original line number Original line Diff line number Diff line Loading @@ -1217,14 +1217,6 @@ public abstract class Context { * @see android.hardware.SensorManager * @see android.hardware.SensorManager */ */ public static final String SENSOR_SERVICE = "sensor"; public static final String SENSOR_SERVICE = "sensor"; /** * Use with {@link #getSystemService} to retrieve a {@link * android.bluetooth.BluetoothAdapter} for using Bluetooth. * * @see #getSystemService * @see android.bluetooth.BluetoothAdapter */ public static final String BLUETOOTH_SERVICE = "bluetooth"; /** /** * Use with {@link #getSystemService} to retrieve a * Use with {@link #getSystemService} to retrieve a * com.android.server.WallpaperService for accessing wallpapers. * com.android.server.WallpaperService for accessing wallpapers. Loading