summaryrefslogtreecommitdiffstats
path: root/core/java/android/server/BluetoothService.java
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2009-08-28 13:48:55 -0700
committerJaikumar Ganesh <jaikumar@google.com>2009-08-28 17:49:11 -0700
commitefa33676caf5b7a637fad73cd22c9ef23b68cdc2 (patch)
tree168789dff9f8654a04f2d81aaf36a0ce3ba545bf /core/java/android/server/BluetoothService.java
parent25b9cec8de75bd38c4868515e611cd69aff524ca (diff)
downloadframeworks_base-efa33676caf5b7a637fad73cd22c9ef23b68cdc2.zip
frameworks_base-efa33676caf5b7a637fad73cd22c9ef23b68cdc2.tar.gz
frameworks_base-efa33676caf5b7a637fad73cd22c9ef23b68cdc2.tar.bz2
Fix property being cleared when DeviceFound signal is received.
Diffstat (limited to 'core/java/android/server/BluetoothService.java')
-rw-r--r--core/java/android/server/BluetoothService.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 413f6a8..21104c8 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -551,20 +551,21 @@ public class BluetoothService extends IBluetooth.Stub {
for (int i = 0; i < properties.length; i++) {
String name = properties[i];
- String newValue;
+ String newValue = null;
int len;
if (name == null) {
Log.e(TAG, "Error:Adapter Property at index" + i + "is null");
continue;
}
if (name.equals("Devices")) {
+ StringBuilder str = new StringBuilder();
len = Integer.valueOf(properties[++i]);
- if (len != 0)
- newValue = "";
- else
- newValue = null;
for (int j = 0; j < len; j++) {
- newValue += properties[++i] + ",";
+ str.append(properties[++i]);
+ str.append(",");
+ }
+ if (len > 0) {
+ newValue = str.toString();
}
} else {
newValue = properties[++i];
@@ -837,32 +838,32 @@ public class BluetoothService extends IBluetooth.Stub {
* We get a DeviceFound signal every time RSSI changes or name changes.
* Don't create a new Map object every time */
Map<String, String> propertyValues = mDeviceProperties.get(address);
- if (propertyValues != null) {
- propertyValues.clear();
- } else {
+ if (propertyValues == null) {
propertyValues = new HashMap<String, String>();
}
for (int i = 0; i < properties.length; i++) {
String name = properties[i];
- String newValue;
+ String newValue = null;
int len;
if (name == null) {
Log.e(TAG, "Error: Remote Device Property at index" + i + "is null");
continue;
}
if (name.equals("UUIDs") || name.equals("Nodes")) {
+ StringBuilder str = new StringBuilder();
len = Integer.valueOf(properties[++i]);
- if (len != 0)
- newValue = "";
- else
- newValue = null;
for (int j = 0; j < len; j++) {
- newValue += properties[++i] + ",";
+ str.append(properties[++i]);
+ str.append(",");
+ }
+ if (len > 0) {
+ newValue = str.toString();
}
} else {
newValue = properties[++i];
}
+
propertyValues.put(name, newValue);
}
mDeviceProperties.put(address, propertyValues);