Add extra logging to CallerInfoLookupHelper

Add extra logging to help diagnose timeout errors

Bug: 31755827
Change-Id: I7eee9b0f946b03df059531b7e57757b5dc4c452f
(cherry picked from commit 36b4ee2a5ee416b359f167604900c35ffe100ba2)
diff --git a/src/com/android/server/telecom/CallerInfoLookupHelper.java b/src/com/android/server/telecom/CallerInfoLookupHelper.java
index 6276052..244a802 100644
--- a/src/com/android/server/telecom/CallerInfoLookupHelper.java
+++ b/src/com/android/server/telecom/CallerInfoLookupHelper.java
@@ -97,7 +97,7 @@
                             info.callerInfo.cachedPhotoIcon != null)) {
                         listener.onContactPhotoQueryComplete(handle, info.callerInfo);
                     } else if (info.imageQueryPending) {
-                        Log.i(this, "There is a previously incomplete query for handle %s. " +
+                        Log.i(this, "There is a pending photo query for handle %s. " +
                                 "Adding to listeners for this query.", Log.piiHandle(handle));
                         info.listeners.add(listener);
                     }
@@ -141,11 +141,15 @@
                 Log.continueSession((Session) cookie, "CILH.oQC");
                 try {
                     if (mQueryEntries.containsKey(handle)) {
+                        Log.i(CallerInfoLookupHelper.this, "CI query for handle %s has completed;" +
+                                " notifying all listeners.", Log.piiHandle(handle));
                         CallerInfoQueryInfo info = mQueryEntries.get(handle);
                         for (OnQueryCompleteListener l : info.listeners) {
                             l.onCallerInfoQueryComplete(handle, ci);
                         }
                         if (ci.contactDisplayPhotoUri == null) {
+                            Log.i(CallerInfoLookupHelper.this, "There is no photo for this " +
+                                    "contact, skipping photo query");
                             mQueryEntries.remove(handle);
                         } else {
                             info.callerInfo = ci;
@@ -191,6 +195,7 @@
                         if (info.callerInfo == null) {
                             Log.w(CallerInfoLookupHelper.this, "Photo query finished, but the " +
                                     "CallerInfo object previously looked up was not cached.");
+                            mQueryEntries.remove(handle);
                             return;
                         }
                         info.callerInfo.cachedPhoto = photo;