merge b2g-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2015-10-13 11:58:51 +02:00
Родитель 89f4a647c5 384411b48a
Коммит 5aeac175cc
32 изменённых файлов: 410 добавлений и 216 удалений

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
@ -135,7 +135,7 @@
<project groups="invensense" name="platform/hardware/invensense" path="hardware/invensense" revision="e6d9ab28b4f4e7684f6c07874ee819c9ea0002a2"/> <project groups="invensense" name="platform/hardware/invensense" path="hardware/invensense" revision="e6d9ab28b4f4e7684f6c07874ee819c9ea0002a2"/>
<project name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/> <project name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/>
<project name="kernel/common" path="kernel" revision="0f36762ab0c1d8ce10c6a5eda948b05d5d6cc379"/> <project name="kernel/common" path="kernel" revision="0f36762ab0c1d8ce10c6a5eda948b05d5d6cc379"/>
<project name="platform/system/core" path="system/core" revision="4b989b1bec28b0838420c4d5bb454c78afa62bea"/> <project name="platform/system/core" path="system/core" revision="4776448ebcd3f07d58b91503c478da9b54cb58a0"/>
<project name="u-boot" path="u-boot" revision="f1502910977ac88f43da7bf9277c3523ad4b0b2f"/> <project name="u-boot" path="u-boot" revision="f1502910977ac88f43da7bf9277c3523ad4b0b2f"/>
<project name="vendor/sprd/gps" path="vendor/sprd/gps" revision="7d6e1269be7186b2073fa568958b357826692c4b"/> <project name="vendor/sprd/gps" path="vendor/sprd/gps" revision="7d6e1269be7186b2073fa568958b357826692c4b"/>
<project name="vendor/sprd/open-source" path="vendor/sprd/open-source" revision="295ff253b74353751a99aafd687196a28c84a58e"/> <project name="vendor/sprd/open-source" path="vendor/sprd/open-source" revision="295ff253b74353751a99aafd687196a28c84a58e"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/> <project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf"> <project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>

Просмотреть файл

@ -1,9 +1,9 @@
{ {
"git": { "git": {
"git_revision": "0b934d06c04adff2cd9bdd0bc204f974a18b710f", "git_revision": "d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588",
"remote": "https://git.mozilla.org/releases/gaia.git", "remote": "https://git.mozilla.org/releases/gaia.git",
"branch": "" "branch": ""
}, },
"revision": "dee47434923493d57f151448eec00f793f113bfd", "revision": "d382a1ff9028efabb8bbc18812ff7de12759a29e",
"repo_path": "integration/gaia-central" "repo_path": "integration/gaia-central"
} }

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>

Просмотреть файл

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/> <project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf"> <project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>

Просмотреть файл

@ -11,7 +11,6 @@
#include "BluetoothSocket.h" #include "BluetoothSocket.h"
#include "BluetoothUtils.h" #include "BluetoothUtils.h"
#include "BluetoothUuid.h" #include "BluetoothUuid.h"
#include "ObexBase.h"
#include "mozilla/dom/BluetoothPbapParametersBinding.h" #include "mozilla/dom/BluetoothPbapParametersBinding.h"
#include "mozilla/dom/File.h" #include "mozilla/dom/File.h"
@ -46,6 +45,31 @@ namespace {
} }
}; };
// App parameters to pull phonebook
static const AppParameterTag sPhonebookTags[] = {
AppParameterTag::Format,
AppParameterTag::PropertySelector,
AppParameterTag::MaxListCount,
AppParameterTag::ListStartOffset,
AppParameterTag::vCardSelector
};
// App parameters to pull vCard listing
static const AppParameterTag sVCardListingTags[] = {
AppParameterTag::Order,
AppParameterTag::SearchValue,
AppParameterTag::SearchProperty,
AppParameterTag::MaxListCount,
AppParameterTag::ListStartOffset,
AppParameterTag::vCardSelector
};
// App parameters to pull vCard entry
static const AppParameterTag sVCardEntryTags[] = {
AppParameterTag::Format,
AppParameterTag::PropertySelector
};
StaticRefPtr<BluetoothPbapManager> sPbapManager; StaticRefPtr<BluetoothPbapManager> sPbapManager;
static bool sInShutdown = false; static bool sInShutdown = false;
} }
@ -261,7 +285,7 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
return; return;
} }
uint8_t response = SetPhoneBookPath(data[3], pktHeaders); ObexResponseCode response = SetPhoneBookPath(pktHeaders, data[3]);
if (response != ObexResponseCode::Success) { if (response != ObexResponseCode::Success) {
ReplyError(response); ReplyError(response);
return; return;
@ -271,18 +295,22 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
break; break;
} }
case ObexRequestCode::Get: case ObexRequestCode::Get:
// Section 6.2.2 "OBEX Headers in Multi-Packet Responses", IrOBEX 1.2 /*
// All OBEX request messages shall be sent as one OBEX packet containing * Section 6.2.2 "OBEX Headers in Multi-Packet Responses", IrOBEX 1.2
// all of the headers. I.e. OBEX GET with opcode 0x83 shall always be * All OBEX request messages shall be sent as one OBEX packet containing
// used. OBEX GET with opcode 0x03 shall never be used. * all the headers, i.e., OBEX GET with opcode 0x83 shall always be
* used, and GET with opcode 0x03 shall never be used.
*/
BT_LOGR("PBAP shall always use OBEX GetFinal instead of Get."); BT_LOGR("PBAP shall always use OBEX GetFinal instead of Get.");
// no break. Treat 'Get' as 'GetFinal' for error tolerance. // no break. Treat 'Get' as 'GetFinal' for error tolerance.
case ObexRequestCode::GetFinal: { case ObexRequestCode::GetFinal: {
// When |mVCardDataStream| requires multiple response packets to complete, /*
// the client should continue to issue GET requests until the final body * When |mVCardDataStream| requires multiple response packets to complete,
// information (i.e., End-of-Body header) arrives, along with * the client should continue to issue GET requests until the final body
// ObexResponseCode::Success * information (i.e., End-of-Body header) arrives, along with
* ObexResponseCode::Success
*/
if (mVCardDataStream) { if (mVCardDataStream) {
if (!ReplyToGet()) { if (!ReplyToGet()) {
BT_LOGR("Failed to reply to PBAP GET request."); BT_LOGR("Failed to reply to PBAP GET request.");
@ -300,33 +328,18 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
return; return;
} }
nsString type; ObexResponseCode response = NotifyPbapRequest(pktHeaders);
pktHeaders.GetContentType(type);
uint8_t response;
if (type.EqualsLiteral("x-bt/vcard-listing")) {
response = PullvCardListing(pktHeaders);
} else if (type.EqualsLiteral("x-bt/vcard")) {
response = PullvCardEntry(pktHeaders);
} else if (type.EqualsLiteral("x-bt/phonebook")) {
response = PullPhonebook(pktHeaders);
} else {
response = ObexResponseCode::BadRequest;
BT_LOGR("Unknown PBAP request type: %s",
NS_ConvertUTF16toUTF8(type).get());
}
// The OBEX success response will be sent after Gaia replies the PBAP
// request.
if (response != ObexResponseCode::Success) { if (response != ObexResponseCode::Success) {
ReplyError(response); ReplyError(response);
return; return;
} }
// OBEX success response will be sent after gaia replies PBAP request
break; break;
} }
case ObexRequestCode::Put: case ObexRequestCode::Put:
case ObexRequestCode::PutFinal: case ObexRequestCode::PutFinal:
ReplyError(ObexResponseCode::BadRequest); ReplyError(ObexResponseCode::BadRequest);
BT_LOGR("Unsupported ObexRequestCode %x", opCode);
break; break;
default: default:
ReplyError(ObexResponseCode::NotImplemented); ReplyError(ObexResponseCode::NotImplemented);
@ -363,9 +376,9 @@ BluetoothPbapManager::CompareHeaderTarget(const ObexHeaderSet& aHeader)
return true; return true;
} }
uint8_t ObexResponseCode
BluetoothPbapManager::SetPhoneBookPath(uint8_t flags, BluetoothPbapManager::SetPhoneBookPath(const ObexHeaderSet& aHeader,
const ObexHeaderSet& aHeader) uint8_t flags)
{ {
// Section 5.2 "SetPhoneBook Function", PBAP 1.2 // Section 5.2 "SetPhoneBook Function", PBAP 1.2
// flags bit 1 must be 1 and bit 2~7 be 0 // flags bit 1 must be 1 and bit 2~7 be 0
@ -424,103 +437,66 @@ BluetoothPbapManager::SetPhoneBookPath(uint8_t flags,
return ObexResponseCode::Success; return ObexResponseCode::Success;
} }
uint8_t ObexResponseCode
BluetoothPbapManager::PullPhonebook(const ObexHeaderSet& aHeader) BluetoothPbapManager::NotifyPbapRequest(const ObexHeaderSet& aHeader)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get(); // Get content type and name
if (!bs) { nsString type, name;
return ObexResponseCode::PreconditionFailed; aHeader.GetContentType(type);
}
InfallibleTArray<BluetoothNamedValue> data;
nsString name;
aHeader.GetName(name); aHeader.GetName(name);
// Ensure the name of phonebook object is legal // Configure request based on content type
if (!IsLegalPhonebookName(name)) { nsString reqId;
BT_LOGR("Illegal phone book object name [%s]", uint8_t tagCount;
NS_ConvertUTF16toUTF8(name).get()); const AppParameterTag* tags;
return ObexResponseCode::NotFound; if (type.EqualsLiteral("x-bt/phonebook")) {
reqId.AssignLiteral(PULL_PHONEBOOK_REQ_ID);
tagCount = MOZ_ARRAY_LENGTH(sPhonebookTags);
tags = sPhonebookTags;
// Ensure the name of phonebook object is legal
if (!IsLegalPhonebookName(name)) {
BT_LOGR("Illegal phone book object name [%s]",
NS_ConvertUTF16toUTF8(name).get());
return ObexResponseCode::NotFound;
}
} else if (type.EqualsLiteral("x-bt/vcard-listing")) {
reqId.AssignLiteral(PULL_VCARD_LISTING_REQ_ID);
tagCount = MOZ_ARRAY_LENGTH(sVCardListingTags);
tags = sVCardListingTags;
// Section 5.3.3 "Name", PBAP 1.2:
// ... PullvCardListing function uses relative paths. An empty name header
// may be sent to retrieve the vCard Listing object of the current folder.
name = name.IsEmpty() ? mCurrentPath
: mCurrentPath + NS_LITERAL_STRING("/") + name;
} else if (type.EqualsLiteral("x-bt/vcard")) {
reqId.AssignLiteral(PULL_VCARD_ENTRY_REQ_ID);
tagCount = MOZ_ARRAY_LENGTH(sVCardEntryTags);
tags = sVCardEntryTags;
} else {
BT_LOGR("Unknown PBAP request type: %s",
NS_ConvertUTF16toUTF8(type).get());
return ObexResponseCode::BadRequest;
} }
AppendNamedValue(data, "name", name); // Ensure bluetooth service is available
AppendNamedValueByTagId(aHeader, data, AppParameterTag::Format);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::PropertySelector);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::MaxListCount);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::ListStartOffset);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::vCardSelector);
bs->DistributeSignal(NS_LITERAL_STRING(PULL_PHONEBOOK_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
return ObexResponseCode::Success;
}
uint8_t
BluetoothPbapManager::PullvCardListing(const ObexHeaderSet& aHeader)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get(); BluetoothService* bs = BluetoothService::Get();
if (!bs) { if (!bs) {
BT_LOGR("Failed to get Bluetooth service");
return ObexResponseCode::PreconditionFailed; return ObexResponseCode::PreconditionFailed;
} }
// Pack PBAP request
InfallibleTArray<BluetoothNamedValue> data; InfallibleTArray<BluetoothNamedValue> data;
nsString folderName;
aHeader.GetName(folderName);
// Section 5.3.3 "Name", PBAP 1.2
// ... PullvCardListing function uses relative paths. An empty name header may
// be sent to retrieve the vCard Listing object of the current folder.
nsString folderPath = mCurrentPath;
if (!folderName.IsEmpty()) {
folderPath += NS_LITERAL_STRING("/") + folderName;
}
AppendNamedValue(data, "name", folderPath);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::Order);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::SearchValue);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::SearchProperty);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::MaxListCount);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::ListStartOffset);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::vCardSelector);
bs->DistributeSignal(NS_LITERAL_STRING(PULL_VCARD_LISTING_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
return ObexResponseCode::Success;
}
uint8_t
BluetoothPbapManager::PullvCardEntry(const ObexHeaderSet& aHeader)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
return ObexResponseCode::PreconditionFailed;
}
InfallibleTArray<BluetoothNamedValue> data;
nsString name;
aHeader.GetName(name);
AppendNamedValue(data, "name", name); AppendNamedValue(data, "name", name);
for (uint8_t i = 0; i < tagCount; i++) {
AppendNamedValueByTagId(aHeader, data, tags[i]);
}
AppendNamedValueByTagId(aHeader, data, AppParameterTag::Format); bs->DistributeSignal(reqId, NS_LITERAL_STRING(KEY_ADAPTER), data);
AppendNamedValueByTagId(aHeader, data, AppParameterTag::PropertySelector);
bs->DistributeSignal(NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
return ObexResponseCode::Success; return ObexResponseCode::Success;
} }
@ -553,64 +529,41 @@ BluetoothPbapManager::AppendNamedValueByTagId(
AppendNamedValue(aValues, "searchKey", searchKey); AppendNamedValue(aValues, "searchKey", searchKey);
break; break;
} }
case AppParameterTag::SearchValue: { case AppParameterTag::SearchValue:
// Section 5.3.4.3 "SearchValue {<text string>}", PBAP 1.2 // Section 5.3.4.3 "SearchValue {<text string>}", PBAP 1.2
// The UTF-8 character set shall be used for <text string>. // The UTF-8 character set shall be used for <text string>.
// Use nsCString to store UTF-8 string here to follow the suggestion of // Store UTF-8 string with nsCString to follow MDN:Internal_strings
// 'MDN:Internal_strings'. AppendNamedValue(aValues, "searchText", nsCString((char *) buf));
nsCString text((char *) buf);
AppendNamedValue(aValues, "searchText", text);
break; break;
}
case AppParameterTag::MaxListCount: { case AppParameterTag::MaxListCount: {
uint16_t maxListCount = *((uint16_t *)buf); uint16_t maxListCount = ReadLittleEndianUInt16(buf);
// convert big endian to little endian
maxListCount = (maxListCount >> 8) | (maxListCount << 8);
// Section 5 "Phone Book Access Profile Functions", PBAP 1.2
// Replying 'PhonebookSize' is mandatory if 'MaxListCount' parameter is
// present in the request with a value of 0, else it is excluded.
mPhonebookSizeRequired = !maxListCount;
AppendNamedValue(aValues, "maxListCount", AppendNamedValue(aValues, "maxListCount",
static_cast<uint32_t>(maxListCount)); static_cast<uint32_t>(maxListCount));
// Section 5 "Phone Book Access Profile Functions", PBAP 1.2
// Replying 'PhonebookSize' is mandatory if 'MaxListCount' parameter
// is present in the request with a value of 0, else it is excluded.
mPhonebookSizeRequired = !maxListCount;
break; break;
} }
case AppParameterTag::ListStartOffset: { case AppParameterTag::ListStartOffset:
uint16_t listStartOffset = *((uint16_t *)buf);
// convert big endian to little endian
listStartOffset = (listStartOffset >> 8) | (listStartOffset << 8);
AppendNamedValue(aValues, "listStartOffset", AppendNamedValue(aValues, "listStartOffset",
static_cast<uint32_t>(listStartOffset)); static_cast<uint32_t>(ReadLittleEndianUInt16(buf)));
break; break;
} case AppParameterTag::PropertySelector:
case AppParameterTag::PropertySelector: { AppendNamedValue(aValues, "propSelector", PackPropertiesMask(buf, 64));
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64);
AppendNamedValue(aValues, "propSelector", props);
break; break;
} case AppParameterTag::Format:
case AppParameterTag::Format: { AppendNamedValue(aValues, "format", static_cast<bool>(buf[0]));
bool usevCard3 = buf[0];
AppendNamedValue(aValues, "format", usevCard3);
break; break;
}
case AppParameterTag::vCardSelector: { case AppParameterTag::vCardSelector: {
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64); bool hasSelectorOperator = aHeader.GetAppParameter(
bool hasVCardSelectorOperator = aHeader.GetAppParameter(
AppParameterTag::vCardSelectorOperator, buf, 64); AppParameterTag::vCardSelectorOperator, buf, 64);
AppendNamedValue(aValues,
if (hasVCardSelectorOperator && buf[0]) { hasSelectorOperator && buf[0] ? "vCardSelector_AND"
AppendNamedValue(aValues, "vCardSelector_AND", BluetoothValue(props)); : "vCardSelector_OR",
} else { PackPropertiesMask(buf, 64));
AppendNamedValue(aValues, "vCardSelector_OR", BluetoothValue(props));
}
break; break;
} }
default: default:
@ -906,10 +859,7 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
if (mPhonebookSizeRequired) { if (mPhonebookSizeRequired) {
// ---- Part 2: [headerId:1][length:2][PhonebookSize:4] ---- // // ---- Part 2: [headerId:1][length:2][PhonebookSize:4] ---- //
// convert little endian to big endian uint16_t pbSizeBigEndian = ConvertEndiannessUInt16(aPhonebookSize);
uint8_t phonebookSize[2];
phonebookSize[0] = (aPhonebookSize & 0xFF00) >> 8;
phonebookSize[1] = aPhonebookSize & 0x00FF;
// Section 6.2.1 "Application Parameters Header", PBAP 1.2 // Section 6.2.1 "Application Parameters Header", PBAP 1.2
// appParameters: [headerId:1][length:2][PhonebookSize:4], where // appParameters: [headerId:1][length:2][PhonebookSize:4], where
@ -917,9 +867,9 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
uint8_t appParameters[4]; uint8_t appParameters[4];
AppendAppParameter(appParameters, AppendAppParameter(appParameters,
sizeof(appParameters), sizeof(appParameters),
(uint8_t) AppParameterTag::PhonebookSize, static_cast<uint8_t>(AppParameterTag::PhonebookSize),
phonebookSize, (uint8_t*) &pbSizeBigEndian,
sizeof(phonebookSize)); sizeof(pbSizeBigEndian));
index += AppendHeaderAppParameters(&res[index], index += AppendHeaderAppParameters(&res[index],
mRemoteMaxPacketLength, mRemoteMaxPacketLength,

Просмотреть файл

@ -12,9 +12,9 @@
#include "BluetoothSocketObserver.h" #include "BluetoothSocketObserver.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h" #include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/ipc/SocketBase.h" #include "mozilla/ipc/SocketBase.h"
#include "ObexBase.h"
class nsIInputStream; class nsIInputStream;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class Blob; class Blob;
@ -141,20 +141,18 @@ private:
void ReplyToConnect(); void ReplyToConnect();
void ReplyToDisconnectOrAbort(); void ReplyToDisconnectOrAbort();
void ReplyToSetPath(); void ReplyToSetPath();
bool ReplyToGet(uint16_t aPhonebookSize = 0);
void ReplyError(uint8_t aError); void ReplyError(uint8_t aError);
void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize); void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize);
bool ReplyToGet(uint16_t aPhonebookSize = 0);
uint8_t SetPhoneBookPath(uint8_t flags, const ObexHeaderSet& aHeader); ObexResponseCode SetPhoneBookPath(const ObexHeaderSet& aHeader,
uint8_t PullPhonebook(const ObexHeaderSet& aHeader); uint8_t flags);
uint8_t PullvCardListing(const ObexHeaderSet& aHeader); ObexResponseCode NotifyPbapRequest(const ObexHeaderSet& aHeader);
uint8_t PullvCardEntry(const ObexHeaderSet& aHeader); void AppendNamedValueByTagId(const ObexHeaderSet& aHeader,
void AppendNamedValueByTagId( InfallibleTArray<BluetoothNamedValue>& aValues,
const ObexHeaderSet& aHeader, const AppParameterTag aTagId);
InfallibleTArray<BluetoothNamedValue>& aValues,
const AppParameterTag aTagId);
InfallibleTArray<uint32_t> PackPropertiesMask(uint8_t* aData, int aSize); InfallibleTArray<uint32_t> PackPropertiesMask(uint8_t* aData, int aSize);
bool CompareHeaderTarget(const ObexHeaderSet& aHeader); bool CompareHeaderTarget(const ObexHeaderSet& aHeader);
bool IsLegalPath(const nsAString& aPath); bool IsLegalPath(const nsAString& aPath);
bool IsLegalPhonebookName(const nsAString& aName); bool IsLegalPhonebookName(const nsAString& aName);

Просмотреть файл

@ -604,4 +604,16 @@ InsertNamedValue(InfallibleTArray<BluetoothNamedValue>& aArray,
aArray.InsertElementAt(aIndex, BluetoothNamedValue(name, aValue)); aArray.InsertElementAt(aIndex, BluetoothNamedValue(name, aValue));
} }
uint16_t
ConvertEndiannessUInt16(uint16_t aValue)
{
return (aValue >> 8) | (aValue << 8);
}
uint16_t
ReadLittleEndianUInt16(const uint8_t* aBuf)
{
return ConvertEndiannessUInt16(*((uint16_t *) aBuf));
}
END_BLUETOOTH_NAMESPACE END_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -272,6 +272,20 @@ void InsertNamedValue(InfallibleTArray<BluetoothNamedValue>& aArray,
uint8_t aIndex, const char* aName, uint8_t aIndex, const char* aName,
const BluetoothValue& aValue); const BluetoothValue& aValue);
//
// Big/Little endianness conversion
//
/**
* Convert a big/little endian uint16_t value to little/big endian one.
*/
uint16_t ConvertEndiannessUInt16(uint16_t aValue);
/**
* Read an uint16_t from array and convert it to little endian one.
*/
uint16_t ReadLittleEndianUInt16(const uint8_t* aBuf);
END_BLUETOOTH_NAMESPACE END_BLUETOOTH_NAMESPACE
#endif // mozilla_dom_bluetooth_BluetoothUtils_h #endif // mozilla_dom_bluetooth_BluetoothUtils_h

Просмотреть файл

@ -299,6 +299,43 @@ PreallocatedProcessManagerImpl::GetSpareProcess()
return process.forget(); return process.forget();
} }
static bool
TestCaseEnabled()
{
return Preferences::GetBool("dom.ipc.preallocatedProcessManager.testMode");
}
static void
SendTestOnlyNotification(const char* aMessage)
{
if (!TestCaseEnabled()) {
return;
}
AutoSafeJSContext cx;
nsString message;
message.AppendPrintf("%s", aMessage);
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
mozilla::unused << ppmm->BroadcastAsyncMessage(
message, JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
static void
KillOrCloseProcess(ContentParent* aProcess)
{
if (TestCaseEnabled()) {
// KillHard() the process because we don't want the process to abort when we
// close the IPC channel while it's still running and creating actors.
aProcess->KillHard("Killed by test case.");
}
else {
aProcess->Close();
}
}
/** /**
* Publish a ContentParent to spare process list. * Publish a ContentParent to spare process list.
*/ */
@ -307,14 +344,7 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (Preferences::GetBool("dom.ipc.preallocatedProcessManager.testMode")) { SendTestOnlyNotification("TEST-ONLY:nuwa-add-new-process");
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
mozilla::unused << ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
mSpareProcesses.AppendElement(aContent); mSpareProcesses.AppendElement(aContent);
} }
@ -333,7 +363,7 @@ PreallocatedProcessManagerImpl::MaybeForgetSpare(ContentParent* aContent)
mIsNuwaReady = false; mIsNuwaReady = false;
while (mSpareProcesses.Length() > 0) { while (mSpareProcesses.Length() > 0) {
nsRefPtr<ContentParent> process = mSpareProcesses[mSpareProcesses.Length() - 1]; nsRefPtr<ContentParent> process = mSpareProcesses[mSpareProcesses.Length() - 1];
process->Close(); KillOrCloseProcess(aContent);
mSpareProcesses.RemoveElementAt(mSpareProcesses.Length() - 1); mSpareProcesses.RemoveElementAt(mSpareProcesses.Length() - 1);
} }
ScheduleDelayedNuwaFork(); ScheduleDelayedNuwaFork();
@ -353,14 +383,8 @@ PreallocatedProcessManagerImpl::OnNuwaReady()
ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess, ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess,
hal::PROCESS_PRIORITY_MASTER); hal::PROCESS_PRIORITY_MASTER);
mIsNuwaReady = true; mIsNuwaReady = true;
if (Preferences::GetBool("dom.ipc.preallocatedProcessManager.testMode")) { SendTestOnlyNotification("TEST-ONLY:nuwa-ready");
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
mozilla::unused << ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"),
JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
NuwaFork(); NuwaFork();
} }
@ -370,7 +394,6 @@ PreallocatedProcessManagerImpl::PreallocatedProcessReady()
return !mSpareProcesses.IsEmpty(); return !mSpareProcesses.IsEmpty();
} }
void void
PreallocatedProcessManagerImpl::NuwaFork() PreallocatedProcessManagerImpl::NuwaFork()
{ {
@ -399,7 +422,7 @@ PreallocatedProcessManagerImpl::Disable()
#ifdef MOZ_NUWA_PROCESS #ifdef MOZ_NUWA_PROCESS
while (mSpareProcesses.Length() > 0){ while (mSpareProcesses.Length() > 0){
nsRefPtr<ContentParent> process = mSpareProcesses[0]; nsRefPtr<ContentParent> process = mSpareProcesses[0];
process->Close(); KillOrCloseProcess(process);
mSpareProcesses.RemoveElementAt(0); mSpareProcesses.RemoveElementAt(0);
} }
mIsNuwaReady = false; mIsNuwaReady = false;

Просмотреть файл

@ -14,7 +14,7 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s || toolkit == 'androi
[test_cpow_cookies.html] [test_cpow_cookies.html]
skip-if = buildapp == 'b2g' || buildapp == 'mulet' skip-if = buildapp == 'b2g' || buildapp == 'mulet'
[test_NuwaProcessCreation.html] [test_NuwaProcessCreation.html]
skip-if = true # bug 1166923 skip-if = toolkit != 'gonk'
[test_NuwaProcessDeadlock.html] [test_NuwaProcessDeadlock.html]
skip-if = true # bug 1166923 skip-if = true # bug 1166923
[test_child_docshell.html] [test_child_docshell.html]

Просмотреть файл

@ -14,6 +14,9 @@ Test if Nuwa process created successfully.
function runTest() function runTest()
{ {
info("Shut down processes by disabling process prelaunch");
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', false);
info("Launch the Nuwa process"); info("Launch the Nuwa process");
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"] let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(SpecialPowers.Ci.nsISyncMessageSender); .getService(SpecialPowers.Ci.nsISyncMessageSender);
@ -22,12 +25,11 @@ function runTest()
receiveMessage: function receiveMessage(msg) { receiveMessage: function receiveMessage(msg) {
msg = SpecialPowers.wrap(msg); msg = SpecialPowers.wrap(msg);
if (msg.name == 'TEST-ONLY:nuwa-ready') { if (msg.name == 'TEST-ONLY:nuwa-ready') {
ok(true, "Got nuwa-ready"); is(seenNuwaReady, false, "The Nuwa process is launched");
is(seenNuwaReady, false, "Already received nuwa ready");
seenNuwaReady = true; seenNuwaReady = true;
} else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') { } else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') {
ok(true, "Got nuwa-add-new-process"); ok(true, "Got nuwa-add-new-process");
is(seenNuwaReady, true, "Receive nuwa-add-new-process before nuwa-ready"); is(seenNuwaReady, true, "The preallocated process is launched from the Nuwa process");
shutdown(); shutdown();
} }
} }
@ -56,7 +58,6 @@ function setup()
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
'set': [ 'set': [
['dom.ipc.processPrelaunch.enabled', false],
['dom.ipc.preallocatedProcessManager.testMode', true] ['dom.ipc.preallocatedProcessManager.testMode', true]
] ]
}, runTest); }, runTest);

Просмотреть файл

@ -98,7 +98,14 @@ MobileMessageDatabaseService::MarkMessageRead(int32_t aMessageId,
bool aSendReadReport, bool aSendReadReport,
nsIMobileMessageCallback* aRequest) nsIMobileMessageCallback* aRequest)
{ {
// TODO: This would need to be implemented as part of Bug 748391 if (!AndroidBridge::Bridge()) {
return NS_OK;
}
AndroidBridge::Bridge()->MarkMessageRead(aMessageId,
aValue,
aSendReadReport,
aRequest);
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -393,5 +393,36 @@ SmsManager::NotifyCursorDone(int32_t aRequestId)
NS_DispatchToMainThread(runnable); NS_DispatchToMainThread(runnable);
} }
} // namespace /*static*/
void
SmsManager::NotifySmsMarkedAsRead(bool aMarkedAsRead, int32_t aRequestId)
{
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=]() {
nsCOMPtr<nsIMobileMessageCallback> request =
AndroidBridge::Bridge()->DequeueSmsRequest(aRequestId);
if (!request) {
return;
}
request->NotifyMessageMarkedRead(aMarkedAsRead);
});
NS_DispatchToMainThread(runnable);
}
/*static*/
void
SmsManager::NotifySmsMarkAsReadFailed(int32_t aError, int32_t aRequestId)
{
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=]() {
nsCOMPtr<nsIMobileMessageCallback> request =
AndroidBridge::Bridge()->DequeueSmsRequest(aRequestId);
if (!request) {
return;
}
request->NotifyMarkMessageReadFailed(aError);
});
NS_DispatchToMainThread(runnable);
}
} // namespace

Просмотреть файл

@ -66,6 +66,8 @@ public:
bool aRead, bool aRead,
int32_t aRequestId); int32_t aRequestId);
static void NotifyCursorDone(int32_t aRequestId); static void NotifyCursorDone(int32_t aRequestId);
static void NotifySmsMarkedAsRead(bool aMarkedAsRead, int32_t aRequestId);
static void NotifySmsMarkAsReadFailed(int32_t aError, int32_t aRequestId);
}; };
} // namespace } // namespace

Просмотреть файл

@ -2361,6 +2361,15 @@ public class GeckoAppShell
SmsManager.getInstance().deleteMessage(aMessageId, aRequestId); SmsManager.getInstance().deleteMessage(aMessageId, aRequestId);
} }
@WrapForJNI
public static void markMessageRead(int aMessageId, boolean aValue, boolean aSendReadReport, int aRequestId) {
if (!SmsManager.isEnabled()) {
return;
}
SmsManager.getInstance().markMessageRead(aMessageId, aValue, aSendReadReport, aRequestId);
}
@WrapForJNI(stubName = "CreateMessageCursorWrapper") @WrapForJNI(stubName = "CreateMessageCursorWrapper")
public static void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) { public static void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {

Просмотреть файл

@ -762,6 +762,48 @@ public class GeckoSmsManager
aRequestId); aRequestId);
} }
@Override
public void markMessageRead(int aMessageId, boolean aValue, boolean aSendReadReport, int aRequestId) {
class MarkMessageReadRunnable implements Runnable {
private final int mMessageId;
private final boolean mValue;
private final int mRequestId;
MarkMessageReadRunnable(int aMessageId, boolean aValue, int aRequestId) {
mMessageId = aMessageId;
mValue = aValue;
mRequestId = aRequestId;
}
@Override
public void run() {
try {
ContentResolver cr = GeckoAppShell.getContext().getContentResolver();
Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
ContentValues updatedProps = new ContentValues();
updatedProps.put("read", mValue);
int count = cr.update(message, updatedProps, null, null);
notifySmsMarkedAsRead(count == 1, mRequestId);
} catch (Exception e) {
Log.e("GeckoSmsManager", "Error while trying to mark message as read: " + e);
notifySmsMarkAsReadFailed(kUnknownError, mRequestId);
}
}
}
if (aSendReadReport == true) {
Log.w("GeckoSmsManager", "Android SmsManager doesn't suport read receipts for SMS.");
}
if (!SmsIOThread.getInstance().execute(new MarkMessageReadRunnable(aMessageId, aValue, aRequestId))) {
Log.e("GeckoSmsManager", "Failed to add MarkMessageReadRunnable to the SmsIOThread");
notifySmsMarkAsReadFailed(kUnknownError, aRequestId);
}
}
@Override @Override
public void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) { public void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) {
class CreateMessageCursorRunnable implements Runnable { class CreateMessageCursorRunnable implements Runnable {
@ -1101,6 +1143,10 @@ public class GeckoSmsManager
@WrapForJNI @WrapForJNI
private static native void notifySmsDeleteFailed(int aError, int aRequestId); private static native void notifySmsDeleteFailed(int aError, int aRequestId);
@WrapForJNI @WrapForJNI
private static native void notifySmsMarkedAsRead(boolean aMarkedAsRead, int aRequestId);
@WrapForJNI
private static native void notifySmsMarkAsReadFailed(int aError, int aRequestId);
@WrapForJNI
private static native void notifyCursorError(int aError, int aRequestId); private static native void notifyCursorError(int aError, int aRequestId);
@WrapForJNI @WrapForJNI
private static native void notifyThreadCursorResult(long aId, String aLastMessageSubject, String aBody, long aUnreadCount, Object[] aParticipants, long aTimestamp, String aLastMessageType, int aRequestId); private static native void notifyThreadCursorResult(long aId, String aLastMessageSubject, String aBody, long aUnreadCount, Object[] aParticipants, long aTimestamp, String aLastMessageType, int aRequestId);

Просмотреть файл

@ -31,6 +31,7 @@ public class SmsManager {
void send(String aNumber, String aMessage, int aRequestId); void send(String aNumber, String aMessage, int aRequestId);
void getMessage(int aMessageId, int aRequestId); void getMessage(int aMessageId, int aRequestId);
void deleteMessage(int aMessageId, int aRequestId); void deleteMessage(int aMessageId, int aRequestId);
void markMessageRead(int aMessageId, boolean aValue, boolean aSendReadReport, int aRequestId);
void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId); void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId);
void createThreadCursor(int aRequestId); void createThreadCursor(int aRequestId);
void getNextThread(int aRequestId); void getNextThread(int aRequestId);

Просмотреть файл

@ -20,7 +20,7 @@ task:
--test-suite crashtest --test-suite crashtest
--installer-url {{build_url}} --installer-url {{build_url}}
--test-packages-url {{test_packages_url}} --test-packages-url {{test_packages_url}}
--xre-url https://queue.taskcluster.net/v1/task/wXAHAaxDQpqxoWF1iljJjg/runs/0/artifacts/public/cache/xulrunner-sdk-40.zip --xre-url https://queue.taskcluster.net/v1/task/YNNF94qRSyCXiSU_AQgFOQ/runs/0/artifacts/public/cache/xulrunner-sdk-40.zip
--this-chunk {{chunk}} --this-chunk {{chunk}}
--total-chunk {{total_chunks}} --total-chunk {{total_chunks}}
artifacts: artifacts:

Просмотреть файл

@ -19,7 +19,7 @@ task:
--test-suite reftest --test-suite reftest
--installer-url {{build_url}} --installer-url {{build_url}}
--test-packages-url {{test_packages_url}} --test-packages-url {{test_packages_url}}
--xre-url https://queue.taskcluster.net/v1/task/wXAHAaxDQpqxoWF1iljJjg/runs/0/artifacts/public/cache/xulrunner-sdk-40.zip --xre-url https://queue.taskcluster.net/v1/task/YNNF94qRSyCXiSU_AQgFOQ/runs/0/artifacts/public/cache/xulrunner-sdk-40.zip
--this-chunk {{chunk}} --this-chunk {{chunk}}
--total-chunk {{total_chunks}} --total-chunk {{total_chunks}}
artifacts: artifacts:

Просмотреть файл

@ -1101,6 +1101,25 @@ AndroidBridge::DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequ
GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId); GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId);
} }
void
AndroidBridge::MarkMessageRead(int32_t aMessageId,
bool aValue,
bool aSendReadReport,
nsIMobileMessageCallback* aRequest)
{
ALOG_BRIDGE("AndroidBridge::MarkMessageRead");
uint32_t requestId;
if (!QueueSmsRequest(aRequest, &requestId)) {
return;
}
GeckoAppShell::MarkMessageRead(aMessageId,
aValue,
aSendReadReport,
requestId);
}
NS_IMPL_ISUPPORTS0(MessageCursorContinueCallback) NS_IMPL_ISUPPORTS0(MessageCursorContinueCallback)
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -270,6 +270,10 @@ public:
nsIMobileMessageCallback* aRequest); nsIMobileMessageCallback* aRequest);
void GetMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest); void GetMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest);
void DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest); void DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest);
void MarkMessageRead(int32_t aMessageId,
bool aValue,
bool aSendReadReport,
nsIMobileMessageCallback* aRequest);
already_AddRefed<nsICursorContinueCallback> already_AddRefed<nsICursorContinueCallback>
CreateMessageCursor(bool aHasStartDate, CreateMessageCursor(bool aHasStartDate,
uint64_t aStartDate, uint64_t aStartDate,

Просмотреть файл

@ -104,6 +104,14 @@ public:
mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsDelivery_t, Impl> mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsDelivery_t, Impl>
::template Wrap<&Impl::NotifySmsDelivery>), ::template Wrap<&Impl::NotifySmsDelivery>),
mozilla::jni::MakeNativeMethod<GeckoSmsManager::NotifySmsMarkAsReadFailed_t>(
mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsMarkAsReadFailed_t, Impl>
::template Wrap<&Impl::NotifySmsMarkAsReadFailed>),
mozilla::jni::MakeNativeMethod<GeckoSmsManager::NotifySmsMarkedAsRead_t>(
mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsMarkedAsRead_t, Impl>
::template Wrap<&Impl::NotifySmsMarkedAsRead>),
mozilla::jni::MakeNativeMethod<GeckoSmsManager::NotifySmsReceived_t>( mozilla::jni::MakeNativeMethod<GeckoSmsManager::NotifySmsReceived_t>(
mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsReceived_t, Impl> mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsReceived_t, Impl>
::template Wrap<&Impl::NotifySmsReceived>), ::template Wrap<&Impl::NotifySmsReceived>),

Просмотреть файл

@ -518,6 +518,14 @@ auto GeckoAppShell::LockScreenOrientation(int32_t a0) -> void
return mozilla::jni::Method<LockScreenOrientation_t>::Call(nullptr, nullptr, a0); return mozilla::jni::Method<LockScreenOrientation_t>::Call(nullptr, nullptr, a0);
} }
constexpr char GeckoAppShell::MarkMessageRead_t::name[];
constexpr char GeckoAppShell::MarkMessageRead_t::signature[];
auto GeckoAppShell::MarkMessageRead(int32_t a0, bool a1, bool a2, int32_t a3) -> void
{
return mozilla::jni::Method<MarkMessageRead_t>::Call(nullptr, nullptr, a0, a1, a2, a3);
}
constexpr char GeckoAppShell::MarkURIVisited_t::name[]; constexpr char GeckoAppShell::MarkURIVisited_t::name[];
constexpr char GeckoAppShell::MarkURIVisited_t::signature[]; constexpr char GeckoAppShell::MarkURIVisited_t::signature[];
@ -857,6 +865,12 @@ constexpr char GeckoSmsManager::NotifySmsDeleted_t::signature[];
constexpr char GeckoSmsManager::NotifySmsDelivery_t::name[]; constexpr char GeckoSmsManager::NotifySmsDelivery_t::name[];
constexpr char GeckoSmsManager::NotifySmsDelivery_t::signature[]; constexpr char GeckoSmsManager::NotifySmsDelivery_t::signature[];
constexpr char GeckoSmsManager::NotifySmsMarkAsReadFailed_t::name[];
constexpr char GeckoSmsManager::NotifySmsMarkAsReadFailed_t::signature[];
constexpr char GeckoSmsManager::NotifySmsMarkedAsRead_t::name[];
constexpr char GeckoSmsManager::NotifySmsMarkedAsRead_t::signature[];
constexpr char GeckoSmsManager::NotifySmsReceived_t::name[]; constexpr char GeckoSmsManager::NotifySmsReceived_t::name[];
constexpr char GeckoSmsManager::NotifySmsReceived_t::signature[]; constexpr char GeckoSmsManager::NotifySmsReceived_t::signature[];

Просмотреть файл

@ -1243,6 +1243,27 @@ public:
static auto LockScreenOrientation(int32_t) -> void; static auto LockScreenOrientation(int32_t) -> void;
public:
struct MarkMessageRead_t {
typedef GeckoAppShell Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
int32_t,
bool,
bool,
int32_t> Args;
static constexpr char name[] = "markMessageRead";
static constexpr char signature[] =
"(IZZI)V";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
static auto MarkMessageRead(int32_t, bool, bool, int32_t) -> void;
public: public:
struct MarkURIVisited_t { struct MarkURIVisited_t {
typedef GeckoAppShell Owner; typedef GeckoAppShell Owner;
@ -2181,6 +2202,40 @@ public:
mozilla::jni::ExceptionMode::ABORT; mozilla::jni::ExceptionMode::ABORT;
}; };
public:
struct NotifySmsMarkAsReadFailed_t {
typedef GeckoSmsManager Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
int32_t,
int32_t> Args;
static constexpr char name[] = "notifySmsMarkAsReadFailed";
static constexpr char signature[] =
"(II)V";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
public:
struct NotifySmsMarkedAsRead_t {
typedef GeckoSmsManager Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
bool,
int32_t> Args;
static constexpr char name[] = "notifySmsMarkedAsRead";
static constexpr char signature[] =
"(ZI)V";
static const bool isStatic = true;
static const bool isMultithreaded = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
public: public:
struct NotifySmsReceived_t { struct NotifySmsReceived_t {
typedef GeckoSmsManager Owner; typedef GeckoSmsManager Owner;