diff options
author | Saurabh Shah <saurshah@codeaurora.org> | 2015-03-02 17:42:46 -0800 |
---|---|---|
committer | Saurabh Shah <saurshah@codeaurora.org> | 2015-03-02 17:46:49 -0800 |
commit | 1799cb4eeb8728431d3cdb02b0dba98f7a2ad364 (patch) | |
tree | 126b4596464fc0e967bf03cefd6dd64ac8ea0ac2 /libqservice/QService.cpp | |
parent | 92fff342470ca0196f4485f78c01ad8941eca336 (diff) | |
download | display-1799cb4eeb8728431d3cdb02b0dba98f7a2ad364.tar.gz |
QService: Fix binder out-parcel position as well
If we call binder APIs from within the same process, the parcel's
positions are not reset at the caller and callee ends for out-parcel
and in-parcel respectively. Reset the outparcel position to zero as
well if the calling process is the same as the current one.
Change-Id: Ie770b0565e62772a4c8ab635cbeba49adab43b66
Diffstat (limited to 'libqservice/QService.cpp')
-rw-r--r-- | libqservice/QService.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libqservice/QService.cpp b/libqservice/QService.cpp index 12dd9956..5d2e5de6 100644 --- a/libqservice/QService.cpp +++ b/libqservice/QService.cpp @@ -59,11 +59,15 @@ status_t QService::dispatch(uint32_t command, const Parcel* inParcel, status_t err = (status_t) FAILED_TRANSACTION; IPCThreadState* ipc = IPCThreadState::self(); //Rewind parcel in case we're calling from the same process - if (ipc->getCallingPid() == getpid()) + bool sameProcess = (ipc->getCallingPid() == getpid()); + if(sameProcess) inParcel->setDataPosition(0); if (mClient.get()) { ALOGD_IF(QSERVICE_DEBUG, "Dispatching command: %d", command); err = mClient->notifyCallback(command, inParcel, outParcel); + //Rewind parcel in case we're calling from the same process + if (sameProcess) + outParcel->setDataPosition(0); } return err; } |