diff --git a/b2g/chrome/content/forms.js b/b2g/chrome/content/forms.js
index ad6806401b4f..2d0859dc67a5 100644
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -382,6 +382,10 @@ let FormAssistant = {
break;
case "keydown":
+ if (!this.focusedElement) {
+ break;
+ }
+
// Don't monitor the text change resulting from key event.
this._ignoreEditActionOnce = true;
@@ -393,6 +397,10 @@ let FormAssistant = {
break;
case "keyup":
+ if (!this.focusedElement) {
+ break;
+ }
+
this._ignoreEditActionOnce = false;
break;
}
@@ -824,6 +832,10 @@ function getDocumentEncoder(element) {
// Get the visible content text of a content editable element
function getContentEditableText(element) {
+ if (!element) {
+ return null;
+ }
+
let doc = element.ownerDocument;
let range = doc.createRange();
range.selectNodeContents(element);
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 7e908215250e..2bcd6563a5ce 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
{
- "revision": "a6b81f7d4b84287a2bdf0ce78df08fed9fd46bee",
+ "revision": "2b195ef19ed8cadd557ca185bae72c9ff836b264",
"repo_path": "/integration/gaia-central"
}
diff --git a/b2g/config/helix/config.json b/b2g/config/helix/config.json
new file mode 100644
index 000000000000..86a6a161cd87
--- /dev/null
+++ b/b2g/config/helix/config.json
@@ -0,0 +1,36 @@
+{
+ "config_version": 2,
+ "tooltool_manifest": "releng-helix.tt",
+ "mock_target": "mozilla-centos6-i386",
+ "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"],
+ "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
+ "build_targets": [],
+ "upload_files": [
+ "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
+ "{objdir}/dist/b2g-*.tar.gz",
+ "{workdir}/sources.xml"
+ ],
+ "zip_files": [
+ ["{workdir}/out/target/product/helix/*.img", "out/target/product/helix/"],
+ "{workdir}/flash.sh",
+ "{workdir}/load-config.sh",
+ "{workdir}/.config",
+ "{workdir}/sources.xml"
+ ],
+ "env": {
+ "VARIANT": "user",
+ "MOZILLA_OFFICIAL": "1",
+ "B2GUPDATER": "1",
+ "ANDROIDFS_DIR": "{workdir}/helix-ics"
+ },
+ "b2g_manifest": "helix.xml",
+ "b2g_manifest_branch": "master",
+ "additional_source_tarballs": ["helix-ics.tar.xz"],
+ "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
+ "gaia": {
+ "l10n": {
+ "vcs": "hgtool",
+ "root": "http://hg.mozilla.org/gaia-l10n"
+ }
+ }
+}
diff --git a/b2g/config/helix/releng-helix.tt b/b2g/config/helix/releng-helix.tt
new file mode 100644
index 000000000000..4a19b427f76a
--- /dev/null
+++ b/b2g/config/helix/releng-helix.tt
@@ -0,0 +1,14 @@
+[
+{
+"size": 214609120,
+"digest": "cbda63d37b8db104a0fddcb5d8ffe1da173922805863905cb82e819c80cf6032caffa49903cb74e8c703da35df876cc305a7d7b989a52c045e99845e20718f7e",
+"algorithm": "sha512",
+"filename": "helix-ics.tar.xz"
+},
+{
+"size": 1570553,
+"digest": "ea03de74df73b05e939c314cd15c54aac7b5488a407b7cc4f5f263f3049a1f69642c567dd35c43d0bc3f0d599d0385a26ab2dd947a6b18f9044e4918b382eea7",
+"algorithm": "sha512",
+"filename": "Adreno200-AU_LINUX_ANDROID_ICS_CHOCO_CS.04.00.03.06.001.zip"
+}
+]
diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp
index 351dc2a8d4c4..6a601bf4496d 100644
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -2072,6 +2072,13 @@ nsFrameLoader::TryRemoteBrowser()
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
mContentParent = mRemoteBrowser->Manager();
+
+ if (mOwnerContent->AttrValueIs(kNameSpaceID_None,
+ nsGkAtoms::mozpasspointerevents,
+ nsGkAtoms::_true,
+ eCaseMatters)) {
+ unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
+ }
}
return true;
}
diff --git a/content/events/test/Makefile.in b/content/events/test/Makefile.in
index aeca179c4a3d..9e23d5e3cdad 100644
--- a/content/events/test/Makefile.in
+++ b/content/events/test/Makefile.in
@@ -80,7 +80,6 @@ MOCHITEST_FILES = \
test_bug659350.html \
test_bug662678.html \
test_bug667919-1.html \
- test_bug667919-2.html \
test_bug667612.html \
empty.js \
test_bug689564.html \
diff --git a/content/events/test/test_bug615597.html b/content/events/test/test_bug615597.html
index 8e743b1be38a..4f0eaeecf418 100644
--- a/content/events/test/test_bug615597.html
+++ b/content/events/test/test_bug615597.html
@@ -24,7 +24,6 @@ window.addEventListener("deviceorientation", function(event) {
is(event.beta, 2.25);
is(event.gamma, 3.667);
is(event.absolute, true);
- SimpleTest.finish();
}, true);
var event = DeviceOrientationEvent;
@@ -33,7 +32,6 @@ ok(!!event, "Should have seen DeviceOrientationEvent!");
event = document.createEvent("DeviceOrientationEvent");
event.initDeviceOrientationEvent('deviceorientation', true, true, 1.5, 2.25, 3.667, true);
window.dispatchEvent(event);
-SimpleTest.waitForExplicitFinish();
diff --git a/content/events/test/test_bug667919-2.html b/content/events/test/test_bug667919-2.html
deleted file mode 100644
index 56643ae018e6..000000000000
--- a/content/events/test/test_bug667919-2.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
- Test for Bug 615597
-
-
-
-
-Mozilla Bug 615597
-
-
-
-
-
-
-
-
-
diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h
index 271de34689ce..0fd4100dfc40 100644
--- a/dom/bluetooth/BluetoothCommon.h
+++ b/dom/bluetooth/BluetoothCommon.h
@@ -57,6 +57,7 @@ extern bool gBluetoothDebugFlag;
*/
#define BLUETOOTH_A2DP_STATUS_CHANGED_ID "bluetooth-a2dp-status-changed"
#define BLUETOOTH_HFP_STATUS_CHANGED_ID "bluetooth-hfp-status-changed"
+#define BLUETOOTH_HID_STATUS_CHANGED_ID "bluetooth-hid-status-changed"
#define BLUETOOTH_SCO_STATUS_CHANGED_ID "bluetooth-sco-status-changed"
/**
diff --git a/dom/bluetooth/BluetoothHidManager.cpp b/dom/bluetooth/BluetoothHidManager.cpp
new file mode 100644
index 000000000000..ec70e9d06b30
--- /dev/null
+++ b/dom/bluetooth/BluetoothHidManager.cpp
@@ -0,0 +1,207 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "base/basictypes.h"
+
+#include "BluetoothHidManager.h"
+
+#include "BluetoothCommon.h"
+#include "BluetoothService.h"
+#include "BluetoothUtils.h"
+
+#include "mozilla/dom/bluetooth/BluetoothTypes.h"
+#include "mozilla/Services.h"
+#include "mozilla/StaticPtr.h"
+#include "nsIObserverService.h"
+
+using namespace mozilla;
+USING_BLUETOOTH_NAMESPACE
+
+namespace {
+ StaticRefPtr sBluetoothHidManager;
+ bool sInShutdown = false;
+} // anonymous namespace
+
+NS_IMETHODIMP
+BluetoothHidManager::Observe(nsISupports* aSubject,
+ const char* aTopic,
+ const PRUnichar* aData)
+{
+ MOZ_ASSERT(sBluetoothHidManager);
+
+ if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
+ HandleShutdown();
+ return NS_OK;
+ }
+
+ MOZ_ASSERT(false, "BluetoothHidManager got unexpected topic!");
+ return NS_ERROR_UNEXPECTED;
+}
+
+BluetoothHidManager::BluetoothHidManager()
+ : mConnected(false)
+{
+}
+
+bool
+BluetoothHidManager::Init()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ nsCOMPtr obs = services::GetObserverService();
+ NS_ENSURE_TRUE(obs, false);
+ if (NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) {
+ BT_WARNING("Failed to add shutdown observer!");
+ return false;
+ }
+
+ return true;
+}
+
+BluetoothHidManager::~BluetoothHidManager()
+{
+ nsCOMPtr obs = services::GetObserverService();
+ NS_ENSURE_TRUE_VOID(obs);
+ if (NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID))) {
+ BT_WARNING("Failed to remove shutdown observer!");
+ }
+}
+
+//static
+BluetoothHidManager*
+BluetoothHidManager::Get()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ // If we already exist, exit early
+ if (sBluetoothHidManager) {
+ return sBluetoothHidManager;
+ }
+
+ // If we're in shutdown, don't create a new instance
+ NS_ENSURE_FALSE(sInShutdown, nullptr);
+
+ // Create a new instance, register, and return
+ BluetoothHidManager* manager = new BluetoothHidManager();
+ NS_ENSURE_TRUE(manager->Init(), nullptr);
+
+ sBluetoothHidManager = manager;
+ return sBluetoothHidManager;
+}
+
+void
+BluetoothHidManager::HandleShutdown()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ sInShutdown = true;
+ Disconnect();
+ sBluetoothHidManager = nullptr;
+}
+
+bool
+BluetoothHidManager::Connect(const nsAString& aDeviceAddress,
+ BluetoothReplyRunnable* aRunnable)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(!aDeviceAddress.IsEmpty());
+
+ NS_ENSURE_FALSE(sInShutdown, false);
+ NS_ENSURE_FALSE(mConnected, false);
+
+ mDeviceAddress = aDeviceAddress;
+
+ BluetoothService* bs = BluetoothService::Get();
+ NS_ENSURE_TRUE(bs, false);
+ nsresult rv = bs->SendInputMessage(aDeviceAddress,
+ NS_LITERAL_STRING("Connect"),
+ aRunnable);
+
+ return NS_SUCCEEDED(rv);
+}
+
+void
+BluetoothHidManager::Disconnect()
+{
+ NS_ENSURE_TRUE_VOID(mConnected);
+
+ MOZ_ASSERT(!mDeviceAddress.IsEmpty());
+
+ BluetoothService* bs = BluetoothService::Get();
+ NS_ENSURE_TRUE_VOID(bs);
+ bs->SendInputMessage(mDeviceAddress,
+ NS_LITERAL_STRING("Disconnect"),
+ nullptr);
+}
+
+bool BluetoothHidManager::IsConnected()
+{
+ return mConnected;
+}
+
+void BluetoothHidManager::HandleInputPropertyChanged(const BluetoothSignal& aSignal)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(aSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
+
+ const InfallibleTArray& arr =
+ aSignal.value().get_ArrayOfBluetoothNamedValue();
+ MOZ_ASSERT(arr.Length() == 1);
+
+ const nsString& name = arr[0].name();
+ const BluetoothValue& value = arr[0].value();
+
+ if (name.EqualsLiteral("Connected")) {
+ MOZ_ASSERT(value.type() == BluetoothValue::Tbool);
+ MOZ_ASSERT(mConnected != value.get_bool());
+
+ mConnected = value.get_bool();
+ NotifyStatusChanged();
+ }
+}
+
+void
+BluetoothHidManager::NotifyStatusChanged()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ NS_NAMED_LITERAL_STRING(type, BLUETOOTH_HID_STATUS_CHANGED_ID);
+ InfallibleTArray parameters;
+
+ BluetoothValue v = mConnected;
+ parameters.AppendElement(
+ BluetoothNamedValue(NS_LITERAL_STRING("connected"), v));
+
+ v = mDeviceAddress;
+ parameters.AppendElement(
+ BluetoothNamedValue(NS_LITERAL_STRING("address"), v));
+
+ if (!BroadcastSystemMessage(type, parameters)) {
+ NS_WARNING("Failed to broadcast system message to settings");
+ return;
+ }
+}
+
+void
+BluetoothHidManager::OnGetServiceChannel(const nsAString& aDeviceAddress,
+ const nsAString& aServiceUuid,
+ int aChannel)
+{
+ // Do nothing here as bluez acquires service channel and connects for us
+}
+
+void
+BluetoothHidManager::OnUpdateSdpRecords(const nsAString& aDeviceAddress)
+{
+ // Do nothing here as bluez acquires service channel and connects for us
+}
+
+void
+BluetoothHidManager::GetAddress(nsAString& aDeviceAddress)
+{
+ aDeviceAddress = mDeviceAddress;
+}
+
+NS_IMPL_ISUPPORTS1(BluetoothHidManager, nsIObserver)
diff --git a/dom/bluetooth/BluetoothHidManager.h b/dom/bluetooth/BluetoothHidManager.h
new file mode 100644
index 000000000000..48095be58eb1
--- /dev/null
+++ b/dom/bluetooth/BluetoothHidManager.h
@@ -0,0 +1,53 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_bluetooth_bluetoothhidmanager_h__
+#define mozilla_dom_bluetooth_bluetoothhidmanager_h__
+
+#include "BluetoothCommon.h"
+#include "BluetoothProfileManagerBase.h"
+
+BEGIN_BLUETOOTH_NAMESPACE
+
+class BluetoothReplyRunnable;
+
+class BluetoothHidManager : public BluetoothProfileManagerBase
+{
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIOBSERVER
+
+ static BluetoothHidManager* Get();
+ ~BluetoothHidManager();
+
+ virtual void OnGetServiceChannel(const nsAString& aDeviceAddress,
+ const nsAString& aServiceUuid,
+ int aChannel) MOZ_OVERRIDE;
+ virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) MOZ_OVERRIDE;
+ virtual void GetAddress(nsAString& aDeviceAddress) MOZ_OVERRIDE;
+ virtual bool IsConnected() MOZ_OVERRIDE;
+
+ bool Connect(const nsAString& aDeviceAddress,
+ BluetoothReplyRunnable* aRunnable);
+ void Disconnect();
+ void HandleInputPropertyChanged(const BluetoothSignal& aSignal);
+
+private:
+ BluetoothHidManager();
+ bool Init();
+ void Cleanup();
+ void HandleShutdown();
+
+ void NotifyStatusChanged();
+
+ // data member
+ bool mConnected;
+ nsString mDeviceAddress;
+};
+
+END_BLUETOOTH_NAMESPACE
+
+#endif //#ifndef mozilla_dom_bluetooth_bluetoothhidmanager_h__
diff --git a/dom/bluetooth/BluetoothService.h b/dom/bluetooth/BluetoothService.h
index addfc0bece09..63c6d872f014 100644
--- a/dom/bluetooth/BluetoothService.h
+++ b/dom/bluetooth/BluetoothService.h
@@ -294,6 +294,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) = 0;
+ virtual nsresult
+ SendInputMessage(const nsAString& aDeviceAddresses,
+ const nsAString& aMessage,
+ BluetoothReplyRunnable* aRunnable) = 0;
+
bool
IsEnabled() const
{
diff --git a/dom/bluetooth/BluetoothUuid.h b/dom/bluetooth/BluetoothUuid.h
index 1cc3760aa08d..2cbf11b2e5ee 100644
--- a/dom/bluetooth/BluetoothUuid.h
+++ b/dom/bluetooth/BluetoothUuid.h
@@ -26,7 +26,8 @@ enum BluetoothServiceClass
HEADSET_AG = 0x1112,
HANDSFREE = 0x111E,
HANDSFREE_AG = 0x111F,
- OBJECT_PUSH = 0x1105
+ OBJECT_PUSH = 0x1105,
+ HID = 0x1124,
};
class BluetoothUuidHelper
diff --git a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
index 9184e84dc86d..61f8d02f8cd4 100644
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
@@ -415,6 +415,14 @@ BluetoothServiceChildProcess::SendSinkMessage(const nsAString& aDeviceAddresses,
MOZ_CRASH("This should never be called!");
}
+nsresult
+BluetoothServiceChildProcess::SendInputMessage(const nsAString& aDeviceAddresses,
+ const nsAString& aMessage,
+ BluetoothReplyRunnable* aRunnable)
+{
+ MOZ_CRASH("This should never be called!");
+}
+
void
BluetoothServiceChildProcess::UpdatePlayStatus(uint32_t aDuration,
uint32_t aPosition,
diff --git a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
index e8af2460feda..7b55c5b4eb25 100644
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
@@ -176,6 +176,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
+ virtual nsresult
+ SendInputMessage(const nsAString& aDeviceAddresses,
+ const nsAString& aMessage,
+ BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+
protected:
BluetoothServiceChildProcess();
virtual ~BluetoothServiceChildProcess();
diff --git a/dom/bluetooth/linux/BluetoothDBusService.cpp b/dom/bluetooth/linux/BluetoothDBusService.cpp
index a1de72c739d5..7e0aa2174439 100644
--- a/dom/bluetooth/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/linux/BluetoothDBusService.cpp
@@ -20,6 +20,7 @@
#include "BluetoothDBusService.h"
#include "BluetoothA2dpManager.h"
#include "BluetoothHfpManager.h"
+#include "BluetoothHidManager.h"
#include "BluetoothOppManager.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothUnixSocketConnector.h"
@@ -69,6 +70,7 @@ USING_BLUETOOTH_NAMESPACE
#define DBUS_AGENT_IFACE BLUEZ_DBUS_BASE_IFC ".Agent"
#define DBUS_SINK_IFACE BLUEZ_DBUS_BASE_IFC ".AudioSink"
#define DBUS_CTL_IFACE BLUEZ_DBUS_BASE_IFC ".Control"
+#define DBUS_INPUT_IFACE BLUEZ_DBUS_BASE_IFC ".Input"
#define BLUEZ_DBUS_BASE_PATH "/org/bluez"
#define BLUEZ_DBUS_BASE_IFC "org.bluez"
#define BLUEZ_ERROR_IFC "org.bluez.Error"
@@ -139,6 +141,10 @@ static Properties sControlProperties[] = {
{"Connected", DBUS_TYPE_BOOLEAN}
};
+static Properties sInputProperties[] = {
+ {"Connected", DBUS_TYPE_BOOLEAN}
+};
+
static const char* sBluetoothDBusIfaces[] =
{
DBUS_MANAGER_IFACE,
@@ -175,7 +181,6 @@ static Monitor sStopBluetoothMonitor("BluetoothService.sStopBluetoothMonitor");
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
typedef bool (*FilterFunc)(const BluetoothValue&);
-typedef void (*SinkCallback)(DBusMessage*, void*);
static bool
GetConnectedDevicesFilter(const BluetoothValue& aValue)
@@ -290,6 +295,35 @@ private:
BluetoothSignal mSignal;
};
+class InputPropertyChangedHandler : public nsRunnable
+{
+public:
+ InputPropertyChangedHandler(const BluetoothSignal& aSignal)
+ : mSignal(aSignal)
+ {
+ }
+
+ NS_IMETHOD
+ Run()
+ {
+ MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(mSignal.name().EqualsLiteral("PropertyChanged"));
+ MOZ_ASSERT(mSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
+
+ // Replace object path with device address
+ nsString address = GetAddressFromObjectPath(mSignal.path());
+ mSignal.path() = address;
+
+ BluetoothHidManager* hid = BluetoothHidManager::Get();
+ NS_ENSURE_TRUE(hid, NS_ERROR_FAILURE);
+ hid->HandleInputPropertyChanged(mSignal);
+ return NS_OK;
+ }
+
+private:
+ BluetoothSignal mSignal;
+};
+
static bool
IsDBusMessageError(DBusMessage* aMsg, DBusError* aErr, nsAString& aErrorStr)
{
@@ -489,6 +523,15 @@ CheckForError(DBusMessage* aMsg, void *aParam, const nsAString& aError)
}
#endif
+static void
+InputDisconnectCallback(DBusMessage* aMsg, void* aParam)
+{
+#ifdef DEBUG
+ NS_NAMED_LITERAL_STRING(errorStr, "Failed to disconnect input device");
+ CheckForError(aMsg, aParam, errorStr);
+#endif
+}
+
static void
SinkConnectCallback(DBusMessage* aMsg, void* aParam)
{
@@ -503,7 +546,7 @@ SinkDisconnectCallback(DBusMessage* aMsg, void* aParam)
{
#ifdef DEBUG
NS_NAMED_LITERAL_STRING(errorStr, "Failed to disconnect sink");
- CheckForError(false, aMsg, errorStr);
+ CheckForError(aMsg, aParam, errorStr);
#endif
}
@@ -1558,6 +1601,13 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
errorStr,
sControlProperties,
ArrayLength(sControlProperties));
+ } else if (dbus_message_is_signal(aMsg, DBUS_INPUT_IFACE,
+ "PropertyChanged")) {
+ ParsePropertyChange(aMsg,
+ v,
+ errorStr,
+ sInputProperties,
+ ArrayLength(sInputProperties));
} else {
errorStr = NS_ConvertUTF8toUTF16(dbus_message_get_member(aMsg));
errorStr.AppendLiteral(" Signal not handled!");
@@ -1574,6 +1624,8 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
task = new SinkPropertyChangedHandler(signal);
} else if (signalInterface.EqualsLiteral(DBUS_CTL_IFACE)) {
task = new ControlPropertyChangedHandler(signal);
+ } else if (signalInterface.EqualsLiteral(DBUS_INPUT_IFACE)) {
+ task = new InputPropertyChangedHandler(signal);
} else {
task = new DistributeBluetoothSignalTask(signal);
}
@@ -1882,6 +1934,43 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName,
return NS_OK;
}
+nsresult
+BluetoothDBusService::SendInputMessage(const nsAString& aDeviceAddress,
+ const nsAString& aMessage,
+ BluetoothReplyRunnable* aRunnable)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(mConnection);
+ MOZ_ASSERT(aMessage.EqualsLiteral("Connect") ||
+ aMessage.EqualsLiteral("Disconnect"));
+
+ NS_ENSURE_TRUE(IsReady(), NS_ERROR_FAILURE);
+
+ DBusCallback callback;
+ if (aMessage.EqualsLiteral("Connect")) {
+ callback = GetVoidCallback;
+ } else if (aMessage.EqualsLiteral("Disconnect")) {
+ callback = InputDisconnectCallback;
+ }
+
+ nsRefPtr runnable(aRunnable);
+
+ nsString objectPath = GetObjectPathFromAddress(sAdapterPath, aDeviceAddress);
+ bool ret = dbus_func_args_async(mConnection,
+ -1,
+ callback,
+ static_cast(runnable.get()),
+ NS_ConvertUTF16toUTF8(objectPath).get(),
+ DBUS_INPUT_IFACE,
+ NS_ConvertUTF16toUTF8(aMessage).get(),
+ DBUS_TYPE_INVALID);
+ NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
+
+ runnable.forget();
+
+ return NS_OK;
+}
+
nsresult
BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
const nsAString& aMessage)
@@ -1890,7 +1979,7 @@ BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
MOZ_ASSERT(mConnection);
MOZ_ASSERT(IsEnabled());
- SinkCallback callback;
+ DBusCallback callback;
if (aMessage.EqualsLiteral("Connect")) {
callback = SinkConnectCallback;
} else if (aMessage.EqualsLiteral("Disconnect")) {
@@ -1909,8 +1998,8 @@ BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
DBUS_SINK_IFACE,
NS_ConvertUTF16toUTF8(aMessage).get(),
DBUS_TYPE_INVALID);
-
NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
+
return NS_OK;
}
@@ -2022,6 +2111,8 @@ BluetoothDBusService::GetConnectedDevicePropertiesInternal(uint16_t aProfileId,
if (aProfileId == BluetoothServiceClass::HANDSFREE ||
aProfileId == BluetoothServiceClass::HEADSET) {
profile = BluetoothHfpManager::Get();
+ } else if (aProfileId == BluetoothServiceClass::HID) {
+ profile = BluetoothHidManager::Get();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
profile = BluetoothOppManager::Get();
} else {
@@ -2489,6 +2580,9 @@ BluetoothDBusService::Connect(const nsAString& aDeviceAddress,
} else if (aProfileId == BluetoothServiceClass::HEADSET) {
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->Connect(aDeviceAddress, false, aRunnable);
+ } else if (aProfileId == BluetoothServiceClass::HID) {
+ BluetoothHidManager* hid = BluetoothHidManager::Get();
+ hid->Connect(aDeviceAddress, aRunnable);
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
BluetoothOppManager* opp = BluetoothOppManager::Get();
opp->Connect(aDeviceAddress, aRunnable);
@@ -2508,6 +2602,9 @@ BluetoothDBusService::Disconnect(const uint16_t aProfileId,
aProfileId == BluetoothServiceClass::HEADSET) {
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->Disconnect();
+ } else if (aProfileId == BluetoothServiceClass::HID) {
+ BluetoothHidManager* hid = BluetoothHidManager::Get();
+ hid->Disconnect();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
BluetoothOppManager* opp = BluetoothOppManager::Get();
opp->Disconnect();
@@ -2531,6 +2628,8 @@ BluetoothDBusService::IsConnected(const uint16_t aProfileId)
if (aProfileId == BluetoothServiceClass::HANDSFREE ||
aProfileId == BluetoothServiceClass::HEADSET) {
profile = BluetoothHfpManager::Get();
+ } else if (aProfileId == BluetoothServiceClass::HID) {
+ profile = BluetoothHidManager::Get();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
profile = BluetoothOppManager::Get();
} else {
diff --git a/dom/bluetooth/linux/BluetoothDBusService.h b/dom/bluetooth/linux/BluetoothDBusService.h
index 5da45ecc60b3..c6ba429a6ebe 100644
--- a/dom/bluetooth/linux/BluetoothDBusService.h
+++ b/dom/bluetooth/linux/BluetoothDBusService.h
@@ -162,6 +162,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
+ virtual nsresult
+ SendInputMessage(const nsAString& aDeviceAddresses,
+ const nsAString& aMessage,
+ BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+
private:
/**
* For DBus Control method of "UpdateNotification", event id should be
diff --git a/dom/bluetooth/moz.build b/dom/bluetooth/moz.build
index 6976b7b8f512..6527f4bfdb75 100644
--- a/dom/bluetooth/moz.build
+++ b/dom/bluetooth/moz.build
@@ -37,6 +37,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothUnixSocketConnector.cpp',
'BluetoothA2dpManager.cpp',
'BluetoothHfpManager.cpp',
+ 'BluetoothHidManager.cpp',
'BluetoothOppManager.cpp',
'ObexBase.cpp',
'BluetoothUuid.cpp',
diff --git a/dom/camera/moz.build b/dom/camera/moz.build
index d78e8bcd4174..654b8ec5a5c7 100644
--- a/dom/camera/moz.build
+++ b/dom/camera/moz.build
@@ -24,8 +24,6 @@ EXPORTS += [
'CameraPreviewMediaStream.h',
'DOMCameraManager.h',
'GonkCameraControl.h',
- 'GonkNativeWindow.h',
- 'GonkNativeWindowClient.h',
]
CPP_SOURCES += [
@@ -43,20 +41,11 @@ if CONFIG['MOZ_B2G_CAMERA']:
'GonkCameraManager.cpp',
'GonkCameraControl.cpp',
'GonkCameraHwMgr.cpp',
- 'GonkNativeWindow.cpp',
- 'GonkNativeWindowClient.cpp',
'GonkRecorder.cpp',
'GonkCameraSource.cpp',
'AudioParameter.cpp',
'GonkRecorderProfiles.cpp',
]
-elif CONFIG['MOZ_OMX_DECODER']:
- CPP_SOURCES += [
- 'FallbackCameraManager.cpp',
- 'FallbackCameraControl.cpp',
- 'GonkNativeWindow.cpp',
- 'GonkNativeWindowClient.cpp',
- ]
else:
CPP_SOURCES += [
'FallbackCameraManager.cpp',
diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl
index 179309035aba..1f944966fd15 100644
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -405,6 +405,13 @@ child:
*/
Destroy();
+
+ /**
+ * Tell the child side if it has to update it's touchable region
+ * to the parent.
+ */
+ SetUpdateHitRegion(bool aEnabled);
+
/*
* FIXME: write protocol!
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index 9329097903b6..72d2c50d1692 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -294,6 +294,7 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mContentDocumentIsDisplayed(false)
, mTriedBrowserInit(false)
, mOrientation(eScreenOrientation_PortraitPrimary)
+ , mUpdateHitRegion(false)
{
printf("creating %d!\n", NS_IsMainThread());
}
@@ -2142,6 +2143,13 @@ TabChild::RecvDestroy()
return Send__delete__(this);
}
+bool
+TabChild::RecvSetUpdateHitRegion(const bool& aEnabled)
+{
+ mUpdateHitRegion = aEnabled;
+ return true;
+}
+
PRenderFrameChild*
TabChild::AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
@@ -2353,6 +2361,12 @@ TabChild::MakeHidden()
}
}
+void
+TabChild::UpdateHitRegion(const nsRegion& aRegion)
+{
+ mRemoteFrame->SendUpdateHitRegion(aRegion);
+}
+
NS_IMETHODIMP
TabChild::GetMessageManager(nsIContentFrameMessageManager** aResult)
{
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index 2b8b80f0e8bb..34fcd056d8a8 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -340,12 +340,17 @@ public:
ContentChild* Manager() { return mManager; }
+ bool GetUpdateHitRegion() { return mUpdateHitRegion; }
+
+ void UpdateHitRegion(const nsRegion& aRegion);
+
protected:
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) MOZ_OVERRIDE;
virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
virtual bool RecvDestroy() MOZ_OVERRIDE;
+ virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) MOZ_OVERRIDE;
nsEventStatus DispatchWidgetEvent(nsGUIEvent& event);
@@ -471,6 +476,7 @@ private:
bool mContentDocumentIsDisplayed;
bool mTriedBrowserInit;
ScreenOrientation mOrientation;
+ bool mUpdateHitRegion;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};
diff --git a/dom/messages/SystemMessagePermissionsChecker.jsm b/dom/messages/SystemMessagePermissionsChecker.jsm
index 655c3adccf98..7cd6f89de302 100644
--- a/dom/messages/SystemMessagePermissionsChecker.jsm
+++ b/dom/messages/SystemMessagePermissionsChecker.jsm
@@ -49,6 +49,9 @@ this.SystemMessagePermissionsTable = {
"bluetooth-hfp-status-changed": {
"bluetooth": []
},
+ "bluetooth-hid-status-changed": {
+ "bluetooth": []
+ },
"bluetooth-sco-status-changed": {
"bluetooth": []
},
diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js
index ae0ffbddda27..2c43deadc07d 100644
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -82,10 +82,8 @@ const RIL_IPC_MSG_NAMES = [
"RIL:CardLockResult",
"RIL:CardLockRetryCount",
"RIL:USSDReceived",
- "RIL:SendMMI:Return:OK",
- "RIL:SendMMI:Return:KO",
- "RIL:CancelMMI:Return:OK",
- "RIL:CancelMMI:Return:KO",
+ "RIL:SendMMI",
+ "RIL:CancelMMI",
"RIL:StkCommand",
"RIL:StkSessionEnd",
"RIL:DataError",
@@ -1521,10 +1519,8 @@ RILContentHelper.prototype = {
[data.message, data.sessionEnded]);
break;
}
- case "RIL:SendMMI:Return:OK":
- case "RIL:CancelMMI:Return:OK":
- case "RIL:SendMMI:Return:KO":
- case "RIL:CancelMMI:Return:KO":
+ case "RIL:SendMMI":
+ case "RIL:CancelMMI":
this.handleSendCancelMMI(msg.json);
break;
case "RIL:StkCommand":
diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js
index 42f787a52934..2271b59620d5 100644
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -256,7 +256,6 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
ril: null,
- targetsByRequestId: {},
// Manage message targets in terms of topic. Only the authorized and
// registered contents can receive related messages.
targetsByTopic: {},
@@ -544,27 +543,6 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
clientId: clientId,
data: data
});
- },
-
- saveRequestTarget: function saveRequestTarget(msg) {
- let requestId = msg.json.data.requestId;
- if (!requestId) {
- // The content is not interested in a response;
- return;
- }
-
- this.targetsByRequestId[requestId] = msg.target;
- },
-
- sendRequestResults: function sendRequestResults(requestType, options) {
- let target = this.targetsByRequestId[options.requestId];
- delete this.targetsByRequestId[options.requestId];
-
- if (!target) {
- return;
- }
-
- target.sendAsyncMessage(requestType, options);
}
};
});
@@ -631,8 +609,135 @@ XPCOMUtils.defineLazyGetter(RadioInterfaceLayer.prototype,
}
});
+function WorkerMessenger(radioInterface, options) {
+ // Initial owning attributes.
+ this.radioInterface = radioInterface;
+ this.tokenCallbackMap = {};
+
+ // Add a convenient alias to |radioInterface.debug()|.
+ this.debug = radioInterface.debug.bind(radioInterface);
+
+ if (DEBUG) this.debug("Starting RIL Worker[" + options.clientId + "]");
+ this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
+ this.worker.onerror = this.onerror.bind(this);
+ this.worker.onmessage = this.onmessage.bind(this);
+
+ this.send("setInitialOptions", options);
+
+ gSystemWorkerManager.registerRilWorker(options.clientId, this.worker);
+}
+WorkerMessenger.prototype = {
+ radioInterface: null,
+ worker: null,
+
+ // This gets incremented each time we send out a message.
+ token: 1,
+
+ // Maps tokens we send out with messages to the message callback.
+ tokenCallbackMap: null,
+
+ onerror: function onerror(event) {
+ if (DEBUG) {
+ this.debug("Got an error: " + event.filename + ":" +
+ event.lineno + ": " + event.message + "\n");
+ }
+ event.preventDefault();
+ },
+
+ /**
+ * Process the incoming message from the RIL worker.
+ */
+ onmessage: function onmessage(event) {
+ let message = event.data;
+ if (DEBUG) {
+ this.debug("Received message from worker: " + JSON.stringify(message));
+ }
+
+ let token = message.rilMessageToken;
+ if (token == null) {
+ // That's an unsolicited message. Pass to RadioInterface directly.
+ this.radioInterface.handleUnsolicitedWorkerMessage(message);
+ return;
+ }
+
+ let callback = this.tokenCallbackMap[message.rilMessageToken];
+ if (!callback) {
+ if (DEBUG) this.debug("Ignore orphan token: " + message.rilMessageToken);
+ return;
+ }
+
+ let keep = false;
+ try {
+ keep = callback(message);
+ } catch(e) {
+ if (DEBUG) this.debug("callback throws an exception: " + e);
+ }
+
+ if (!keep) {
+ delete this.tokenCallbackMap[message.rilMessageToken];
+ }
+ },
+
+ /**
+ * Send arbitrary message to worker.
+ *
+ * @param rilMessageType
+ * A text message type.
+ * @param message [optional]
+ * An optional message object to send.
+ * @param callback [optional]
+ * An optional callback function which is called when worker replies
+ * with an message containing a 'rilMessageToken' attribute of the
+ * same value we passed. This callback function accepts only one
+ * parameter -- the reply from worker. It also returns a boolean
+ * value true to keep current token-callback mapping and wait for
+ * another worker reply, or false to remove the mapping.
+ */
+ send: function send(rilMessageType, message, callback) {
+ message = message || {};
+
+ message.rilMessageToken = this.token;
+ this.token++;
+
+ if (callback) {
+ // Only create the map if callback is provided. For sending a request
+ // and intentionally leaving the callback undefined, that reply will
+ // be dropped in |this.onmessage| because of that orphan token.
+ //
+ // For sending a request that never replied at all, we're fine with this
+ // because no callback shall be passed and we leave nothing to be cleaned
+ // up later.
+ this.tokenCallbackMap[message.rilMessageToken] = callback;
+ }
+
+ message.rilMessageType = rilMessageType;
+ this.worker.postMessage(message);
+ },
+
+ /**
+ * Send message to worker and return worker reply to RILContentHelper.
+ *
+ * @param msg
+ * A message object from ppmm.
+ * @param rilMessageType
+ * A text string for worker message type.
+ * @param ipcType [optinal]
+ * A text string for ipc message type. 'msg.name' if omitted.
+ *
+ * @TODO: Bug 815526 - deprecate RILContentHelper.
+ */
+ sendWithIPCMessage: function sendWithIPCMessage(msg, rilMessageType, ipcType) {
+ this.send(rilMessageType, msg.json.data, function(reply) {
+ ipcType = ipcType || msg.name;
+ msg.target.sendAsyncMessage(ipcType, reply);
+ return false;
+ });
+ }
+};
+
function RadioInterface(options) {
this.clientId = options.clientId;
+ this.workerMessenger = new WorkerMessenger(this, options);
this.dataCallSettings = {
oldEnabled: false,
@@ -649,15 +754,6 @@ function RadioInterface(options) {
byAPN: {}
};
- if (DEBUG) this.debug("Starting RIL Worker[" + this.clientId + "]");
- this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
- this.worker.onerror = this.onerror.bind(this);
- this.worker.onmessage = this.onmessage.bind(this);
-
- // Pass initial options to ril_worker.
- options.rilMessageType = "setInitialOptions";
- this.worker.postMessage(options);
-
this.rilContext = {
radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE,
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
@@ -726,12 +822,8 @@ function RadioInterface(options) {
Services.prefs.addObserver(kCellBroadcastDisabled, this, false);
- this._sentSmsEnvelopes = {};
-
this.portAddressedSmsApps = {};
this.portAddressedSmsApps[WAP.WDP_PORT_PUSH] = this.handleSmsWdpPortPush.bind(this);
-
- gSystemWorkerManager.registerRilWorker(this.clientId, this.worker);
}
RadioInterface.prototype = {
@@ -744,6 +836,9 @@ RadioInterface.prototype = {
Ci.nsIObserver,
Ci.nsISettingsServiceCallback]),
+ // A private WorkerMessenger instance.
+ workerMessenger: null,
+
debug: function debug(s) {
dump("-*- RadioInterface[" + this.clientId + "]: " + s + "\n");
},
@@ -770,8 +865,7 @@ RadioInterface.prototype = {
// This message is sync.
return this.rilContext;
case "RIL:EnumerateCalls":
- gMessageManager.saveRequestTarget(msg);
- this.enumerateCalls(msg.json.data);
+ this.enumerateCalls(msg.target, msg.json.data);
break;
case "RIL:GetMicrophoneMuted":
// This message is sync.
@@ -786,10 +880,10 @@ RadioInterface.prototype = {
this.speakerEnabled = msg.json.data;
break;
case "RIL:StartTone":
- this.startTone(msg.json.data);
+ this.workerMessenger.send("startTone", { dtmfChar: msg.json.data });
break;
case "RIL:StopTone":
- this.stopTone();
+ this.workerMessenger.send("stopTone");
break;
case "RIL:Dial":
this.dial(msg.json.data);
@@ -798,154 +892,115 @@ RadioInterface.prototype = {
this.dialEmergency(msg.json.data);
break;
case "RIL:HangUp":
- this.hangUp(msg.json.data);
+ this.workerMessenger.send("hangUp", { callIndex: msg.json.data });
break;
case "RIL:AnswerCall":
- this.answerCall(msg.json.data);
+ this.workerMessenger.send("answerCall", { callIndex: msg.json.data });
break;
case "RIL:RejectCall":
- this.rejectCall(msg.json.data);
+ this.workerMessenger.send("rejectCall", { callIndex: msg.json.data });
break;
case "RIL:HoldCall":
- this.holdCall(msg.json.data);
+ this.workerMessenger.send("holdCall", { callIndex: msg.json.data });
break;
case "RIL:ResumeCall":
- this.resumeCall(msg.json.data);
+ this.workerMessenger.send("resumeCall", { callIndex: msg.json.data });
break;
case "RIL:GetAvailableNetworks":
- gMessageManager.saveRequestTarget(msg);
- this.getAvailableNetworks(msg.json.data.requestId);
+ this.workerMessenger.sendWithIPCMessage(msg, "getAvailableNetworks");
break;
case "RIL:SelectNetwork":
- gMessageManager.saveRequestTarget(msg);
- this.selectNetwork(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "selectNetwork");
break;
case "RIL:SelectNetworkAuto":
- gMessageManager.saveRequestTarget(msg);
- this.selectNetworkAuto(msg.json.data.requestId);
+ this.workerMessenger.sendWithIPCMessage(msg, "selectNetworkAuto");
break;
case "RIL:GetCardLockState":
- gMessageManager.saveRequestTarget(msg);
- this.getCardLockState(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockState",
+ "RIL:CardLockResult");
break;
case "RIL:UnlockCardLock":
- gMessageManager.saveRequestTarget(msg);
- this.unlockCardLock(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccUnlockCardLock",
+ "RIL:CardLockResult");
break;
case "RIL:SetCardLock":
- gMessageManager.saveRequestTarget(msg);
- this.setCardLock(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccSetCardLock",
+ "RIL:CardLockResult");
break;
case "RIL:GetCardLockRetryCount":
- gMessageManager.saveRequestTarget(msg);
- this.getCardLockRetryCount(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockRetryCount",
+ "RIL:CardLockRetryCount");
break;
case "RIL:SendMMI":
- gMessageManager.saveRequestTarget(msg);
- this.sendMMI(msg.json.data);
+ this.sendMMI(msg.target, msg.json.data);
break;
case "RIL:CancelMMI":
- gMessageManager.saveRequestTarget(msg);
- this.cancelMMI(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "cancelUSSD");
break;
case "RIL:SendStkResponse":
- this.sendStkResponse(msg.json.data);
+ this.workerMessenger.send("sendStkTerminalResponse", msg.json.data);
break;
case "RIL:SendStkMenuSelection":
- this.sendStkMenuSelection(msg.json.data);
+ this.workerMessenger.send("sendStkMenuSelection", msg.json.data);
break;
case "RIL:SendStkTimerExpiration":
- this.sendStkTimerExpiration(msg.json.data);
+ this.workerMessenger.send("sendStkTimerExpiration", msg.json.data);
break;
case "RIL:SendStkEventDownload":
- this.sendStkEventDownload(msg.json.data);
+ this.workerMessenger.send("sendStkEventDownload", msg.json.data);
break;
case "RIL:IccOpenChannel":
- gMessageManager.saveRequestTarget(msg);
- this.iccOpenChannel(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccOpenChannel");
break;
case "RIL:IccCloseChannel":
- gMessageManager.saveRequestTarget(msg);
- this.iccCloseChannel(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccCloseChannel");
break;
case "RIL:IccExchangeAPDU":
- gMessageManager.saveRequestTarget(msg);
- this.iccExchangeAPDU(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "iccExchangeAPDU");
break;
case "RIL:ReadIccContacts":
- gMessageManager.saveRequestTarget(msg);
- this.readIccContacts(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "readICCContacts");
break;
case "RIL:UpdateIccContact":
- gMessageManager.saveRequestTarget(msg);
- this.updateIccContact(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "updateICCContact");
break;
case "RIL:SetCallForwardingOption":
- gMessageManager.saveRequestTarget(msg);
- this.setCallForwardingOption(msg.json.data);
+ this.setCallForwardingOption(msg.target, msg.json.data);
break;
case "RIL:GetCallForwardingOption":
- gMessageManager.saveRequestTarget(msg);
- this.getCallForwardingOption(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "queryCallForwardStatus");
break;
case "RIL:SetCallBarringOption":
- gMessageManager.saveRequestTarget(msg);
- this.setCallBarringOption(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "setCallBarring");
break;
case "RIL:GetCallBarringOption":
- gMessageManager.saveRequestTarget(msg);
- this.getCallBarringOption(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "queryCallBarringStatus");
break;
case "RIL:SetCallWaitingOption":
- gMessageManager.saveRequestTarget(msg);
- this.setCallWaitingOption(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "setCallWaiting");
break;
case "RIL:GetCallWaitingOption":
- gMessageManager.saveRequestTarget(msg);
- this.getCallWaitingOption(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "queryCallWaiting");
break;
case "RIL:SetCallingLineIdRestriction":
- gMessageManager.saveRequestTarget(msg);
- this.setCallingLineIdRestriction(msg.json.data);
+ this.setCallingLineIdRestriction(msg.target, msg.json.data);
break;
case "RIL:GetCallingLineIdRestriction":
- gMessageManager.saveRequestTarget(msg);
- this.getCallingLineIdRestriction(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "getCLIR");
break;
case "RIL:GetVoicemailInfo":
// This message is sync.
return this.voicemailInfo;
case "RIL:SetRoamingPreference":
- gMessageManager.saveRequestTarget(msg);
- this.setRoamingPreference(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "setRoamingPreference");
break;
case "RIL:GetRoamingPreference":
- gMessageManager.saveRequestTarget(msg);
- this.getRoamingPreference(msg.json.data);
+ this.workerMessenger.sendWithIPCMessage(msg, "queryRoamingPreference");
break;
}
},
- onerror: function onerror(event) {
- if (DEBUG) {
- this.debug("Got an error: " + event.filename + ":" +
- event.lineno + ": " + event.message + "\n");
- }
- event.preventDefault();
- },
-
- /**
- * Process the incoming message from the RIL worker. This roughly
- * works as follows:
- * (1) Update local state.
- * (2) Update state in related systems such as the audio.
- * (3) Multiplex the message to callbacks / listeners (typically the DOM).
- */
- onmessage: function onmessage(event) {
- let message = event.data;
- if (DEBUG) {
- this.debug("Received message from worker: " + JSON.stringify(message));
- }
+ handleUnsolicitedWorkerMessage: function handleUnsolicitedWorkerMessage(message) {
switch (message.rilMessageType) {
case "callRing":
this.handleCallRing();
@@ -962,34 +1017,12 @@ RadioInterface.prototype = {
gMessageManager.sendTelephonyMessage("RIL:CdmaCallWaiting",
this.clientId, message.number);
break;
- case "enumerateCalls":
- // This one will handle its own notifications.
- this.handleEnumerateCalls(message);
- break;
case "callError":
this.handleCallError(message);
break;
case "suppSvcNotification":
this.handleSuppSvcNotification(message);
break;
- case "iccOpenChannel":
- this.handleIccOpenChannel(message);
- break;
- case "iccCloseChannel":
- this.handleIccCloseChannel(message);
- break;
- case "iccExchangeAPDU":
- this.handleIccExchangeAPDU(message);
- break;
- case "getAvailableNetworks":
- this.handleGetAvailableNetworks(message);
- break;
- case "selectNetwork":
- this.handleSelectNetwork(message);
- break;
- case "selectNetworkAuto":
- this.handleSelectNetworkAuto(message);
- break;
case "networkinfochanged":
this.updateNetworkInfo(message);
break;
@@ -1022,21 +1055,9 @@ RadioInterface.prototype = {
case "sms-received":
let ackOk = this.handleSmsReceived(message);
if (ackOk) {
- this.worker.postMessage({
- rilMessageType: "ackSMS",
- result: RIL.PDU_FCS_OK
- });
+ this.workerMessenger.send("ackSMS", { result: RIL.PDU_FCS_OK });
}
return;
- case "sms-sent":
- this.handleSmsSent(message);
- return;
- case "sms-delivery":
- this.handleSmsDelivery(message);
- return;
- case "sms-send-failed":
- this.handleSmsSendFailed(message);
- return;
case "cellbroadcast-received":
message.timestamp = Date.now();
gMessageManager.sendCellBroadcastMessage("RIL:CellBroadcastReceived",
@@ -1057,20 +1078,6 @@ RadioInterface.prototype = {
case "iccimsi":
this.rilContext.imsi = message.imsi;
break;
- case "iccGetCardLockState":
- case "iccSetCardLock":
- case "iccUnlockCardLock":
- this.handleIccCardLockResult(message);
- break;
- case "iccGetCardLockRetryCount":
- this.handleIccCardLockRetryCount(message);
- break;
- case "icccontacts":
- this.handleReadIccContacts(message);
- break;
- case "icccontactupdate":
- this.handleUpdateIccContact(message);
- break;
case "iccmbdn":
this.handleIccMbdn(message);
break;
@@ -1078,60 +1085,16 @@ RadioInterface.prototype = {
if (DEBUG) this.debug("USSDReceived " + JSON.stringify(message));
this.handleUSSDReceived(message);
break;
- case "sendMMI":
- case "sendUSSD":
- this.handleSendMMI(message);
- break;
- case "cancelMMI":
- case "cancelUSSD":
- this.handleCancelMMI(message);
- break;
case "stkcommand":
this.handleStkProactiveCommand(message);
break;
case "stksessionend":
gMessageManager.sendIccMessage("RIL:StkSessionEnd", this.clientId, null);
break;
- case "setPreferredNetworkType":
- this.handleSetPreferredNetworkType(message);
- break;
- case "queryCallForwardStatus":
- this.handleQueryCallForwardStatus(message);
- break;
- case "setCallForward":
- this.handleSetCallForward(message);
- break;
- case "queryCallBarringStatus":
- this.handleQueryCallBarringStatus(message);
- break;
- case "setCallBarring":
- this.handleSetCallBarring(message);
- break;
- case "queryCallWaiting":
- this.handleQueryCallWaiting(message);
- break;
- case "setCallWaiting":
- this.handleSetCallWaiting(message);
- break;
- case "getCLIR":
- this.handleGetCLIR(message);
- break;
- case "setCLIR":
- this.handleSetCLIR(message);
- break;
- case "setCellBroadcastSearchList":
- this.handleSetCellBroadcastSearchList(message);
- break;
case "setRadioEnabled":
let lock = gSettingsService.createLock();
lock.set("ril.radio.disabled", !message.on, null, null);
break;
- case "setRoamingPreference":
- this.handleSetRoamingPreference(message);
- break;
- case "queryRoamingPreference":
- this.handleQueryRoamingPreference(message);
- break;
default:
throw new Error("Don't know about this message type: " +
message.rilMessageType);
@@ -1322,23 +1285,24 @@ RadioInterface.prototype = {
return;
}
- this.worker.postMessage({rilMessageType: "setPreferredNetworkType",
- networkType: networkType});
- },
+ this.workerMessenger.send("setPreferredNetworkType",
+ { networkType: networkType },
+ (function(response) {
+ if ((this._preferredNetworkType != null) && !response.success) {
+ gSettingsService.createLock().set("ril.radio.preferredNetworkType",
+ this._preferredNetworkType,
+ null);
+ return false;
+ }
- handleSetPreferredNetworkType: function handleSetPreferredNetworkType(message) {
- if ((this._preferredNetworkType != null) && !message.success) {
- gSettingsService.createLock().set("ril.radio.preferredNetworkType",
- this._preferredNetworkType,
- null);
- return;
- }
+ this._preferredNetworkType = response.networkType;
+ if (DEBUG) {
+ this.debug("_preferredNetworkType is now " +
+ RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]);
+ }
- this._preferredNetworkType = message.networkType;
- if (DEBUG) {
- this.debug("_preferredNetworkType is now " +
- RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]);
- }
+ return false;
+ }).bind(this));
},
setCellBroadcastSearchList: function setCellBroadcastSearchList(newSearchListStr) {
@@ -1346,20 +1310,19 @@ RadioInterface.prototype = {
return;
}
- this.worker.postMessage({
- rilMessageType: "setCellBroadcastSearchList",
- searchListStr: newSearchListStr
- });
- },
+ this.workerMessenger.send("setCellBroadcastSearchList",
+ { searchListStr: newSearchListStr },
+ (function callback(response) {
+ if (!response.success) {
+ let lock = gSettingsService.createLock();
+ lock.set(kCellBroadcastSearchList,
+ this._cellBroadcastSearchListStr, null);
+ } else {
+ this._cellBroadcastSearchListStr = response.searchListStr;
+ }
- handleSetCellBroadcastSearchList: function handleSetCellBroadcastSearchList(message) {
- if (message.rilRequestError != RIL.ERROR_SUCCESS) {
- let lock = gSettingsService.createLock();
- lock.set(kCellBroadcastSearchList, this._cellBroadcastSearchListStr, null);
- return;
- }
-
- this._cellBroadcastSearchListStr = message.searchListStr;
+ return false;
+ }).bind(this));
},
handleSignalStrengthChange: function handleSignalStrengthChange(message) {
@@ -1765,62 +1728,6 @@ RadioInterface.prototype = {
this.clientId, call);
},
- /**
- * Handle calls delivered in response to a 'enumerateCalls' request.
- */
- handleEnumerateCalls: function handleEnumerateCalls(options) {
- if (DEBUG) this.debug("handleEnumerateCalls: " + JSON.stringify(options));
- for (let i in options.calls) {
- options.calls[i].state = convertRILCallState(options.calls[i].state);
- options.calls[i].isActive = this._activeCall ?
- options.calls[i].callIndex == this._activeCall.callIndex : false;
- }
- gMessageManager.sendRequestResults("RIL:EnumerateCalls", options);
- },
-
- handleReadIccContacts: function handleReadIccContacts(message) {
- if (DEBUG) this.debug("handleReadIccContacts: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:ReadIccContacts", message);
- },
-
- handleUpdateIccContact: function handleUpdateIccContact(message) {
- if (DEBUG) this.debug("handleUpdateIccContact: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:UpdateIccContact", message);
- },
-
- /**
- * Open Logical UICC channel (aid) for Secure Element access
- */
- handleIccOpenChannel: function handleIccOpenChannel(message) {
- if (DEBUG) this.debug("handleIccOpenChannel: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:IccOpenChannel", message);
- },
-
- /**
- * Close Logical UICC channel
- */
- handleIccCloseChannel: function handleIccCloseChannel(message) {
- if (DEBUG) this.debug("handleIccCloseChannel: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:IccCloseChannel", message);
- },
-
- /**
- * Exchange APDU data on an open Logical UICC channel
- */
- handleIccExchangeAPDU: function handleIccExchangeAPDU(message) {
- if (DEBUG) this.debug("handleIccExchangeAPDU: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:IccExchangeAPDU", message);
- },
-
- /**
- * Handle available networks returned by the 'getAvailableNetworks' request.
- */
- handleGetAvailableNetworks: function handleGetAvailableNetworks(message) {
- if (DEBUG) this.debug("handleGetAvailableNetworks: " + JSON.stringify(message));
-
- gMessageManager.sendRequestResults("RIL:GetAvailableNetworks", message);
- },
-
/**
* Update network selection mode
*/
@@ -1831,22 +1738,6 @@ RadioInterface.prototype = {
this.clientId, message);
},
- /**
- * Handle "manual" network selection request.
- */
- handleSelectNetwork: function handleSelectNetwork(message) {
- if (DEBUG) this.debug("handleSelectNetwork: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:SelectNetwork", message);
- },
-
- /**
- * Handle "automatic" network selection request.
- */
- handleSelectNetworkAuto: function handleSelectNetworkAuto(message) {
- if (DEBUG) this.debug("handleSelectNetworkAuto: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:SelectNetworkAuto", message);
- },
-
/**
* Handle call error.
*/
@@ -1995,11 +1886,10 @@ RadioInterface.prototype = {
let success = Components.isSuccessCode(rv);
// Acknowledge the reception of the SMS.
- message.rilMessageType = "ackSMS";
- if (!success) {
- message.result = RIL.PDU_FCS_MEMORY_CAPACITY_EXCEEDED;
- }
- this.worker.postMessage(message);
+ this.workerMessenger.send("ackSMS", {
+ result: (success ? RIL.PDU_FCS_OK
+ : RIL.PDU_FCS_MEMORY_CAPACITY_EXCEEDED)
+ });
if (!success) {
// At this point we could send a message to content to notify the user
@@ -2043,132 +1933,6 @@ RadioInterface.prototype = {
return false;
},
- /**
- * Local storage for sent SMS messages.
- */
- _sentSmsEnvelopes: null,
- createSmsEnvelope: function createSmsEnvelope(options) {
- let i;
- for (i = 1; this._sentSmsEnvelopes[i]; i++) {
- // Do nothing.
- }
-
- if (DEBUG) this.debug("createSmsEnvelope: assigned " + i);
- this._sentSmsEnvelopes[i] = options;
- return i;
- },
-
- handleSmsSent: function handleSmsSent(message) {
- if (DEBUG) this.debug("handleSmsSent: " + JSON.stringify(message));
-
- let options = this._sentSmsEnvelopes[message.envelopeId];
- if (!options) {
- return;
- }
-
- if (options.silent) {
- // There is no way to modify nsIDOMMozSmsMessage attributes as they are
- // read only so we just create a new sms instance to send along with
- // the notification.
- let sms = options.sms;
- options.request.notifyMessageSent(
- gMobileMessageService.createSmsMessage(sms.id,
- sms.threadId,
- DOM_MOBILE_MESSAGE_DELIVERY_SENT,
- sms.deliveryStatus,
- sms.sender,
- sms.receiver,
- sms.body,
- sms.messageClass,
- sms.timestamp,
- sms.read));
- return;
- }
-
- gMobileMessageDatabaseService
- .setMessageDeliveryByMessageId(options.sms.id,
- null,
- DOM_MOBILE_MESSAGE_DELIVERY_SENT,
- options.sms.deliveryStatus,
- null,
- function notifyResult(rv, domMessage) {
- // TODO bug 832140 handle !Components.isSuccessCode(rv)
- this.broadcastSmsSystemMessage("sms-sent", domMessage);
-
- if (!options.requestStatusReport) {
- // No more used if STATUS-REPORT not requested.
- delete this._sentSmsEnvelopes[message.envelopeId];
- } else {
- options.sms = domMessage;
- }
-
- options.request.notifyMessageSent(domMessage);
- Services.obs.notifyObservers(domMessage, kSmsSentObserverTopic, null);
- }.bind(this));
- },
-
- handleSmsDelivery: function handleSmsDelivery(message) {
- if (DEBUG) this.debug("handleSmsDelivery: " + JSON.stringify(message));
-
- let options = this._sentSmsEnvelopes[message.envelopeId];
- if (!options) {
- return;
- }
- delete this._sentSmsEnvelopes[message.envelopeId];
-
- if (options.silent) {
- return;
- }
-
- gMobileMessageDatabaseService
- .setMessageDeliveryByMessageId(options.sms.id,
- null,
- options.sms.delivery,
- message.deliveryStatus,
- null,
- function notifyResult(rv, domMessage) {
- // TODO bug 832140 handle !Components.isSuccessCode(rv)
- let topic = (message.deliveryStatus == RIL.GECKO_SMS_DELIVERY_STATUS_SUCCESS)
- ? kSmsDeliverySuccessObserverTopic
- : kSmsDeliveryErrorObserverTopic;
- Services.obs.notifyObservers(domMessage, topic, null);
- }.bind(this));
- },
-
- handleSmsSendFailed: function handleSmsSendFailed(message) {
- if (DEBUG) this.debug("handleSmsSendFailed: " + JSON.stringify(message));
-
- let options = this._sentSmsEnvelopes[message.envelopeId];
- if (!options) {
- return;
- }
- delete this._sentSmsEnvelopes[message.envelopeId];
-
- let error = Ci.nsIMobileMessageCallback.UNKNOWN_ERROR;
- switch (message.errorMsg) {
- case RIL.ERROR_RADIO_NOT_AVAILABLE:
- error = Ci.nsIMobileMessageCallback.NO_SIGNAL_ERROR;
- break;
- }
-
- if (options.silent) {
- options.request.notifySendMessageFailed(error);
- return;
- }
-
- gMobileMessageDatabaseService
- .setMessageDeliveryByMessageId(options.sms.id,
- null,
- DOM_MOBILE_MESSAGE_DELIVERY_ERROR,
- RIL.GECKO_SMS_DELIVERY_STATUS_ERROR,
- null,
- function notifyResult(rv, domMessage) {
- // TODO bug 832140 handle !Components.isSuccessCode(rv)
- options.request.notifySendMessageFailed(error);
- Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null);
- }.bind(this));
- },
-
/**
* Handle data call state changes.
*/
@@ -2320,14 +2084,6 @@ RadioInterface.prototype = {
}
},
- handleIccCardLockResult: function handleIccCardLockResult(message) {
- gMessageManager.sendRequestResults("RIL:CardLockResult", message);
- },
-
- handleIccCardLockRetryCount: function handleIccCardLockRetryCount(message) {
- gMessageManager.sendRequestResults("RIL:CardLockRetryCount", message);
- },
-
handleUSSDReceived: function handleUSSDReceived(ussd) {
if (DEBUG) this.debug("handleUSSDReceived " + JSON.stringify(ussd));
gSystemMessenger.broadcastMessage("ussd-received", ussd);
@@ -2335,103 +2091,12 @@ RadioInterface.prototype = {
this.clientId, ussd);
},
- handleSendMMI: function handleSendMMI(message) {
- if (DEBUG) this.debug("handleSendMMI " + JSON.stringify(message));
- let messageType = message.success ? "RIL:SendMMI:Return:OK" :
- "RIL:SendMMI:Return:KO";
- gMessageManager.sendRequestResults(messageType, message);
- },
-
- handleCancelMMI: function handleCancelMMI(message) {
- if (DEBUG) this.debug("handleCancelMMI " + JSON.stringify(message));
- let messageType = message.success ? "RIL:CancelMMI:Return:OK" :
- "RIL:CancelMMI:Return:KO";
- gMessageManager.sendRequestResults(messageType, message);
- },
-
handleStkProactiveCommand: function handleStkProactiveCommand(message) {
if (DEBUG) this.debug("handleStkProactiveCommand " + JSON.stringify(message));
gSystemMessenger.broadcastMessage("icc-stkcommand", message);
gMessageManager.sendIccMessage("RIL:StkCommand", this.clientId, message);
},
- handleQueryCallForwardStatus: function handleQueryCallForwardStatus(message) {
- if (DEBUG) this.debug("handleQueryCallForwardStatus: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:GetCallForwardingOption", message);
- },
-
- handleSetCallForward: function handleSetCallForward(message) {
- if (DEBUG) this.debug("handleSetCallForward: " + JSON.stringify(message));
- gMessageManager.sendMobileConnectionMessage("RIL:CfStateChanged",
- this.clientId, message);
-
- let messageType;
- if (message.isSendMMI) {
- messageType = message.success ? "RIL:SendMMI:Return:OK" :
- "RIL:SendMMI:Return:KO";
- } else {
- messageType = "RIL:SetCallForwardingOption";
- }
- gMessageManager.sendRequestResults(messageType, message);
- },
-
- handleQueryCallBarringStatus: function handleQueryCallBarringStatus(message) {
- if (DEBUG) this.debug("handleQueryCallBarringStatus: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:GetCallBarringOption", message);
- },
-
- handleSetCallBarring: function handleSetCallBarring(message) {
- if (DEBUG) this.debug("handleSetCallBarring: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:SetCallBarringOption", message);
- },
-
- handleQueryCallWaiting: function handleQueryCallWaiting(message) {
- if (DEBUG) this.debug("handleQueryCallWaiting: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:GetCallWaitingOption", message);
- },
-
- handleSetCallWaiting: function handleSetCallWaiting(message) {
- if (DEBUG) this.debug("handleSetCallWaiting: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:SetCallWaitingOption", message);
- },
-
- handleGetCLIR: function handleGetCLIR(message) {
- if (DEBUG) this.debug("handleGetCLIR: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:GetCallingLineIdRestriction",
- message);
- },
-
- handleSetCLIR: function handleSetCLIR(message) {
- if (DEBUG) this.debug("handleSetCLIR: " + JSON.stringify(message));
- let messageType;
- if (message.isSendMMI) {
- messageType = message.success ? "RIL:SendMMI:Return:OK" :
- "RIL:SendMMI:Return:KO";
- } else {
- messageType = "RIL:SetCallingLineIdRestriction";
- }
- if (message.success) {
- try {
- Services.prefs.setIntPref(kClirModePreference, message.clirMode);
- Services.prefs.savePrefFile(null);
- if (DEBUG) {
- this.debug(kClirModePreference + " pref is now " + message.clirMode);
- }
- } catch (e) {}
- }
- gMessageManager.sendRequestResults(messageType, message);
- },
-
- handleSetRoamingPreference: function handleSetRoamingPreference(message) {
- if (DEBUG) this.debug("handleSetRoamingPreference: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:SetRoamingPreference", message);
- },
-
- handleQueryRoamingPreference: function handleQueryRoamingPreference(message) {
- if (DEBUG) this.debug("handleQueryRoamingPreference: " + JSON.stringify(message));
- gMessageManager.sendRequestResults("RIL:GetRoamingPreference", message);
- },
-
// nsIObserver
observe: function observe(subject, topic, data) {
@@ -2451,10 +2116,8 @@ RadioInterface.prototype = {
try {
value = Services.prefs.getBoolPref(kCellBroadcastDisabled);
} catch(e) {}
- this.worker.postMessage({
- rilMessageType: "setCellBroadcastDisabled",
- disabled: value
- });
+ this.workerMessenger.send("setCellBroadcastDisabled",
+ { disabled: value });
}
break;
case "xpcom-shutdown":
@@ -2478,7 +2141,7 @@ RadioInterface.prototype = {
}
break;
case kScreenStateChangedTopic:
- this.setScreenState(data);
+ this.workerMessenger.send("setScreenState", { on: (state === "on") });
break;
}
},
@@ -2591,26 +2254,29 @@ RadioInterface.prototype = {
};
},
- // nsIRadioWorker
-
- worker: null,
-
// nsIRadioInterface
setRadioEnabled: function setRadioEnabled(value) {
if (DEBUG) this.debug("Setting radio power to " + value);
this._changingRadioPower = true;
- this.worker.postMessage({rilMessageType: "setRadioPower", on: value});
+ this.workerMessenger.send("setRadioPower", { on: value });
},
rilContext: null,
// Handle phone functions of nsIRILContentHelper
- enumerateCalls: function enumerateCalls(message) {
+ enumerateCalls: function enumerateCalls(target, message) {
if (DEBUG) this.debug("Requesting enumeration of calls for callback");
- message.rilMessageType = "enumerateCalls";
- this.worker.postMessage(message);
+ this.workerMessenger.send("enumerateCalls", message, (function(response) {
+ for (let call of response.calls) {
+ call.state = convertRILCallState(call.state);
+ call.isActive = this._activeCall ?
+ call.callIndex == this._activeCall.callIndex : false;
+ }
+ target.sendAsyncMessage("RIL:EnumerateCalls", response);
+ return false;
+ }).bind(this));
},
_validateNumber: function _validateNumber(number) {
@@ -2635,9 +2301,8 @@ RadioInterface.prototype = {
if (DEBUG) this.debug("Dialing " + number);
number = PhoneNumberUtils.normalize(number);
if (this._validateNumber(number)) {
- this.worker.postMessage({rilMessageType: "dial",
- number: number,
- isDialEmergency: false});
+ this.workerMessenger.send("dial", { number: number,
+ isDialEmergency: false });
}
},
@@ -2646,191 +2311,62 @@ RadioInterface.prototype = {
// we don't try to be too clever here, as the phone is probably in the
// locked state. Let's just check if it's a number without normalizing
if (this._validateNumber(number)) {
- this.worker.postMessage({rilMessageType: "dial",
- number: number,
- isDialEmergency: true});
+ this.workerMessenger.send("dial", { number: number,
+ isDialEmergency: true });
}
},
- hangUp: function hangUp(callIndex) {
- if (DEBUG) this.debug("Hanging up call no. " + callIndex);
- this.worker.postMessage({rilMessageType: "hangUp",
- callIndex: callIndex});
+ _sendCfStateChanged: function _sendCfStateChanged(message) {
+ gMessageManager.sendMobileConnectionMessage("RIL:CfStateChanged",
+ this.clientId, message);
},
- startTone: function startTone(dtmfChar) {
- if (DEBUG) this.debug("Sending Tone for " + dtmfChar);
- this.worker.postMessage({rilMessageType: "startTone",
- dtmfChar: dtmfChar});
+ _updateCallingLineIdRestrictionPref:
+ function _updateCallingLineIdRestrictionPref(mode) {
+ try {
+ Services.prefs.setIntPref(kClirModePreference, mode);
+ Services.prefs.savePrefFile(null);
+ if (DEBUG) {
+ this.debug(kClirModePreference + " pref is now " + mode);
+ }
+ } catch (e) {}
},
- stopTone: function stopTone() {
- if (DEBUG) this.debug("Stopping Tone");
- this.worker.postMessage({rilMessageType: "stopTone"});
- },
-
- answerCall: function answerCall(callIndex) {
- this.worker.postMessage({rilMessageType: "answerCall",
- callIndex: callIndex});
- },
-
- rejectCall: function rejectCall(callIndex) {
- this.worker.postMessage({rilMessageType: "rejectCall",
- callIndex: callIndex});
- },
-
- holdCall: function holdCall(callIndex) {
- this.worker.postMessage({rilMessageType: "holdCall",
- callIndex: callIndex});
- },
-
- resumeCall: function resumeCall(callIndex) {
- this.worker.postMessage({rilMessageType: "resumeCall",
- callIndex: callIndex});
- },
-
- getAvailableNetworks: function getAvailableNetworks(requestId) {
- this.worker.postMessage({rilMessageType: "getAvailableNetworks",
- requestId: requestId});
- },
-
- setScreenState: function setScreenState(state) {
- if (DEBUG) this.debug("setScreenState: " + JSON.stringify(state));
- this.worker.postMessage({
- rilMessageType: "setScreenState",
- on: (state === "on")
- });
- },
-
- sendMMI: function sendMMI(message) {
+ sendMMI: function sendMMI(target, message) {
if (DEBUG) this.debug("SendMMI " + JSON.stringify(message));
- message.rilMessageType = "sendMMI";
- this.worker.postMessage(message);
+ this.workerMessenger.send("sendMMI", message, (function(response) {
+ if (response.isSetCallForward) {
+ this._sendCfStateChanged(response);
+ } else if (response.isSetCLIR && response.success) {
+ this._updateCallingLineIdRestrictionPref(response.clirMode);
+ }
+
+ target.sendAsyncMessage("RIL:SendMMI", response);
+ return false;
+ }).bind(this));
},
- cancelMMI: function cancelMMI(message) {
- // Some MMI codes trigger radio operations, but unfortunately the RIL only
- // supports cancelling USSD requests so far. Despite that, in order to keep
- // the API uniformity, we are wrapping the cancelUSSD function within the
- // cancelMMI funcion.
- if (DEBUG) this.debug("Cancel pending USSD");
- message.rilMessageType = "cancelUSSD";
- this.worker.postMessage(message);
- },
-
- selectNetworkAuto: function selectNetworkAuto(requestId) {
- this.worker.postMessage({rilMessageType: "selectNetworkAuto",
- requestId: requestId});
- },
-
- selectNetwork: function selectNetwork(message) {
- message.rilMessageType = "selectNetwork";
- this.worker.postMessage(message);
- },
-
- sendStkResponse: function sendStkResponse(message) {
- message.rilMessageType = "sendStkTerminalResponse";
- this.worker.postMessage(message);
- },
-
- sendStkMenuSelection: function sendStkMenuSelection(message) {
- message.rilMessageType = "sendStkMenuSelection";
- this.worker.postMessage(message);
- },
-
- sendStkTimerExpiration: function sendStkTimerExpiration(message) {
- message.rilMessageType = "sendStkTimerExpiration";
- this.worker.postMessage(message);
- },
-
- sendStkEventDownload: function sendStkEventDownload(message) {
- message.rilMessageType = "sendStkEventDownload";
- this.worker.postMessage(message);
- },
-
- iccOpenChannel: function iccOpenChannel(message) {
- if (DEBUG) this.debug("ICC Open Channel");
- message.rilMessageType = "iccOpenChannel";
- this.worker.postMessage(message);
- },
-
- iccCloseChannel: function iccCloseChannel(message) {
- if (DEBUG) this.debug("ICC Close Channel");
- message.rilMessageType = "iccCloseChannel";
- this.worker.postMessage(message);
- },
-
- iccExchangeAPDU: function iccExchangeAPDU(message) {
- if (DEBUG) this.debug("ICC Exchange APDU");
- message.rilMessageType = "iccExchangeAPDU";
- this.worker.postMessage(message);
- },
-
- setCallForwardingOption: function setCallForwardingOption(message) {
+ setCallForwardingOption: function setCallForwardingOption(target, message) {
if (DEBUG) this.debug("setCallForwardingOption: " + JSON.stringify(message));
- message.rilMessageType = "setCallForward";
message.serviceClass = RIL.ICC_SERVICE_CLASS_VOICE;
- this.worker.postMessage(message);
+ this.workerMessenger.send("setCallForward", message, (function(response) {
+ this._sendCfStateChanged(response);
+ target.sendAsyncMessage("RIL:SetCallForwardingOption", response);
+ return false;
+ }).bind(this));
},
- getCallForwardingOption: function getCallForwardingOption(message) {
- if (DEBUG) this.debug("getCallForwardingOption: " + JSON.stringify(message));
- message.rilMessageType = "queryCallForwardStatus";
- message.serviceClass = RIL.ICC_SERVICE_CLASS_NONE;
- message.number = null;
- this.worker.postMessage(message);
- },
-
- setCallBarringOption: function setCallBarringingOption(message) {
- if (DEBUG) this.debug("setCallBarringOption: " + JSON.stringify(message));
- message.rilMessageType = "setCallBarring";
- this.worker.postMessage(message);
- },
-
- getCallBarringOption: function getCallBarringOption(message) {
- if (DEBUG) this.debug("getCallBarringOption: " + JSON.stringify(message));
- message.rilMessageType = "queryCallBarringStatus";
- this.worker.postMessage(message);
- },
-
- setCallWaitingOption: function setCallWaitingOption(message) {
- if (DEBUG) this.debug("setCallWaitingOption: " + JSON.stringify(message));
- message.rilMessageType = "setCallWaiting";
- this.worker.postMessage(message);
- },
-
- getCallWaitingOption: function getCallWaitingOption(message) {
- if (DEBUG) this.debug("getCallWaitingOption: " + JSON.stringify(message));
- message.rilMessageType = "queryCallWaiting";
- this.worker.postMessage(message);
- },
-
- setCallingLineIdRestriction: function setCallingLineIdRestriction(message) {
+ setCallingLineIdRestriction: function setCallingLineIdRestriction(target,
+ message) {
if (DEBUG) {
this.debug("setCallingLineIdRestriction: " + JSON.stringify(message));
}
- message.rilMessageType = "setCLIR";
- this.worker.postMessage(message);
- },
-
- getCallingLineIdRestriction: function getCallingLineIdRestriction(message) {
- if (DEBUG) {
- this.debug("getCallingLineIdRestriction: " + JSON.stringify(message));
- }
- message.rilMessageType = "getCLIR";
- this.worker.postMessage(message);
- },
-
- getRoamingPreference: function getRoamingPreference(message) {
- if (DEBUG) this.debug("getRoamingPreference: " + JSON.stringify(message));
- message.rilMessageType = "queryRoamingPreference";
- this.worker.postMessage(message);
- },
-
- setRoamingPreference: function setRoamingPreference(message) {
- if (DEBUG) this.debug("setRoamingPreference: " + JSON.stringify(message));
- message.rilMessageType = "setRoamingPreference";
- this.worker.postMessage(message);
+ this.workerMessenger.send("setCLIR", message, (function(response) {
+ if (response.success) {
+ this._updateCallingLineIdRestrictionPref(response.clirMode);
+ }
+ target.sendAsyncMessage("RIL:SetCallingLineIdRestriction", response);
+ }).bind(this));
},
get microphoneMuted() {
@@ -3292,7 +2828,6 @@ RadioInterface.prototype = {
}
let options = this._fragmentText(message, null, strict7BitEncoding);
- options.rilMessageType = "sendSMS";
options.number = PhoneNumberUtils.normalize(number);
let requestStatusReport;
try {
@@ -3301,7 +2836,7 @@ RadioInterface.prototype = {
} catch (e) {
requestStatusReport = true;
}
- options.requestStatusReport = requestStatusReport;
+ options.requestStatusReport = requestStatusReport && !silent;
if (options.segmentMaxSeq > 1) {
options.segmentRef16Bit = this.segmentRef16Bit;
options.segmentRef = this.nextSegmentRef;
@@ -3348,16 +2883,107 @@ RadioInterface.prototype = {
}
// Keep current SMS message info for sent/delivered notifications
- options.envelopeId = this.createSmsEnvelope({
+ let context = {
request: request,
sms: domMessage,
requestStatusReport: options.requestStatusReport,
silent: silent
- });
+ };
// This is the entry point starting to send SMS.
- this.worker.postMessage(options);
- }).bind(this);
+ this.workerMessenger.send("sendSMS", options,
+ (function(context, response) {
+ if (response.errorMsg) {
+ // Failed to send SMS out.
+ let error = Ci.nsIMobileMessageCallback.UNKNOWN_ERROR;
+ switch (message.errorMsg) {
+ case RIL.ERROR_RADIO_NOT_AVAILABLE:
+ error = Ci.nsIMobileMessageCallback.NO_SIGNAL_ERROR;
+ break;
+ }
+
+ if (context.silent) {
+ context.request.notifySendMessageFailed(error);
+ return false;
+ }
+
+ gMobileMessageDatabaseService
+ .setMessageDeliveryByMessageId(context.sms.id,
+ null,
+ DOM_MOBILE_MESSAGE_DELIVERY_ERROR,
+ RIL.GECKO_SMS_DELIVERY_STATUS_ERROR,
+ null,
+ function notifyResult(rv, domMessage) {
+ // TODO bug 832140 handle !Components.isSuccessCode(rv)
+ context.request.notifySendMessageFailed(error);
+ Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null);
+ });
+ return false;
+ } // End of send failure.
+
+ if (response.deliveryStatus) {
+ // Message delivery.
+ gMobileMessageDatabaseService
+ .setMessageDeliveryByMessageId(context.sms.id,
+ null,
+ context.sms.delivery,
+ message.deliveryStatus,
+ null,
+ function notifyResult(rv, domMessage) {
+ // TODO bug 832140 handle !Components.isSuccessCode(rv)
+ let topic = (message.deliveryStatus == RIL.GECKO_SMS_DELIVERY_STATUS_SUCCESS)
+ ? kSmsDeliverySuccessObserverTopic
+ : kSmsDeliveryErrorObserverTopic;
+ Services.obs.notifyObservers(domMessage, topic, null);
+ });
+
+ // Send transaction has ended completely.
+ return false;
+ } // End of message delivery.
+
+ // Message sent.
+ if (context.silent) {
+ // There is no way to modify nsIDOMMozSmsMessage attributes as they are
+ // read only so we just create a new sms instance to send along with
+ // the notification.
+ let sms = context.sms;
+ context.request.notifyMessageSent(
+ gMobileMessageService.createSmsMessage(sms.id,
+ sms.threadId,
+ DOM_MOBILE_MESSAGE_DELIVERY_SENT,
+ sms.deliveryStatus,
+ sms.sender,
+ sms.receiver,
+ sms.body,
+ sms.messageClass,
+ sms.timestamp,
+ sms.read));
+ // We don't wait for SMS-DELIVER-REPORT for silent one.
+ return false;
+ }
+
+ gMobileMessageDatabaseService
+ .setMessageDeliveryByMessageId(context.sms.id,
+ null,
+ DOM_MOBILE_MESSAGE_DELIVERY_SENT,
+ context.sms.deliveryStatus,
+ null,
+ (function notifyResult(rv, domMessage) {
+ // TODO bug 832140 handle !Components.isSuccessCode(rv)
+ this.broadcastSmsSystemMessage("sms-sent", domMessage);
+
+ if (context.requestStatusReport) {
+ context.sms = domMessage;
+ }
+
+ context.request.notifyMessageSent(domMessage);
+ Services.obs.notifyObservers(domMessage, kSmsSentObserverTopic, null);
+ }).bind(this));
+
+ // Only keep current context if we have requested for delivery report.
+ return context.requestStatusReport;
+ }).bind(this, context)); // End of |workerMessenger.send| callback.
+ }).bind(this); // End of DB saveSendingMessage callback.
let sendingMessage = {
type: "sms",
@@ -3528,49 +3154,17 @@ RadioInterface.prototype = {
},
setupDataCall: function setupDataCall(radioTech, apn, user, passwd, chappap, pdptype) {
- this.worker.postMessage({rilMessageType: "setupDataCall",
- radioTech: radioTech,
- apn: apn,
- user: user,
- passwd: passwd,
- chappap: chappap,
- pdptype: pdptype});
+ this.workerMessenger.send("setupDataCall", { radioTech: radioTech,
+ apn: apn,
+ user: user,
+ passwd: passwd,
+ chappap: chappap,
+ pdptype: pdptype });
},
deactivateDataCall: function deactivateDataCall(cid, reason) {
- this.worker.postMessage({rilMessageType: "deactivateDataCall",
- cid: cid,
- reason: reason});
- },
-
- getCardLockState: function getCardLockState(message) {
- message.rilMessageType = "iccGetCardLockState";
- this.worker.postMessage(message);
- },
-
- unlockCardLock: function unlockCardLock(message) {
- message.rilMessageType = "iccUnlockCardLock";
- this.worker.postMessage(message);
- },
-
- setCardLock: function setCardLock(message) {
- message.rilMessageType = "iccSetCardLock";
- this.worker.postMessage(message);
- },
-
- getCardLockRetryCount: function getCardLockRetryCount(message) {
- message.rilMessageType = "iccGetCardLockRetryCount";
- this.worker.postMessage(message);
- },
-
- readIccContacts: function readIccContacts(message) {
- message.rilMessageType = "readICCContacts";
- this.worker.postMessage(message);
- },
-
- updateIccContact: function updateIccContact(message) {
- message.rilMessageType = "updateICCContact";
- this.worker.postMessage(message);
+ this.workerMessenger.send("deactivateDataCall", { cid: cid,
+ reason: reason });
},
};
diff --git a/dom/system/gonk/SystemWorkerManager.cpp b/dom/system/gonk/SystemWorkerManager.cpp
index 95e633f13134..4aa590215f9d 100644
--- a/dom/system/gonk/SystemWorkerManager.cpp
+++ b/dom/system/gonk/SystemWorkerManager.cpp
@@ -28,6 +28,7 @@
#include "mozilla/ipc/Netd.h"
#include "AutoMounter.h"
#include "TimeZoneSettingObserver.h"
+#include "AudioManager.h"
#endif
#include "mozilla/ipc/Ril.h"
#include "nsIObserverService.h"
@@ -347,6 +348,8 @@ SystemWorkerManager::Init()
InitializeTimeZoneSettingObserver();
rv = InitNetd(cx);
NS_ENSURE_SUCCESS(rv, rv);
+ nsCOMPtr audioManager =
+ do_GetService(NS_AUDIOMANAGER_CONTRACTID);
#endif
nsCOMPtr obs =
diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js
index 6a5a66ec123c..2962b88652f2 100644
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1383,9 +1383,9 @@ let RIL = {
*/
readICCContacts: function readICCContacts(options) {
if (!this.appType) {
- options.rilMessageType = "icccontacts";
options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
this.sendChromeMessage(options);
+ return;
}
ICCContactHelper.readICCContacts(
@@ -1393,12 +1393,10 @@ let RIL = {
options.contactType,
function onsuccess(contacts) {
// Reuse 'options' to get 'requestId' and 'contactType'.
- options.rilMessageType = "icccontacts";
options.contacts = contacts;
RIL.sendChromeMessage(options);
}.bind(this),
function onerror(errorMsg) {
- options.rilMessageType = "icccontacts";
options.errorMsg = errorMsg;
RIL.sendChromeMessage(options);
}.bind(this));
@@ -1415,12 +1413,10 @@ let RIL = {
updateICCContact: function updateICCContact(options) {
let onsuccess = function onsuccess() {
// Reuse 'options' to get 'requestId' and 'contactType'.
- options.rilMessageType = "icccontactupdate";
RIL.sendChromeMessage(options);
}.bind(this);
let onerror = function onerror(errorMsg) {
- options.rilMessageType = "icccontactupdate";
options.errorMsg = errorMsg;
RIL.sendChromeMessage(options);
}.bind(this);
@@ -2076,12 +2072,16 @@ let RIL = {
try {
let str = options.searchListStr;
this.cellBroadcastConfigs.MMI = this._convertCellBroadcastSearchList(str);
+ options.success = true;
} catch (e) {
if (DEBUG) {
debug("Invalid Cell Broadcast search list: " + e);
}
- options.rilRequestError = ERROR_GENERIC_FAILURE;
- this.sendChromeMessage(options);
+ options.success = false;
+ }
+
+ this.sendChromeMessage(options);
+ if (!options.success) {
return;
}
@@ -2420,7 +2420,6 @@ let RIL = {
let _sendMMIError = (function _sendMMIError(errorMsg, mmiServiceCode) {
options.success = false;
- options.rilMessageType = "sendMMI";
options.errorMsg = errorMsg;
if (mmiServiceCode) {
options.mmiServiceCode = mmiServiceCode;
@@ -2484,8 +2483,6 @@ let RIL = {
debug("MMI " + JSON.stringify(mmi));
}
- options.rilMessageType = "sendMMI";
-
// We check if the MMI service code is supported and in that case we
// trigger the appropriate RIL request if possible.
let sc = mmi.serviceCode;
@@ -2514,8 +2511,7 @@ let RIL = {
return;
}
- options.rilMessageType = "setCallForward";
- options.isSendMMI = true;
+ options.isSetCallForward = true;
options.timeSeconds = mmi.sic;
this.setCallForward(options);
return;
@@ -2592,7 +2588,7 @@ let RIL = {
case MMI_SC_IMEI:
// A device's IMEI can't change, so we only need to request it once.
if (this.IMEI == null) {
- this.getIMEI({mmi: true});
+ this.getIMEI(options);
return;
}
// If we already had the device's IMEI, we just send it to chrome.
@@ -2634,8 +2630,7 @@ let RIL = {
_sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED, MMI_KS_SC_CLIR);
return;
}
- options.rilMessageType = "setCLIR";
- options.isSendMMI = true;
+ options.isSetCLIR = true;
this.setCLIR(options);
return;
@@ -2656,7 +2651,8 @@ let RIL = {
if (mmi.procedure === MMI_PROCEDURE_INTERROGATION) {
this.queryICCFacilityLock(options);
return;
- } else if (mmi.procedure === MMI_PROCEDURE_ACTIVATION) {
+ }
+ if (mmi.procedure === MMI_PROCEDURE_ACTIVATION) {
options.enabled = 1;
} else if (mmi.procedure === MMI_PROCEDURE_DEACTIVATION) {
options.enabled = 0;
@@ -2725,7 +2721,7 @@ let RIL = {
Buf.newParcel(REQUEST_QUERY_CALL_FORWARD_STATUS, options);
Buf.writeUint32(CALL_FORWARD_ACTION_QUERY_STATUS);
Buf.writeUint32(options.reason);
- Buf.writeUint32(options.serviceClass);
+ Buf.writeUint32(options.serviceClass || ICC_SERVICE_CLASS_NONE);
Buf.writeUint32(this._toaFromString(options.number));
Buf.writeString(options.number);
Buf.writeUint32(0);
@@ -2795,7 +2791,7 @@ let RIL = {
* Does use have confirmed the call requested from ICC?
*/
stkHandleCallSetup: function stkHandleCallSetup(options) {
- Buf.newParcel(REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, options);
+ Buf.newParcel(REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM);
Buf.writeUint32(1);
Buf.writeUint32(options.hasConfirmed ? 1 : 0);
Buf.sendParcel();
@@ -4375,8 +4371,8 @@ let RIL = {
? GECKO_SMS_DELIVERY_STATUS_SUCCESS
: GECKO_SMS_DELIVERY_STATUS_ERROR;
this.sendChromeMessage({
- rilMessageType: "sms-delivery",
- envelopeId: options.envelopeId,
+ rilMessageType: options.rilMessageType,
+ rilMessageToken: options.rilMessageToken,
deliveryStatus: deliveryStatus
});
@@ -4492,8 +4488,8 @@ let RIL = {
// Fall through.
default:
this.sendChromeMessage({
- rilMessageType: "sms-send-failed",
- envelopeId: options.envelopeId,
+ rilMessageType: options.rilMessageType,
+ rilMessageToken: options.rilMessageToken,
errorMsg: options.rilRequestError,
});
break;
@@ -4517,8 +4513,8 @@ let RIL = {
}
this.sendChromeMessage({
- rilMessageType: "sms-sent",
- envelopeId: options.envelopeId,
+ rilMessageType: options.rilMessageType,
+ rilMessageToken: options.rilMessageToken,
});
}
},
@@ -5403,8 +5399,7 @@ RIL[REQUEST_SET_CLIR] = function REQUEST_SET_CLIR(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- }
- if (options.success && options.isSendMMI) {
+ } else if (options.rilMessageType === "sendMMI") {
switch (options.procedure) {
case MMI_PROCEDURE_ACTIVATION:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@@ -5462,8 +5457,7 @@ RIL[REQUEST_SET_CALL_FORWARD] =
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- }
- if (options.success && options.isSendMMI) {
+ } else if (options.rilMessageType === "sendMMI") {
switch (options.action) {
case CALL_FORWARD_ACTION_ENABLE:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@@ -5506,12 +5500,10 @@ RIL[REQUEST_SMS_ACKNOWLEDGE] = null;
RIL[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, options) {
this.IMEI = Buf.readString();
// So far we only send the IMEI back to chrome if it was requested via MMI.
- if (!options.mmi) {
+ if (options.rilMessageType !== "sendMMI") {
return;
}
- options.mmiServiceCode = MMI_KS_SC_IMEI;
- options.rilMessageType = "sendMMI";
options.success = (options.rilRequestError === 0);
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
if ((!options.success || this.IMEI == null) && !options.errorMsg) {
@@ -5667,8 +5659,6 @@ RIL[REQUEST_QUERY_NETWORK_SELECTION_MODE] = function REQUEST_QUERY_NETWORK_SELEC
RIL[REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = function REQUEST_SET_NETWORK_SELECTION_AUTOMATIC(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- this.sendChromeMessage(options);
- return;
}
this.sendChromeMessage(options);
@@ -5676,8 +5666,6 @@ RIL[REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = function REQUEST_SET_NETWORK_SELE
RIL[REQUEST_SET_NETWORK_SELECTION_MANUAL] = function REQUEST_SET_NETWORK_SELECTION_MANUAL(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- this.sendChromeMessage(options);
- return;
}
this.sendChromeMessage(options);
@@ -5685,11 +5673,9 @@ RIL[REQUEST_SET_NETWORK_SELECTION_MANUAL] = function REQUEST_SET_NETWORK_SELECTI
RIL[REQUEST_QUERY_AVAILABLE_NETWORKS] = function REQUEST_QUERY_AVAILABLE_NETWORKS(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- this.sendChromeMessage(options);
- return;
+ } else {
+ options.networks = this._processNetworks();
}
-
- options.networks = this._processNetworks();
this.sendChromeMessage(options);
};
RIL[REQUEST_DTMF_START] = null;
@@ -5857,11 +5843,8 @@ RIL[REQUEST_SET_PREFERRED_NETWORK_TYPE] = function REQUEST_SET_PREFERRED_NETWORK
return;
}
- this.sendChromeMessage({
- rilMessageType: "setPreferredNetworkType",
- networkType: options.networkType,
- success: options.rilRequestError == ERROR_SUCCESS
- });
+ options.success = (options.rilRequestError == ERROR_SUCCESS);
+ this.sendChromeMessage(options);
};
RIL[REQUEST_GET_PREFERRED_NETWORK_TYPE] = function REQUEST_GET_PREFERRED_NETWORK_TYPE(length, options) {
let networkType;
@@ -5885,21 +5868,16 @@ RIL[REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE] = null;
RIL[REQUEST_CDMA_SET_ROAMING_PREFERENCE] = function REQUEST_CDMA_SET_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- this.sendChromeMessage(options);
- return;
}
-
this.sendChromeMessage(options);
};
RIL[REQUEST_CDMA_QUERY_ROAMING_PREFERENCE] = function REQUEST_CDMA_QUERY_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
- this.sendChromeMessage(options);
- return;
+ } else {
+ let mode = Buf.readUint32List();
+ options.mode = CDMA_ROAMING_PREFERENCE_TO_GECKO[mode[0]];
}
-
- let mode = Buf.readUint32List();
- options.mode = CDMA_ROAMING_PREFERENCE_TO_GECKO[mode[0]];
this.sendChromeMessage(options);
};
RIL[REQUEST_SET_TTY_MODE] = null;
diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h
index a86a8be4179a..6cd172c65413 100644
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -763,24 +763,24 @@ struct ParamTraits
}
};
-template<>
-struct ParamTraits
+template
+struct RegionParamTraits
{
- typedef nsIntRegion paramType;
+ typedef Region paramType;
static void Write(Message* msg, const paramType& param)
{
- nsIntRegionRectIterator it(param);
- while (const nsIntRect* r = it.Next())
+ Iter it(param);
+ while (const Rect* r = it.Next())
WriteParam(msg, *r);
// empty rects are sentinel values because nsRegions will never
// contain them
- WriteParam(msg, nsIntRect());
+ WriteParam(msg, Rect());
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
- nsIntRect rect;
+ Rect rect;
while (ReadParam(msg, iter, &rect)) {
if (rect.IsEmpty())
return true;
@@ -790,6 +790,11 @@ struct ParamTraits
}
};
+template<>
+struct ParamTraits
+ : RegionParamTraits
+{};
+
template<>
struct ParamTraits
{
@@ -988,6 +993,11 @@ struct ParamTraits
}
};
+template<>
+struct ParamTraits
+ : RegionParamTraits
+{};
+
template<>
struct ParamTraits
{
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 46a27dd0cfe9..1b63d16a72ef 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -40,6 +40,7 @@
#include "BasicLayers.h"
#include "nsBoxFrame.h"
#include "nsViewportFrame.h"
+#include "nsSubDocumentFrame.h"
#include "nsSVGEffects.h"
#include "nsSVGElement.h"
#include "nsSVGClipPathFrame.h"
@@ -1270,6 +1271,17 @@ GetMouseThrough(const nsIFrame* aFrame)
return false;
}
+static bool
+IsFrameReceivingPointerEvents(nsIFrame* aFrame)
+{
+ nsSubDocumentFrame* frame = do_QueryFrame(aFrame);
+ if (frame && frame->PassPointerEventsToChildren()) {
+ return true;
+ }
+ return NS_STYLE_POINTER_EVENTS_NONE !=
+ aFrame->StyleVisibility()->GetEffectivePointerEvents(aFrame);
+}
+
// A list of frames, and their z depth. Used for sorting
// the results of hit testing.
struct FramesWithDepth
@@ -1352,8 +1364,7 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
for (uint32_t j = 0; j < outFrames.Length(); j++) {
nsIFrame *f = outFrames.ElementAt(j);
// Handle the XUL 'mousethrough' feature and 'pointer-events'.
- if (!GetMouseThrough(f) &&
- f->StyleVisibility()->GetEffectivePointerEvents(f) != NS_STYLE_POINTER_EVENTS_NONE) {
+ if (!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f)) {
writeFrames->AppendElement(f);
}
}
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index dd252484429e..09d478655c2c 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5489,6 +5489,47 @@ private:
uint32_t mFlags;
};
+class AutoUpdateHitRegion
+{
+public:
+ AutoUpdateHitRegion(PresShell* aShell, nsIFrame* aFrame)
+ : mShell(aShell), mFrame(aFrame)
+ {
+ }
+ ~AutoUpdateHitRegion()
+ {
+ if (XRE_GetProcessType() != GeckoProcessType_Content ||
+ !mFrame || !mShell) {
+ return;
+ }
+ TabChild* tabChild = GetTabChildFrom(mShell);
+ if (!tabChild || !tabChild->GetUpdateHitRegion()) {
+ return;
+ }
+ nsRegion region;
+ nsDisplayListBuilder builder(mFrame,
+ nsDisplayListBuilder::EVENT_DELIVERY,
+ /* aBuildCert= */ false);
+ nsDisplayList list;
+ nsAutoTArray outFrames;
+ nsDisplayItem::HitTestState hitTestState;
+ nsRect bounds = mShell->GetPresContext()->GetVisibleArea();
+ builder.EnterPresShell(mFrame, bounds);
+ mFrame->BuildDisplayListForStackingContext(&builder, bounds, &list);
+ builder.LeavePresShell(mFrame, bounds);
+ list.HitTest(&builder, bounds, &hitTestState, &outFrames);
+ list.DeleteAll();
+ for (int32_t i = outFrames.Length() - 1; i >= 0; --i) {
+ region.Or(region, nsLayoutUtils::TransformFrameRectToAncestor(
+ outFrames[i], nsRect(nsPoint(0, 0), outFrames[i]->GetSize()), mFrame));
+ }
+ tabChild->UpdateHitRegion(region);
+ }
+private:
+ PresShell* mShell;
+ nsIFrame* mFrame;
+};
+
void
PresShell::Paint(nsView* aViewToPaint,
const nsRegion& aDirtyRegion,
@@ -5520,6 +5561,7 @@ PresShell::Paint(nsView* aViewToPaint,
didPaintFlags |= PAINT_COMPOSITE;
}
nsAutoNotifyDidPaint notifyDidPaint(this, didPaintFlags);
+ AutoUpdateHitRegion updateHitRegion(this, frame);
// Whether or not we should set first paint when painting is
// suppressed is debatable. For now we'll do it because
diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in
index b41a25d2cd75..d7369a124a9f 100644
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -141,6 +141,7 @@ MOCHITEST_FILES = \
test_bug770106.html \
test_maxLineBoxWidth.html \
test_remote_frame.html \
+ test_remote_passpointerevents.html \
test_bug842853.html \
test_bug842853-2.html \
file_bug842853.sjs \
diff --git a/layout/base/tests/test_remote_passpointerevents.html b/layout/base/tests/test_remote_passpointerevents.html
new file mode 100644
index 000000000000..44de9465a429
--- /dev/null
+++ b/layout/base/tests/test_remote_passpointerevents.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp
index 5f560f508a52..f547844299a0 100644
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -303,7 +303,11 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (aBuilder->IsForEventDelivery() && !PassPointerEventsToChildren())
return;
- DisplayBorderBackgroundOutline(aBuilder, aLists);
+ // If we are pointer-events:none then we don't need to HitTest background
+ if (!aBuilder->IsForEventDelivery() ||
+ StyleVisibility()->mPointerEvents != NS_STYLE_POINTER_EVENTS_NONE) {
+ DisplayBorderBackgroundOutline(aBuilder, aLists);
+ }
if (!mInnerView)
return;
diff --git a/layout/generic/nsSubDocumentFrame.h b/layout/generic/nsSubDocumentFrame.h
index 9fd44d1eae05..871472dbc203 100644
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -107,6 +107,12 @@ public:
return !frameLoader || frameLoader->ShouldClampScrollPosition();
}
+ /**
+ * Return true if pointer event hit-testing should be allowed to target
+ * content in the subdocument.
+ */
+ bool PassPointerEventsToChildren();
+
protected:
friend class AsyncFrameInit;
@@ -135,12 +141,6 @@ protected:
*/
nsIFrame* ObtainIntrinsicSizeFrame();
- /**
- * Return true if pointer event hit-testing should be allowed to target
- * content in the subdocument.
- */
- bool PassPointerEventsToChildren();
-
nsRefPtr mFrameLoader;
nsView* mInnerView;
bool mIsInline;
diff --git a/layout/ipc/PRenderFrame.ipdl b/layout/ipc/PRenderFrame.ipdl
index 1e7bd6975e8a..f0f5ce6b2c88 100644
--- a/layout/ipc/PRenderFrame.ipdl
+++ b/layout/ipc/PRenderFrame.ipdl
@@ -8,6 +8,10 @@
include protocol PBrowser;
include protocol PLayerTransaction;
+include "nsRegion.h";
+
+using nsRegion;
+
namespace mozilla {
namespace layout {
@@ -44,15 +48,19 @@ parent:
async CancelDefaultPanZoom();
async DetectScrollableSubframe();
+ async UpdateHitRegion(nsRegion aRegion);
+
async __delete__();
state EMPTY_OR_DIRECT_COMPOSITOR:
recv PLayerTransaction goto HAVE_CONTENT;
recv NotifyCompositorTransaction goto EMPTY_OR_DIRECT_COMPOSITOR;
+ recv UpdateHitRegion goto EMPTY_OR_DIRECT_COMPOSITOR;
recv __delete__;
state HAVE_CONTENT:
recv NotifyCompositorTransaction goto HAVE_CONTENT;
+ recv UpdateHitRegion goto HAVE_CONTENT;
recv __delete__;
};
diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp
index b44eaa286cd4..67b7c991a0ef 100644
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -624,6 +624,8 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
CompositorParent::SetControllerForLayerTree(mLayersId, mContentController);
}
}
+ // Set a default RenderFrameParent
+ mFrameLoader->SetCurrentRemoteFrame(this);
}
APZCTreeManager*
@@ -862,6 +864,13 @@ RenderFrameParent::RecvDetectScrollableSubframe()
return true;
}
+bool
+RenderFrameParent::RecvUpdateHitRegion(const nsRegion& aRegion)
+{
+ mTouchRegion = aRegion;
+ return true;
+}
+
PLayerTransactionParent*
RenderFrameParent::AllocPLayerTransactionParent()
{
@@ -1007,6 +1016,12 @@ RenderFrameParent::UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float
}
}
+bool
+RenderFrameParent::HitTest(const nsRect& aRect)
+{
+ return mTouchRegion.Contains(aRect);
+}
+
} // namespace layout
} // namespace mozilla
@@ -1022,6 +1037,14 @@ nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder,
return layer.forget();
}
+void
+nsDisplayRemote::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
+ HitTestState* aState, nsTArray *aOutFrames)
+{
+ if (mRemoteFrame->HitTest(aRect)) {
+ aOutFrames->AppendElement(mFrame);
+ }
+}
void
nsDisplayRemoteShadow::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
diff --git a/layout/ipc/RenderFrameParent.h b/layout/ipc/RenderFrameParent.h
index 04e7b88feec5..2e684984ba9b 100644
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -104,6 +104,8 @@ public:
void UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
+ bool HitTest(const nsRect& aRect);
+
protected:
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
@@ -112,6 +114,8 @@ protected:
virtual bool RecvCancelDefaultPanZoom() MOZ_OVERRIDE;
virtual bool RecvDetectScrollableSubframe() MOZ_OVERRIDE;
+ virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) MOZ_OVERRIDE;
+
virtual PLayerTransactionParent* AllocPLayerTransactionParent() MOZ_OVERRIDE;
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
@@ -160,6 +164,8 @@ private:
bool mFrameLoaderDestroyed;
// this is gfxRGBA because that's what ColorLayer wants.
gfxRGBA mBackgroundColor;
+
+ nsRegion mTouchRegion;
};
} // namespace layout
@@ -190,6 +196,9 @@ public:
BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerParameters& aContainerParameters) MOZ_OVERRIDE;
+ void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
+ HitTestState* aState, nsTArray *aOutFrames) MOZ_OVERRIDE;
+
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
private:
diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
index 30d2ef4d5a53..fa5a5fc9398f 100644
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -457,6 +457,7 @@ OS_LIBS += \
-lstagefright_omx \
-lbinder \
-lgui \
+ $(DEPTH)/widget/gonk/nativewindow/$(LIB_PREFIX)nativewindow.$(LIB_SUFFIX) \
$(NULL)
endif
diff --git a/widget/gonk/moz.build b/widget/gonk/moz.build
index 2331e632aa11..bf37f187277c 100644
--- a/widget/gonk/moz.build
+++ b/widget/gonk/moz.build
@@ -20,7 +20,7 @@ EXPORTS += [
'OrientationObserver.h',
]
-DIRS += ['libdisplay']
+DIRS += ['libdisplay', 'nativewindow']
CPP_SOURCES += [
'EventHub.cpp',
diff --git a/widget/gonk/nativewindow/GonkNativeWindow.h b/widget/gonk/nativewindow/GonkNativeWindow.h
new file mode 100644
index 000000000000..6da01035820a
--- /dev/null
+++ b/widget/gonk/nativewindow/GonkNativeWindow.h
@@ -0,0 +1,2 @@
+
+#include "GonkNativeWindowICS.h"
diff --git a/widget/gonk/nativewindow/GonkNativeWindowClient.h b/widget/gonk/nativewindow/GonkNativeWindowClient.h
new file mode 100644
index 000000000000..d229bc237a54
--- /dev/null
+++ b/widget/gonk/nativewindow/GonkNativeWindowClient.h
@@ -0,0 +1,2 @@
+
+#include "GonkNativeWindowClientICS.h"
diff --git a/dom/camera/GonkNativeWindowClient.cpp b/widget/gonk/nativewindow/GonkNativeWindowClientICS.cpp
similarity index 100%
rename from dom/camera/GonkNativeWindowClient.cpp
rename to widget/gonk/nativewindow/GonkNativeWindowClientICS.cpp
diff --git a/dom/camera/GonkNativeWindowClient.h b/widget/gonk/nativewindow/GonkNativeWindowClientICS.h
similarity index 96%
rename from dom/camera/GonkNativeWindowClient.h
rename to widget/gonk/nativewindow/GonkNativeWindowClientICS.h
index c7b7ba305d04..bd5720000d9a 100644
--- a/dom/camera/GonkNativeWindowClient.h
+++ b/widget/gonk/nativewindow/GonkNativeWindowClientICS.h
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#ifndef DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
-#define DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
+#ifndef NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H
+#define NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H
#include
@@ -127,10 +127,10 @@ private:
// member variables are accessed.
mutable Mutex mMutex;
- bool mConnectedToCpu;
+ bool mConnectedToCpu;
};
}; // namespace android
-#endif // DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
+#endif // NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H
diff --git a/dom/camera/GonkNativeWindow.cpp b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
similarity index 99%
rename from dom/camera/GonkNativeWindow.cpp
rename to widget/gonk/nativewindow/GonkNativeWindowICS.cpp
index 7a997988d4fe..1560d572f681 100644
--- a/dom/camera/GonkNativeWindow.cpp
+++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
@@ -16,7 +16,6 @@
*/
#include "base/basictypes.h"
-#include "GonkCameraHwMgr.h"
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
#include "mozilla/layers/ImageBridgeChild.h"
diff --git a/dom/camera/GonkNativeWindow.h b/widget/gonk/nativewindow/GonkNativeWindowICS.h
similarity index 99%
rename from dom/camera/GonkNativeWindow.h
rename to widget/gonk/nativewindow/GonkNativeWindowICS.h
index 836885d8d48d..cfb1e7f2b5de 100644
--- a/dom/camera/GonkNativeWindow.h
+++ b/widget/gonk/nativewindow/GonkNativeWindowICS.h
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#ifndef DOM_CAMERA_GONKNATIVEWINDOW_H
-#define DOM_CAMERA_GONKNATIVEWINDOW_H
+#ifndef NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
+#define NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
#include
#include
@@ -349,4 +349,4 @@ protected:
}; // namespace android
-#endif // DOM_CAMERA_GONKNATIVEWINDOW_H
+#endif // NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
diff --git a/widget/gonk/nativewindow/Makefile.in b/widget/gonk/nativewindow/Makefile.in
new file mode 100644
index 000000000000..098906cb6523
--- /dev/null
+++ b/widget/gonk/nativewindow/Makefile.in
@@ -0,0 +1,27 @@
+# Copyright 2013 Mozilla Foundation and Mozilla contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+LIBRARY_NAME = nativewindow
+LIBXUL_LIBRARY = 1
+FAIL_ON_WARNINGS := 1
+STL_FLAGS=
+
+include $(topsrcdir)/config/rules.mk
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
diff --git a/widget/gonk/nativewindow/moz.build b/widget/gonk/nativewindow/moz.build
new file mode 100644
index 000000000000..25617adb25a0
--- /dev/null
+++ b/widget/gonk/nativewindow/moz.build
@@ -0,0 +1,34 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# Copyright 2013 Mozilla Foundation and Mozilla contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+MODULE = 'nativewindow'
+
+EXPORTS += [
+ 'GonkNativeWindow.h',
+ 'GonkNativeWindowClient.h',
+]
+
+EXPORTS += [
+ 'GonkNativeWindowClientICS.h',
+ 'GonkNativeWindowICS.h',
+]
+
+if CONFIG['MOZ_B2G_CAMERA'] or CONFIG['MOZ_OMX_DECODER']:
+ CPP_SOURCES += [
+ 'GonkNativeWindowICS.cpp',
+ 'GonkNativeWindowClientICS.cpp',
+ ]
+