mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound. a=merge
This commit is contained in:
commit
5248c3dab8
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
|
||||
@ -134,7 +134,7 @@
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="d259117b4976decbe2f76eeed85218bf0109190f"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="7047fcaa8bb55888ec7b84997e1bab41185ba3a3"/>
|
||||
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
|
||||
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
|
||||
</manifest>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -132,7 +132,7 @@
|
||||
<!-- Flame specific things -->
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/>
|
||||
<project name="device/qcom/common" path="device/qcom/common" revision="54c32c2ddef066fbdf611d29e4b7c47e0363599e"/>
|
||||
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="52c909e821d107d414f851e267dedcd7aae2cebf"/>
|
||||
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="05aa7b98d3f891b334031dc710d48d0d6b82ec1d"/>
|
||||
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="7731d63c809dbca4da408e1de0c1a044f0765e52"/>
|
||||
<project name="kernel_lk" path="bootable/bootloader/lk" remote="b2g" revision="fda40423ffa573dc6cafd3780515010cb2a086be"/>
|
||||
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="30b96dfca99cb384bf520a16b81f3aba56f09907"/>
|
||||
@ -151,7 +151,7 @@
|
||||
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
|
||||
<project name="platform/system/core" path="system/core" revision="350eac5403124dacb2a5fd9e28ac290a59fc3b8e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="7047fcaa8bb55888ec7b84997e1bab41185ba3a3"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="7704e16da545f4207812e593743d6743e1afb9c5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
|
||||
@ -145,7 +145,7 @@
|
||||
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
|
||||
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
|
||||
<project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="7047fcaa8bb55888ec7b84997e1bab41185ba3a3"/>
|
||||
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
|
||||
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
|
||||
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "8017299c3eb7b82bdaee1334994f546c11eb16ab",
|
||||
"revision": "63436aa17e7fa3ad521fdeffdc22b81c36e5d69b",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
|
||||
@ -129,7 +129,7 @@
|
||||
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
|
||||
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="7047fcaa8bb55888ec7b84997e1bab41185ba3a3"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="5c636a7a54b2c86d8ff6bc1aa1e5f9594c7bc586"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="abef62c0623e5504a97b4fd411e879a67b285b52"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=807222
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=807222">Mozilla Bug 807222</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
@ -21,9 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=807222
|
||||
/** Test for Bug 807222 **/
|
||||
var expectedProps = [ "Image", "Audio", "Option",
|
||||
"PerformanceTiming", "CSS2Properties", "SVGElement" ];
|
||||
if (navigator.mozTelephony) {
|
||||
expectedProps.push("USSDReceivedEvent");
|
||||
}
|
||||
var actualProps = Object.getOwnPropertyNames(window);
|
||||
|
||||
for (var i = 0; i < expectedProps.length; ++i) {
|
||||
|
@ -193,6 +193,28 @@ private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
};
|
||||
|
||||
class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
public:
|
||||
OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes,
|
||||
nsresult aRv)
|
||||
: mRes(aRes)
|
||||
, mRv(aRv)
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mRes->OnError(mRv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
nsresult mRv;
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be only called when Bluetooth is turning on.
|
||||
* It is important to register a2dp callbacks before enable() gets called.
|
||||
@ -204,10 +226,28 @@ void
|
||||
BluetoothA2dpManager::InitA2dpInterface(BluetoothProfileResultHandler* aRes)
|
||||
{
|
||||
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
|
||||
NS_ENSURE_TRUE_VOID(btInf);
|
||||
if (NS_WARN_IF(!btInf)) {
|
||||
// If there's no HFP interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sBtA2dpInterface = btInf->GetBluetoothA2dpInterface();
|
||||
NS_ENSURE_TRUE_VOID(sBtA2dpInterface);
|
||||
if (NS_WARN_IF(!sBtA2dpInterface)) {
|
||||
// If there's no HFP interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothA2dpManager* a2dpManager = BluetoothA2dpManager::Get();
|
||||
sBtA2dpInterface->Init(a2dpManager, new InitA2dpResultHandler(aRes));
|
||||
@ -341,6 +381,11 @@ public:
|
||||
sBtA2dpInterface = nullptr;
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
|
||||
} else if (mRes) {
|
||||
/* Not all backends support AVRCP. If it's not available
|
||||
* we signal success from here.
|
||||
*/
|
||||
mRes->Deinit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,6 +405,11 @@ public:
|
||||
sBtA2dpInterface = nullptr;
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
|
||||
} else if (mRes) {
|
||||
/* Not all backends support AVRCP. If it's not available
|
||||
* we signal success from here.
|
||||
*/
|
||||
mRes->Deinit();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -329,16 +329,56 @@ private:
|
||||
nsRefPtr<CleanupInitResultHandler> mRes;
|
||||
};
|
||||
|
||||
class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
public:
|
||||
OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes,
|
||||
nsresult aRv)
|
||||
: mRes(aRes)
|
||||
, mRv(aRv)
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mRes->OnError(mRv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
nsresult mRv;
|
||||
};
|
||||
|
||||
// static
|
||||
void
|
||||
BluetoothHfpManager::InitHfpInterface(BluetoothProfileResultHandler* aRes)
|
||||
{
|
||||
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
|
||||
NS_ENSURE_TRUE_VOID(btInf);
|
||||
if (NS_WARN_IF(!btInf)) {
|
||||
// If there's no backend interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothHandsfreeInterface *interface =
|
||||
btInf->GetBluetoothHandsfreeInterface();
|
||||
NS_ENSURE_TRUE_VOID(interface);
|
||||
if (NS_WARN_IF(!interface)) {
|
||||
// If there's no HFP interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<CleanupInitResultHandler> res =
|
||||
new CleanupInitResultHandler(interface, aRes);
|
||||
|
@ -197,6 +197,28 @@ private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
};
|
||||
|
||||
class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
public:
|
||||
OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes,
|
||||
nsresult aRv)
|
||||
: mRes(aRes)
|
||||
, mRv(aRv)
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mRes->OnError(mRv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
nsresult mRv;
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be only called when Bluetooth is turning on.
|
||||
* It is important to register a2dp callbacks before enable() gets called.
|
||||
@ -208,19 +230,25 @@ void
|
||||
BluetoothA2dpManager::InitA2dpInterface(BluetoothProfileResultHandler* aRes)
|
||||
{
|
||||
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
|
||||
if (!btInf) {
|
||||
BT_LOGR("Error: Bluetooth interface not available");
|
||||
if (aRes) {
|
||||
aRes->OnError(NS_ERROR_FAILURE);
|
||||
if (NS_WARN_IF(!btInf)) {
|
||||
// If there's no backend interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sBtA2dpInterface = btInf->GetBluetoothA2dpInterface();
|
||||
if (!sBtA2dpInterface) {
|
||||
BT_LOGR("Error: Bluetooth A2DP interface not available");
|
||||
if (aRes) {
|
||||
aRes->OnError(NS_ERROR_FAILURE);
|
||||
if (NS_WARN_IF(!sBtA2dpInterface)) {
|
||||
// If there's no A2DP interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -357,6 +385,11 @@ public:
|
||||
sBtA2dpInterface = nullptr;
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
|
||||
} else if (mRes) {
|
||||
/* Not all backends support AVRCP. If it's not available
|
||||
* we signal success from here.
|
||||
*/
|
||||
mRes->Deinit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,6 +409,11 @@ public:
|
||||
sBtA2dpInterface = nullptr;
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
|
||||
} else if (mRes) {
|
||||
/* Not all backends support AVRCP. If it's not available
|
||||
* we signal success from here.
|
||||
*/
|
||||
mRes->Deinit();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -320,25 +320,53 @@ private:
|
||||
nsRefPtr<CleanupInitResultHandler> mRes;
|
||||
};
|
||||
|
||||
class OnErrorProfileResultHandlerRunnable MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
public:
|
||||
OnErrorProfileResultHandlerRunnable(BluetoothProfileResultHandler* aRes,
|
||||
nsresult aRv)
|
||||
: mRes(aRes)
|
||||
, mRv(aRv)
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
mRes->OnError(mRv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
nsresult mRv;
|
||||
};
|
||||
|
||||
// static
|
||||
void
|
||||
BluetoothHfpManager::InitHfpInterface(BluetoothProfileResultHandler* aRes)
|
||||
{
|
||||
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
|
||||
if (!btInf) {
|
||||
BT_LOGR("Error: Bluetooth interface not available");
|
||||
if (aRes) {
|
||||
aRes->OnError(NS_ERROR_FAILURE);
|
||||
if (NS_WARN_IF(!btInf)) {
|
||||
// If there's no backend interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothHandsfreeInterface *interface =
|
||||
btInf->GetBluetoothHandsfreeInterface();
|
||||
if (!interface) {
|
||||
BT_LOGR("Error: Bluetooth Handsfree interface not available");
|
||||
if (aRes) {
|
||||
aRes->OnError(NS_ERROR_FAILURE);
|
||||
if (NS_WARN_IF(!interface)) {
|
||||
// If there's no HFP interface, we dispatch a runnable
|
||||
// that calls the profile result handler.
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch HFP OnError runnable");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ const MOBILECELLINFO_CID =
|
||||
Components.ID("{0635d9ab-997e-4cdf-84e7-c1883752dff3}");
|
||||
const MOBILECALLFORWARDINGOPTIONS_CID =
|
||||
Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
|
||||
const TELEPHONYCALLBACK_CID =
|
||||
Components.ID("{6e1af17e-37f3-11e4-aed3-60a44c237d2b}");
|
||||
const TELEPHONYDIALCALLBACK_CID =
|
||||
Components.ID("{c2af1a5d-3649-44ef-a1ff-18e9ac1dec51}");
|
||||
|
||||
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
|
||||
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
|
||||
@ -139,14 +139,14 @@ MobileCallForwardingOptions.prototype = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a MobileConnectionCallback to a TelephonyCallback.
|
||||
* Wrap a MobileConnectionCallback to a TelephonyDialCallback.
|
||||
*/
|
||||
function TelephonyCallback(aCallback) {
|
||||
function TelephonyDialCallback(aCallback) {
|
||||
this.callback = aCallback;
|
||||
}
|
||||
TelephonyCallback.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyCallback]),
|
||||
classID: TELEPHONYCALLBACK_CID,
|
||||
TelephonyDialCallback.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyDialCallback]),
|
||||
classID: TELEPHONYDIALCALLBACK_CID,
|
||||
|
||||
_notifySendCancelMmiSuccess: function(aResult) {
|
||||
// No additional information.
|
||||
@ -692,8 +692,8 @@ MobileConnectionProvider.prototype = {
|
||||
},
|
||||
|
||||
sendMMI: function(aMmi, aCallback) {
|
||||
let telephonyCallback = new TelephonyCallback(aCallback);
|
||||
gGonkTelephonyService.dialMMI(this._clientId, aMmi, telephonyCallback);
|
||||
let callback = new TelephonyDialCallback(aCallback);
|
||||
gGonkTelephonyService.dialMMI(this._clientId, aMmi, callback);
|
||||
},
|
||||
|
||||
cancelMMI: function(aCallback) {
|
||||
@ -1000,14 +1000,6 @@ MobileConnectionService.prototype = {
|
||||
|
||||
this.getItemByServiceId(aClientId)
|
||||
.deliverListenerEvent("notifyUssdReceived", [aMessage, aSessionEnded]);
|
||||
|
||||
let info = {
|
||||
message: aMessage,
|
||||
sessionEnded: aSessionEnded,
|
||||
serviceId: aClientId
|
||||
};
|
||||
|
||||
gSystemMessenger.broadcastMessage("ussd-received", info);
|
||||
},
|
||||
|
||||
notifyDataError: function(aClientId, aMessage) {
|
||||
|
@ -630,6 +630,7 @@ Nfc.prototype = {
|
||||
this.sendToNfcService("readNDEF", message.data);
|
||||
break;
|
||||
case "NFC:WriteNDEF":
|
||||
message.data.isP2P = SessionHelper.isP2PSession(message.data.sessionId);
|
||||
this.sendToNfcService("writeNDEF", message.data);
|
||||
break;
|
||||
case "NFC:MakeReadOnlyNDEF":
|
||||
|
@ -8,7 +8,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
#define NFCD_MAJOR_VERSION 1
|
||||
#define NFCD_MINOR_VERSION 10
|
||||
#define NFCD_MINOR_VERSION 12
|
||||
|
||||
enum NfcRequest {
|
||||
ConfigReq = 0,
|
||||
|
@ -196,6 +196,7 @@ NfcMessageHandler::WriteNDEFRequest(Parcel& aParcel, const CommandOptions& aOpti
|
||||
{
|
||||
aParcel.writeInt32(NfcRequest::WriteNDEFReq);
|
||||
aParcel.writeInt32(aOptions.mSessionId);
|
||||
aParcel.writeInt32(aOptions.mIsP2P);
|
||||
WriteNDEFMessage(aParcel, aOptions);
|
||||
mRequestIdQueue.AppendElement(aOptions.mRequestId);
|
||||
return true;
|
||||
|
@ -36,6 +36,7 @@ struct CommandOptions
|
||||
COPY_OPT_FIELD(mSessionId, 0)
|
||||
COPY_OPT_FIELD(mPowerLevel, 0)
|
||||
COPY_OPT_FIELD(mTechType, 0)
|
||||
COPY_OPT_FIELD(mIsP2P, false)
|
||||
|
||||
if (!aOther.mRecords.WasPassed()) {
|
||||
return;
|
||||
@ -77,6 +78,7 @@ struct CommandOptions
|
||||
nsString mRequestId;
|
||||
int32_t mPowerLevel;
|
||||
int32_t mTechType;
|
||||
bool mIsP2P;
|
||||
nsTArray<NDEFRecordStruct> mRecords;
|
||||
};
|
||||
|
||||
|
@ -31,20 +31,6 @@ function MozNFCTag() {
|
||||
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
|
||||
.getService(Ci.nsINfcContentHelper);
|
||||
this.session = null;
|
||||
|
||||
// Map WebIDL declared enum map names to integer
|
||||
this._techTypesMap = [];
|
||||
this._techTypesMap['NFC_A'] = 0;
|
||||
this._techTypesMap['NFC_B'] = 1;
|
||||
this._techTypesMap['NFC_ISO_DEP'] = 2;
|
||||
this._techTypesMap['NFC_F'] = 3;
|
||||
this._techTypesMap['NFC_V'] = 4;
|
||||
this._techTypesMap['NDEF'] = 5;
|
||||
this._techTypesMap['NDEF_FORMATABLE'] = 6;
|
||||
this._techTypesMap['MIFARE_CLASSIC'] = 7;
|
||||
this._techTypesMap['MIFARE_ULTRALIGHT'] = 8;
|
||||
this._techTypesMap['NFC_BARCODE'] = 9;
|
||||
this._techTypesMap['P2P'] = 10;
|
||||
}
|
||||
MozNFCTag.prototype = {
|
||||
_nfcContentHelper: null,
|
||||
@ -55,8 +41,6 @@ MozNFCTag.prototype = {
|
||||
this.session = aSessionToken;
|
||||
},
|
||||
|
||||
_techTypesMap: null,
|
||||
|
||||
// NFCTag interface:
|
||||
readNDEF: function readNDEF() {
|
||||
return this._nfcContentHelper.readNDEF(this._window, this.session);
|
||||
|
@ -1985,13 +1985,18 @@ RadioInterface.prototype = {
|
||||
gTelephonyService.notifyConferenceCallStateChanged(message.state);
|
||||
break;
|
||||
case "cdmaCallWaiting":
|
||||
gTelephonyService.notifyCdmaCallWaiting(this.clientId, message.waitingCall);
|
||||
gTelephonyService.notifyCdmaCallWaiting(this.clientId,
|
||||
message.waitingCall);
|
||||
break;
|
||||
case "suppSvcNotification":
|
||||
gTelephonyService.notifySupplementaryService(this.clientId,
|
||||
message.callIndex,
|
||||
message.notification);
|
||||
break;
|
||||
case "ussdreceived":
|
||||
gTelephonyService.notifyUssdReceived(this.clientId, message.message,
|
||||
message.sessionEnded);
|
||||
break;
|
||||
case "datacallerror":
|
||||
connHandler.handleDataCallError(message);
|
||||
break;
|
||||
@ -2045,11 +2050,6 @@ RadioInterface.prototype = {
|
||||
gRadioEnabledController.notifyRadioStateChanged(this.clientId,
|
||||
message.radioState);
|
||||
break;
|
||||
case "ussdreceived":
|
||||
gMobileConnectionService.notifyUssdReceived(this.clientId,
|
||||
message.message,
|
||||
message.sessionEnded);
|
||||
break;
|
||||
case "cardstatechange":
|
||||
this.rilContext.cardState = message.cardState;
|
||||
gRadioEnabledController.receiveCardState(this.clientId);
|
||||
|
@ -2641,22 +2641,48 @@ RilObject.prototype = {
|
||||
}
|
||||
|
||||
options.ussd = mmi.fullMMI;
|
||||
|
||||
if (options.startNewSession && this._ussdSession) {
|
||||
if (DEBUG) this.context.debug("Cancel existing ussd session.");
|
||||
this.cachedUSSDRequest = options;
|
||||
this.cancelUSSD({});
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendUSSD(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Cache the request for send out a new ussd when there is an existing
|
||||
* session. We should do cancelUSSD first.
|
||||
*/
|
||||
cachedUSSDRequest : null,
|
||||
|
||||
/**
|
||||
* Send USSD.
|
||||
*
|
||||
* @param ussd
|
||||
* String containing the USSD code.
|
||||
*
|
||||
* @param checkSession
|
||||
* True if an existing session should be there.
|
||||
*/
|
||||
sendUSSD: function(options) {
|
||||
let Buf = this.context.Buf;
|
||||
Buf.newParcel(REQUEST_SEND_USSD, options);
|
||||
Buf.writeString(options.ussd);
|
||||
Buf.sendParcel();
|
||||
},
|
||||
sendUSSD: function(options) {
|
||||
if (options.checkSession && !this._ussdSession) {
|
||||
options.success = false;
|
||||
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendRilRequestSendUSSD(options);
|
||||
},
|
||||
|
||||
sendRilRequestSendUSSD: function(options) {
|
||||
let Buf = this.context.Buf;
|
||||
Buf.newParcel(REQUEST_SEND_USSD, options);
|
||||
Buf.writeString(options.ussd);
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancel pending USSD.
|
||||
@ -5679,9 +5705,19 @@ RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length,
|
||||
if (DEBUG) {
|
||||
this.context.debug("REQUEST_CANCEL_USSD" + JSON.stringify(options));
|
||||
}
|
||||
|
||||
options.success = (options.rilRequestError === 0);
|
||||
this._ussdSession = !options.success;
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
|
||||
// The cancelUSSD is triggered by ril_worker itself.
|
||||
if (this.cachedUSSDRequest) {
|
||||
if (DEBUG) this.context.debug("Send out the cached ussd request");
|
||||
this.sendUSSD(this.cachedUSSDRequest);
|
||||
this.cachedUSSDRequest = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, options) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "TelephonyCall.h"
|
||||
#include "TelephonyCallGroup.h"
|
||||
#include "TelephonyCallId.h"
|
||||
#include "TelephonyCallback.h"
|
||||
#include "TelephonyDialCallback.h"
|
||||
|
||||
// Service instantiation
|
||||
#include "ipc/TelephonyIPCService.h"
|
||||
@ -235,8 +235,8 @@ Telephony::DialInternal(uint32_t aServiceId, const nsAString& aNumber,
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback =
|
||||
new TelephonyCallback(GetOwner(), this, promise, aServiceId);
|
||||
nsCOMPtr<nsITelephonyDialCallback> callback =
|
||||
new TelephonyDialCallback(GetOwner(), this, promise, aServiceId);
|
||||
|
||||
nsresult rv = mService->Dial(aServiceId, aNumber, aEmergency, callback);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -23,7 +23,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
namespace telephony {
|
||||
|
||||
class TelephonyCallback;
|
||||
class TelephonyDialCallback;
|
||||
|
||||
} // namespace telephony
|
||||
|
||||
@ -43,7 +43,7 @@ class Telephony MOZ_FINAL : public DOMEventTargetHelper,
|
||||
class EnumerationAck;
|
||||
|
||||
friend class EnumerationAck;
|
||||
friend class telephony::TelephonyCallback;
|
||||
friend class telephony::TelephonyDialCallback;
|
||||
|
||||
nsCOMPtr<nsITelephonyService> mService;
|
||||
nsRefPtr<Listener> mListener;
|
||||
|
@ -4,136 +4,31 @@
|
||||
|
||||
#include "TelephonyCallback.h"
|
||||
|
||||
#include "mozilla/dom/DOMMMIError.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::telephony;
|
||||
|
||||
NS_IMPL_ISUPPORTS(TelephonyCallback, nsITelephonyCallback)
|
||||
|
||||
TelephonyCallback::TelephonyCallback(nsPIDOMWindow* aWindow,
|
||||
Telephony* aTelephony,
|
||||
Promise* aPromise,
|
||||
uint32_t aServiceId)
|
||||
: mWindow(aWindow), mTelephony(aTelephony), mPromise(aPromise),
|
||||
mServiceId(aServiceId)
|
||||
TelephonyCallback::TelephonyCallback(Promise* aPromise)
|
||||
: mPromise(aPromise)
|
||||
{
|
||||
MOZ_ASSERT(mTelephony);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCallback::NotifyDialMMISuccess(const nsAString& aStatusMessage)
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
if (!NS_WARN_IF(jsapi.Init(mWindow))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
MozMMIResult result;
|
||||
|
||||
result.mServiceCode.Assign(mServiceCode);
|
||||
result.mStatusMessage.Assign(aStatusMessage);
|
||||
|
||||
return NotifyDialMMISuccess(cx, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCallback::NotifyDialMMISuccess(JSContext* aCx,
|
||||
const nsAString& aStatusMessage,
|
||||
JS::Handle<JS::Value> aInfo)
|
||||
{
|
||||
RootedDictionary<MozMMIResult> result(aCx);
|
||||
|
||||
result.mServiceCode.Assign(mServiceCode);
|
||||
result.mStatusMessage.Assign(aStatusMessage);
|
||||
result.mAdditionalInformation.Construct().SetAsObject() = &aInfo.toObject();
|
||||
|
||||
return NotifyDialMMISuccess(aCx, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCallback::NotifyDialMMISuccess(JSContext* aCx,
|
||||
const MozMMIResult& aResult)
|
||||
{
|
||||
JS::Rooted<JS::Value> jsResult(aCx);
|
||||
|
||||
if (!ToJSValue(aCx, aResult, &jsResult)) {
|
||||
JS_ClearPendingException(aCx);
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
|
||||
return NotifyDialMMISuccess(jsResult);
|
||||
}
|
||||
|
||||
// nsITelephonyCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialMMI(const nsAString& aServiceCode)
|
||||
TelephonyCallback::NotifySuccess()
|
||||
{
|
||||
mMMIRequest = new DOMRequest(mWindow);
|
||||
mServiceCode.Assign(aServiceCode);
|
||||
|
||||
mPromise->MaybeResolve(mMMIRequest);
|
||||
mPromise->MaybeResolve(JS::UndefinedHandleValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialError(const nsAString& aError)
|
||||
TelephonyCallback::NotifyError(const nsAString& aError)
|
||||
{
|
||||
mPromise->MaybeRejectBrokenly(aError);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialCallSuccess(uint32_t aCallIndex,
|
||||
const nsAString& aNumber)
|
||||
{
|
||||
nsRefPtr<TelephonyCallId> id = mTelephony->CreateCallId(aNumber);
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
mTelephony->CreateCall(id, mServiceId, aCallIndex,
|
||||
nsITelephonyService::CALL_STATE_DIALING);
|
||||
|
||||
mPromise->MaybeResolve(call);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialMMISuccess(JS::Handle<JS::Value> aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireSuccessAsync(mMMIRequest, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialMMIError(const nsAString& aError)
|
||||
{
|
||||
Nullable<int16_t> info;
|
||||
|
||||
nsRefPtr<DOMError> error =
|
||||
new DOMMMIError(mWindow, aError, EmptyString(), mServiceCode, info);
|
||||
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireDetailedError(mMMIRequest, error);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCallback::NotifyDialMMIErrorWithInfo(const nsAString& aError,
|
||||
uint16_t aInfo)
|
||||
{
|
||||
Nullable<int16_t> info(aInfo);
|
||||
|
||||
nsRefPtr<DOMError> error =
|
||||
new DOMMMIError(mWindow, aError, EmptyString(), mServiceCode, info);
|
||||
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireDetailedError(mMMIRequest, error);
|
||||
}
|
||||
|
@ -5,73 +5,30 @@
|
||||
#ifndef mozilla_dom_TelephonyCallback_h
|
||||
#define mozilla_dom_TelephonyCallback_h
|
||||
|
||||
#include "Telephony.h"
|
||||
#include "mozilla/dom/DOMRequest.h"
|
||||
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITelephonyService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Promise;
|
||||
|
||||
namespace telephony {
|
||||
|
||||
class TelephonyCallback MOZ_FINAL : public nsITelephonyCallback
|
||||
class TelephonyCallback : public nsITelephonyCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITELEPHONYCALLBACK
|
||||
|
||||
TelephonyCallback(nsPIDOMWindow* aWindow, Telephony* aTelephony,
|
||||
Promise* aPromise, uint32_t aServiceId);
|
||||
TelephonyCallback(Promise* aPromise);
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(const nsAString& aStatusMessage);
|
||||
protected:
|
||||
virtual ~TelephonyCallback() {}
|
||||
|
||||
template<typename T>
|
||||
nsresult
|
||||
NotifyDialMMISuccess(const nsAString& aStatusMessage, const T& aInfo)
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
if (!NS_WARN_IF(jsapi.Init(mWindow))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> info(cx);
|
||||
|
||||
if (!ToJSValue(cx, aInfo, &info)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
|
||||
return NotifyDialMMISuccess(cx, aStatusMessage, info);
|
||||
}
|
||||
|
||||
private:
|
||||
~TelephonyCallback() {}
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(JSContext* aCx, const nsAString& aStatusMessage,
|
||||
JS::Handle<JS::Value> aInfo);
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(JSContext* aCx, const MozMMIResult& aResult);
|
||||
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<Telephony> mTelephony;
|
||||
protected:
|
||||
nsRefPtr<Promise> mPromise;
|
||||
uint32_t mServiceId;
|
||||
|
||||
nsRefPtr<DOMRequest> mMMIRequest;
|
||||
nsString mServiceCode;
|
||||
};
|
||||
|
||||
} // namespace telephony
|
||||
|
133
dom/telephony/TelephonyDialCallback.cpp
Normal file
133
dom/telephony/TelephonyDialCallback.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
/* 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 "TelephonyDialCallback.h"
|
||||
|
||||
#include "mozilla/dom/DOMMMIError.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::telephony;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(TelephonyDialCallback, TelephonyCallback,
|
||||
nsITelephonyDialCallback)
|
||||
|
||||
TelephonyDialCallback::TelephonyDialCallback(nsPIDOMWindow* aWindow,
|
||||
Telephony* aTelephony,
|
||||
Promise* aPromise,
|
||||
uint32_t aServiceId)
|
||||
: TelephonyCallback(aPromise), mWindow(aWindow), mTelephony(aTelephony),
|
||||
mServiceId(aServiceId)
|
||||
{
|
||||
MOZ_ASSERT(mTelephony);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyDialCallback::NotifyDialMMISuccess(const nsAString& aStatusMessage)
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
if (!NS_WARN_IF(jsapi.Init(mWindow))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
MozMMIResult result;
|
||||
|
||||
result.mServiceCode.Assign(mServiceCode);
|
||||
result.mStatusMessage.Assign(aStatusMessage);
|
||||
|
||||
return NotifyDialMMISuccess(cx, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyDialCallback::NotifyDialMMISuccess(JSContext* aCx,
|
||||
const nsAString& aStatusMessage,
|
||||
JS::Handle<JS::Value> aInfo)
|
||||
{
|
||||
RootedDictionary<MozMMIResult> result(aCx);
|
||||
|
||||
result.mServiceCode.Assign(mServiceCode);
|
||||
result.mStatusMessage.Assign(aStatusMessage);
|
||||
result.mAdditionalInformation.Construct().SetAsObject() = &aInfo.toObject();
|
||||
|
||||
return NotifyDialMMISuccess(aCx, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyDialCallback::NotifyDialMMISuccess(JSContext* aCx,
|
||||
const MozMMIResult& aResult)
|
||||
{
|
||||
JS::Rooted<JS::Value> jsResult(aCx);
|
||||
|
||||
if (!ToJSValue(aCx, aResult, &jsResult)) {
|
||||
JS_ClearPendingException(aCx);
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
|
||||
return NotifyDialMMISuccess(jsResult);
|
||||
}
|
||||
|
||||
// nsITelephonyDialCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyDialCallback::NotifyDialMMI(const nsAString& aServiceCode)
|
||||
{
|
||||
mMMIRequest = new DOMRequest(mWindow);
|
||||
mServiceCode.Assign(aServiceCode);
|
||||
|
||||
mPromise->MaybeResolve(mMMIRequest);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyDialCallback::NotifyDialCallSuccess(uint32_t aCallIndex,
|
||||
const nsAString& aNumber)
|
||||
{
|
||||
nsRefPtr<TelephonyCallId> id = mTelephony->CreateCallId(aNumber);
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
mTelephony->CreateCall(id, mServiceId, aCallIndex,
|
||||
nsITelephonyService::CALL_STATE_DIALING);
|
||||
|
||||
mPromise->MaybeResolve(call);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyDialCallback::NotifyDialMMISuccess(JS::Handle<JS::Value> aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireSuccessAsync(mMMIRequest, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyDialCallback::NotifyDialMMIError(const nsAString& aError)
|
||||
{
|
||||
Nullable<int16_t> info;
|
||||
|
||||
nsRefPtr<DOMError> error =
|
||||
new DOMMMIError(mWindow, aError, EmptyString(), mServiceCode, info);
|
||||
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireDetailedError(mMMIRequest, error);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyDialCallback::NotifyDialMMIErrorWithInfo(const nsAString& aError,
|
||||
uint16_t aInfo)
|
||||
{
|
||||
Nullable<int16_t> info(aInfo);
|
||||
|
||||
nsRefPtr<DOMError> error =
|
||||
new DOMMMIError(mWindow, aError, EmptyString(), mServiceCode, info);
|
||||
|
||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||
|
||||
return rs->FireDetailedError(mMMIRequest, error);
|
||||
}
|
84
dom/telephony/TelephonyDialCallback.h
Normal file
84
dom/telephony/TelephonyDialCallback.h
Normal file
@ -0,0 +1,84 @@
|
||||
/* 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_TelephonyDialCallback_h
|
||||
#define mozilla_dom_TelephonyDialCallback_h
|
||||
|
||||
#include "Telephony.h"
|
||||
#include "mozilla/dom/DOMRequest.h"
|
||||
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/telephony/TelephonyCallback.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITelephonyService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace telephony {
|
||||
|
||||
class TelephonyDialCallback MOZ_FINAL : public TelephonyCallback,
|
||||
public nsITelephonyDialCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSITELEPHONYDIALCALLBACK
|
||||
|
||||
TelephonyDialCallback(nsPIDOMWindow* aWindow, Telephony* aTelephony,
|
||||
Promise* aPromise, uint32_t aServiceId);
|
||||
|
||||
NS_FORWARD_NSITELEPHONYCALLBACK(TelephonyCallback::)
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(const nsAString& aStatusMessage);
|
||||
|
||||
template<typename T>
|
||||
nsresult
|
||||
NotifyDialMMISuccess(const nsAString& aStatusMessage, const T& aInfo)
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
if (!NS_WARN_IF(jsapi.Init(mWindow))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JS::Value> info(cx);
|
||||
|
||||
if (!ToJSValue(cx, aInfo, &info)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
|
||||
return NotifyDialMMISuccess(cx, aStatusMessage, info);
|
||||
}
|
||||
|
||||
private:
|
||||
~TelephonyDialCallback() {}
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(JSContext* aCx, const nsAString& aStatusMessage,
|
||||
JS::Handle<JS::Value> aInfo);
|
||||
|
||||
nsresult
|
||||
NotifyDialMMISuccess(JSContext* aCx, const MozMMIResult& aResult);
|
||||
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<Telephony> mTelephony;
|
||||
uint32_t mServiceId;
|
||||
|
||||
nsRefPtr<DOMRequest> mMMIRequest;
|
||||
nsString mServiceCode;
|
||||
};
|
||||
|
||||
} // namespace telephony
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_TelephonyDialCallback_h
|
97
dom/telephony/USSDSession.cpp
Normal file
97
dom/telephony/USSDSession.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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 "mozilla/dom/USSDSession.h"
|
||||
|
||||
#include "mozilla/dom/USSDSessionBinding.h"
|
||||
#include "mozilla/dom/telephony/TelephonyCallback.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::telephony;
|
||||
using mozilla::ErrorResult;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(USSDSession, mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(USSDSession)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(USSDSession)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(USSDSession)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
USSDSession::USSDSession(nsPIDOMWindow* aWindow, nsITelephonyService* aService,
|
||||
uint32_t aServiceId)
|
||||
: mWindow(aWindow), mService(aService), mServiceId(aServiceId)
|
||||
{
|
||||
}
|
||||
|
||||
USSDSession::~USSDSession()
|
||||
{
|
||||
}
|
||||
|
||||
nsPIDOMWindow*
|
||||
USSDSession::GetParentObject() const
|
||||
{
|
||||
return mWindow;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
USSDSession::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return USSDSessionBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
// WebIDL
|
||||
|
||||
already_AddRefed<USSDSession>
|
||||
USSDSession::Constructor(const GlobalObject& aGlobal, uint32_t aServiceId,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyService> ril =
|
||||
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
|
||||
if (!ril) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<USSDSession> session = new USSDSession(window, ril, aServiceId);
|
||||
return session.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
USSDSession::Send(const nsAString& aUssd, ErrorResult& aRv)
|
||||
{
|
||||
if (!mService) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
|
||||
if (!global) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
|
||||
nsresult rv = mService->SendUSSD(mServiceId, aUssd, callback);
|
||||
if (NS_FAILED(rv)) {
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
|
||||
return promise.forget();
|
||||
}
|
61
dom/telephony/USSDSession.h
Normal file
61
dom/telephony/USSDSession.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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_USSDSession_h
|
||||
#define mozilla_dom_USSDSession_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsITelephonyService.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
struct JSContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class USSDSession MOZ_FINAL : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(USSDSession)
|
||||
|
||||
USSDSession(nsPIDOMWindow* aWindow, nsITelephonyService* aService,
|
||||
uint32_t aServiceId);
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const;
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
static already_AddRefed<USSDSession>
|
||||
Constructor(const GlobalObject& aGlobal, uint32_t aServiceId,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Send(const nsAString& aUssd, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
~USSDSession();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsITelephonyService> mService;
|
||||
uint32_t mServiceId;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_USSDSession_h
|
@ -564,7 +564,7 @@ TelephonyService.prototype = {
|
||||
// Note: isPlainPhoneNumber also accepts USSD and SS numbers
|
||||
if (!gPhoneNumberUtils.isPlainPhoneNumber(aNumber)) {
|
||||
if (DEBUG) debug("Error: Number '" + aNumber + "' is not viable. Drop.");
|
||||
aCallback.notifyDialError(DIAL_ERROR_BAD_NUMBER);
|
||||
aCallback.notifyError(DIAL_ERROR_BAD_NUMBER);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -581,11 +581,11 @@ TelephonyService.prototype = {
|
||||
} else {
|
||||
// Reject MMI code from dialEmergency api.
|
||||
if (aIsDialEmergency) {
|
||||
aCallback.notifyDialError(DIAL_ERROR_BAD_NUMBER);
|
||||
aCallback.notifyError(DIAL_ERROR_BAD_NUMBER);
|
||||
return;
|
||||
}
|
||||
|
||||
this._dialMMI(aClientId, mmi, aCallback);
|
||||
this._dialMMI(aClientId, mmi, aCallback, true);
|
||||
}
|
||||
},
|
||||
|
||||
@ -597,14 +597,14 @@ TelephonyService.prototype = {
|
||||
_dialCall: function(aClientId, aOptions, aCallback) {
|
||||
if (this._isDialing) {
|
||||
if (DEBUG) debug("Error: Already has a dialing call.");
|
||||
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
aCallback.notifyError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// We can only have at most two calls on the same line (client).
|
||||
if (this._numCallsOnLine(aClientId) >= 2) {
|
||||
if (DEBUG) debug("Error: Already has more than 2 calls on line.");
|
||||
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
aCallback.notifyError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ TelephonyService.prototype = {
|
||||
// any new call on other SIM.
|
||||
if (this._hasCallsOnOtherClient(aClientId)) {
|
||||
if (DEBUG) debug("Error: Already has a call on other sim.");
|
||||
aCallback.notifyDialError(DIAL_ERROR_OTHER_CONNECTION_IN_USE);
|
||||
aCallback.notifyError(DIAL_ERROR_OTHER_CONNECTION_IN_USE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ TelephonyService.prototype = {
|
||||
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;
|
||||
if (aClientId === -1) {
|
||||
if (DEBUG) debug("Error: No client is avaialble for emergency call.");
|
||||
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
aCallback.notifyError(DIAL_ERROR_INVALID_STATE_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -655,7 +655,7 @@ TelephonyService.prototype = {
|
||||
this._isDialing = false;
|
||||
|
||||
if (!response.success) {
|
||||
aCallback.notifyDialError(response.errorMsg);
|
||||
aCallback.notifyError(response.errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -673,16 +673,24 @@ TelephonyService.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @param aClientId
|
||||
* Client id.
|
||||
* @param aMmi
|
||||
* Parsed MMI structure.
|
||||
* @param aCallback
|
||||
* A nsITelephonyDialCallback object.
|
||||
* @param aStartNewSession
|
||||
* True to start a new session for ussd request.
|
||||
*/
|
||||
_dialMMI: function(aClientId, aMmi, aCallback) {
|
||||
_dialMMI: function(aClientId, aMmi, aCallback, aStartNewSession) {
|
||||
let mmiServiceCode = aMmi ?
|
||||
this._serviceCodeToKeyString(aMmi.serviceCode) : RIL.MMI_KS_SC_USSD;
|
||||
|
||||
aCallback.notifyDialMMI(mmiServiceCode);
|
||||
|
||||
this._sendToRilWorker(aClientId, "sendMMI", { mmi: aMmi }, response => {
|
||||
this._sendToRilWorker(aClientId, "sendMMI",
|
||||
{ mmi: aMmi,
|
||||
startNewSession: aStartNewSession }, response => {
|
||||
if (DEBUG) debug("MMI response: " + JSON.stringify(response));
|
||||
|
||||
if (!response.success) {
|
||||
@ -1048,6 +1056,18 @@ TelephonyService.prototype = {
|
||||
this._sendToRilWorker(aClientId, "resumeConference");
|
||||
},
|
||||
|
||||
sendUSSD: function(aClientId, aUssd, aCallback) {
|
||||
this._sendToRilWorker(aClientId, "sendUSSD",
|
||||
{ ussd: aUssd, checkSession: true },
|
||||
response => {
|
||||
if (!response.success) {
|
||||
aCallback.notifyError(response.errorMsg);
|
||||
} else {
|
||||
aCallback.notifySuccess();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get microphoneMuted() {
|
||||
return gAudioManager.microphoneMuted;
|
||||
},
|
||||
@ -1266,9 +1286,27 @@ TelephonyService.prototype = {
|
||||
this._notifyAllListeners("conferenceCallStateChanged", [aState]);
|
||||
},
|
||||
|
||||
notifyUssdReceived: function(aClientId, aMessage, aSessionEnded) {
|
||||
if (DEBUG) {
|
||||
debug("notifyUssdReceived for " + aClientId + ": " +
|
||||
aMessage + " (sessionEnded : " + aSessionEnded + ")");
|
||||
}
|
||||
|
||||
let info = {
|
||||
serviceId: aClientId,
|
||||
message: aMessage,
|
||||
sessionEnded: aSessionEnded
|
||||
};
|
||||
|
||||
gSystemMessenger.broadcastMessage("ussd-received", info);
|
||||
|
||||
gGonkMobileConnectionService.notifyUssdReceived(aClientId, aMessage,
|
||||
aSessionEnded);
|
||||
},
|
||||
|
||||
dialMMI: function(aClientId, aMmiString, aCallback) {
|
||||
let mmi = this._parseMMI(aMmiString, this._hasCalls(aClientId));
|
||||
this._dialMMI(aClientId, mmi, aCallback);
|
||||
this._dialMMI(aClientId, mmi, aCallback, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1295,4 +1333,38 @@ TelephonyService.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelephonyService]);
|
||||
/**
|
||||
* This implements nsISystemMessagesWrapper.wrapMessage(), which provides a
|
||||
* plugable way to wrap a "ussd-received" type system message.
|
||||
*
|
||||
* Please see SystemMessageManager.js to know how it customizes the wrapper.
|
||||
*/
|
||||
function USSDReceivedWrapper() {
|
||||
if (DEBUG) debug("USSDReceivedWrapper()");
|
||||
}
|
||||
USSDReceivedWrapper.prototype = {
|
||||
// nsISystemMessagesWrapper implementation.
|
||||
wrapMessage: function(aMessage, aWindow) {
|
||||
if (DEBUG) debug("wrapMessage: " + JSON.stringify(aMessage));
|
||||
|
||||
let session = aMessage.sessionEnded ? null :
|
||||
new aWindow.USSDSession(aMessage.serviceId);
|
||||
|
||||
let event = new aWindow.USSDReceivedEvent("ussdreceived", {
|
||||
serviceId: aMessage.serviceId,
|
||||
message: aMessage.message,
|
||||
sessionEnded: aMessage.sessionEnded,
|
||||
session: session
|
||||
});
|
||||
|
||||
return event;
|
||||
},
|
||||
|
||||
classDescription: "USSDReceivedWrapper",
|
||||
classID: Components.ID("{d03684ed-ede4-4210-8206-f4f32772d9f5}"),
|
||||
contractID: "@mozilla.org/dom/system-messages/wrapper/ussd-received;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper])
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelephonyService,
|
||||
USSDReceivedWrapper]);
|
||||
|
@ -1,2 +1,5 @@
|
||||
component {67d26434-d063-4d28-9f48-5b3189788155} TelephonyService.js
|
||||
contract @mozilla.org/telephony/gonktelephonyservice;1 {67d26434-d063-4d28-9f48-5b3189788155}
|
||||
|
||||
component {d03684ed-ede4-4210-8206-f4f32772d9f5} TelephonyService.js
|
||||
contract @mozilla.org/dom/system-messages/wrapper/ussd-received;1 {d03684ed-ede4-4210-8206-f4f32772d9f5}
|
||||
|
@ -24,10 +24,17 @@ struct DialRequest
|
||||
bool isEmergency;
|
||||
};
|
||||
|
||||
struct USSDRequest
|
||||
{
|
||||
uint32_t clientId;
|
||||
nsString ussd;
|
||||
};
|
||||
|
||||
union IPCTelephonyRequest
|
||||
{
|
||||
EnumerateCallsRequest;
|
||||
DialRequest;
|
||||
USSDRequest;
|
||||
};
|
||||
|
||||
sync protocol PTelephony {
|
||||
|
@ -16,7 +16,12 @@ struct EnumerateCallsResponse
|
||||
// empty.
|
||||
};
|
||||
|
||||
struct DialResponseError
|
||||
struct SuccessResponse
|
||||
{
|
||||
// empty.
|
||||
};
|
||||
|
||||
struct ErrorResponse
|
||||
{
|
||||
nsString name;
|
||||
};
|
||||
@ -42,8 +47,12 @@ struct DialResponseMMIError
|
||||
union IPCTelephonyResponse
|
||||
{
|
||||
EnumerateCallsResponse;
|
||||
|
||||
// General.
|
||||
SuccessResponse;
|
||||
ErrorResponse;
|
||||
|
||||
// dial
|
||||
DialResponseError;
|
||||
DialResponseCallSuccess;
|
||||
DialResponseMMISuccess;
|
||||
DialResponseMMIError;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "TelephonyChild.h"
|
||||
|
||||
#include "mozilla/dom/telephony/TelephonyCallback.h"
|
||||
#include "mozilla/dom/telephony/TelephonyDialCallback.h"
|
||||
#include "TelephonyIPCService.h"
|
||||
|
||||
USING_TELEPHONY_NAMESPACE
|
||||
@ -147,8 +147,10 @@ TelephonyRequestChild::Recv__delete__(const IPCTelephonyResponse& aResponse)
|
||||
case IPCTelephonyResponse::TEnumerateCallsResponse:
|
||||
mListener->EnumerateCallStateComplete();
|
||||
break;
|
||||
case IPCTelephonyResponse::TDialResponseError:
|
||||
return DoResponse(aResponse.get_DialResponseError());
|
||||
case IPCTelephonyResponse::TSuccessResponse:
|
||||
return DoResponse(aResponse.get_SuccessResponse());
|
||||
case IPCTelephonyResponse::TErrorResponse:
|
||||
return DoResponse(aResponse.get_ErrorResponse());
|
||||
case IPCTelephonyResponse::TDialResponseCallSuccess:
|
||||
return DoResponse(aResponse.get_DialResponseCallSuccess());
|
||||
case IPCTelephonyResponse::TDialResponseMMISuccess:
|
||||
@ -187,16 +189,24 @@ bool
|
||||
TelephonyRequestChild::RecvNotifyDialMMI(const nsString& aServiceCode)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
|
||||
mCallback->NotifyDialMMI(aServiceCode);
|
||||
nsCOMPtr<nsITelephonyDialCallback> callback = do_QueryInterface(mCallback);
|
||||
callback->NotifyDialMMI(aServiceCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TelephonyRequestChild::DoResponse(const DialResponseError& aResponse)
|
||||
TelephonyRequestChild::DoResponse(const SuccessResponse& aResponse)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
mCallback->NotifyDialError(aResponse.name());
|
||||
mCallback->NotifySuccess();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TelephonyRequestChild::DoResponse(const ErrorResponse& aResponse)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
mCallback->NotifyError(aResponse.name());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -204,7 +214,8 @@ bool
|
||||
TelephonyRequestChild::DoResponse(const DialResponseCallSuccess& aResponse)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
mCallback->NotifyDialCallSuccess(aResponse.callIndex(), aResponse.number());
|
||||
nsCOMPtr<nsITelephonyDialCallback> callback = do_QueryInterface(mCallback);
|
||||
callback->NotifyDialCallSuccess(aResponse.callIndex(), aResponse.number());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -215,7 +226,8 @@ TelephonyRequestChild::DoResponse(const DialResponseMMISuccess& aResponse)
|
||||
|
||||
// FIXME: Need to overload NotifyDialMMISuccess in the IDL. mCallback is not
|
||||
// necessarily an instance of TelephonyCallback.
|
||||
nsRefPtr<TelephonyCallback> callback = static_cast<TelephonyCallback*>(mCallback.get());
|
||||
nsCOMPtr<nsITelephonyDialCallback> dialCallback = do_QueryInterface(mCallback);
|
||||
nsRefPtr<TelephonyDialCallback> callback = static_cast<TelephonyDialCallback*>(dialCallback.get());
|
||||
|
||||
nsAutoString statusMessage(aResponse.statusMessage());
|
||||
AdditionalInformation info(aResponse.additionalInformation());
|
||||
@ -242,16 +254,17 @@ bool
|
||||
TelephonyRequestChild::DoResponse(const DialResponseMMIError& aResponse)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
nsCOMPtr<nsITelephonyDialCallback> callback = do_QueryInterface(mCallback);
|
||||
|
||||
nsAutoString name(aResponse.name());
|
||||
AdditionalInformation info(aResponse.additionalInformation());
|
||||
|
||||
switch (info.type()) {
|
||||
case AdditionalInformation::Tvoid_t:
|
||||
mCallback->NotifyDialMMIError(name);
|
||||
callback->NotifyDialMMIError(name);
|
||||
break;
|
||||
case AdditionalInformation::Tuint16_t:
|
||||
mCallback->NotifyDialMMIErrorWithInfo(name, info.get_uint16_t());
|
||||
callback->NotifyDialMMIErrorWithInfo(name, info.get_uint16_t());
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Received invalid type!");
|
||||
|
@ -84,7 +84,10 @@ protected:
|
||||
|
||||
private:
|
||||
bool
|
||||
DoResponse(const DialResponseError& aResponse);
|
||||
DoResponse(const SuccessResponse& aResponse);
|
||||
|
||||
bool
|
||||
DoResponse(const ErrorResponse& aResponse);
|
||||
|
||||
bool
|
||||
DoResponse(const DialResponseCallSuccess& aResponse);
|
||||
|
@ -162,7 +162,8 @@ TelephonyIPCService::EnumerateCalls(nsITelephonyListener *aListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyIPCService::Dial(uint32_t aClientId, const nsAString& aNumber,
|
||||
bool aIsEmergency, nsITelephonyCallback *aCallback)
|
||||
bool aIsEmergency,
|
||||
nsITelephonyDialCallback *aCallback)
|
||||
{
|
||||
return SendRequest(nullptr, aCallback,
|
||||
DialRequest(aClientId, nsString(aNumber), aIsEmergency));
|
||||
@ -300,6 +301,14 @@ TelephonyIPCService::StopTone(uint32_t aClientId)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyIPCService::SendUSSD(uint32_t aClientId, const nsAString& aUssd,
|
||||
nsITelephonyCallback *aCallback)
|
||||
{
|
||||
return SendRequest(nullptr, aCallback,
|
||||
USSDRequest(aClientId, nsString(aUssd)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyIPCService::GetMicrophoneMuted(bool* aMuted)
|
||||
{
|
||||
|
@ -43,6 +43,8 @@ TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActo
|
||||
return actor->DoRequest(aRequest.get_EnumerateCallsRequest());
|
||||
case IPCTelephonyRequest::TDialRequest:
|
||||
return actor->DoRequest(aRequest.get_DialRequest());
|
||||
case IPCTelephonyRequest::TUSSDRequest:
|
||||
return actor->DoRequest(aRequest.get_USSDRequest());
|
||||
default:
|
||||
MOZ_CRASH("Unknown type!");
|
||||
}
|
||||
@ -385,7 +387,8 @@ TelephonyParent::SupplementaryServiceNotification(uint32_t aClientId,
|
||||
|
||||
NS_IMPL_ISUPPORTS(TelephonyRequestParent,
|
||||
nsITelephonyListener,
|
||||
nsITelephonyCallback)
|
||||
nsITelephonyCallback,
|
||||
nsITelephonyDialCallback)
|
||||
|
||||
TelephonyRequestParent::TelephonyRequestParent()
|
||||
: mActorDestroyed(false)
|
||||
@ -426,9 +429,23 @@ TelephonyRequestParent::DoRequest(const DialRequest& aRequest)
|
||||
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
|
||||
if (service) {
|
||||
service->Dial(aRequest.clientId(), aRequest.number(),
|
||||
aRequest.isEmergency(), this);
|
||||
aRequest.isEmergency(), this);
|
||||
} else {
|
||||
return NS_SUCCEEDED(NotifyDialError(NS_LITERAL_STRING("InvalidStateError")));
|
||||
return NS_SUCCEEDED(NotifyError(NS_LITERAL_STRING("InvalidStateError")));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TelephonyRequestParent::DoRequest(const USSDRequest& aRequest)
|
||||
{
|
||||
nsCOMPtr<nsITelephonyService> service =
|
||||
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
|
||||
if (service) {
|
||||
service->SendUSSD(aRequest.clientId(), aRequest.ussd(), this);
|
||||
} else {
|
||||
return NS_SUCCEEDED(NotifyError(NS_LITERAL_STRING("InvalidStateError")));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -532,7 +549,7 @@ TelephonyRequestParent::SupplementaryServiceNotification(uint32_t aClientId,
|
||||
MOZ_CRASH("Not a TelephonyParent!");
|
||||
}
|
||||
|
||||
// nsITelephonyCallback
|
||||
// nsITelephonyDialCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyRequestParent::NotifyDialMMI(const nsAString& aServiceCode)
|
||||
@ -543,9 +560,15 @@ TelephonyRequestParent::NotifyDialMMI(const nsAString& aServiceCode)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyRequestParent::NotifyDialError(const nsAString& aError)
|
||||
TelephonyRequestParent::NotifySuccess()
|
||||
{
|
||||
return SendResponse(DialResponseError(nsAutoString(aError)));
|
||||
return SendResponse(SuccessResponse());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyRequestParent::NotifyError(const nsAString& aError)
|
||||
{
|
||||
return SendResponse(ErrorResponse(nsAutoString(aError)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -98,7 +98,7 @@ private:
|
||||
|
||||
class TelephonyRequestParent : public PTelephonyRequestParent
|
||||
, public nsITelephonyListener
|
||||
, public nsITelephonyCallback
|
||||
, public nsITelephonyDialCallback
|
||||
{
|
||||
friend class TelephonyParent;
|
||||
|
||||
@ -106,6 +106,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITELEPHONYLISTENER
|
||||
NS_DECL_NSITELEPHONYCALLBACK
|
||||
NS_DECL_NSITELEPHONYDIALCALLBACK
|
||||
|
||||
protected:
|
||||
TelephonyRequestParent();
|
||||
@ -125,6 +126,9 @@ private:
|
||||
|
||||
bool
|
||||
DoRequest(const DialRequest& aRequest);
|
||||
|
||||
bool
|
||||
DoRequest(const USSDRequest& aRequest);
|
||||
};
|
||||
|
||||
END_TELEPHONY_NAMESPACE
|
||||
|
@ -16,6 +16,7 @@ EXPORTS.mozilla.dom += [
|
||||
'TelephonyCall.h',
|
||||
'TelephonyCallGroup.h',
|
||||
'TelephonyCallId.h',
|
||||
'USSDSession.h'
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom.telephony += [
|
||||
@ -23,6 +24,7 @@ EXPORTS.mozilla.dom.telephony += [
|
||||
'ipc/TelephonyParent.h',
|
||||
'TelephonyCallback.h',
|
||||
'TelephonyCommon.h',
|
||||
'TelephonyDialCallback.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
@ -35,6 +37,8 @@ UNIFIED_SOURCES += [
|
||||
'TelephonyCallback.cpp',
|
||||
'TelephonyCallGroup.cpp',
|
||||
'TelephonyCallId.cpp',
|
||||
'TelephonyDialCallback.cpp',
|
||||
'USSDSession.cpp',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
|
@ -10,7 +10,7 @@
|
||||
"@mozilla.org/telephony/gonktelephonyservice;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(8790e2cc-2c68-4ce9-90dc-f68e1b6e4886)]
|
||||
[scriptable, uuid(79eec3c3-2dfc-4bbf-b106-af5457651ae0)]
|
||||
interface nsIGonkTelephonyService : nsITelephonyService
|
||||
{
|
||||
void notifyCallDisconnected(in unsigned long clientId, in jsval call);
|
||||
@ -27,6 +27,9 @@ interface nsIGonkTelephonyService : nsITelephonyService
|
||||
|
||||
void notifyConferenceCallStateChanged(in short state);
|
||||
|
||||
void notifyUssdReceived(in unsigned long clientId, in DOMString message,
|
||||
in boolean sessionEnded);
|
||||
|
||||
void dialMMI(in unsigned long clientId, in AString mmiString,
|
||||
in nsITelephonyCallback callback);
|
||||
in nsITelephonyDialCallback callback);
|
||||
};
|
||||
|
@ -177,10 +177,20 @@ interface nsITelephonyListener : nsISupports
|
||||
};
|
||||
|
||||
/**
|
||||
* A callback interface for handling asynchronous response of Telephony.dial().
|
||||
* A callback interface for handling asynchronous response.
|
||||
*/
|
||||
[scriptable, uuid(67533db3-cd38-475c-a774-8d0bbf9169fb)]
|
||||
[scriptable, uuid(cffc3f9d-2c88-4a14-8ebc-f216caf0cc1d)]
|
||||
interface nsITelephonyCallback : nsISupports
|
||||
{
|
||||
void notifySuccess();
|
||||
void notifyError(in AString error);
|
||||
};
|
||||
|
||||
/**
|
||||
* A callback interface for handling asynchronous response for telephony.dial.
|
||||
*/
|
||||
[scriptable, uuid(4481212f-72e9-4aef-97e1-5397af782113)]
|
||||
interface nsITelephonyDialCallback : nsITelephonyCallback
|
||||
{
|
||||
/**
|
||||
* Called when a dial request is treated as an MMI code and it is about to
|
||||
@ -191,14 +201,6 @@ interface nsITelephonyCallback : nsISupports
|
||||
*/
|
||||
void notifyDialMMI(in AString serviceCode);
|
||||
|
||||
/**
|
||||
* Called when a dial request fails.
|
||||
*
|
||||
* @param error
|
||||
* Error from RIL.
|
||||
*/
|
||||
void notifyDialError(in AString error);
|
||||
|
||||
/**
|
||||
* Called when a dial request is treated as a call setup and the result
|
||||
* succeeds.
|
||||
@ -238,7 +240,7 @@ interface nsITelephonyCallback : nsISupports
|
||||
* XPCOM component (in the content process) that provides the telephony
|
||||
* information.
|
||||
*/
|
||||
[scriptable, uuid(4ff3ecb7-b024-4752-9dd6-c3623c6e6b8a)]
|
||||
[scriptable, uuid(79188caa-046a-48e1-b9c5-2e891504dc7a)]
|
||||
interface nsITelephonyService : nsISupports
|
||||
{
|
||||
const unsigned short CALL_STATE_UNKNOWN = 0;
|
||||
@ -281,7 +283,7 @@ interface nsITelephonyService : nsISupports
|
||||
* Functionality for making and managing phone calls.
|
||||
*/
|
||||
void dial(in unsigned long clientId, in DOMString number,
|
||||
in boolean isEmergency, in nsITelephonyCallback callback);
|
||||
in boolean isEmergency, in nsITelephonyDialCallback callback);
|
||||
void hangUp(in unsigned long clientId, in unsigned long callIndex);
|
||||
|
||||
void startTone(in unsigned long clientId, in DOMString dtmfChar);
|
||||
@ -297,6 +299,16 @@ interface nsITelephonyService : nsISupports
|
||||
void holdConference(in unsigned long clientId);
|
||||
void resumeConference(in unsigned long clientId);
|
||||
|
||||
/**
|
||||
* Send an USSD on existing session. It results in error if the session is
|
||||
* not existed.
|
||||
*
|
||||
* If successful, callback.notifySuccess() will be called.
|
||||
* Otherwise, callback.notifyError() will be called.
|
||||
*/
|
||||
void sendUSSD(in unsigned long clientId, in DOMString ussd,
|
||||
in nsITelephonyCallback callback);
|
||||
|
||||
attribute bool microphoneMuted;
|
||||
attribute bool speakerEnabled;
|
||||
};
|
||||
|
@ -1244,8 +1244,6 @@ var interfaceNamesInGlobalScope =
|
||||
"URLSearchParams",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"UserProximityEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "USSDReceivedEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"ValidityState",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
enum NFCTechType {
|
||||
"NDEF",
|
||||
"NDEF_WRITABLE",
|
||||
"NDEF_FORMATABLE",
|
||||
"P2P",
|
||||
"NFC_A",
|
||||
"NFC_B",
|
||||
|
@ -13,6 +13,7 @@ dictionary NfcCommandOptions
|
||||
|
||||
long techType;
|
||||
|
||||
boolean isP2P;
|
||||
sequence<MozNDEFRecordOptions> records;
|
||||
};
|
||||
|
||||
|
@ -4,16 +4,22 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.mobileconnection.enabled",
|
||||
[Pref="dom.telephony.enabled",
|
||||
CheckPermissions="telephony mobileconnection",
|
||||
AvailableIn="CertifiedApps",
|
||||
Constructor(DOMString type, optional USSDReceivedEventInit eventInitDict)]
|
||||
interface USSDReceivedEvent : Event
|
||||
{
|
||||
readonly attribute unsigned long serviceId;
|
||||
readonly attribute DOMString? message;
|
||||
readonly attribute boolean sessionEnded;
|
||||
readonly attribute USSDSession? session; // null if session is ended.
|
||||
readonly attribute boolean sessionEnded; // deprecated. Bug 1070831
|
||||
};
|
||||
|
||||
dictionary USSDReceivedEventInit : EventInit
|
||||
{
|
||||
unsigned long serviceId = 0;
|
||||
DOMString? message = null;
|
||||
USSDSession? session = null;
|
||||
boolean sessionEnded = false;
|
||||
};
|
||||
|
14
dom/webidl/USSDSession.webidl
Normal file
14
dom/webidl/USSDSession.webidl
Normal file
@ -0,0 +1,14 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
[Pref="dom.telephony.enabled",
|
||||
CheckPermissions="telephony",
|
||||
AvailableIn="CertifiedApps",
|
||||
Constructor(unsigned long serviceId)]
|
||||
interface USSDSession {
|
||||
[Throws]
|
||||
Promise<void> send(DOMString ussd);
|
||||
};
|
@ -508,6 +508,7 @@ WEBIDL_FILES = [
|
||||
'URLSearchParams.webidl',
|
||||
'URLUtils.webidl',
|
||||
'URLUtilsReadOnly.webidl',
|
||||
'USSDSession.webidl',
|
||||
'ValidityState.webidl',
|
||||
'VideoPlaybackQuality.webidl',
|
||||
'VideoStreamTrack.webidl',
|
||||
|
Loading…
Reference in New Issue
Block a user