From 9924d3f5859854da57289dbfd1e4fce1110436f8 Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Thu, 30 Apr 2015 16:48:39 +0800 Subject: [PATCH] Bug 1156503 - Update device name from |RemoteDevicePropertiesNotification| during discovery, r=shuang --- .../bluedroid/BluetoothServiceBluedroid.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp index e119429e086..e619fb532f6 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ -2482,8 +2482,9 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification( * RemoteDevicePropertiesNotification will be called * * (1) automatically by Bluedroid when BT is turning on, or - * (2) as result of GetRemoteDeviceProperties, or - * (3) as result of GetRemoteServices. + * (2) as result of remote device properties update during discovery, or + * (3) as result of GetRemoteDeviceProperties, or + * (4) as result of GetRemoteServices. */ void BluetoothServiceBluedroid::RemoteDevicePropertiesNotification( @@ -2654,8 +2655,18 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification( BT_APPEND_NAMED_VALUE(props, "Connected", IsConnected(aBdAddr)); if (sRequestedDeviceCountArray.IsEmpty()) { - // This is possible because the callback would be called after turning - // Bluetooth on. + /** + * This is possible when + * + * (1) the callback is called after Bluetooth is turned on, or + * (2) remote device properties get updated during discovery. + * + * For (2), fire 'devicefound' again to update device name. + * See bug 1076553 for more information. + */ + DistributeSignal(BluetoothSignal(NS_LITERAL_STRING("DeviceFound"), + NS_LITERAL_STRING(KEY_ADAPTER), + BluetoothValue(props))); return; }