Backed out changeset 089f015f15bb and e907ab075ec8 (
bug 880610) for hitting MOZ_ASSERT
--- a/configure.in
+++ b/configure.in
@@ -217,34 +217,27 @@ if test -n "$gonkdir" ; then
ARCH_DIR=arch-x86
;;
esac
case "$ANDROID_VERSION" in
15)
GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
MOZ_B2G_BT=1
- MOZ_B2G_BT_BLUEZ=1
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1
AC_SUBST(MOZ_OMX_DECODER)
MOZ_RTSP=1
;;
17|18)
GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
if test -d "$gonkdir/external/bluetooth/bluez"; then
- GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
+ GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
MOZ_B2G_BT=1
- MOZ_B2G_BT_BLUEZ=1
fi
- if test -d "$gonkdir/external/bluetooth/bluedroid"; then
- MOZ_B2G_BT=1
- MOZ_B2G_BT_BLUEDROID=1
- fi
-
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1
AC_SUBST(MOZ_OMX_DECODER)
;;
*)
AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
;;
esac
@@ -7290,18 +7283,16 @@ dnl ====================================
MOZ_ARG_ENABLE_BOOL(b2g-bt,
[ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
MOZ_B2G_BT=1,
MOZ_B2G_BT= )
if test -n "$MOZ_B2G_BT"; then
AC_DEFINE(MOZ_B2G_BT)
fi
AC_SUBST(MOZ_B2G_BT)
-AC_SUBST(MOZ_B2G_BT_BLUEZ)
-AC_SUBST(MOZ_B2G_BT_BLUEDROID)
dnl ========================================================
dnl = Enable Pico Speech Synthesis (Gonk usually)
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(synth-pico,
[ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
MOZ_SYNTH_PICO=1,
MOZ_SYNTH_PICO= )
--- a/dom/bluetooth/BluetoothService.cpp
+++ b/dom/bluetooth/BluetoothService.cpp
@@ -39,19 +39,17 @@
#include "nsXPCOM.h"
#if defined(MOZ_WIDGET_GONK)
#include "cutils/properties.h"
#endif
#if defined(MOZ_B2G_BT)
# if defined(MOZ_BLUETOOTH_GONK)
-#ifndef MOZ_B2G_BT_BLUEDROID
-#include "BluetoothGonkService.h"
-#endif
+# include "BluetoothGonkService.h"
# elif defined(MOZ_BLUETOOTH_DBUS)
# include "BluetoothDBusService.h"
# else
# error No_suitable_backend_for_bluetooth!
# endif
#endif
#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
@@ -301,24 +299,20 @@ BluetoothService::Create()
{
#if defined(MOZ_B2G_BT)
if (!IsMainProcess()) {
return BluetoothServiceChildProcess::Create();
}
#endif
#if defined(MOZ_BLUETOOTH_GONK)
-#ifndef MOZ_B2G_BT_BLUEDROID
return new BluetoothGonkService();
-#endif
#elif defined(MOZ_BLUETOOTH_DBUS)
-#ifdef MOZ_B2G_BT_BLUEZ
return new BluetoothDBusService();
#endif
-#endif
BT_WARNING("No platform support for bluetooth!");
return nullptr;
}
bool
BluetoothService::Init()
{
MOZ_ASSERT(NS_IsMainThread());
--- a/dom/bluetooth/BluetoothUnixSocketConnector.cpp
+++ b/dom/bluetooth/BluetoothUnixSocketConnector.cpp
@@ -22,34 +22,32 @@
*/
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
-#ifdef MOZ_B2G_BT_BLUEZ
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/rfcomm.h>
#include <bluetooth/sco.h>
-#endif
+
#include "BluetoothUnixSocketConnector.h"
#include "nsThreadUtils.h"
using namespace mozilla::ipc;
USING_BLUETOOTH_NAMESPACE
static const int RFCOMM_SO_SNDBUF = 70 * 1024; // 70 KB send buffer
static const int L2CAP_SO_SNDBUF = 400 * 1024; // 400 KB send buffer
static const int L2CAP_SO_RCVBUF = 400 * 1024; // 400 KB receive buffer
static const int L2CAP_MAX_MTU = 65000;
-#ifdef MOZ_B2G_BT_BLUEZ
static
int get_bdaddr(const char *str, bdaddr_t *ba)
{
char *d = ((char*)ba) + 5, *endp;
for (int i = 0; i < 6; i++) {
*d-- = strtol(str, &endp, 16);
MOZ_ASSERT(!(*endp != ':' && i != 5));
str = endp + 1;
@@ -59,33 +57,30 @@ int get_bdaddr(const char *str, bdaddr_t
static
void get_bdaddr_as_string(const bdaddr_t *ba, char *str) {
const uint8_t *b = (const uint8_t *)ba;
sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
b[5], b[4], b[3], b[2], b[1], b[0]);
}
-#endif
-
BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
BluetoothSocketType aType,
int aChannel,
bool aAuth,
bool aEncrypt) : mType(aType)
, mChannel(aChannel)
, mAuth(aAuth)
, mEncrypt(aEncrypt)
{
}
bool
BluetoothUnixSocketConnector::SetUp(int aFd)
{
-#ifdef MOZ_B2G_BT_BLUEZ
int lm = 0;
int sndbuf, rcvbuf;
/* kernel does not yet support LM for SCO */
switch (mType) {
case BluetoothSocketType::RFCOMM:
lm |= mAuth ? RFCOMM_LM_AUTH : 0;
lm |= mEncrypt ? RFCOMM_LM_ENCRYPT : 0;
@@ -157,27 +152,26 @@ BluetoothUnixSocketConnector::SetUp(int
rcvbuf = L2CAP_SO_RCVBUF;
if (setsockopt(aFd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf))) {
BT_WARNING("setsockopt(SO_RCVBUF) failed, throwing");
return false;
}
}
}
-#endif
+
return true;
}
int
BluetoothUnixSocketConnector::Create()
{
MOZ_ASSERT(!NS_IsMainThread());
int fd = -1;
-#ifdef MOZ_B2G_BT_BLUEZ
switch (mType) {
case BluetoothSocketType::RFCOMM:
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
break;
case BluetoothSocketType::SCO:
fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
break;
case BluetoothSocketType::L2CAP:
@@ -194,27 +188,26 @@ BluetoothUnixSocketConnector::Create()
BT_WARNING("Could not open bluetooth socket!");
return -1;
}
if (!SetUp(fd)) {
BT_WARNING("Could not set up socket!");
return -1;
}
-#endif
+
return fd;
}
bool
BluetoothUnixSocketConnector::CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress)
{
-#ifdef MOZ_B2G_BT_BLUEZ
// Set to BDADDR_ANY, if it's not a server, we'll reset.
bdaddr_t bd_address_obj = {{0, 0, 0, 0, 0, 0}};
if (!aIsServer && aAddress && strlen(aAddress) > 0) {
if (get_bdaddr(aAddress, &bd_address_obj)) {
BT_WARNING("Can't get bluetooth address!");
return false;
}
@@ -244,35 +237,32 @@ BluetoothUnixSocketConnector::CreateAddr
aAddrSize = sizeof(addr_sco);
aAddr.sco.sco_family = AF_BLUETOOTH;
memcpy(&aAddr.sco.sco_bdaddr, &bd_address_obj, sizeof(bd_address_obj));
break;
default:
BT_WARNING("Socket type unknown!");
return false;
}
-#endif
return true;
}
void
BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
-#ifdef MOZ_B2G_BT_BLUEZ
char addr[18];
switch (mType) {
case BluetoothSocketType::RFCOMM:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.rc.rc_bdaddr), addr);
break;
case BluetoothSocketType::SCO:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.sco.sco_bdaddr), addr);
break;
case BluetoothSocketType::L2CAP:
case BluetoothSocketType::EL2CAP:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.l2.l2_bdaddr), addr);
break;
default:
MOZ_CRASH("Socket should be either RFCOMM or SCO!");
}
aAddrStr.AssignASCII(addr);
-#endif
}
--- a/dom/bluetooth/Makefile.in
+++ b/dom/bluetooth/Makefile.in
@@ -31,24 +31,16 @@ ifdef MOZ_ENABLE_DBUS
VPATH += $(srcdir)/linux
LOCAL_INCLUDES += $(MOZ_DBUS_CFLAGS)
CFLAGS += $(MOZ_DBUS_GLIB_CFLAGS)
CXXFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) -DHAVE_PTHREADS
DEFINES += -DMOZ_BLUETOOTH_DBUS
endif
endif
-ifdef MOZ_B2G_BT_BLUEZ
-DEFINES += -DMOZ_B2G_BT_BLUEZ
-endif
-
-ifdef MOZ_B2G_BT_BLUEDROID
-DEFINES += -DMOZ_B2G_BT_BLUEDROID
-endif
-
# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
# subdirectory.
LOCAL_INCLUDES += $(VPATH:%=-I%)
endif # MOZ_B2G_BT
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/dom/bluetooth/linux/BluetoothDBusService.h
+++ b/dom/bluetooth/linux/BluetoothDBusService.h
@@ -19,19 +19,16 @@ BEGIN_BLUETOOTH_NAMESPACE
/**
* BluetoothDBusService is the implementation of BluetoothService for DBus on
* linux/android/B2G. Function comments are in BluetoothService.h
*/
class BluetoothDBusService : public BluetoothService
{
public:
- BluetoothDBusService();
- ~BluetoothDBusService();
-
bool IsReady();
virtual nsresult StartInternal() MOZ_OVERRIDE;
virtual nsresult StopInternal() MOZ_OVERRIDE;
virtual bool IsEnabledInternal() MOZ_OVERRIDE;
@@ -166,16 +163,21 @@ public:
virtual nsresult
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
+
+protected:
+ BluetoothDBusService();
+ ~BluetoothDBusService();
+
private:
/**
* For DBus Control method of "UpdateNotification", event id should be
* specified as following:
* (Please see specification of AVRCP 1.3, Table 5.28 for more details.)
*/
enum ControlEventId {
EVENT_PLAYBACK_STATUS_CHANGED = 0x01,
--- a/dom/bluetooth/moz.build
+++ b/dom/bluetooth/moz.build
@@ -47,17 +47,17 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothProfileController.cpp'
]
if CONFIG['MOZ_B2G_RIL']:
CPP_SOURCES += [
'BluetoothRilListener.cpp',
]
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_BT_BLUEZ']:
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
CPP_SOURCES += [
'linux/BluetoothDBusService.cpp',
'gonk/BluetoothGonkService.cpp',
]
else:
if CONFIG['MOZ_ENABLE_DBUS']:
CPP_SOURCES += [
'linux/BluetoothDBusService.cpp',
--- a/ipc/moz.build
+++ b/ipc/moz.build
@@ -9,17 +9,17 @@ DIRS += [
'glue',
'ipdl',
'testshell',
]
if CONFIG['MOZ_B2G_RIL']:
DIRS += ['ril']
-if CONFIG['MOZ_B2G_BT_BLUEZ']:
+if CONFIG['MOZ_B2G_BT']:
DIRS += ['dbus']
if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT']:
DIRS += ['unixsocket', 'keystore']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DIRS += ['netd']
--- a/ipc/unixsocket/UnixSocket.h
+++ b/ipc/unixsocket/UnixSocket.h
@@ -7,17 +7,17 @@
#ifndef mozilla_ipc_UnixSocket_h
#define mozilla_ipc_UnixSocket_h
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <netinet/in.h>
-#ifdef MOZ_B2G_BT_BLUEZ
+#ifdef MOZ_B2G_BT
#include <bluetooth/bluetooth.h>
#include <bluetooth/sco.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/rfcomm.h>
#endif
#include <stdlib.h>
#include "nsString.h"
#include "nsAutoPtr.h"
@@ -26,17 +26,17 @@
namespace mozilla {
namespace ipc {
union sockaddr_any {
sockaddr_storage storage; // address-family only
sockaddr_un un;
sockaddr_in in;
sockaddr_in6 in6;
-#ifdef MOZ_B2G_BT_BLUEZ
+#ifdef MOZ_B2G_BT
sockaddr_sco sco;
sockaddr_rc rc;
sockaddr_l2 l2;
#endif
// ... others
};
class UnixSocketRawData
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -84,17 +84,17 @@ STATIC_LIBS += \
ifdef MOZ_CONTENT_SANDBOX #{
STATIC_LIBS += sandbox_s
endif #}
ifdef MOZ_B2G_RIL #{
STATIC_LIBS += mozril_s
endif #}
-ifdef MOZ_B2G_BT_BLUEZ #{
+ifdef MOZ_B2G_BT #{
STATIC_LIBS += mozdbus_s
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
OS_LIBS += -ldbus
endif
endif #}
ifneq ($(strip $(MOZ_B2G_RIL)$(MOZ_B2G_BT)),) #{
STATIC_LIBS += mozipcunixsocket_s mozkeystore_s