From b725eca476043cec197fbf1b1942703b6d1db6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Mon, 12 Aug 2013 21:02:11 -0700 Subject: [PATCH 01/24] Bug 904224 - "System JS : ERROR chrome://browser/content/forms.js:827 TypeError: element is null" in green B2G mochitest-2,3 runs r=yxl --- b2g/chrome/content/forms.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/b2g/chrome/content/forms.js b/b2g/chrome/content/forms.js index ad6806401b4f..5e0b87e2d6b9 100644 --- a/b2g/chrome/content/forms.js +++ b/b2g/chrome/content/forms.js @@ -824,6 +824,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); From acebed034f9a7ba5b79b421557ef7ab30a217b3f Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Mon, 12 Aug 2013 23:35:23 -0700 Subject: [PATCH 02/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/d7ff1015ccee Author: Rex KM Lee Desc: Merge pull request #11270 from rexboy7/fix-bug899511 Bug 899501 - [Dialer] Layout adjusting for HD support on suggestion over... ======== https://hg.mozilla.org/integration/gaia-central/rev/fc83b598b958 Author: Rex Lee Desc: Bug 899501 - [Dialer] Layout adjusting for HD support on suggestion overlay --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7e908215250e..1eec5068c4af 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "a6b81f7d4b84287a2bdf0ce78df08fed9fd46bee", + "revision": "d7ff1015ccee68bc68364f589e4eb42d1130a493", "repo_path": "/integration/gaia-central" } From 68800c93752a94d37a54b1ff99beb91c862287ea Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 00:10:24 -0700 Subject: [PATCH 03/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/f2c1d7617f86 Author: Rex KM Lee Desc: Merge pull request #11456 from rexboy7/fix-bug894815 bug 894815 - [lockscreen]permission screen and attention screen height f... ======== https://hg.mozilla.org/integration/gaia-central/rev/29b9507be23b Author: Rex Lee Desc: bug 894815 - [lockscreen]permission screen and attention screen height fix on lockscreen camera --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1eec5068c4af..01d8b15ad0d3 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "d7ff1015ccee68bc68364f589e4eb42d1130a493", + "revision": "f2c1d7617f86432416df4e4fccbaf835afac203c", "repo_path": "/integration/gaia-central" } From 79f2e1f7bfbe0b555cd50ce775c0991027e834de Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Mon, 12 Aug 2013 17:32:25 +0800 Subject: [PATCH 04/24] Bug 899014 - [Bluetooth][HID] HID dom bluetooth implementation, r=echou --- dom/bluetooth/BluetoothCommon.h | 1 + dom/bluetooth/BluetoothHidManager.cpp | 207 ++++++++++++++++++ dom/bluetooth/BluetoothHidManager.h | 53 +++++ dom/bluetooth/BluetoothService.h | 5 + dom/bluetooth/BluetoothUuid.h | 3 +- .../ipc/BluetoothServiceChildProcess.cpp | 8 + .../ipc/BluetoothServiceChildProcess.h | 5 + dom/bluetooth/linux/BluetoothDBusService.cpp | 107 ++++++++- dom/bluetooth/linux/BluetoothDBusService.h | 5 + dom/bluetooth/moz.build | 1 + .../SystemMessagePermissionsChecker.jsm | 3 + 11 files changed, 393 insertions(+), 5 deletions(-) create mode 100644 dom/bluetooth/BluetoothHidManager.cpp create mode 100644 dom/bluetooth/BluetoothHidManager.h 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/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": [] }, From 41345e773943ab5492c5c8b55caa0f8960700585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Tue, 13 Aug 2013 15:56:57 +0800 Subject: [PATCH 05/24] Bug 845169 - Update touch region from remote frame. r=roc --- content/base/src/nsFrameLoader.cpp | 7 +++++ dom/ipc/PBrowser.ipdl | 7 +++++ dom/ipc/TabChild.cpp | 14 +++++++++ dom/ipc/TabChild.h | 6 ++++ ipc/glue/IPCMessageUtils.h | 24 ++++++++++----- layout/base/nsDisplayList.cpp | 15 ++++++++-- layout/base/nsPresShell.cpp | 42 +++++++++++++++++++++++++++ layout/generic/nsSubDocumentFrame.cpp | 6 +++- layout/generic/nsSubDocumentFrame.h | 12 ++++---- layout/ipc/PRenderFrame.ipdl | 8 +++++ layout/ipc/RenderFrameParent.cpp | 21 ++++++++++++++ layout/ipc/RenderFrameParent.h | 9 ++++++ 12 files changed, 155 insertions(+), 16 deletions(-) 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/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/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/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..d3fdd7d2a1e9 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -862,6 +862,13 @@ RenderFrameParent::RecvDetectScrollableSubframe() return true; } +bool +RenderFrameParent::RecvUpdateHitRegion(const nsRegion& aRegion) +{ + mTouchRegion = aRegion; + return true; +} + PLayerTransactionParent* RenderFrameParent::AllocPLayerTransactionParent() { @@ -1007,6 +1014,12 @@ RenderFrameParent::UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float } } +bool +RenderFrameParent::HitTest(const nsRect& aRect) +{ + return mTouchRegion.Contains(aRect); +} + } // namespace layout } // namespace mozilla @@ -1022,6 +1035,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: From 3215631ba66b5f8b7df2410516cd281a071ec3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Thu, 8 Aug 2013 15:43:59 +0800 Subject: [PATCH 06/24] Bug 845169 - Add test case test_remote_passpointerevents.html r=roc --- layout/base/tests/Makefile.in | 1 + .../tests/test_remote_passpointerevents.html | 52 +++++++++++++++++++ layout/ipc/RenderFrameParent.cpp | 2 + 3 files changed, 55 insertions(+) create mode 100644 layout/base/tests/test_remote_passpointerevents.html 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/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index d3fdd7d2a1e9..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* From 69ed9d034ca48fa4c6dd322c5562edecd7007bb1 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 02:10:25 -0700 Subject: [PATCH 07/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/93333daac801 Author: Dominic Kuo Desc: Merge pull request #11474 from dominickuo/bug-894203 Bug 894203 - Update the @1.5x assets for music app, r=rexboy7 ======== https://hg.mozilla.org/integration/gaia-central/rev/a352b9a46b36 Author: Dominic Kuo Desc: Bug 894203 - Update the @1.5x assets for music app --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 01d8b15ad0d3..49d768e26043 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f2c1d7617f86432416df4e4fccbaf835afac203c", + "revision": "93333daac801dfe04daef084f3109cbe1088e669", "repo_path": "/integration/gaia-central" } From c719099266e0920e4e5fbc9f0363dbf2edd4e359 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 02:25:27 -0700 Subject: [PATCH 08/24] Bumping gaia.json for 4 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/f53a55fb7dba Author: Arthur Chen Desc: Merge pull request #11423 from crh0716/900874 Bug 900874 - Register to DOM events instead of system messages r=evelyn ======== https://hg.mozilla.org/integration/gaia-central/rev/c70b822c886e Author: crh0716 Desc: Bug 900874 - Register to DOM events instead of system messages ======== https://hg.mozilla.org/integration/gaia-central/rev/e7560439092a Author: Arthur Chen Desc: Merge pull request #11449 from crh0716/903181 Bug 903181 - Add a step value r=evelyn ======== https://hg.mozilla.org/integration/gaia-central/rev/811120d1f1aa Author: crh0716 Desc: Bug 903181 - Add a step value --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 49d768e26043..db72935cb05f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "93333daac801dfe04daef084f3109cbe1088e669", + "revision": "f53a55fb7dba1a760bcd3a02d6509f2db0c78c9d", "repo_path": "/integration/gaia-central" } From 59a69832eba15ab0aa1f3ce31a1825283da0720c Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 03:51:34 -0700 Subject: [PATCH 09/24] Bumping gaia.json for 2 gaia-central revision(s) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/f7a77191a8b5 Author: Salvador de la Puente González Desc: Merge pull request #11343 from arcturus/bug-901472 Bug 901472 - [Cost Control] Modify the parameters for checking the credit in Colombia r=salva ======== https://hg.mozilla.org/integration/gaia-central/rev/23386613230c Author: Francisco Jordano Desc: Bug 901472 - [Cost Control] Modify the parameters for checking the credit in Colombia --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index db72935cb05f..c2cc5df38d95 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f53a55fb7dba1a760bcd3a02d6509f2db0c78c9d", + "revision": "f7a77191a8b53c3666c6322e6951a94e7d118b6f", "repo_path": "/integration/gaia-central" } From 6925737ec38b4c842af4ad5e733b75da58709dd1 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 05:10:23 -0700 Subject: [PATCH 10/24] Bumping gaia.json for 3 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/260ceda6d54c Author: Sam Joch Desc: Merge pull request #11493 from pivanov/bug-903491 Bug 903491 - [HD][Browser] Refresh icon appears to be in SD r=samjoch ======== https://hg.mozilla.org/integration/gaia-central/rev/4ce7490a7042 Author: Pavel Ivanov Desc: Bug 903491 - [HD][Browser] Refresh icon appears to be in SD ======== https://hg.mozilla.org/integration/gaia-central/rev/9bcc87a8a908 Author: Amir Nissim Desc: Bug 898639 - [EVERYTHING.ME] User is unable to add bookmarks to Homescreen r=vingtetun Added missing 'var' declarations, one of which was setting window.name from 'main' to other values --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c2cc5df38d95..05d85081d8ea 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f7a77191a8b53c3666c6322e6951a94e7d118b6f", + "revision": "260ceda6d54c9d6ce3b8c34dc5048542a0a5ee8f", "repo_path": "/integration/gaia-central" } From f044e44b414249b5ae41e22b8c6420a2afaaab0a Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Tue, 13 Aug 2013 20:14:10 +0800 Subject: [PATCH 11/24] Bug 899885 - 1/2: B2G RIL - Callback-based worker messaging. Add WorkerMessenger. r=yoshi --- dom/system/gonk/RadioInterfaceLayer.js | 188 +++++++++++++++++-------- 1 file changed, 131 insertions(+), 57 deletions(-) diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 42f787a52934..811a5ae023d3 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, @@ -730,8 +826,6 @@ function RadioInterface(options) { this.portAddressedSmsApps = {}; this.portAddressedSmsApps[WAP.WDP_PORT_PUSH] = this.handleSmsWdpPortPush.bind(this); - - gSystemWorkerManager.registerRilWorker(this.clientId, this.worker); } RadioInterface.prototype = { @@ -744,6 +838,9 @@ RadioInterface.prototype = { Ci.nsIObserver, Ci.nsISettingsServiceCallback]), + // A private WorkerMessenger instance. + workerMessenger: null, + debug: function debug(s) { dump("-*- RadioInterface[" + this.clientId + "]: " + s + "\n"); }, @@ -926,26 +1023,7 @@ RadioInterface.prototype = { } }, - 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(); @@ -2591,10 +2669,6 @@ RadioInterface.prototype = { }; }, - // nsIRadioWorker - - worker: null, - // nsIRadioInterface setRadioEnabled: function setRadioEnabled(value) { From bae5feb8db1bf3809334d29495072a6309c372cf Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Tue, 13 Aug 2013 20:14:13 +0800 Subject: [PATCH 12/24] Bug 899885 - 2/2: fix all communications to ril_worker. r=yoshi,gene --- dom/system/gonk/RILContentHelper.js | 12 +- dom/system/gonk/RadioInterfaceLayer.js | 944 ++++++------------------- dom/system/gonk/ril_worker.js | 82 +-- 3 files changed, 266 insertions(+), 772 deletions(-) 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 811a5ae023d3..2271b59620d5 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -822,8 +822,6 @@ function RadioInterface(options) { Services.prefs.addObserver(kCellBroadcastDisabled, this, false); - this._sentSmsEnvelopes = {}; - this.portAddressedSmsApps = {}; this.portAddressedSmsApps[WAP.WDP_PORT_PUSH] = this.handleSmsWdpPortPush.bind(this); } @@ -867,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. @@ -883,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); @@ -895,130 +892,110 @@ 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; } }, @@ -1040,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; @@ -1100,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", @@ -1135,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; @@ -1156,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); @@ -1400,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) { @@ -1424,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) { @@ -1843,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 */ @@ -1909,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. */ @@ -2073,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 @@ -2121,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. */ @@ -2398,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); @@ -2413,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) { @@ -2529,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": @@ -2556,7 +2141,7 @@ RadioInterface.prototype = { } break; case kScreenStateChangedTopic: - this.setScreenState(data); + this.workerMessenger.send("setScreenState", { on: (state === "on") }); break; } }, @@ -2674,17 +2259,24 @@ RadioInterface.prototype = { 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) { @@ -2709,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 }); } }, @@ -2720,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() { @@ -3366,7 +2828,6 @@ RadioInterface.prototype = { } let options = this._fragmentText(message, null, strict7BitEncoding); - options.rilMessageType = "sendSMS"; options.number = PhoneNumberUtils.normalize(number); let requestStatusReport; try { @@ -3375,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; @@ -3422,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", @@ -3602,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/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; From 598c9974aa2c2bdbc075149a39199a7ab6a79752 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 05:20:25 -0700 Subject: [PATCH 13/24] Bumping gaia.json for 4 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/4013a01e6d32 Author: Olav Nymoen Desc: Merge pull request #11481 from comoyo/allow_open_remote Bug 819882: Allow all apps to open OOP windows. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/cd64075d3f27 Author: Olav Nymoen Desc: Bug 819882: Allow all apps to open OOP windows. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/24e7f09e1058 Author: Sam Joch Desc: Merge pull request #11494 from pivanov/bug-904013 Bug 904013 - [Contacts] Replace "+" Icon in contacts for 1x, 1.5x and 2x r=samjoch ======== https://hg.mozilla.org/integration/gaia-central/rev/b12cc9c6d5a7 Author: Pavel Ivanov Desc: Bug 904013 - [Contacts] Replace "+" Icon in contacts for 1x, 1.5x and 2x --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 05d85081d8ea..10da372b9bc5 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "260ceda6d54c9d6ce3b8c34dc5048542a0a5ee8f", + "revision": "4013a01e6d3276dd7f41a0a177acc725352e5a78", "repo_path": "/integration/gaia-central" } From 0ff2dec9e6153f06206d6332d1d630a77bdde9bd Mon Sep 17 00:00:00 2001 From: Marco Chen Date: Tue, 13 Aug 2013 15:12:53 +0800 Subject: [PATCH 14/24] Bug 895822 - To initilize AudioManager service in SystemWorkerManager for monitoring the headset change and setting configuration of audio backend. r=dhylands --- dom/system/gonk/SystemWorkerManager.cpp | 3 +++ 1 file changed, 3 insertions(+) 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 = From ddd848ecd937923d950c7ce0b89527f51587317e Mon Sep 17 00:00:00 2001 From: Yuan Xulei Date: Tue, 13 Aug 2013 08:40:54 -0400 Subject: [PATCH 15/24] Bug 904224 - Don't handle key events in forms.js if these is no focused input element. r=fabrice --- b2g/chrome/content/forms.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/b2g/chrome/content/forms.js b/b2g/chrome/content/forms.js index 5e0b87e2d6b9..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; } From 0bcd40711fa93f66a67fbbe0520e6b6a98c6ddac Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Mon, 12 Aug 2013 21:17:36 +0200 Subject: [PATCH 16/24] Bug 900969 - Failing deviceorientation test_bug615597.html for b2g mochitest. r=smaug --- content/events/test/Makefile.in | 1 - content/events/test/test_bug615597.html | 2 -- content/events/test/test_bug667919-2.html | 41 ----------------------- 3 files changed, 44 deletions(-) delete mode 100644 content/events/test/test_bug667919-2.html 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 -

- -
-
-
- - From 0e477fe6a5cb300730a4d828835d7ea8e6a2c897 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Tue, 13 Aug 2013 12:58:38 -0400 Subject: [PATCH 17/24] Bug 903174 - Move GonkNativeWindow to /widget/gonk/nativewindow. r=vlad --- dom/camera/moz.build | 11 ------ toolkit/library/Makefile.in | 1 + widget/gonk/moz.build | 2 +- widget/gonk/nativewindow/GonkNativeWindow.h | 2 ++ .../nativewindow/GonkNativeWindowClient.h | 2 ++ .../GonkNativeWindowClientICS.cpp | 0 .../nativewindow/GonkNativeWindowClientICS.h | 8 ++--- .../gonk/nativewindow/GonkNativeWindowICS.cpp | 1 - .../gonk/nativewindow/GonkNativeWindowICS.h | 6 ++-- widget/gonk/nativewindow/Makefile.in | 27 +++++++++++++++ widget/gonk/nativewindow/moz.build | 34 +++++++++++++++++++ 11 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 widget/gonk/nativewindow/GonkNativeWindow.h create mode 100644 widget/gonk/nativewindow/GonkNativeWindowClient.h rename dom/camera/GonkNativeWindowClient.cpp => widget/gonk/nativewindow/GonkNativeWindowClientICS.cpp (100%) rename dom/camera/GonkNativeWindowClient.h => widget/gonk/nativewindow/GonkNativeWindowClientICS.h (96%) rename dom/camera/GonkNativeWindow.cpp => widget/gonk/nativewindow/GonkNativeWindowICS.cpp (99%) rename dom/camera/GonkNativeWindow.h => widget/gonk/nativewindow/GonkNativeWindowICS.h (99%) create mode 100644 widget/gonk/nativewindow/Makefile.in create mode 100644 widget/gonk/nativewindow/moz.build 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/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 13a7474543ff..03cb28c436a4 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -461,6 +461,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', + ] + From 76e45f7d8ecce9925f97501a83e6d43ffb96a80b Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 10:00:26 -0700 Subject: [PATCH 18/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/494467b3c443 Author: Etienne Segonzac Desc: Merge pull request #11434 from etiennesegonzac/oncall-split-and-test Bug 902983 - Split oncall.js and make it testable r=Rik ======== https://hg.mozilla.org/integration/gaia-central/rev/c5e1f2148a89 Author: Etienne Segonzac Desc: Bug 902983 - Split oncall.js and make it testable r=Rik --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 10da372b9bc5..753c81b5c0d7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "4013a01e6d3276dd7f41a0a177acc725352e5a78", + "revision": "494467b3c4432964a8c1ba3739e20af65b248d88", "repo_path": "/integration/gaia-central" } From 8a898c495d1f15afd841d3fd5e49c65f144ddd78 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 10:00:48 -0700 Subject: [PATCH 19/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/aab0a2027f9e Author: Gregor Wagner Desc: Merge pull request #11274 from JonHylands/jhylands-899123-add-contact-pics-master Bug 899123 - add pictures to contact reference workloads ======== https://hg.mozilla.org/integration/gaia-central/rev/49a58a560acb Author: Jon Hylands Desc: Bug 899123 - add pictures to contact reference workloads --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 753c81b5c0d7..e01ae57646dd 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "494467b3c4432964a8c1ba3739e20af65b248d88", + "revision": "aab0a2027f9e0e5475db809553287288671e4429", "repo_path": "/integration/gaia-central" } From 5d69aef71e5ac3f75e00d46ac40dd4efd7fd734a Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 10:15:24 -0700 Subject: [PATCH 20/24] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/050d7d00d95b Author: Etienne Segonzac Desc: Merge pull request #11485 from etiennesegonzac/bug-904076-call-log-db-create Bug 904076 - fixing a bug in the call log db creation path. r=rik ======== https://hg.mozilla.org/integration/gaia-central/rev/a9bd710578e8 Author: Etienne Segonzac Desc: Bug 904076 - fixing a bug in the call log db creation path. r=rik --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index e01ae57646dd..7f00ca23ec41 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "aab0a2027f9e0e5475db809553287288671e4429", + "revision": "050d7d00d95bfab132b2325b300f80bac1723774", "repo_path": "/integration/gaia-central" } From d12df6e42eeab7151c7c5d6f7173bd02b8163aa3 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 10:35:24 -0700 Subject: [PATCH 21/24] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/565d16505778 Author: Julien Wajsberg Desc: Bug 897437 - SMS message timestamps do not display the expected strings. r=gnarf Rewrote the message container handling function. Now with lots of unit tests covering lots of edge cases. This patch also does a very little bit of safe refactoring, still with unit tests. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7f00ca23ec41..b296cd73e045 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "050d7d00d95bfab132b2325b300f80bac1723774", + "revision": "565d16505778a961898aa15d882b543657821ed1", "repo_path": "/integration/gaia-central" } From 0df7f99f3bcc07076eaa7698d1e749ad5f66884b Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Tue, 13 Aug 2013 10:46:54 -0700 Subject: [PATCH 22/24] bug 903661 - helix configs. r=catlee --- b2g/config/helix/config.json | 36 ++++++++++++++++++++++++++++++++ b2g/config/helix/releng-helix.tt | 14 +++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 b2g/config/helix/config.json create mode 100644 b2g/config/helix/releng-helix.tt 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" +} +] From 9df332bac4fd38f7bffc5f7043810cad4483692f Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 10:50:26 -0700 Subject: [PATCH 23/24] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/8d72439fdc56 Author: Rick Waldron Desc: Bug 903947 - [Messages] The last recipient is copied everytime when selecting recipeint for removing r=julienw https://bugzilla.mozilla.org/show_bug.cgi?id=903947 - Clicks on accepted recipients... - Should close the keyboard, if it's a known contact recipient - while manually entering a recipient: - Two rendered recipients - A placeholder for the cursor - with only accepted recipients: - no changes, no assimilated recipients - with no placeholder at end of list: - no changes, no assimilated recipients - Ensure MockDialog triggers are assigned an initial called value (false) This patch also fixes https://bugzilla.mozilla.org/show_bug.cgi?id=903943 Signed-off-by: Rick Waldron --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index b296cd73e045..1958d121816d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "565d16505778a961898aa15d882b543657821ed1", + "revision": "8d72439fdc56682e0621928992c3986b26ccd83f", "repo_path": "/integration/gaia-central" } From f9c1ad95fa1b03c4ff4e334e57789e513e0cbfad Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 13 Aug 2013 11:45:25 -0700 Subject: [PATCH 24/24] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/2b195ef19ed8 Author: Rick Waldron Desc: Bug 904640 - [Messages] Keyboard should always close when pressing Send r=julienw https://bugzilla.mozilla.org/show_bug.cgi?id=904640 - Remove focus from all elements before panel change by calling document.activeElement.blur() in MessageManager.onHashChange - Updates Mocks: - MockThreadListUI to contain all properties (data and method) - MockThreadUI to contain all properties (data and method) - Tests MessageManager.onHashChange: - Remove any focus left on specific elements - Assert on spy intel for document.activeElement.blur - Exit edit mode (Thread or Message) - Assert on spy intel for: - ThreadUI.cancelEdit - ThreadListUI.cancelEdit - Reset Group Participants View - Assert on spy intel for ThreadUI.groupView.reset Signed-off-by: Rick Waldron --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1958d121816d..2bcd6563a5ce 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "8d72439fdc56682e0621928992c3986b26ccd83f", + "revision": "2b195ef19ed8cadd557ca185bae72c9ff836b264", "repo_path": "/integration/gaia-central" }