diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2009-06-19 16:12:31 -0700 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2009-06-19 17:43:36 -0700 |
commit | 395d1023660c5caedf7888def17f8ad826f51bf8 (patch) | |
tree | f2d390311efa3d6be7cdcc58ab68aef0953bce1e | |
parent | aba6af9277b34c739b83d3d2d908724c3f7ec1b4 (diff) | |
download | frameworks_base-395d1023660c5caedf7888def17f8ad826f51bf8.zip frameworks_base-395d1023660c5caedf7888def17f8ad826f51bf8.tar.gz frameworks_base-395d1023660c5caedf7888def17f8ad826f51bf8.tar.bz2 |
Send the name of the device in the DeviceFound signal.
When name resolution is done, we get a DeviceFound signal.
Settings app was not updating the cache.
-rw-r--r-- | core/java/android/server/BluetoothDeviceService.java | 11 | ||||
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/server/BluetoothDeviceService.java b/core/java/android/server/BluetoothDeviceService.java index dcaede2..75c590d 100644 --- a/core/java/android/server/BluetoothDeviceService.java +++ b/core/java/android/server/BluetoothDeviceService.java @@ -809,7 +809,16 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { } /* package */ synchronized void addRemoteDeviceProperties(String address, String[] properties) { - Map<String, String> propertyValues = new HashMap<String, String>(); + /* + * 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 = mRemoteDeviceProperties.get(address); + if (propertyValues != null) { + propertyValues.clear(); + } else { + propertyValues = new HashMap<String, String>(); + } + for (int i = 0; i < properties.length; i+=2) { String value = null; if (propertyValues.containsKey(properties[i])) { diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 00c13b7..ed66dce 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -130,12 +130,14 @@ class BluetoothEventLoop { mBluetoothService.addRemoteDeviceProperties(address, properties); String rssi = mBluetoothService.getRemoteDeviceProperty(address, "RSSI"); String classValue = mBluetoothService.getRemoteDeviceProperty(address, "Class"); + String name = mBluetoothService.getRemoteDeviceProperty(address, "Name"); if (rssi != null && classValue != null) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_FOUND_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - intent.putExtra(BluetoothIntent.CLASS, classValue); + intent.putExtra(BluetoothIntent.CLASS, Integer.valueOf(classValue)); intent.putExtra(BluetoothIntent.RSSI, (short)Integer.valueOf(rssi).intValue()); + intent.putExtra(BluetoothIntent.NAME, name); mContext.sendBroadcast(intent, BLUETOOTH_PERM); } else { |