Loading core/java/android/view/ImeFocusController.java +2 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,8 @@ public final class ImeFocusController { if (!view.hasImeFocus() || !view.hasWindowFocus()) { return; } if (DEBUG) Log.d(TAG, "onViewFocusChanged, view=" + view + ", mServedView=" + mServedView); if (DEBUG) Log.d(TAG, "onViewFocusChanged, view=" + InputMethodDebug.dumpViewInfo(view) + ", mServedView=" + InputMethodDebug.dumpViewInfo(mServedView)); // We don't need to track the next served view when the view lost focus here because: // 1) The current view focus may be cleared temporary when in touch mode, closing input Loading core/java/android/view/inputmethod/InputMethodManager.java +7 −24 Original line number Diff line number Diff line Loading @@ -1771,7 +1771,7 @@ public final class InputMethodManager { if (getServedViewLocked() != null) { if (DEBUG) { Log.v(TAG, "FINISH INPUT: mServedView=" + dumpViewInfo(getServedViewLocked())); + InputMethodDebug.dumpViewInfo(getServedViewLocked())); } setServedViewLocked(null); mCompletions = null; Loading Loading @@ -2304,7 +2304,7 @@ public final class InputMethodManager { // Make sure we have a window token for the served view. if (DEBUG) { Log.v(TAG, "Starting input: view=" + dumpViewInfo(view) + Log.v(TAG, "Starting input: view=" + InputMethodDebug.dumpViewInfo(view) + " reason=" + InputMethodDebug.startInputReasonToString(startInputReason)); } if (view == null) { Loading Loading @@ -2375,9 +2375,9 @@ public final class InputMethodManager { final View servedView = getServedViewLocked(); if (servedView != view || !mServedConnecting) { // Something else happened, so abort. if (DEBUG) Log.v(TAG, "Starting input: finished by someone else. view=" + dumpViewInfo(view) + " servedView=" + dumpViewInfo(servedView) if (DEBUG) Log.v(TAG, "Starting input: finished by someone else." + " view=" + InputMethodDebug.dumpViewInfo(view) + " servedView=" + InputMethodDebug.dumpViewInfo(servedView) + " mServedConnecting=" + mServedConnecting); if (mServedInputConnection != null && startInputReason == BOUND_TO_IMMS) { // This is not an error. Once IME binds (MSG_BIND), InputConnection is fully Loading Loading @@ -2437,8 +2437,8 @@ public final class InputMethodManager { mServedInputConnection = servedInputConnection; if (DEBUG) { Log.v(TAG, "START INPUT: view=" + dumpViewInfo(view) + " ic=" + ic + " editorInfo=" + editorInfo + " startInputFlags=" Log.v(TAG, "START INPUT: view=" + InputMethodDebug.dumpViewInfo(view) + " ic=" + ic + " editorInfo=" + editorInfo + " startInputFlags=" + InputMethodDebug.startInputFlagsToString(startInputFlags)); } Loading Loading @@ -3774,23 +3774,6 @@ public final class InputMethodManager { return mCurBindState != null ? mCurBindState.mBindSequence : -1; } private static String dumpViewInfo(@Nullable final View view) { if (view == null) { return "null"; } final StringBuilder sb = new StringBuilder(); sb.append(view); sb.append(",focus=" + view.hasFocus()); sb.append(",windowFocus=" + view.hasWindowFocus()); sb.append(",autofillUiShowing=" + isAutofillUIShowing(view)); sb.append(",window=" + view.getWindowToken()); sb.append(",displayId=" + view.getContext().getDisplayId()); sb.append(",temporaryDetach=" + view.isTemporarilyDetached()); sb.append(",hasImeFocus=" + view.hasImeFocus()); return sb.toString(); } /** * Checks the args to see if a proto-based ime dump was requested and writes the client side * ime dump to the given {@link FileDescriptor}. Loading core/java/com/android/internal/inputmethod/InputMethodDebug.java +15 −13 Original line number Diff line number Diff line Loading @@ -16,10 +16,11 @@ package com.android.internal.inputmethod; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.view.View; import android.view.WindowManager; import android.view.WindowManager.LayoutParams.SoftInputModeFlags; import android.view.autofill.AutofillManager; import android.view.inputmethod.HandwritingGesture; import java.util.StringJoiner; Loading Loading @@ -281,20 +282,21 @@ public final class InputMethodDebug { } /** * Return a fixed size string of the object. * TODO(b/151575861): Take & return with StringBuilder to make more memory efficient. * Dumps the given {@link View} related to input method focus state for debugging. */ @NonNull @AnyThread public static String objToString(Object obj) { if (obj == null) { public static String dumpViewInfo(@Nullable View view) { if (view == null) { return "null"; } StringBuilder sb = new StringBuilder(64); sb.setLength(0); sb.append(obj.getClass().getName()); sb.append("@"); sb.append(Integer.toHexString(obj.hashCode())); final StringBuilder sb = new StringBuilder(); sb.append(view); sb.append(",focus=" + view.hasFocus()); sb.append(",windowFocus=" + view.hasWindowFocus()); sb.append(",window=" + view.getWindowToken()); sb.append(",displayId=" + view.getContext().getDisplayId()); sb.append(",temporaryDetach=" + view.isTemporarilyDetached()); sb.append(",hasImeFocus=" + view.hasImeFocus()); return sb.toString(); } } Loading
core/java/android/view/ImeFocusController.java +2 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,8 @@ public final class ImeFocusController { if (!view.hasImeFocus() || !view.hasWindowFocus()) { return; } if (DEBUG) Log.d(TAG, "onViewFocusChanged, view=" + view + ", mServedView=" + mServedView); if (DEBUG) Log.d(TAG, "onViewFocusChanged, view=" + InputMethodDebug.dumpViewInfo(view) + ", mServedView=" + InputMethodDebug.dumpViewInfo(mServedView)); // We don't need to track the next served view when the view lost focus here because: // 1) The current view focus may be cleared temporary when in touch mode, closing input Loading
core/java/android/view/inputmethod/InputMethodManager.java +7 −24 Original line number Diff line number Diff line Loading @@ -1771,7 +1771,7 @@ public final class InputMethodManager { if (getServedViewLocked() != null) { if (DEBUG) { Log.v(TAG, "FINISH INPUT: mServedView=" + dumpViewInfo(getServedViewLocked())); + InputMethodDebug.dumpViewInfo(getServedViewLocked())); } setServedViewLocked(null); mCompletions = null; Loading Loading @@ -2304,7 +2304,7 @@ public final class InputMethodManager { // Make sure we have a window token for the served view. if (DEBUG) { Log.v(TAG, "Starting input: view=" + dumpViewInfo(view) + Log.v(TAG, "Starting input: view=" + InputMethodDebug.dumpViewInfo(view) + " reason=" + InputMethodDebug.startInputReasonToString(startInputReason)); } if (view == null) { Loading Loading @@ -2375,9 +2375,9 @@ public final class InputMethodManager { final View servedView = getServedViewLocked(); if (servedView != view || !mServedConnecting) { // Something else happened, so abort. if (DEBUG) Log.v(TAG, "Starting input: finished by someone else. view=" + dumpViewInfo(view) + " servedView=" + dumpViewInfo(servedView) if (DEBUG) Log.v(TAG, "Starting input: finished by someone else." + " view=" + InputMethodDebug.dumpViewInfo(view) + " servedView=" + InputMethodDebug.dumpViewInfo(servedView) + " mServedConnecting=" + mServedConnecting); if (mServedInputConnection != null && startInputReason == BOUND_TO_IMMS) { // This is not an error. Once IME binds (MSG_BIND), InputConnection is fully Loading Loading @@ -2437,8 +2437,8 @@ public final class InputMethodManager { mServedInputConnection = servedInputConnection; if (DEBUG) { Log.v(TAG, "START INPUT: view=" + dumpViewInfo(view) + " ic=" + ic + " editorInfo=" + editorInfo + " startInputFlags=" Log.v(TAG, "START INPUT: view=" + InputMethodDebug.dumpViewInfo(view) + " ic=" + ic + " editorInfo=" + editorInfo + " startInputFlags=" + InputMethodDebug.startInputFlagsToString(startInputFlags)); } Loading Loading @@ -3774,23 +3774,6 @@ public final class InputMethodManager { return mCurBindState != null ? mCurBindState.mBindSequence : -1; } private static String dumpViewInfo(@Nullable final View view) { if (view == null) { return "null"; } final StringBuilder sb = new StringBuilder(); sb.append(view); sb.append(",focus=" + view.hasFocus()); sb.append(",windowFocus=" + view.hasWindowFocus()); sb.append(",autofillUiShowing=" + isAutofillUIShowing(view)); sb.append(",window=" + view.getWindowToken()); sb.append(",displayId=" + view.getContext().getDisplayId()); sb.append(",temporaryDetach=" + view.isTemporarilyDetached()); sb.append(",hasImeFocus=" + view.hasImeFocus()); return sb.toString(); } /** * Checks the args to see if a proto-based ime dump was requested and writes the client side * ime dump to the given {@link FileDescriptor}. Loading
core/java/com/android/internal/inputmethod/InputMethodDebug.java +15 −13 Original line number Diff line number Diff line Loading @@ -16,10 +16,11 @@ package com.android.internal.inputmethod; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.view.View; import android.view.WindowManager; import android.view.WindowManager.LayoutParams.SoftInputModeFlags; import android.view.autofill.AutofillManager; import android.view.inputmethod.HandwritingGesture; import java.util.StringJoiner; Loading Loading @@ -281,20 +282,21 @@ public final class InputMethodDebug { } /** * Return a fixed size string of the object. * TODO(b/151575861): Take & return with StringBuilder to make more memory efficient. * Dumps the given {@link View} related to input method focus state for debugging. */ @NonNull @AnyThread public static String objToString(Object obj) { if (obj == null) { public static String dumpViewInfo(@Nullable View view) { if (view == null) { return "null"; } StringBuilder sb = new StringBuilder(64); sb.setLength(0); sb.append(obj.getClass().getName()); sb.append("@"); sb.append(Integer.toHexString(obj.hashCode())); final StringBuilder sb = new StringBuilder(); sb.append(view); sb.append(",focus=" + view.hasFocus()); sb.append(",windowFocus=" + view.hasWindowFocus()); sb.append(",window=" + view.getWindowToken()); sb.append(",displayId=" + view.getContext().getDisplayId()); sb.append(",temporaryDetach=" + view.isTemporarilyDetached()); sb.append(",hasImeFocus=" + view.hasImeFocus()); return sb.toString(); } }