From 395d1023660c5caedf7888def17f8ad826f51bf8 Mon Sep 17 00:00:00 2001
From: Jaikumar Ganesh <jaikumar@google.com>
Date: Fri, 19 Jun 2009 16:12:31 -0700
Subject: 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.
---
 core/java/android/server/BluetoothDeviceService.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'core/java/android/server/BluetoothDeviceService.java')

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])) {
-- 
cgit v1.1