Add functions to query #threads and looper state.

Can't submit until we can make ABI changes to libhwbinder.

Bug: 35117173
Test: boots
Change-Id: I10eeb128998e94b583be50c9968603ab656f0f28
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp
index 428866a..feaef3b 100644
--- a/IPCThreadState.cpp
+++ b/IPCThreadState.cpp
@@ -502,6 +502,7 @@
     mOut.writeInt32(isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER);
 
     status_t result;
+    mIsLooper = true;
     do {
         processPendingDerefs();
         // now get the next command to be processed, waiting if necessary
@@ -524,6 +525,7 @@
         (void*)pthread_self(), getpid(), result);
 
     mOut.writeInt32(BC_EXIT_LOOPER);
+    mIsLooper = false;
     talkWithDriver(false);
 }
 
@@ -962,6 +964,11 @@
     mContextObject = obj;
 }
 
+bool IPCThreadState::isLooperThread()
+{
+    return mIsLooper;
+}
+
 status_t IPCThreadState::executeCommand(int32_t cmd)
 {
     BHwBinder* obj;