Improve IMF visibility log (1/N)
Add event log to record the show/hide IME request InputMethodManagerService. The log includes focused window, visibility reason, soft input mode, and use the tag of ImeTracker.Token for identification. The log is only enabled for debug builds. Bug: 239501597 Test: presubmit Change-Id: I3b4d16ae441ce0628febfb6e18a54aae86cdab4a
This commit is contained in:
@@ -423,6 +423,12 @@ public interface ImeTracker {
|
||||
mTag = tag;
|
||||
}
|
||||
|
||||
/** Returns the {@link Token#mTag} */
|
||||
@NonNull
|
||||
public String getTag() {
|
||||
return mTag;
|
||||
}
|
||||
|
||||
/** For Parcelable, no special marshalled objects. */
|
||||
@Override
|
||||
public int describeContents() {
|
||||
|
||||
@@ -185,6 +185,10 @@ option java_package com.android.server
|
||||
# ---------------------------
|
||||
# Re-connecting to input method service because we haven't received its interface
|
||||
32000 imf_force_reconnect_ime (IME|4),(Time Since Connect|2|3),(Showing|1|1)
|
||||
# Indicates server show input method
|
||||
32001 imf_show_ime (token|3),(window|3),(reason|3),(softInputMode|3)
|
||||
# Indicates server hide input method
|
||||
32002 imf_hide_ime (token|3),(window|3),(reason|3),(softInputMode|3)
|
||||
|
||||
|
||||
# ---------------------------
|
||||
|
||||
@@ -49,8 +49,11 @@ import static android.view.Display.INVALID_DISPLAY;
|
||||
import static android.view.WindowManager.DISPLAY_IME_POLICY_HIDE;
|
||||
import static android.view.WindowManager.DISPLAY_IME_POLICY_LOCAL;
|
||||
|
||||
import static com.android.server.EventLogTags.IMF_HIDE_IME;
|
||||
import static com.android.server.EventLogTags.IMF_SHOW_IME;
|
||||
import static com.android.server.inputmethod.InputMethodBindingController.TIME_TO_RECONNECT;
|
||||
import static com.android.server.inputmethod.InputMethodUtils.isSoftInputModeStateVisibleAllowed;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_IME_VISIBILITY;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
@@ -3439,6 +3442,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
// TODO(b/192412909): Check if we can always call onShowHideSoftInputRequested() or not.
|
||||
if (curMethod.showSoftInput(showInputToken, statsToken, showFlags, resultReceiver)) {
|
||||
if (DEBUG_IME_VISIBILITY) {
|
||||
EventLog.writeEvent(IMF_SHOW_IME, statsToken.getTag(),
|
||||
Objects.toString(mCurFocusedWindow),
|
||||
InputMethodDebug.softInputDisplayReasonToString(reason),
|
||||
InputMethodDebug.softInputModeToString(mCurFocusedWindowSoftInputMode));
|
||||
}
|
||||
onShowHideSoftInputRequested(true /* show */, windowToken, reason);
|
||||
}
|
||||
mInputShown = true;
|
||||
@@ -3537,6 +3546,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
// TODO(b/192412909): Check if we can always call onShowHideSoftInputRequested() or not.
|
||||
if (curMethod.hideSoftInput(hideInputToken, statsToken, 0 /* flags */,
|
||||
resultReceiver)) {
|
||||
if (DEBUG_IME_VISIBILITY) {
|
||||
EventLog.writeEvent(IMF_HIDE_IME, statsToken.getTag(),
|
||||
Objects.toString(mCurFocusedWindow),
|
||||
InputMethodDebug.softInputDisplayReasonToString(reason),
|
||||
InputMethodDebug.softInputModeToString(mCurFocusedWindowSoftInputMode));
|
||||
}
|
||||
onShowHideSoftInputRequested(false /* show */, windowToken, reason);
|
||||
}
|
||||
res = true;
|
||||
|
||||
@@ -56,4 +56,7 @@ public class WindowManagerDebugConfig {
|
||||
static final boolean SHOW_STACK_CRAWLS = false;
|
||||
static final boolean DEBUG_WINDOW_CROP = false;
|
||||
static final boolean DEBUG_UNKNOWN_APP_VISIBILITY = false;
|
||||
|
||||
// TODO(b/239501597) : Have a system property to control this flag.
|
||||
public static final boolean DEBUG_IME_VISIBILITY = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user