From cdf8d7b17df878a68888858fff6bd1753778a895 Mon Sep 17 00:00:00 2001 From: Jamin Liu Date: Fri, 21 Aug 2015 09:51:50 +0800 Subject: [PATCH] Bug 1180555 - Handle PBAP replies and pass the results through IPC to PbapManager. r=btian --- dom/bluetooth/BluetoothPbapRequestHandle.cpp | 115 +++++++++++++++++- .../bluedroid/BluetoothPbapManager.cpp | 35 +++++- .../bluedroid/BluetoothPbapManager.h | 44 +++++++ .../bluedroid/BluetoothServiceBluedroid.cpp | 103 ++++++++++++++++ .../bluedroid/BluetoothServiceBluedroid.h | 31 +++++ dom/bluetooth/bluetooth2/BluetoothAdapter.cpp | 7 ++ dom/bluetooth/bluetooth2/BluetoothService.h | 32 +++++ .../bluetooth2/ipc/BluetoothParent.cpp | 44 +++++++ .../bluetooth2/ipc/BluetoothParent.h | 9 ++ .../ipc/BluetoothServiceChildProcess.cpp | 60 +++++++++ .../ipc/BluetoothServiceChildProcess.h | 31 +++++ dom/bluetooth/bluetooth2/ipc/PBluetooth.ipdl | 20 +++ dom/bluetooth/bluez/BluetoothDBusService.cpp | 49 ++++++++ dom/bluetooth/bluez/BluetoothDBusService.h | 31 +++++ 14 files changed, 602 insertions(+), 9 deletions(-) diff --git a/dom/bluetooth/BluetoothPbapRequestHandle.cpp b/dom/bluetooth/BluetoothPbapRequestHandle.cpp index ad45a982959..7375b7ee50b 100644 --- a/dom/bluetooth/BluetoothPbapRequestHandle.cpp +++ b/dom/bluetooth/BluetoothPbapRequestHandle.cpp @@ -10,6 +10,7 @@ #include "BluetoothService.h" #include "mozilla/dom/BluetoothPbapRequestHandleBinding.h" +#include "mozilla/dom/ContentChild.h" using namespace mozilla; using namespace dom; @@ -49,8 +50,42 @@ already_AddRefed BluetoothPbapRequestHandle::ReplyTovCardPulling(Blob& aBlob, ErrorResult& aRv) { - // TODO: Implement this function (Bug 1180555) - return nullptr; + nsCOMPtr win = GetParentObject(); + if (!win) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + nsRefPtr request = new DOMRequest(win); + nsRefPtr result = + new BluetoothVoidReplyRunnable(request); + + BluetoothService* bs = BluetoothService::Get(); + if (!bs) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + if (XRE_GetProcessType() == GeckoProcessType_Default) { + // In-process reply + bs->ReplyTovCardPulling(&aBlob, result); + } else { + ContentChild *cc = ContentChild::GetSingleton(); + if (!cc) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob); + if (!actor) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + bs->ReplyTovCardPulling(nullptr, actor, result); + } + + return request.forget(); } already_AddRefed @@ -58,8 +93,42 @@ BluetoothPbapRequestHandle::ReplyToPhonebookPulling(Blob& aBlob, uint16_t phonebookSize, ErrorResult& aRv) { - // TODO: Implement this function (Bug 1180555) - return nullptr; + nsCOMPtr win = GetParentObject(); + if (!win) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + nsRefPtr request = new DOMRequest(win); + nsRefPtr result = + new BluetoothVoidReplyRunnable(request); + + BluetoothService* bs = BluetoothService::Get(); + if (!bs) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + if (XRE_GetProcessType() == GeckoProcessType_Default) { + // In-process reply + bs->ReplyToPhonebookPulling(&aBlob, phonebookSize, result); + } else { + ContentChild *cc = ContentChild::GetSingleton(); + if (!cc) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob); + if (!actor) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + bs->ReplyToPhonebookPulling(nullptr, actor, phonebookSize, result); + } + + return request.forget(); } already_AddRefed @@ -67,8 +136,42 @@ BluetoothPbapRequestHandle::ReplyTovCardListing(Blob& aBlob, uint16_t phonebookSize, ErrorResult& aRv) { - // TODO: Implement this function (Bug 1180555) - return nullptr; + nsCOMPtr win = GetParentObject(); + if (!win) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + nsRefPtr request = new DOMRequest(win); + nsRefPtr result = + new BluetoothVoidReplyRunnable(request); + + BluetoothService* bs = BluetoothService::Get(); + if (!bs) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + if (XRE_GetProcessType() == GeckoProcessType_Default) { + // In-process reply + bs->ReplyTovCardListing(&aBlob, phonebookSize, result); + } else { + ContentChild *cc = ContentChild::GetSingleton(); + if (!cc) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob); + if (!actor) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + bs->ReplyTovCardListing(nullptr, actor, phonebookSize, result); + } + + return request.forget(); } JSObject* diff --git a/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp b/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp index 3a3ebcf0b33..2902c18addc 100644 --- a/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp @@ -12,6 +12,7 @@ #include "BluetoothUuid.h" #include "ObexBase.h" +#include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/RefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" @@ -752,6 +753,16 @@ BluetoothPbapManager::PackPropertiesMask(uint8_t* aData, int aSize) return propSelector; } +void +BluetoothPbapManager::ReplyToPullPhonebook(BlobParent* aActor, + uint16_t aPhonebookSize) +{ + nsRefPtr impl = aActor->GetBlobImpl(); + nsRefPtr blob = Blob::Create(nullptr, impl); + + ReplyToPullPhonebook(blob.get(), aPhonebookSize); +} + void BluetoothPbapManager::ReplyToPullPhonebook(Blob* aBlob, uint16_t aPhonebookSize) { @@ -759,13 +770,31 @@ BluetoothPbapManager::ReplyToPullPhonebook(Blob* aBlob, uint16_t aPhonebookSize) } void -BluetoothPbapManager::ReplyToPullvCardListing( - Blob* aBlob, - uint16_t aPhonebookSize) +BluetoothPbapManager::ReplyToPullvCardListing(BlobParent* aActor, + uint16_t aPhonebookSize) +{ + nsRefPtr impl = aActor->GetBlobImpl(); + nsRefPtr blob = Blob::Create(nullptr, impl); + + ReplyToPullvCardListing(blob.get(), aPhonebookSize); +} + +void +BluetoothPbapManager::ReplyToPullvCardListing(Blob* aBlob, + uint16_t aPhonebookSize) { // TODO: Implement this function (Bug 1180556) } +void +BluetoothPbapManager::ReplyToPullvCardEntry(BlobParent* aActor) +{ + nsRefPtr impl = aActor->GetBlobImpl(); + nsRefPtr blob = Blob::Create(nullptr, impl); + + ReplyToPullvCardEntry(blob.get()); +} + void BluetoothPbapManager::ReplyToPullvCardEntry(Blob* aBlob) { diff --git a/dom/bluetooth/bluedroid/BluetoothPbapManager.h b/dom/bluetooth/bluedroid/BluetoothPbapManager.h index 75548a63039..0b387dd4915 100644 --- a/dom/bluetooth/bluedroid/BluetoothPbapManager.h +++ b/dom/bluetooth/bluedroid/BluetoothPbapManager.h @@ -16,6 +16,7 @@ namespace mozilla { namespace dom { class Blob; + class BlobParent; } } @@ -62,8 +63,51 @@ public: static BluetoothPbapManager* Get(); bool Listen(); + + /** + * Reply vCard object to the *IPC* 'pullphonebook' request. + * + * @param aActor [in] a blob actor containing the vCard objects + * @param aPhonebookSize [in] the number of vCard indexes in the blob + */ + void ReplyToPullPhonebook(BlobParent* aActor, uint16_t aPhonebookSize); + + /** + * Reply vCard object to the *in-process* 'pullphonebook' request. + * + * @param aBlob [in] a blob contained the vCard objects + * @param aPhonebookSize [in] the number of vCard indexes in the blob + */ void ReplyToPullPhonebook(Blob* aBlob, uint16_t aPhonebookSize); + + /** + * Reply vCard object to the *IPC* 'pullvcardlisting' request. + * + * @param aActor [in] a blob actor containing the vCard objects + * @param aPhonebookSize [in] the number of vCard indexes in the blob + */ + void ReplyToPullvCardListing(BlobParent* aActor, uint16_t aPhonebookSize); + + /** + * Reply vCard object to the *in-process* 'pullvcardlisting' request. + * + * @param aBlob [in] a blob contained the vCard objects + * @param aPhonebookSize [in] the number of vCard indexes in the blob + */ void ReplyToPullvCardListing(Blob* aBlob, uint16_t aPhonebookSize); + + /** + * Reply vCard object to the *IPC* 'pullvcardentry' request. + * + * @param aActor [in] a blob actor containing the vCard objects + */ + void ReplyToPullvCardEntry(BlobParent* aActor); + + /** + * Reply vCard object to the *in-process* 'pullvcardentry' request. + * + * @param aBlob [in] a blob contained the vCard objects + */ void ReplyToPullvCardEntry(Blob* aBlob); protected: diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp index b689c16c4ab..43bd8ed4daf 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ -1125,6 +1125,109 @@ BluetoothServiceBluedroid::IsScoConnected(BluetoothReplyRunnable* aRunnable) DispatchReplySuccess(aRunnable, BluetoothValue(hfp->IsScoConnected())); } +void +BluetoothServiceBluedroid::ReplyTovCardPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to vCardPulling failed")); + return; + } + + pbap->ReplyToPullvCardEntry(aBlobParent); + DispatchReplySuccess(aRunnable); +} + +void +BluetoothServiceBluedroid::ReplyTovCardPulling( + Blob* aBlob, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to vCardPulling failed")); + return; + } + + pbap->ReplyToPullvCardEntry(aBlob); + DispatchReplySuccess(aRunnable); +} + +void +BluetoothServiceBluedroid::ReplyToPhonebookPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to Phonebook Pulling failed")); + return; + } + + pbap->ReplyToPullPhonebook(aBlobParent, aPhonebookSize); + DispatchReplySuccess(aRunnable); +} + +void +BluetoothServiceBluedroid::ReplyToPhonebookPulling( + Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to Phonebook Pulling failed")); + return; + } + + pbap->ReplyToPullPhonebook(aBlob, aPhonebookSize); + DispatchReplySuccess(aRunnable); +} + +void +BluetoothServiceBluedroid::ReplyTovCardListing( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to vCard Listing failed")); + return; + } + + pbap->ReplyToPullvCardListing(aBlobParent, aPhonebookSize); + DispatchReplySuccess(aRunnable); +} + +void +BluetoothServiceBluedroid::ReplyTovCardListing( + Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + BluetoothPbapManager* pbap = BluetoothPbapManager::Get(); + if (!pbap) { + DispatchReplyError(aRunnable, + NS_LITERAL_STRING("Reply to vCard Listing failed")); + return; + } + + pbap->ReplyToPullvCardListing(aBlob, aPhonebookSize); + DispatchReplySuccess(aRunnable); +} + void BluetoothServiceBluedroid::SendMetaData(const nsAString& aTitle, const nsAString& aArtist, diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h index 5892bfaa310..72fa4b64d19 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h @@ -142,6 +142,37 @@ public: virtual void IsScoConnected(BluetoothReplyRunnable* aRunnable); + virtual void + ReplyTovCardPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable); + + virtual void + ReplyTovCardPulling(Blob* aBlob, + BluetoothReplyRunnable* aRunnable); + + virtual void + ReplyToPhonebookPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable); + + virtual void + ReplyToPhonebookPulling(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable); + + virtual void + ReplyTovCardListing(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable); + + virtual void + ReplyTovCardListing(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable); + virtual void AnswerWaitingCall(BluetoothReplyRunnable* aRunnable); diff --git a/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp b/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp index 58c7188099a..7635e4e7861 100644 --- a/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp +++ b/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp @@ -30,6 +30,7 @@ #include "mozilla/dom/bluetooth/BluetoothDiscoveryHandle.h" #include "mozilla/dom/bluetooth/BluetoothGattServer.h" #include "mozilla/dom/bluetooth/BluetoothPairingListener.h" +#include "mozilla/dom/bluetooth/BluetoothPbapRequestHandle.h" #include "mozilla/dom/bluetooth/BluetoothTypes.h" using namespace mozilla; @@ -1234,6 +1235,8 @@ BluetoothAdapter::HandlePullPhonebookReq(const BluetoothValue& aValue) } } + init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner()); + nsRefPtr event = BluetoothPhonebookPullingEvent::Constructor(this, NS_LITERAL_STRING(PULL_PHONEBOOK_REQ_ID), init); @@ -1266,6 +1269,8 @@ BluetoothAdapter::HandlePullVCardEntryReq(const BluetoothValue& aValue) } } + init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner()); + nsRefPtr event = BluetoothVCardPullingEvent::Constructor(this, NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID), init); @@ -1308,6 +1313,8 @@ BluetoothAdapter::HandlePullVCardListingReq(const BluetoothValue& aValue) } } + init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner()); + nsRefPtr event = BluetoothVCardListingEvent::Constructor(this, NS_LITERAL_STRING(PULL_VCARD_LISTING_REQ_ID), init); diff --git a/dom/bluetooth/bluetooth2/BluetoothService.h b/dom/bluetooth/bluetooth2/BluetoothService.h index 2a99883eadf..649bdf797cc 100644 --- a/dom/bluetooth/bluetooth2/BluetoothService.h +++ b/dom/bluetooth/bluetooth2/BluetoothService.h @@ -9,6 +9,7 @@ #include "BluetoothCommon.h" #include "BluetoothInterface.h" +#include "BluetoothPbapRequestHandle.h" #include "BluetoothProfileManagerBase.h" #include "nsAutoPtr.h" #include "nsClassHashtable.h" @@ -310,6 +311,37 @@ public: virtual void IsScoConnected(BluetoothReplyRunnable* aRunnable) = 0; + virtual void + ReplyTovCardPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) = 0; + + virtual void + ReplyTovCardPulling(Blob* aBlob, + BluetoothReplyRunnable* aRunnable) = 0; + + virtual void + ReplyToPhonebookPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) = 0; + + virtual void + ReplyToPhonebookPulling(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) = 0; + + virtual void + ReplyTovCardListing(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) = 0; + + virtual void + ReplyTovCardListing(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) = 0; + #ifdef MOZ_B2G_RIL virtual void AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) = 0; diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothParent.cpp b/dom/bluetooth/bluetooth2/ipc/BluetoothParent.cpp index f1be8e31226..fe90a26cf9b 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothParent.cpp +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothParent.cpp @@ -246,6 +246,12 @@ BluetoothParent::RecvPBluetoothRequestConstructor( return actor->DoRequest(aRequest.get_DisconnectScoRequest()); case Request::TIsScoConnectedRequest: return actor->DoRequest(aRequest.get_IsScoConnectedRequest()); + case Request::TReplyTovCardPullingRequest: + return actor->DoRequest(aRequest.get_ReplyTovCardPullingRequest()); + case Request::TReplyToPhonebookPullingRequest: + return actor->DoRequest(aRequest.get_ReplyToPhonebookPullingRequest()); + case Request::TReplyTovCardListingRequest: + return actor->DoRequest(aRequest.get_ReplyTovCardListingRequest()); #ifdef MOZ_B2G_RIL case Request::TAnswerWaitingCallRequest: return actor->DoRequest(aRequest.get_AnswerWaitingCallRequest()); @@ -703,6 +709,44 @@ BluetoothRequestParent::DoRequest(const IsScoConnectedRequest& aRequest) return true; } +bool +BluetoothRequestParent::DoRequest(const ReplyTovCardPullingRequest& aRequest) +{ + MOZ_ASSERT(mService); + MOZ_ASSERT(mRequestType == Request::TReplyTovCardPullingRequest); + + mService->ReplyTovCardPulling((BlobParent*)aRequest.blobParent(), + (BlobChild*)aRequest.blobChild(), + mReplyRunnable.get()); + return true; +} + +bool +BluetoothRequestParent::DoRequest(const ReplyToPhonebookPullingRequest& aRequest) +{ + MOZ_ASSERT(mService); + MOZ_ASSERT(mRequestType == Request::TReplyToPhonebookPullingRequest); + + mService->ReplyToPhonebookPulling((BlobParent*)aRequest.blobParent(), + (BlobChild*)aRequest.blobChild(), + aRequest.phonebookSize(), + mReplyRunnable.get()); + return true; +} + +bool +BluetoothRequestParent::DoRequest(const ReplyTovCardListingRequest& aRequest) +{ + MOZ_ASSERT(mService); + MOZ_ASSERT(mRequestType == Request::TReplyTovCardListingRequest); + + mService->ReplyTovCardListing((BlobParent*)aRequest.blobParent(), + (BlobChild*)aRequest.blobChild(), + aRequest.phonebookSize(), + mReplyRunnable.get()); + return true; +} + #ifdef MOZ_B2G_RIL bool BluetoothRequestParent::DoRequest(const AnswerWaitingCallRequest& aRequest) diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothParent.h b/dom/bluetooth/bluetooth2/ipc/BluetoothParent.h index ca2fdc7b9b1..4db1549ee4f 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothParent.h +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothParent.h @@ -212,6 +212,15 @@ protected: bool DoRequest(const IsScoConnectedRequest& aRequest); + bool + DoRequest(const ReplyTovCardPullingRequest& aRequest); + + bool + DoRequest(const ReplyToPhonebookPullingRequest& aRequest); + + bool + DoRequest(const ReplyTovCardListingRequest& aRequest); + #ifdef MOZ_B2G_RIL bool DoRequest(const AnswerWaitingCallRequest& aRequest); diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp index 711aa6bf49c..ac39b38073b 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp @@ -366,6 +366,66 @@ BluetoothServiceChildProcess::IsScoConnected(BluetoothReplyRunnable* aRunnable) SendRequest(aRunnable, IsScoConnectedRequest()); } +void +BluetoothServiceChildProcess::ReplyTovCardPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) +{ + SendRequest(aRunnable, ReplyTovCardPullingRequest(nullptr, aBlobChild)); +} + +void +BluetoothServiceChildProcess::ReplyTovCardPulling( + Blob* aBlobChild, + BluetoothReplyRunnable* aRunnable) +{ + // Parent-process-only method + MOZ_CRASH("This should never be called!"); +} + +void +BluetoothServiceChildProcess::ReplyToPhonebookPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + SendRequest(aRunnable, + ReplyToPhonebookPullingRequest(nullptr, aBlobChild, aPhonebookSize)); +} + +void +BluetoothServiceChildProcess::ReplyToPhonebookPulling( + Blob* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + // Parent-process-only method + MOZ_CRASH("This should never be called!"); +} + +void +BluetoothServiceChildProcess::ReplyTovCardListing( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + SendRequest(aRunnable, + ReplyTovCardListingRequest(nullptr, aBlobChild, aPhonebookSize)); +} + +void +BluetoothServiceChildProcess::ReplyTovCardListing( + Blob* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ + // Parent-process-only method + MOZ_CRASH("This should never be called!"); +} + #ifdef MOZ_B2G_RIL void BluetoothServiceChildProcess::AnswerWaitingCall( diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h index 860cac83d78..d860f02bde9 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h @@ -158,6 +158,37 @@ public: virtual void IsScoConnected(BluetoothReplyRunnable* aRunnable) override; + virtual void + ReplyTovCardPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardPulling(Blob* aBlob, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyToPhonebookPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyToPhonebookPulling(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardListing(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardListing(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + #ifdef MOZ_B2G_RIL virtual void AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) override; diff --git a/dom/bluetooth/bluetooth2/ipc/PBluetooth.ipdl b/dom/bluetooth/bluetooth2/ipc/PBluetooth.ipdl index 24f56cbf70f..8663021b471 100644 --- a/dom/bluetooth/bluetooth2/ipc/PBluetooth.ipdl +++ b/dom/bluetooth/bluetooth2/ipc/PBluetooth.ipdl @@ -171,6 +171,23 @@ struct IsScoConnectedRequest { }; +struct ReplyTovCardPullingRequest +{ + PBlob blob; +}; + +struct ReplyToPhonebookPullingRequest +{ + PBlob blob; + uint16_t phonebookSize; +}; + +struct ReplyTovCardListingRequest +{ + PBlob blob; + uint16_t phonebookSize; +}; + struct AnswerWaitingCallRequest { }; @@ -306,6 +323,9 @@ union Request ConnectScoRequest; DisconnectScoRequest; IsScoConnectedRequest; + ReplyTovCardPullingRequest; + ReplyToPhonebookPullingRequest; + ReplyTovCardListingRequest; AnswerWaitingCallRequest; IgnoreWaitingCallRequest; ToggleCallsRequest; diff --git a/dom/bluetooth/bluez/BluetoothDBusService.cpp b/dom/bluetooth/bluez/BluetoothDBusService.cpp index fcd0b236e58..a90d7d999f5 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp @@ -4378,3 +4378,52 @@ BluetoothDBusService::GattClientWriteDescriptorValueInternal( BluetoothReplyRunnable* aRunnable) { } + +void +BluetoothDBusService::ReplyTovCardPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) +{ +} + +void +BluetoothDBusService::ReplyTovCardPulling( + Blob* aBlob, + BluetoothReplyRunnable* aRunnable) +{ +} + +void +BluetoothDBusService::ReplyToPhonebookPulling( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ +} + +void +BluetoothDBusService::ReplyToPhonebookPulling( + Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ +} + +void +BluetoothDBusService::ReplyTovCardListing( + BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ +} + +void +BluetoothDBusService::ReplyTovCardListing( + Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) +{ +} diff --git a/dom/bluetooth/bluez/BluetoothDBusService.h b/dom/bluetooth/bluez/BluetoothDBusService.h index e3275845d3a..d564063b480 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.h +++ b/dom/bluetooth/bluez/BluetoothDBusService.h @@ -157,6 +157,37 @@ public: virtual void IsScoConnected(BluetoothReplyRunnable* aRunnable) override; + virtual void + ReplyTovCardPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardPulling(Blob* aBlob, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyToPhonebookPulling(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyToPhonebookPulling(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardListing(BlobParent* aBlobParent, + BlobChild* aBlobChild, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable) override; + + virtual void + ReplyTovCardListing(Blob* aBlob, + uint16_t aPhonebookSize, + BluetoothReplyRunnable* aRunnable); + #ifdef MOZ_B2G_RIL virtual void AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);