summaryrefslogtreecommitdiffstats
path: root/libqservice
diff options
context:
space:
mode:
authorNaseer Ahmed <naseer@codeaurora.org>2014-05-29 18:24:20 -0400
committerNaseer Ahmed <naseer@codeaurora.org>2014-05-29 19:25:31 -0400
commite2e19631baa418bc33c4af386f3eeddb8a868c0a (patch)
tree65dfcd5aac58bdd855456977f2d0fc86162b230f /libqservice
parent9e1a2256348e1ed999d9afb871baa52ab227e433 (diff)
downloadhardware_qcom_display-e2e19631baa418bc33c4af386f3eeddb8a868c0a.tar.gz
hardware_qcom_display-e2e19631baa418bc33c4af386f3eeddb8a868c0a.tar.bz2
hardware_qcom_display-e2e19631baa418bc33c4af386f3eeddb8a868c0a.zip
display: Fix binder parcel position
If we call binder APIs from within the same process, the parcels read position will not be reset at the client end. Also there is no interface token. Reset the parcel position to zero if the calling process is the same as the current one. Change-Id: I6c4499f453dba3ec89b203ce9c86150edaefdbec
Diffstat (limited to 'libqservice')
-rw-r--r--libqservice/QService.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libqservice/QService.cpp b/libqservice/QService.cpp
index e4af42232..12dd9956a 100644
--- a/libqservice/QService.cpp
+++ b/libqservice/QService.cpp
@@ -28,6 +28,8 @@
*/
#include <QService.h>
+#include <binder/Parcel.h>
+#include <binder/IPCThreadState.h>
#define QSERVICE_DEBUG 0
@@ -55,6 +57,10 @@ void QService::connect(const sp<qClient::IQClient>& client) {
status_t QService::dispatch(uint32_t command, const Parcel* inParcel,
Parcel* outParcel) {
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())
+ inParcel->setDataPosition(0);
if (mClient.get()) {
ALOGD_IF(QSERVICE_DEBUG, "Dispatching command: %d", command);
err = mClient->notifyCallback(command, inParcel, outParcel);