Merge "Improve IMF visibility log (1/N)"

This commit is contained in:
Wilson Wu
2022-12-19 02:22:27 +00:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 0 deletions

View File

@@ -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() {

View File

@@ -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)
# ---------------------------

View File

@@ -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;

View File

@@ -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;
}