Add getFdStateDebug to access Looper's callbacks

Added getFdStateDebug to access Looper's internal state.

Flag: EXEMPT testing
Test: TEST=libutils_test; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="LooperTest.getFdStateDebug*"
Change-Id: I253ed4a6fa1040053117dcea3be80e55eef9a9b0
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index e11d197..2541aa8 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -496,6 +496,21 @@
     return 1;
 }
 
+bool Looper::getFdStateDebug(int fd, int* ident, int* events, sp<LooperCallback>* cb, void** data) {
+    AutoMutex _l(mLock);
+    if (auto seqNumIt = mSequenceNumberByFd.find(fd); seqNumIt != mSequenceNumberByFd.cend()) {
+        if (auto reqIt = mRequests.find(seqNumIt->second); reqIt != mRequests.cend()) {
+            const Request& request = reqIt->second;
+            if (ident) *ident = request.ident;
+            if (events) *events = request.events;
+            if (cb) *cb = request.callback;
+            if (data) *data = request.data;
+            return true;
+        }
+    }
+    return false;
+}
+
 int Looper::removeFd(int fd) {
     AutoMutex _l(mLock);
     const auto& it = mSequenceNumberByFd.find(fd);