summaryrefslogtreecommitdiffstats
path: root/core/java/android/server
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
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')
-rw-r--r--core/java/android/server/BluetoothEventLoop.java12
-rw-r--r--core/java/android/server/BluetoothService.java31
2 files changed, 24 insertions, 19 deletions
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 975c2ff..79a7cf8 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -283,10 +283,12 @@ class BluetoothEventLoop {
String value = null;
int len = Integer.valueOf(propValues[1]);
if (len > 0) {
- value = "";
+ StringBuilder str = new StringBuilder();
for (int i = 2; i < propValues.length; i++) {
- value = value + propValues[i] + ',';
+ str.append(propValues[i]);
+ str.append(",");
}
+ value = str.toString();
}
mBluetoothService.setProperty(name, value);
} else if (name.equals("Powered")) {
@@ -331,10 +333,12 @@ class BluetoothEventLoop {
String uuid = null;
int len = Integer.valueOf(propValues[1]);
if (len > 0) {
- uuid = "";
+ StringBuilder str = new StringBuilder();
for (int i = 2; i < propValues.length; i++) {
- uuid = uuid + propValues[i] + ",";
+ str.append(propValues[i]);
+ str.append(",");
}
+ uuid = str.toString();
}
mBluetoothService.setRemoteDeviceProperty(address, name, uuid);
} else if (name.equals("Paired")) {
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);