Allow error/abort for non-oneway calls.
Low-level processes like init might not want to make blocking calls.
This provides the mechanism to programmatically enforce that.
Test: enable ERROR_BLOCKING on process and look at callstacks
Bug: 36424585
Change-Id: I6dad33271108768f8bfc4723bf3eeddbf9720395
diff --git a/include/hwbinder/ProcessState.h b/include/hwbinder/ProcessState.h
index f02b003..c42d8a8 100644
--- a/include/hwbinder/ProcessState.h
+++ b/include/hwbinder/ProcessState.h
@@ -77,6 +77,19 @@
// It does NOT include local strong references to the node
ssize_t getStrongRefCountForNodeByHandle(int32_t handle);
size_t getMmapSize();
+
+ enum class CallRestriction {
+ // all calls okay
+ NONE,
+ // log when calls are blocking
+ ERROR_IF_NOT_ONEWAY,
+ // abort process on blocking calls
+ FATAL_IF_NOT_ONEWAY,
+ };
+ // Sets calling restrictions for all transactions in this process. This must be called
+ // before any threads are spawned.
+ void setCallRestriction(CallRestriction restriction);
+
private:
friend class IPCThreadState;
@@ -124,6 +137,8 @@
bool mSpawnThreadOnStart;
volatile int32_t mThreadPoolSeq;
const size_t mMmapSize;
+
+ CallRestriction mCallRestriction;
};
}; // namespace hardware