Add log for showSoftInput called from Insets API

Add a debug log to identify calls to showSoftInput from Insets API.

Fix: 1865976
Test: manually using steps:
      1. Use an app like launcher that uses Insets API to show IME.
      2. dump using adb shell dumpsys input_method
      3. Verify log.
      4. use another app that shows IME using showSoftInput like gmail
      5. verify the log

Change-Id: I6ba0d3f7912855f31e033735557b44eeed3e6652
This commit is contained in:
Taran Singh
2021-04-28 04:24:59 +00:00
parent 6f46df2512
commit 11472f70b4
3 changed files with 12 additions and 2 deletions

View File

@@ -2259,7 +2259,8 @@ public final class InputMethodManager {
if (servedView == null || servedView.getWindowToken() != windowToken) {
return false;
}
showSoftInput(servedView, 0 /* flags */, null /* resultReceiver */);
showSoftInput(servedView, 0 /* flags */, null /* resultReceiver */,
SoftInputShowHideReason.SHOW_SOFT_INPUT_BY_INSETS_API);
return true;
}
}

View File

@@ -234,6 +234,8 @@ public final class InputMethodDebug {
return "SHOW_TOGGLE_SOFT_INPUT";
case SoftInputShowHideReason.HIDE_TOGGLE_SOFT_INPUT:
return "HIDE_TOGGLE_SOFT_INPUT";
case SoftInputShowHideReason.SHOW_SOFT_INPUT_BY_INSETS_API:
return "SHOW_SOFT_INPUT_BY_INSETS_API";
default:
return "Unknown=" + reason;
}

View File

@@ -52,7 +52,8 @@ import java.lang.annotation.Retention;
SoftInputShowHideReason.HIDE_REMOVE_CLIENT,
SoftInputShowHideReason.SHOW_RESTORE_IME_VISIBILITY,
SoftInputShowHideReason.SHOW_TOGGLE_SOFT_INPUT,
SoftInputShowHideReason.HIDE_TOGGLE_SOFT_INPUT})
SoftInputShowHideReason.HIDE_TOGGLE_SOFT_INPUT,
SoftInputShowHideReason.SHOW_SOFT_INPUT_BY_INSETS_API})
public @interface SoftInputShowHideReason {
/** Show soft input by {@link android.view.inputmethod.InputMethodManager#showSoftInput}. */
int SHOW_SOFT_INPUT = 0;
@@ -188,4 +189,10 @@ public @interface SoftInputShowHideReason {
* {@link android.view.inputmethod.InputMethodManager#toggleSoftInput(int, int)};
*/
int HIDE_TOGGLE_SOFT_INPUT = 24;
/**
* Show soft input by
* {@link android.view.InsetsController#show(int)};
*/
int SHOW_SOFT_INPUT_BY_INSETS_API = 25;
}