зеркало из https://github.com/mozilla/gecko-dev.git
merge b2g-inbound to mozilla-central a=merge
This commit is contained in:
Коммит
5aeac175cc
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<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">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<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 name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/>
|
||||
<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="vendor/sprd/gps" path="vendor/sprd/gps" revision="7d6e1269be7186b2073fa568958b357826692c4b"/>
|
||||
<project name="vendor/sprd/open-source" path="vendor/sprd/open-source" revision="295ff253b74353751a99aafd687196a28c84a58e"/>
|
||||
|
|
|
@ -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="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<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="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -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="0b934d06c04adff2cd9bdd0bc204f974a18b710f"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<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">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "0b934d06c04adff2cd9bdd0bc204f974a18b710f",
|
||||
"git_revision": "d400cda6bf0f8b30dcf7d7d71bfa61f29a3f1588",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "dee47434923493d57f151448eec00f793f113bfd",
|
||||
"revision": "d382a1ff9028efabb8bbc18812ff7de12759a29e",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<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="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<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="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="25554535ee69d4c0c24a51f6a55bbabe5cb0a6b8"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</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-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7938df689aa87769fad3f2cf9097fb4ecb106a43"/>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "BluetoothSocket.h"
|
||||
#include "BluetoothUtils.h"
|
||||
#include "BluetoothUuid.h"
|
||||
#include "ObexBase.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothPbapParametersBinding.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;
|
||||
static bool sInShutdown = false;
|
||||
}
|
||||
|
@ -261,7 +285,7 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
|||
return;
|
||||
}
|
||||
|
||||
uint8_t response = SetPhoneBookPath(data[3], pktHeaders);
|
||||
ObexResponseCode response = SetPhoneBookPath(pktHeaders, data[3]);
|
||||
if (response != ObexResponseCode::Success) {
|
||||
ReplyError(response);
|
||||
return;
|
||||
|
@ -271,18 +295,22 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
|||
break;
|
||||
}
|
||||
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
|
||||
// all of the headers. I.e. OBEX GET with opcode 0x83 shall always be
|
||||
// used. OBEX GET with opcode 0x03 shall never be used.
|
||||
/*
|
||||
* 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
|
||||
* 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.");
|
||||
|
||||
// no break. Treat 'Get' as 'GetFinal' for error tolerance.
|
||||
case ObexRequestCode::GetFinal: {
|
||||
// When |mVCardDataStream| requires multiple response packets to complete,
|
||||
// the client should continue to issue GET requests until the final body
|
||||
// information (i.e., End-of-Body header) arrives, along with
|
||||
// ObexResponseCode::Success
|
||||
/*
|
||||
* When |mVCardDataStream| requires multiple response packets to complete,
|
||||
* the client should continue to issue GET requests until the final body
|
||||
* information (i.e., End-of-Body header) arrives, along with
|
||||
* ObexResponseCode::Success
|
||||
*/
|
||||
if (mVCardDataStream) {
|
||||
if (!ReplyToGet()) {
|
||||
BT_LOGR("Failed to reply to PBAP GET request.");
|
||||
|
@ -300,33 +328,18 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
|||
return;
|
||||
}
|
||||
|
||||
nsString type;
|
||||
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.
|
||||
ObexResponseCode response = NotifyPbapRequest(pktHeaders);
|
||||
if (response != ObexResponseCode::Success) {
|
||||
ReplyError(response);
|
||||
return;
|
||||
}
|
||||
// OBEX success response will be sent after gaia replies PBAP request
|
||||
break;
|
||||
}
|
||||
case ObexRequestCode::Put:
|
||||
case ObexRequestCode::PutFinal:
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
BT_LOGR("Unsupported ObexRequestCode %x", opCode);
|
||||
break;
|
||||
default:
|
||||
ReplyError(ObexResponseCode::NotImplemented);
|
||||
|
@ -363,9 +376,9 @@ BluetoothPbapManager::CompareHeaderTarget(const ObexHeaderSet& aHeader)
|
|||
return true;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
BluetoothPbapManager::SetPhoneBookPath(uint8_t flags,
|
||||
const ObexHeaderSet& aHeader)
|
||||
ObexResponseCode
|
||||
BluetoothPbapManager::SetPhoneBookPath(const ObexHeaderSet& aHeader,
|
||||
uint8_t flags)
|
||||
{
|
||||
// Section 5.2 "SetPhoneBook Function", PBAP 1.2
|
||||
// flags bit 1 must be 1 and bit 2~7 be 0
|
||||
|
@ -424,103 +437,66 @@ BluetoothPbapManager::SetPhoneBookPath(uint8_t flags,
|
|||
return ObexResponseCode::Success;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
BluetoothPbapManager::PullPhonebook(const ObexHeaderSet& aHeader)
|
||||
ObexResponseCode
|
||||
BluetoothPbapManager::NotifyPbapRequest(const ObexHeaderSet& aHeader)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
return ObexResponseCode::PreconditionFailed;
|
||||
}
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> data;
|
||||
|
||||
nsString name;
|
||||
// Get content type and name
|
||||
nsString type, name;
|
||||
aHeader.GetContentType(type);
|
||||
aHeader.GetName(name);
|
||||
|
||||
// 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;
|
||||
// Configure request based on content type
|
||||
nsString reqId;
|
||||
uint8_t tagCount;
|
||||
const AppParameterTag* tags;
|
||||
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);
|
||||
|
||||
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());
|
||||
|
||||
// Ensure bluetooth service is available
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
BT_LOGR("Failed to get Bluetooth service");
|
||||
return ObexResponseCode::PreconditionFailed;
|
||||
}
|
||||
|
||||
// Pack PBAP request
|
||||
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);
|
||||
for (uint8_t i = 0; i < tagCount; i++) {
|
||||
AppendNamedValueByTagId(aHeader, data, tags[i]);
|
||||
}
|
||||
|
||||
AppendNamedValueByTagId(aHeader, data, AppParameterTag::Format);
|
||||
AppendNamedValueByTagId(aHeader, data, AppParameterTag::PropertySelector);
|
||||
|
||||
bs->DistributeSignal(NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER),
|
||||
data);
|
||||
bs->DistributeSignal(reqId, NS_LITERAL_STRING(KEY_ADAPTER), data);
|
||||
|
||||
return ObexResponseCode::Success;
|
||||
}
|
||||
|
@ -553,64 +529,41 @@ BluetoothPbapManager::AppendNamedValueByTagId(
|
|||
AppendNamedValue(aValues, "searchKey", searchKey);
|
||||
break;
|
||||
}
|
||||
case AppParameterTag::SearchValue: {
|
||||
case AppParameterTag::SearchValue:
|
||||
// Section 5.3.4.3 "SearchValue {<text string>}", PBAP 1.2
|
||||
// The UTF-8 character set shall be used for <text string>.
|
||||
|
||||
// Use nsCString to store UTF-8 string here to follow the suggestion of
|
||||
// 'MDN:Internal_strings'.
|
||||
nsCString text((char *) buf);
|
||||
|
||||
AppendNamedValue(aValues, "searchText", text);
|
||||
// Store UTF-8 string with nsCString to follow MDN:Internal_strings
|
||||
AppendNamedValue(aValues, "searchText", nsCString((char *) buf));
|
||||
break;
|
||||
}
|
||||
case AppParameterTag::MaxListCount: {
|
||||
uint16_t maxListCount = *((uint16_t *)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;
|
||||
|
||||
uint16_t maxListCount = ReadLittleEndianUInt16(buf);
|
||||
AppendNamedValue(aValues, "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;
|
||||
}
|
||||
case AppParameterTag::ListStartOffset: {
|
||||
uint16_t listStartOffset = *((uint16_t *)buf);
|
||||
|
||||
// convert big endian to little endian
|
||||
listStartOffset = (listStartOffset >> 8) | (listStartOffset << 8);
|
||||
|
||||
case AppParameterTag::ListStartOffset:
|
||||
AppendNamedValue(aValues, "listStartOffset",
|
||||
static_cast<uint32_t>(listStartOffset));
|
||||
static_cast<uint32_t>(ReadLittleEndianUInt16(buf)));
|
||||
break;
|
||||
}
|
||||
case AppParameterTag::PropertySelector: {
|
||||
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64);
|
||||
|
||||
AppendNamedValue(aValues, "propSelector", props);
|
||||
case AppParameterTag::PropertySelector:
|
||||
AppendNamedValue(aValues, "propSelector", PackPropertiesMask(buf, 64));
|
||||
break;
|
||||
}
|
||||
case AppParameterTag::Format: {
|
||||
bool usevCard3 = buf[0];
|
||||
AppendNamedValue(aValues, "format", usevCard3);
|
||||
case AppParameterTag::Format:
|
||||
AppendNamedValue(aValues, "format", static_cast<bool>(buf[0]));
|
||||
break;
|
||||
}
|
||||
case AppParameterTag::vCardSelector: {
|
||||
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64);
|
||||
|
||||
bool hasVCardSelectorOperator = aHeader.GetAppParameter(
|
||||
bool hasSelectorOperator = aHeader.GetAppParameter(
|
||||
AppParameterTag::vCardSelectorOperator, buf, 64);
|
||||
|
||||
if (hasVCardSelectorOperator && buf[0]) {
|
||||
AppendNamedValue(aValues, "vCardSelector_AND", BluetoothValue(props));
|
||||
} else {
|
||||
AppendNamedValue(aValues, "vCardSelector_OR", BluetoothValue(props));
|
||||
}
|
||||
AppendNamedValue(aValues,
|
||||
hasSelectorOperator && buf[0] ? "vCardSelector_AND"
|
||||
: "vCardSelector_OR",
|
||||
PackPropertiesMask(buf, 64));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -906,10 +859,7 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
|
|||
|
||||
if (mPhonebookSizeRequired) {
|
||||
// ---- Part 2: [headerId:1][length:2][PhonebookSize:4] ---- //
|
||||
// convert little endian to big endian
|
||||
uint8_t phonebookSize[2];
|
||||
phonebookSize[0] = (aPhonebookSize & 0xFF00) >> 8;
|
||||
phonebookSize[1] = aPhonebookSize & 0x00FF;
|
||||
uint16_t pbSizeBigEndian = ConvertEndiannessUInt16(aPhonebookSize);
|
||||
|
||||
// Section 6.2.1 "Application Parameters Header", PBAP 1.2
|
||||
// appParameters: [headerId:1][length:2][PhonebookSize:4], where
|
||||
|
@ -917,9 +867,9 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
|
|||
uint8_t appParameters[4];
|
||||
AppendAppParameter(appParameters,
|
||||
sizeof(appParameters),
|
||||
(uint8_t) AppParameterTag::PhonebookSize,
|
||||
phonebookSize,
|
||||
sizeof(phonebookSize));
|
||||
static_cast<uint8_t>(AppParameterTag::PhonebookSize),
|
||||
(uint8_t*) &pbSizeBigEndian,
|
||||
sizeof(pbSizeBigEndian));
|
||||
|
||||
index += AppendHeaderAppParameters(&res[index],
|
||||
mRemoteMaxPacketLength,
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include "BluetoothSocketObserver.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/ipc/SocketBase.h"
|
||||
#include "ObexBase.h"
|
||||
|
||||
class nsIInputStream;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Blob;
|
||||
|
@ -141,20 +141,18 @@ private:
|
|||
void ReplyToConnect();
|
||||
void ReplyToDisconnectOrAbort();
|
||||
void ReplyToSetPath();
|
||||
bool ReplyToGet(uint16_t aPhonebookSize = 0);
|
||||
void ReplyError(uint8_t aError);
|
||||
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);
|
||||
uint8_t PullPhonebook(const ObexHeaderSet& aHeader);
|
||||
uint8_t PullvCardListing(const ObexHeaderSet& aHeader);
|
||||
uint8_t PullvCardEntry(const ObexHeaderSet& aHeader);
|
||||
void AppendNamedValueByTagId(
|
||||
const ObexHeaderSet& aHeader,
|
||||
InfallibleTArray<BluetoothNamedValue>& aValues,
|
||||
const AppParameterTag aTagId);
|
||||
ObexResponseCode SetPhoneBookPath(const ObexHeaderSet& aHeader,
|
||||
uint8_t flags);
|
||||
ObexResponseCode NotifyPbapRequest(const ObexHeaderSet& aHeader);
|
||||
void AppendNamedValueByTagId(const ObexHeaderSet& aHeader,
|
||||
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 IsLegalPath(const nsAString& aPath);
|
||||
bool IsLegalPhonebookName(const nsAString& aName);
|
||||
|
|
|
@ -604,4 +604,16 @@ InsertNamedValue(InfallibleTArray<BluetoothNamedValue>& aArray,
|
|||
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
|
||||
|
|
|
@ -272,6 +272,20 @@ void InsertNamedValue(InfallibleTArray<BluetoothNamedValue>& aArray,
|
|||
uint8_t aIndex, const char* aName,
|
||||
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
|
||||
|
||||
#endif // mozilla_dom_bluetooth_BluetoothUtils_h
|
||||
|
|
|
@ -299,6 +299,43 @@ PreallocatedProcessManagerImpl::GetSpareProcess()
|
|||
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.
|
||||
*/
|
||||
|
@ -307,14 +344,7 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (Preferences::GetBool("dom.ipc.preallocatedProcessManager.testMode")) {
|
||||
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);
|
||||
}
|
||||
SendTestOnlyNotification("TEST-ONLY:nuwa-add-new-process");
|
||||
|
||||
mSpareProcesses.AppendElement(aContent);
|
||||
}
|
||||
|
@ -333,7 +363,7 @@ PreallocatedProcessManagerImpl::MaybeForgetSpare(ContentParent* aContent)
|
|||
mIsNuwaReady = false;
|
||||
while (mSpareProcesses.Length() > 0) {
|
||||
nsRefPtr<ContentParent> process = mSpareProcesses[mSpareProcesses.Length() - 1];
|
||||
process->Close();
|
||||
KillOrCloseProcess(aContent);
|
||||
mSpareProcesses.RemoveElementAt(mSpareProcesses.Length() - 1);
|
||||
}
|
||||
ScheduleDelayedNuwaFork();
|
||||
|
@ -353,14 +383,8 @@ PreallocatedProcessManagerImpl::OnNuwaReady()
|
|||
ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess,
|
||||
hal::PROCESS_PRIORITY_MASTER);
|
||||
mIsNuwaReady = true;
|
||||
if (Preferences::GetBool("dom.ipc.preallocatedProcessManager.testMode")) {
|
||||
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);
|
||||
}
|
||||
SendTestOnlyNotification("TEST-ONLY:nuwa-ready");
|
||||
|
||||
NuwaFork();
|
||||
}
|
||||
|
||||
|
@ -370,7 +394,6 @@ PreallocatedProcessManagerImpl::PreallocatedProcessReady()
|
|||
return !mSpareProcesses.IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PreallocatedProcessManagerImpl::NuwaFork()
|
||||
{
|
||||
|
@ -399,7 +422,7 @@ PreallocatedProcessManagerImpl::Disable()
|
|||
#ifdef MOZ_NUWA_PROCESS
|
||||
while (mSpareProcesses.Length() > 0){
|
||||
nsRefPtr<ContentParent> process = mSpareProcesses[0];
|
||||
process->Close();
|
||||
KillOrCloseProcess(process);
|
||||
mSpareProcesses.RemoveElementAt(0);
|
||||
}
|
||||
mIsNuwaReady = false;
|
||||
|
|
|
@ -14,7 +14,7 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s || toolkit == 'androi
|
|||
[test_cpow_cookies.html]
|
||||
skip-if = buildapp == 'b2g' || buildapp == 'mulet'
|
||||
[test_NuwaProcessCreation.html]
|
||||
skip-if = true # bug 1166923
|
||||
skip-if = toolkit != 'gonk'
|
||||
[test_NuwaProcessDeadlock.html]
|
||||
skip-if = true # bug 1166923
|
||||
[test_child_docshell.html]
|
||||
|
|
|
@ -14,6 +14,9 @@ Test if Nuwa process created successfully.
|
|||
|
||||
function runTest()
|
||||
{
|
||||
info("Shut down processes by disabling process prelaunch");
|
||||
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', false);
|
||||
|
||||
info("Launch the Nuwa process");
|
||||
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsISyncMessageSender);
|
||||
|
@ -22,12 +25,11 @@ function runTest()
|
|||
receiveMessage: function receiveMessage(msg) {
|
||||
msg = SpecialPowers.wrap(msg);
|
||||
if (msg.name == 'TEST-ONLY:nuwa-ready') {
|
||||
ok(true, "Got nuwa-ready");
|
||||
is(seenNuwaReady, false, "Already received nuwa ready");
|
||||
is(seenNuwaReady, false, "The Nuwa process is launched");
|
||||
seenNuwaReady = true;
|
||||
} else if (msg.name == 'TEST-ONLY: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();
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +58,6 @@ function setup()
|
|||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
'set': [
|
||||
['dom.ipc.processPrelaunch.enabled', false],
|
||||
['dom.ipc.preallocatedProcessManager.testMode', true]
|
||||
]
|
||||
}, runTest);
|
||||
|
|
|
@ -98,7 +98,14 @@ MobileMessageDatabaseService::MarkMessageRead(int32_t aMessageId,
|
|||
bool aSendReadReport,
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,5 +393,36 @@ SmsManager::NotifyCursorDone(int32_t aRequestId)
|
|||
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,
|
||||
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
|
||||
|
|
|
@ -2361,6 +2361,15 @@ public class GeckoAppShell
|
|||
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")
|
||||
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()) {
|
||||
|
|
|
@ -762,6 +762,48 @@ public class GeckoSmsManager
|
|||
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
|
||||
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 {
|
||||
|
@ -1101,6 +1143,10 @@ public class GeckoSmsManager
|
|||
@WrapForJNI
|
||||
private static native void notifySmsDeleteFailed(int aError, int aRequestId);
|
||||
@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);
|
||||
@WrapForJNI
|
||||
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 getMessage(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 createThreadCursor(int aRequestId);
|
||||
void getNextThread(int aRequestId);
|
||||
|
|
|
@ -20,7 +20,7 @@ task:
|
|||
--test-suite crashtest
|
||||
--installer-url {{build_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}}
|
||||
--total-chunk {{total_chunks}}
|
||||
artifacts:
|
||||
|
|
|
@ -19,7 +19,7 @@ task:
|
|||
--test-suite reftest
|
||||
--installer-url {{build_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}}
|
||||
--total-chunk {{total_chunks}}
|
||||
artifacts:
|
||||
|
|
|
@ -1101,6 +1101,25 @@ AndroidBridge::DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequ
|
|||
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_IMETHODIMP
|
||||
|
|
|
@ -270,6 +270,10 @@ public:
|
|||
nsIMobileMessageCallback* aRequest);
|
||||
void GetMessage(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>
|
||||
CreateMessageCursor(bool aHasStartDate,
|
||||
uint64_t aStartDate,
|
||||
|
|
|
@ -104,6 +104,14 @@ public:
|
|||
mozilla::jni::NativeStub<GeckoSmsManager::NotifySmsDelivery_t, Impl>
|
||||
::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::NativeStub<GeckoSmsManager::NotifySmsReceived_t, Impl>
|
||||
::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);
|
||||
}
|
||||
|
||||
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::signature[];
|
||||
|
||||
|
@ -857,6 +865,12 @@ constexpr char GeckoSmsManager::NotifySmsDeleted_t::signature[];
|
|||
constexpr char GeckoSmsManager::NotifySmsDelivery_t::name[];
|
||||
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::signature[];
|
||||
|
||||
|
|
|
@ -1243,6 +1243,27 @@ public:
|
|||
|
||||
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:
|
||||
struct MarkURIVisited_t {
|
||||
typedef GeckoAppShell Owner;
|
||||
|
@ -2181,6 +2202,40 @@ public:
|
|||
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:
|
||||
struct NotifySmsReceived_t {
|
||||
typedef GeckoSmsManager Owner;
|
||||
|
|
Загрузка…
Ссылка в новой задаче