libbinder: log when wrong number of threads start
Add a log when a service requests to have 0 threads but a threadpool
(with a thread) is still requested to be started). This currently
doesn't get hit on cuttlefish, but by triggering it manually I
can see the log.
Bug: 210145621
Test: trigger API misuse case and check for log
Change-Id: I9113828e10812895802a83017ed8f55e851fa220
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 4f21cda..9abe4b5 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -176,6 +176,11 @@
{
AutoMutex _l(mLock);
if (!mThreadPoolStarted) {
+ if (mMaxThreads == 0) {
+ ALOGW("Extra binder thread started, but 0 threads requested. Do not use "
+ "*startThreadPool when zero threads are requested.");
+ }
+
mThreadPoolStarted = true;
spawnPooledThread(true);
}