Show logs when an app tries to show the IME

In order for us to be able to easily narrow down bugs that say
  "IMEs stopped being shown up"
this CL temporarily enables good-old debug messages to logcat whenever
an app is trying to show the IME with the following two APIs:

  * InputMethodManager#showSoftInput()
  * InsetsController#show(ime())

With these logs, we can easily see if the app was actually trying to
show the IME or something went wrong before the app calls these APIs.

Hopefully one day we can remove these Log.d() as part of our on-going
effort to improve IME debugging (Bug 154348613).

Bug: 171597353
Bug: 171637033
Bug: 171792138
Bug: 172731591
Test: adb logcat -s InputMethodManager:D InsetsController:D
Change-Id: I67a790f9d98d6131aaf04e4bb98d2a28873d3424
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index fbee833..bcb3a36 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -828,6 +828,9 @@
 
     @VisibleForTesting
     public void show(@InsetsType int types, boolean fromIme) {
+        if ((types & ime()) != 0) {
+            Log.d(TAG, "show(ime(), fromIme=" + fromIme + ")");
+        }
         if (fromIme) {
             ImeTracing.getInstance().triggerDump();
             Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0);
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 6243c63..f1cbd25 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -1672,10 +1672,12 @@
         checkFocus();
         synchronized (mH) {
             if (!hasServedByInputMethodLocked(view)) {
+                Log.w(TAG, "Ignoring showSoftInput() as view=" + view + " is not served.");
                 return false;
             }
 
             try {
+                Log.d(TAG, "showSoftInput() view=" + view + " flags=" + flags);
                 return mService.showSoftInput(
                         mClient, view.getWindowToken(), flags, resultReceiver);
             } catch (RemoteException e) {