Bug 870304: Fix misssing icon when getting paired/connected list, r=echou
authorShawn Huang <shuang@mozilla.com>
Sat, 11 May 2013 00:03:55 +0800
changeset 131515 844adf9c7f2e7c13e620151a3d6221ad5e6a7261
parent 131514 3044afa610b2bf2da2893a4fbedb86161ee36ee9
child 131516 1d7c615b4b6220629b8a3ca923e3952787dcc2d3
child 131519 096bac1de6eeed070652e0ec9e1e23730293f73f
push id24660
push userryanvm@gmail.com
push dateFri, 10 May 2013 18:56:27 +0000
treeherdermozilla-central@1d7c615b4b62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs870304
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 870304: Fix misssing icon when getting paired/connected list, r=echou
dom/bluetooth/linux/BluetoothDBusService.cpp
--- a/dom/bluetooth/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/linux/BluetoothDBusService.cpp
@@ -1940,16 +1940,37 @@ public:
         DispatchBluetoothReply(mRunnable, values, errorStr);
         return NS_OK;
       }
 
       // We have to manually attach the path to the rest of the elements
       v.get_ArrayOfBluetoothNamedValue().AppendElement(
         BluetoothNamedValue(NS_LITERAL_STRING("Path"), objectPath)
       );
+      const InfallibleTArray<BluetoothNamedValue>& deviceProperties =
+        v.get_ArrayOfBluetoothNamedValue();
+      uint32_t length = deviceProperties.Length();
+      // It is possible that property Icon missed due to CoD of major
+      // class is TOY but service class is "Audio", we need to assign
+      // Icon as audio-card. This is for PTS test TC_AG_COD_BV_02_I.
+      // As HFP specification defined that
+      // service class is "Audio" can be considered as HFP AG.
+      if (!ContainsIcon(deviceProperties)) {
+        for (uint32_t p = 0; p < length; ++p) {
+          if (deviceProperties[p].name().EqualsLiteral("Class")) {
+            if (HasAudioService(deviceProperties[p].value().get_uint32_t())) {
+              v.get_ArrayOfBluetoothNamedValue()
+                 .AppendElement(
+                 BluetoothNamedValue(NS_LITERAL_STRING("Icon"),
+                 NS_LITERAL_STRING("audio-card")));
+            }
+            break;
+          }
+        }
+      }
 
       if (mFilterFunc(v)) {
         values.get_ArrayOfBluetoothNamedValue().AppendElement(
           BluetoothNamedValue(mDeviceAddresses[i],
                               v.get_ArrayOfBluetoothNamedValue())
         );
       }
     }