Skip to content

Commit 2b9af44

Browse files
Matthew XieAndroid Git Automerger
authored andcommitted
am 6da97a2: Merge "Check the bluetooth state for getUuid call" into ics-mr0
* commit '6da97a24e329851888890d4e380066037d08bcd7': Check the bluetooth state for getUuid call
2 parents 63b7360 + 6da97a2 commit 2b9af44

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

core/java/android/bluetooth/BluetoothAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ public String getName() {
533533
* @hide
534534
*/
535535
public ParcelUuid[] getUuids() {
536+
if (getState() != STATE_ON) return null;
536537
try {
537538
return mService.getUuids();
538539
} catch (RemoteException e) {Log.e(TAG, "", e);}

core/java/android/server/BluetoothService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ public synchronized boolean setScanMode(int mode, int duration) {
810810
}
811811
}
812812

813-
/*package*/ synchronized String getProperty(String name, boolean checkState) {
813+
/*package*/ String getProperty(String name, boolean checkState) {
814814
// If checkState is false, check if the event loop is running.
815815
// before making the call to Bluez
816816
if (checkState) {
@@ -854,14 +854,14 @@ public synchronized String getName() {
854854
return getProperty("Name", false);
855855
}
856856

857-
public synchronized ParcelUuid[] getUuids() {
857+
public ParcelUuid[] getUuids() {
858858
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
859859
String value = getProperty("UUIDs", true);
860860
if (value == null) return null;
861861
return convertStringToParcelUuid(value);
862862
}
863863

864-
private synchronized ParcelUuid[] convertStringToParcelUuid(String value) {
864+
private ParcelUuid[] convertStringToParcelUuid(String value) {
865865
String[] uuidStrings = null;
866866
// The UUIDs are stored as a "," separated string.
867867
uuidStrings = value.split(",");
@@ -934,7 +934,7 @@ public synchronized boolean setRemoteAlias(String address, String alias) {
934934
* @return The discoverability window of the device, in seconds. A negative
935935
* value indicates an error.
936936
*/
937-
public synchronized int getDiscoverableTimeout() {
937+
public int getDiscoverableTimeout() {
938938
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
939939
String timeout = getProperty("DiscoverableTimeout", true);
940940
if (timeout != null)
@@ -943,7 +943,7 @@ public synchronized int getDiscoverableTimeout() {
943943
return -1;
944944
}
945945

946-
public synchronized int getScanMode() {
946+
public int getScanMode() {
947947
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
948948
if (!isEnabledInternal())
949949
return BluetoothAdapter.SCAN_MODE_NONE;
@@ -969,7 +969,7 @@ public synchronized boolean cancelDiscovery() {
969969
return stopDiscoveryNative();
970970
}
971971

972-
public synchronized boolean isDiscovering() {
972+
public boolean isDiscovering() {
973973
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
974974

975975
String discoveringProperty = getProperty("Discovering", false);
@@ -2387,7 +2387,7 @@ void removeProfileState(String address) {
23872387
mDeviceProfileState.remove(address);
23882388
}
23892389

2390-
synchronized String[] getKnownDevices() {
2390+
String[] getKnownDevices() {
23912391
String[] bonds = null;
23922392
String val = getProperty("Devices", true);
23932393
if (val != null) {

0 commit comments

Comments
 (0)