diff options
author | Matthew Xie <mattx@google.com> | 2011-11-17 13:10:14 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-11-17 13:10:14 -0800 |
commit | 2b9af44e401d884469869a4ac0933bfa727d3135 (patch) | |
tree | 052f7cebe46cd93bdcee3634921e542fe4243adc | |
parent | 63b7360e9d8c6fb077bdd00c7ef08f402d5a76ba (diff) | |
parent | 6da97a24e329851888890d4e380066037d08bcd7 (diff) | |
download | frameworks_base-2b9af44e401d884469869a4ac0933bfa727d3135.zip frameworks_base-2b9af44e401d884469869a4ac0933bfa727d3135.tar.gz frameworks_base-2b9af44e401d884469869a4ac0933bfa727d3135.tar.bz2 |
am 6da97a24: Merge "Check the bluetooth state for getUuid call" into ics-mr0
* commit '6da97a24e329851888890d4e380066037d08bcd7':
Check the bluetooth state for getUuid call
-rw-r--r-- | core/java/android/bluetooth/BluetoothAdapter.java | 1 | ||||
-rwxr-xr-x | core/java/android/server/BluetoothService.java | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index ea5c3db..d971652 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -533,6 +533,7 @@ public final class BluetoothAdapter { * @hide */ public ParcelUuid[] getUuids() { + if (getState() != STATE_ON) return null; try { return mService.getUuids(); } catch (RemoteException e) {Log.e(TAG, "", e);} diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index d604a01..28e231e 100755 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -810,7 +810,7 @@ public class BluetoothService extends IBluetooth.Stub { } } - /*package*/ synchronized String getProperty(String name, boolean checkState) { + /*package*/ String getProperty(String name, boolean checkState) { // If checkState is false, check if the event loop is running. // before making the call to Bluez if (checkState) { @@ -854,14 +854,14 @@ public class BluetoothService extends IBluetooth.Stub { return getProperty("Name", false); } - public synchronized ParcelUuid[] getUuids() { + public ParcelUuid[] getUuids() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String value = getProperty("UUIDs", true); if (value == null) return null; return convertStringToParcelUuid(value); } - private synchronized ParcelUuid[] convertStringToParcelUuid(String value) { + private ParcelUuid[] convertStringToParcelUuid(String value) { String[] uuidStrings = null; // The UUIDs are stored as a "," separated string. uuidStrings = value.split(","); @@ -934,7 +934,7 @@ public class BluetoothService extends IBluetooth.Stub { * @return The discoverability window of the device, in seconds. A negative * value indicates an error. */ - public synchronized int getDiscoverableTimeout() { + public int getDiscoverableTimeout() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String timeout = getProperty("DiscoverableTimeout", true); if (timeout != null) @@ -943,7 +943,7 @@ public class BluetoothService extends IBluetooth.Stub { return -1; } - public synchronized int getScanMode() { + public int getScanMode() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!isEnabledInternal()) return BluetoothAdapter.SCAN_MODE_NONE; @@ -969,7 +969,7 @@ public class BluetoothService extends IBluetooth.Stub { return stopDiscoveryNative(); } - public synchronized boolean isDiscovering() { + public boolean isDiscovering() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String discoveringProperty = getProperty("Discovering", false); @@ -2387,7 +2387,7 @@ public class BluetoothService extends IBluetooth.Stub { mDeviceProfileState.remove(address); } - synchronized String[] getKnownDevices() { + String[] getKnownDevices() { String[] bonds = null; String val = getProperty("Devices", true); if (val != null) { |