Merge "Only print starvation messages for >1 thread." am: 599d7d5a31 am: 91a22bcebc am: 56d1aa5ce3
am: 2c46112e70

Change-Id: I427bcb015d643aaad3dcf947ac201d4dd27312e1
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp
index c3ce7d3..dc4b0e1 100644
--- a/IPCThreadState.cpp
+++ b/IPCThreadState.cpp
@@ -435,7 +435,7 @@
         pthread_mutex_lock(&mProcess->mThreadCountLock);
         mProcess->mExecutingThreadsCount++;
         if (mProcess->mExecutingThreadsCount >= mProcess->mMaxThreads &&
-                mProcess->mStarvationStartTimeMs == 0) {
+            mProcess->mMaxThreads > 1 && mProcess->mStarvationStartTimeMs == 0) {
             mProcess->mStarvationStartTimeMs = uptimeMillis();
         }
         pthread_mutex_unlock(&mProcess->mThreadCountLock);
@@ -444,11 +444,11 @@
 
         pthread_mutex_lock(&mProcess->mThreadCountLock);
         mProcess->mExecutingThreadsCount--;
-        if (mProcess->mExecutingThreadsCount < mProcess->mMaxThreads &&
-                mProcess->mStarvationStartTimeMs != 0) {
+        if (mProcess->mExecutingThreadsCount < mProcess->mMaxThreads && mProcess->mMaxThreads > 1 &&
+            mProcess->mStarvationStartTimeMs != 0) {
             int64_t starvationTimeMs = uptimeMillis() - mProcess->mStarvationStartTimeMs;
             if (starvationTimeMs > 100) {
-                ALOGE("binder thread pool (%zu threads) starved for %" PRId64 " ms",
+                ALOGW("All binder threads in pool (%zu threads) busy for %" PRId64 " ms",
                       mProcess->mMaxThreads, starvationTimeMs);
             }
             mProcess->mStarvationStartTimeMs = 0;