summaryrefslogtreecommitdiffstats
path: root/IPCThreadState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'IPCThreadState.cpp')
-rw-r--r--IPCThreadState.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp
index b275a7e..d97ad12 100644
--- a/IPCThreadState.cpp
+++ b/IPCThreadState.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "hw-IPCThreadState"
#include <hwbinder/IPCThreadState.h>
+#include <binderthreadstate/IPCThreadStateBase.h>
#include <hwbinder/Binder.h>
#include <hwbinder/BpHwBinder.h>
@@ -764,6 +765,7 @@ IPCThreadState::IPCThreadState()
// TODO(b/67742352): remove this variable from the class
(void)mMyThreadId;
+ mIPCThreadStateBase = IPCThreadStateBase::self();
}
IPCThreadState::~IPCThreadState()
@@ -1114,6 +1116,9 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
"Not enough command data for brTRANSACTION");
if (result != NO_ERROR) break;
+ // Record the fact that we're in a hwbinder call
+ mIPCThreadStateBase->pushCurrentState(
+ IPCThreadStateBase::CallState::HWBINDER);
Parcel buffer;
buffer.ipcSetDataReference(
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
@@ -1177,6 +1182,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
error = mContextObject->transact(tr.code, buffer, &reply, tr.flags, reply_callback);
}
+ mIPCThreadStateBase->popCurrentState();
if ((tr.flags & TF_ONE_WAY) == 0) {
if (!reply_sent) {
// Should have been a reply but there wasn't, so there
@@ -1249,6 +1255,11 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
return result;
}
+bool IPCThreadState::isServingCall() const
+{
+ return mIPCThreadStateBase->getCurrentBinderCallState() == IPCThreadStateBase::CallState::HWBINDER;
+}
+
void IPCThreadState::threadDestructor(void *st)
{
IPCThreadState* const self = static_cast<IPCThreadState*>(st);