Auto-connect Bluetooth device only when user initiates pairing.

Fix bug 2271901: do not auto-connect to services on a BT device
when pairing was initiated by the device (e.g. for OPP file transfer).

Also corrected some typos and removed an unneeded lock object in
LocalBluetoothManager (synchronize on .class object instead, like
android.bluetooth.BluetoothDevice.getService() does).

Change-Id: I121105c6eee2658129f6094786754bbc7932d324
This commit is contained in:
Jake Hamby
2010-09-23 19:16:28 -07:00
parent b2fa8719a4
commit dd79a33ba5
6 changed files with 20 additions and 15 deletions

View File

@@ -45,9 +45,8 @@ public class LocalBluetoothManager {
private static final String SHARED_PREFERENCES_NAME = "bluetooth_settings";
/** Singleton instance. */
private static LocalBluetoothManager INSTANCE;
/** Used when obtaining a reference to the singleton instance. */
private static Object INSTANCE_LOCK = new Object();
private boolean mInitialized;
private Context mContext;
@@ -86,7 +85,7 @@ public class LocalBluetoothManager {
private long mLastScan;
public static LocalBluetoothManager getInstance(Context context) {
synchronized (INSTANCE_LOCK) {
synchronized (LocalBluetoothManager.class) {
if (INSTANCE == null) {
INSTANCE = new LocalBluetoothManager();
}