Backed out 4 changesets (bug 1146923) for bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 25 Mar 2015 10:05:42 -0400
changeset 264463 8f132c4bba3d0a90e722d42934a4aa830dbdb1a7
parent 264462 45fbe03aa801691cfe94570b711c4b2f11d09256
child 264464 6415ed807f10d43013847c1b5fdd45a353e3e528
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1146923
milestone39.0a1
backs out926351238914109ad550f1588e831a1750daa27b
7d8eb56f1e2402e86e6114d85d2839ecca748dd3
c5d4efed15e981c7f63ec5af27273eb3aa829eed
045020b31842f46212b3af70db377038e18cd39d
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
Backed out 4 changesets (bug 1146923) for bustage. Backed out changeset 926351238914 (bug 1146923) Backed out changeset 7d8eb56f1e24 (bug 1146923) Backed out changeset c5d4efed15e9 (bug 1146923) Backed out changeset 045020b31842 (bug 1146923) CLOSED TREE
dom/bluetooth/BluetoothCommon.h
dom/bluetooth/BluetoothInterface.h
dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
dom/bluetooth/bluedroid/BluetoothHALHelpers.h
dom/bluetooth/bluedroid/BluetoothHALInterface.cpp
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
--- a/dom/bluetooth/BluetoothCommon.h
+++ b/dom/bluetooth/BluetoothCommon.h
@@ -7,29 +7,16 @@
 #ifndef mozilla_dom_bluetooth_bluetoothcommon_h__
 #define mozilla_dom_bluetooth_bluetoothcommon_h__
 
 #include "mozilla/Observer.h"
 #include "nsPrintfCString.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
-#if MOZ_IS_GCC && MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
-/* use designated array initializers if supported */
-#define INIT_ARRAY_AT(in_, out_) \
-  [in_] = out_
-#else
-/* otherwise init array element by position */
-#define INIT_ARRAY_AT(in_, out_) \
-  out_
-#endif
-
-#define CONVERT(in_, out_) \
-  INIT_ARRAY_AT(in_, out_)
-
 extern bool gBluetoothDebugFlag;
 
 #define SWITCH_BT_DEBUG(V) (gBluetoothDebugFlag = V)
 
 #undef BT_LOG
 #if defined(MOZ_WIDGET_GONK)
 #include <android/log.h>
 
@@ -160,20 +147,20 @@ enum BluetoothStatus {
 };
 
 enum BluetoothBondState {
   BOND_STATE_NONE,
   BOND_STATE_BONDING,
   BOND_STATE_BONDED
 };
 
-enum BluetoothTypeOfDevice {
-  TYPE_OF_DEVICE_BREDR,
-  TYPE_OF_DEVICE_BLE,
-  TYPE_OF_DEVICE_DUAL
+enum BluetoothDeviceType {
+  DEVICE_TYPE_BREDR,
+  DEVICE_TYPE_BLE,
+  DEVICE_TYPE_DUAL
 };
 
 enum BluetoothPropertyType {
   PROPERTY_UNKNOWN,
   PROPERTY_BDNAME,
   PROPERTY_BDADDR,
   PROPERTY_UUIDS,
   PROPERTY_CLASS_OF_DEVICE,
@@ -189,23 +176,16 @@ enum BluetoothPropertyType {
 };
 
 enum BluetoothScanMode {
   SCAN_MODE_NONE,
   SCAN_MODE_CONNECTABLE,
   SCAN_MODE_CONNECTABLE_DISCOVERABLE
 };
 
-enum BluetoothSspVariant {
-  SSP_VARIANT_PASSKEY_CONFIRMATION,
-  SSP_VARIANT_PASSKEY_ENTRY,
-  SSP_VARIANT_CONSENT,
-  SSP_VARIANT_PASSKEY_NOTIFICATION
-};
-
 struct BluetoothUuid {
   uint8_t mUuid[16];
 };
 
 struct BluetoothServiceRecord {
   BluetoothUuid mUuid;
   uint16_t mChannel;
   char mName[256];
@@ -237,18 +217,18 @@ struct BluetoothProperty {
 
   /* PROPERTY_CLASS_OF_DEVICE
      PROPERTY_ADAPTER_DISCOVERY_TIMEOUT */
   uint32_t mUint32;
 
   /* PROPERTY_RSSI_VALUE */
   int32_t mInt32;
 
-  /* PROPERTY_TYPE_OF_DEVICE */
-  BluetoothTypeOfDevice mTypeOfDevice;
+  /* PROPERTY_DEVICE_TYPE */
+  BluetoothDeviceType mDeviceType;
 
   /* PROPERTY_SERVICE_RECORD */
   BluetoothServiceRecord mServiceRecord;
 
   /* PROPERTY_SCAN_MODE */
   BluetoothScanMode mScanMode;
 
   /* PROPERTY_REMOTE_VERSION_INFO */
--- a/dom/bluetooth/BluetoothInterface.h
+++ b/dom/bluetooth/BluetoothInterface.h
@@ -509,17 +509,17 @@ public:
 
   virtual void DiscoveryStateChangedNotification(bool aState) { }
 
   virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
                                       const nsAString& aBdName, uint32_t aCod) { }
   virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
                                       const nsAString& aBdName,
                                       uint32_t aCod,
-                                      BluetoothSspVariant aPairingVariant,
+                                      const nsAString& aPairingVariant,
                                       uint32_t aPassKey) { }
 
   virtual void BondStateChangedNotification(BluetoothStatus aStatus,
                                             const nsAString& aRemoteBdAddr,
                                             BluetoothBondState aState) { }
   virtual void AclStateChangedNotification(BluetoothStatus aStatus,
                                            const nsAString& aRemoteBdAddr,
                                            bool aState) { }
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
@@ -77,29 +77,29 @@ Convert(int aIn, int32_t& aOut)
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = static_cast<int32_t>(aIn);
   return NS_OK;
 }
 
 nsresult
-Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
+Convert(int32_t aIn, BluetoothDeviceType& aOut)
 {
-  static const BluetoothTypeOfDevice sTypeOfDevice[] = {
-    CONVERT(0x00, static_cast<BluetoothTypeOfDevice>(0)), // invalid, required by gcc
-    CONVERT(0x01, TYPE_OF_DEVICE_BREDR),
-    CONVERT(0x02, TYPE_OF_DEVICE_BLE),
-    CONVERT(0x03, TYPE_OF_DEVICE_DUAL)
+  static const BluetoothDeviceType sDeviceType[] = {
+    CONVERT(0x00, static_cast<BluetoothDeviceType>(0)), // invalid, required by gcc
+    CONVERT(0x01, DEVICE_TYPE_BREDR),
+    CONVERT(0x02, DEVICE_TYPE_BLE),
+    CONVERT(0x03, DEVICE_TYPE_DUAL)
   };
   if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice))) {
+      NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sDeviceType))) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
-  aOut = sTypeOfDevice[aIn];
+  aOut = sDeviceType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(int32_t aIn, BluetoothScanMode& aOut)
 {
   static const BluetoothScanMode sScanMode[] = {
     CONVERT(0x00, SCAN_MODE_NONE),
@@ -450,28 +450,28 @@ Convert(BluetoothSocketType aIn, uint8_t
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sSocketType[aIn];
   return NS_OK;
 }
 
 nsresult
-Convert(uint8_t aIn, BluetoothSspVariant& aOut)
+Convert(uint8_t aIn, BluetoothSspPairingVariant& aOut)
 {
-  static const BluetoothSspVariant sSspVariant[] = {
+  static const BluetoothSspPairingVariant sSspPairingVariant[] = {
     CONVERT(0x00, SSP_VARIANT_PASSKEY_CONFIRMATION),
     CONVERT(0x01, SSP_VARIANT_PASSKEY_ENTRY),
     CONVERT(0x02, SSP_VARIANT_CONSENT),
     CONVERT(0x03, SSP_VARIANT_PASSKEY_NOTIFICATION)
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspVariant))) {
+  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspPairingVariant))) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
-  aOut = sSspVariant[aIn];
+  aOut = sSspPairingVariant[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothStatus& aOut)
 {
   static const BluetoothStatus sStatus[] = {
     CONVERT(0x00, STATUS_SUCCESS),
@@ -594,17 +594,17 @@ Convert(const nsAString& aIn, BluetoothS
 
   memcpy(aOut.mName, str, len);
   memset(aOut.mName + len, 0, sizeof(aOut.mName) - len);
 
   return NS_OK;
 }
 
 nsresult
-Convert(const nsAString& aIn, BluetoothSspVariant& aOut)
+Convert(const nsAString& aIn, BluetoothSspPairingVariant& aOut)
 {
   if (aIn.EqualsLiteral("PasskeyConfirmation")) {
     aOut = SSP_VARIANT_PASSKEY_CONFIRMATION;
   } else if (aIn.EqualsLiteral("PasskeyEntry")) {
     aOut = SSP_VARIANT_PASSKEY_ENTRY;
   } else if (aIn.EqualsLiteral("Consent")) {
     aOut = SSP_VARIANT_CONSENT;
   } else if (aIn.EqualsLiteral("PasskeyNotification")) {
@@ -937,34 +937,34 @@ Convert(BluetoothScanMode aIn, int32_t& 
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sScanMode[aIn];
   return NS_OK;
 }
 
 nsresult
-Convert(BluetoothSspVariant aIn, uint8_t& aOut)
+Convert(BluetoothSspPairingVariant aIn, uint8_t& aOut)
 {
   static const uint8_t sValue[] = {
     CONVERT(SSP_VARIANT_PASSKEY_CONFIRMATION, 0x00),
     CONVERT(SSP_VARIANT_PASSKEY_ENTRY, 0x01),
     CONVERT(SSP_VARIANT_CONSENT, 0x02),
     CONVERT(SSP_VARIANT_PASSKEY_NOTIFICATION, 0x03)
   };
   if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
-Convert(BluetoothSspVariant aIn, nsAString& aOut)
+Convert(BluetoothSspPairingVariant aIn, nsAString& aOut)
 {
   static const char* const sString[] = {
     CONVERT(SSP_VARIANT_PASSKEY_CONFIRMATION, "PasskeyConfirmation"),
     CONVERT(SSP_VARIANT_PASSKEY_ENTRY, "PasskeyEntry"),
     CONVERT(SSP_VARIANT_CONSENT, "Consent"),
     CONVERT(SSP_VARIANT_PASSKEY_NOTIFICATION, "PasskeyNotification")
   };
   if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sString))) {
@@ -1326,19 +1326,20 @@ PackPDU(const BluetoothPinCode& aIn, Blu
 
 nsresult
 PackPDU(BluetoothPropertyType aIn, BluetoothDaemonPDU& aPDU)
 {
   return PackPDU(PackConversion<BluetoothPropertyType, uint8_t>(aIn), aPDU);
 }
 
 nsresult
-PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU)
+PackPDU(BluetoothSspPairingVariant aIn, BluetoothDaemonPDU& aPDU)
 {
-  return PackPDU(PackConversion<BluetoothSspVariant, uint8_t>(aIn), aPDU);
+  return PackPDU(PackConversion<BluetoothSspPairingVariant, uint8_t>(aIn),
+                 aPDU);
 }
 
 nsresult
 PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU)
 {
   return PackPDU(PackConversion<BluetoothScanMode, int32_t>(aIn), aPDU);
 }
 
@@ -1454,20 +1455,20 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, Blue
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut)
 {
   return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothBondState>(aOut));
 }
 
 nsresult
-UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut)
+UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDeviceType& aOut)
 {
   return UnpackPDU(
-    aPDU, UnpackConversion<int32_t, BluetoothTypeOfDevice>(aOut));
+    aPDU, UnpackConversion<int32_t, BluetoothDeviceType>(aOut));
 }
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut)
 {
   return UnpackPDU(
     aPDU, UnpackConversion<uint8_t, BluetoothHandsfreeAudioState>(aOut));
 }
@@ -1547,17 +1548,17 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, Blue
       }
       break;
     case PROPERTY_CLASS_OF_DEVICE:
       /* fall through */
     case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
       rv = UnpackPDU(aPDU, aOut.mUint32);
       break;
     case PROPERTY_TYPE_OF_DEVICE:
-      rv = UnpackPDU(aPDU, aOut.mTypeOfDevice);
+      rv = UnpackPDU(aPDU, aOut.mDeviceType);
       break;
     case PROPERTY_SERVICE_RECORD:
       rv = UnpackPDU(aPDU, aOut.mServiceRecord);
       break;
     case PROPERTY_ADAPTER_SCAN_MODE:
       rv = UnpackPDU(aPDU, aOut.mScanMode);
       break;
     case PROPERTY_ADAPTER_BONDED_DEVICES: {
@@ -1635,20 +1636,20 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, Blue
   if (NS_FAILED(rv)) {
     return rv;
   }
   /* unpack name */
   return aPDU.Read(aOut.mName, sizeof(aOut.mName));
 }
 
 nsresult
-UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut)
+UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspPairingVariant& aOut)
 {
   return UnpackPDU(
-    aPDU, UnpackConversion<uint8_t, BluetoothSspVariant>(aOut));
+    aPDU, UnpackConversion<uint8_t, BluetoothSspPairingVariant>(aOut));
 }
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut)
 {
   return UnpackPDU(aPDU, UnpackConversion<uint8_t, BluetoothStatus>(aOut));
 }
 
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h
@@ -8,29 +8,49 @@
 #define mozilla_dom_bluetooth_bluedroid_bluetoothdaemonhelpers_h__
 
 #include "BluetoothCommon.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/ipc/BluetoothDaemonConnection.h"
 #include "nsThreadUtils.h"
 
+#if MOZ_IS_GCC && MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
+/* use designated array initializers if supported */
+#define INIT_ARRAY_AT(in_, out_) \
+  [in_] = out_
+#else
+/* otherwise init array element by position */
+#define INIT_ARRAY_AT(in_, out_) \
+  out_
+#endif
+
+#define CONVERT(in_, out_) \
+  INIT_ARRAY_AT(in_, out_)
+
 using namespace mozilla::ipc;
 
 BEGIN_BLUETOOTH_NAMESPACE
 
 //
 // Helper structures
 //
 
 enum BluetoothAclState {
   ACL_STATE_CONNECTED,
   ACL_STATE_DISCONNECTED
 };
 
+enum BluetoothSspPairingVariant {
+  SSP_VARIANT_PASSKEY_CONFIRMATION,
+  SSP_VARIANT_PASSKEY_ENTRY,
+  SSP_VARIANT_CONSENT,
+  SSP_VARIANT_PASSKEY_NOTIFICATION
+};
+
 struct BluetoothAddress {
   uint8_t mAddr[6];
 };
 
 struct BluetoothAvrcpAttributeTextPairs {
   BluetoothAvrcpAttributeTextPairs(const uint8_t* aAttr,
                                    const char** aText,
                                    size_t aLength)
@@ -158,17 +178,17 @@ Convert(int aIn, uint8_t& aOut);
 
 nsresult
 Convert(int aIn, int16_t& aOut);
 
 nsresult
 Convert(int aIn, int32_t& aOut);
 
 nsresult
-Convert(int32_t aIn, BluetoothTypeOfDevice& aOut);
+Convert(int32_t aIn, BluetoothDeviceType& aOut);
 
 nsresult
 Convert(int32_t aIn, BluetoothScanMode& aOut);
 
 nsresult
 Convert(uint8_t aIn, bool& aOut);
 
 nsresult
@@ -221,26 +241,26 @@ Convert(uint8_t aIn, BluetoothHandsfreeV
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeWbsConfig& aOut);
 
 nsresult
 Convert(uint8_t aIn, BluetoothBondState& aOut);
 
 nsresult
-Convert(uint8_t aIn, BluetoothTypeOfDevice& aOut);
+Convert(uint8_t aIn, BluetoothDeviceType& aOut);
 
 nsresult
 Convert(uint8_t aIn, BluetoothPropertyType& aOut);
 
 nsresult
 Convert(uint8_t aIn, BluetoothScanMode& aOut);
 
 nsresult
-Convert(uint8_t aIn, BluetoothSspVariant& aOut);
+Convert(uint8_t aIn, BluetoothSspPairingVariant& aOut);
 
 nsresult
 Convert(uint8_t aIn, BluetoothStatus& aOut);
 
 nsresult
 Convert(uint32_t aIn, int& aOut);
 
 nsresult
@@ -257,17 +277,17 @@ Convert(const nsAString& aIn, BluetoothP
 
 nsresult
 Convert(const nsAString& aIn, BluetoothPropertyType& aOut);
 
 nsresult
 Convert(const nsAString& aIn, BluetoothServiceName& aOut);
 
 nsresult
-Convert(const nsAString& aIn, BluetoothSspVariant& aOut);
+Convert(const nsAString& aIn, BluetoothSspPairingVariant& aOut);
 
 nsresult
 Convert(BluetoothAclState aIn, bool& aOut);
 
 nsresult
 Convert(const BluetoothAddress& aIn, nsAString& aOut);
 
 nsresult
@@ -323,20 +343,20 @@ Convert(const BluetoothRemoteName& aIn, 
 
 nsresult
 Convert(BluetoothScanMode aIn, uint8_t& aOut);
 
 nsresult
 Convert(BluetoothSocketType aIn, uint8_t& aOut);
 
 nsresult
-Convert(BluetoothSspVariant aIn, uint8_t& aOut);
+Convert(BluetoothSspPairingVariant aIn, uint8_t& aOut);
 
 nsresult
-Convert(BluetoothSspVariant aIn, nsAString& aOut);
+Convert(BluetoothSspPairingVariant aIn, nsAString& aOut);
 
 nsresult
 Convert(ControlPlayStatus aIn, uint8_t& aOut);
 
 //
 // Packing
 //
 
@@ -448,17 +468,17 @@ PackPDU(BluetoothPropertyType aIn, Bluet
 
 nsresult
 PackPDU(const BluetoothServiceName& aIn, BluetoothDaemonPDU& aPDU);
 
 nsresult
 PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU);
 
 nsresult
-PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU);
+PackPDU(BluetoothSspPairingVariant aIn, BluetoothDaemonPDU& aPDU);
 
 nsresult
 PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU);
 
 nsresult
 PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU);
 
 nsresult
@@ -788,17 +808,17 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, Blue
   rv = UnpackPDU(aPDU, aOut.mOpcode);
   if (NS_FAILED(rv)) {
     return rv;
   }
   return UnpackPDU(aPDU, aOut.mLength);
 }
 
 nsresult
-UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut);
+UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDeviceType& aOut);
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut);
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut);
 
 nsresult
@@ -831,17 +851,17 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, Blue
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothScanMode& aOut);
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut);
 
 nsresult
-UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut);
+UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspPairingVariant& aOut);
 
 nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut);
 
 inline nsresult
 UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothUuid& aOut)
 {
   return aPDU.Read(aOut.mUuid, sizeof(aOut.mUuid));
--- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
@@ -513,17 +513,17 @@ public:
                        BluetoothResultHandler* aRes)
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     nsAutoPtr<BluetoothDaemonPDU> pdu(new BluetoothDaemonPDU(0x01, 0x11, 0));
 
     nsresult rv = PackPDU(
       PackConversion<nsAString, BluetoothAddress>(aBdAddr),
-      PackConversion<nsAString, BluetoothSspVariant>(aVariant),
+      PackConversion<nsAString, BluetoothSspPairingVariant>(aVariant),
       aAccept, aPasskey, *pdu);
     if (NS_FAILED(rv)) {
       return rv;
     }
     rv = Send(pdu, aRes);
     if (NS_FAILED(rv)) {
       return rv;
     }
@@ -908,18 +908,19 @@ private:
 
   typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
                                          nsString, nsString, uint32_t,
                                          const nsAString&, const nsAString&>
     PinRequestNotification;
 
   typedef BluetoothNotificationRunnable5<NotificationHandlerWrapper, void,
                                          nsString, nsString, uint32_t,
-                                         BluetoothSspVariant, uint32_t,
-                                         const nsAString&, const nsAString&>
+                                         nsString, uint32_t,
+                                         const nsAString&, const nsAString&,
+                                         uint32_t, const nsAString&>
     SspRequestNotification;
 
   typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
                                          BluetoothStatus, nsString,
                                          BluetoothBondState,
                                          BluetoothStatus, const nsAString&>
     BondStateChangedNotification;
 
@@ -1144,17 +1145,17 @@ private:
   {
   public:
     SspRequestInitOp(BluetoothDaemonPDU& aPDU)
     : PDUInitOp(aPDU)
     { }
 
     nsresult
     operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3,
-                 BluetoothSspVariant aArg4, uint32_t& aArg5) const
+                 nsString& aArg4, uint32_t& aArg5) const
     {
       BluetoothDaemonPDU& pdu = GetPDU();
 
       /* Read remote address */
       nsresult rv = UnpackPDU(
         pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg1));
       if (NS_FAILED(rv)) {
         return rv;
@@ -1169,17 +1170,18 @@ private:
 
       /* Read CoD */
       rv = UnpackPDU(pdu, aArg3);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       /* Read pairing variant */
-      rv = UnpackPDU(pdu, aArg4);
+      rv = UnpackPDU(
+        pdu, UnpackConversion<BluetoothSspPairingVariant, nsAString>(aArg4));
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       /* Read passkey */
       rv = UnpackPDU(pdu, aArg5);
       if (NS_FAILED(rv)) {
         return rv;
--- a/dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
@@ -285,17 +285,17 @@ Convert(const bt_property_t& aIn, Blueto
       break;
     case PROPERTY_CLASS_OF_DEVICE:
       /* fall through */
     case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
       aOut.mUint32 = *static_cast<uint32_t*>(aIn.val);
       break;
     case PROPERTY_TYPE_OF_DEVICE:
       rv = Convert(*static_cast<bt_device_type_t*>(aIn.val),
-                   aOut.mTypeOfDevice);
+                   aOut.mDeviceType);
       break;
     case PROPERTY_SERVICE_RECORD:
       rv = Convert(*static_cast<bt_service_record_t*>(aIn.val),
                    aOut.mServiceRecord);
       break;
     case PROPERTY_ADAPTER_SCAN_MODE:
       rv = Convert(*static_cast<bt_scan_mode_t*>(aIn.val),
                    aOut.mScanMode);
--- a/dom/bluetooth/bluedroid/BluetoothHALHelpers.h
+++ b/dom/bluetooth/bluedroid/BluetoothHALHelpers.h
@@ -14,16 +14,26 @@
 #if ANDROID_VERSION >= 18
 #include <hardware/bt_rc.h>
 #endif
 #include "BluetoothCommon.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "nsThreadUtils.h"
 
+#if MOZ_IS_GCC && MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
+/* use designated array initializers if supported */
+#define CONVERT(in_, out_) \
+  [in_] = out_
+#else
+/* otherwise init array element by position */
+#define CONVERT(in_, out_) \
+  out_
+#endif
+
 BEGIN_BLUETOOTH_NAMESPACE
 
 //
 // Conversion
 //
 
 inline nsresult
 Convert(bt_status_t aIn, BluetoothStatus& aOut)
@@ -106,30 +116,28 @@ Convert(ConvertNamedValue& aIn, bt_prope
 
 nsresult
 Convert(const nsAString& aIn, bt_bdaddr_t& aOut);
 
 nsresult
 Convert(const nsAString& aIn, bt_ssp_variant_t& aOut);
 
 inline nsresult
-Convert(const bt_ssp_variant_t& aIn, BluetoothSspVariant& aOut)
+Convert(const bt_ssp_variant_t& aIn, nsAString& aOut)
 {
-  static const BluetoothSspVariant sSspVariant[] = {
-    CONVERT(BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
-      SSP_VARIANT_PASSKEY_CONFIRMATION),
-    CONVERT(BT_SSP_VARIANT_PASSKEY_ENTRY, SSP_VARIANT_PASSKEY_ENTRY),
-    CONVERT(BT_SSP_VARIANT_CONSENT, SSP_VARIANT_CONSENT),
-    CONVERT(BT_SSP_VARIANT_PASSKEY_NOTIFICATION,
-      SSP_VARIANT_PASSKEY_NOTIFICATION)
+  static const char * const sSspVariant[] = {
+    CONVERT(BT_SSP_VARIANT_PASSKEY_CONFIRMATION, "PasskeyConfirmation"),
+    CONVERT(BT_SSP_VARIANT_PASSKEY_ENTRY, "PasskeyEntry"),
+    CONVERT(BT_SSP_VARIANT_CONSENT, "Consent"),
+    CONVERT(BT_SSP_VARIANT_PASSKEY_NOTIFICATION, "PasskeyNotification")
   };
   if (aIn >= MOZ_ARRAY_LENGTH(sSspVariant)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
-  aOut = sSspVariant[aIn];
+  aOut = NS_ConvertUTF8toUTF16(sSspVariant[aIn]);
   return NS_OK;
 }
 
 inline nsresult
 Convert(const bool& aIn, uint8_t& aOut)
 {
   // casting converts true/false to either 1 or 0
   aOut = static_cast<uint8_t>(aIn);
@@ -281,28 +289,28 @@ Convert(bt_acl_state_t aIn, bool& aOut)
   if (aIn >= MOZ_ARRAY_LENGTH(sAclState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAclState[aIn];
   return NS_OK;
 }
 
 inline nsresult
-Convert(bt_device_type_t aIn, BluetoothTypeOfDevice& aOut)
+Convert(bt_device_type_t aIn, BluetoothDeviceType& aOut)
 {
-  static const BluetoothTypeOfDevice sTypeOfDevice[] = {
-    CONVERT(0, static_cast<BluetoothTypeOfDevice>(0)), // invalid, required by gcc
-    CONVERT(BT_DEVICE_DEVTYPE_BREDR, TYPE_OF_DEVICE_BREDR),
-    CONVERT(BT_DEVICE_DEVTYPE_BLE, TYPE_OF_DEVICE_BLE),
-    CONVERT(BT_DEVICE_DEVTYPE_DUAL, TYPE_OF_DEVICE_DUAL)
+  static const BluetoothDeviceType sDeviceType[] = {
+    CONVERT(0, static_cast<BluetoothDeviceType>(0)), // invalid, required by gcc
+    CONVERT(BT_DEVICE_DEVTYPE_BREDR, DEVICE_TYPE_BREDR),
+    CONVERT(BT_DEVICE_DEVTYPE_BLE, DEVICE_TYPE_BLE),
+    CONVERT(BT_DEVICE_DEVTYPE_DUAL, DEVICE_TYPE_DUAL)
   };
-  if (aIn >= MOZ_ARRAY_LENGTH(sTypeOfDevice)) {
+  if (aIn >= MOZ_ARRAY_LENGTH(sDeviceType)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
-  aOut = sTypeOfDevice[aIn];
+  aOut = sDeviceType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(const bt_service_record_t& aIn, BluetoothServiceRecord& aOut);
 
 inline nsresult
 Convert(BluetoothSocketType aIn, btsock_type_t& aOut)
--- a/dom/bluetooth/bluedroid/BluetoothHALInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothHALInterface.cpp
@@ -146,18 +146,19 @@ struct BluetoothCallback
 
   typedef BluetoothNotificationHALRunnable3<NotificationHandlerWrapper, void,
                                             nsString, nsString, uint32_t,
                                             const nsAString&, const nsAString&>
     PinRequestNotification;
 
   typedef BluetoothNotificationHALRunnable5<NotificationHandlerWrapper, void,
                                             nsString, nsString, uint32_t,
-                                            BluetoothSspVariant, uint32_t,
-                                            const nsAString&, const nsAString&>
+                                            nsString, uint32_t,
+                                            const nsAString&, const nsAString&,
+                                            uint32_t, const nsAString&>
     SspRequestNotification;
 
   typedef BluetoothNotificationHALRunnable3<NotificationHandlerWrapper, void,
                                             BluetoothStatus, nsString,
                                             BluetoothBondState,
                                             BluetoothStatus, const nsAString&>
     BondStateChangedNotification;
 
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -1488,17 +1488,17 @@ BluetoothServiceBluedroid::PinRequestNot
   DistributeSignal(BluetoothSignal(NS_LITERAL_STRING("RequestPinCode"),
                                    NS_LITERAL_STRING(KEY_LOCAL_AGENT),
                                    BluetoothValue(propertiesArray)));
 }
 
 void
 BluetoothServiceBluedroid::SspRequestNotification(
   const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod,
-  BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
+  const nsAString& aPairingaVariant, uint32_t aPassKey)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   InfallibleTArray<BluetoothNamedValue> propertiesArray;
 
   BT_APPEND_NAMED_VALUE(propertiesArray, "address", nsString(aRemoteBdAddr));
   BT_APPEND_NAMED_VALUE(propertiesArray, "method",
                         NS_LITERAL_STRING("confirmation"));
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
@@ -191,17 +191,17 @@ public:
   virtual void DiscoveryStateChangedNotification(bool aState) override;
 
   virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
                                       const nsAString& aBdName,
                                       uint32_t aCod) override;
   virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
                                       const nsAString& aBdName,
                                       uint32_t aCod,
-                                      BluetoothSspVariant aPairingVariant,
+                                      const nsAString& aPairingaVariant,
                                       uint32_t aPassKey) override;
 
   virtual void BondStateChangedNotification(
     BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
     BluetoothBondState aState) override;
   virtual void AclStateChangedNotification(BluetoothStatus aStatus,
                                            const nsAString& aRemoteBdAddr,
                                            bool aState) override;