Loading core/java/android/view/inputmethod/InputMethodManager.java +16 −14 Original line number Diff line number Diff line Loading @@ -789,7 +789,7 @@ public final class InputMethodManager { } } if (checkFocusInternal(forceNewFocus, false, viewRootImpl)) { if (checkFocusInternal(forceNewFocus, viewRootImpl)) { // We need to restart input on the current focus view. This // should be done in conjunction with telling the system service // about the window gaining focus, to help make the transition Loading Loading @@ -826,7 +826,12 @@ public final class InputMethodManager { @Override public void onScheduledCheckFocus(@NonNull ViewRootImpl viewRootImpl) { checkFocusInternal(false, true, viewRootImpl); if (!checkFocusInternal(false, viewRootImpl)) { return; } startInputOnWindowFocusGainInternal(StartInputReason.SCHEDULED_CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } @Override Loading Loading @@ -1118,7 +1123,7 @@ public final class InputMethodManager { if (mCurRootView == null) { return; } if (!checkFocusInternal(mRestartOnNextWindowFocus, false, mCurRootView)) { if (!checkFocusInternal(mRestartOnNextWindowFocus, mCurRootView)) { return; } final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS Loading Loading @@ -2338,8 +2343,7 @@ public final class InputMethodManager { } /** * Called from {@link #checkFocusInternal(boolean, boolean, ViewRootImpl)}, * {@link #restartInput(View)}, {@link #MSG_BIND} or {@link #MSG_UNBIND}. * Starts an input connection from the served view that gains the window focus. * Note that this method should *NOT* be called inside of {@code mH} lock to prevent start input * background thread may blocked by other methods which already inside {@code mH} lock. */ Loading Loading @@ -2660,14 +2664,18 @@ public final class InputMethodManager { } viewRootImpl = mCurRootView; } checkFocusInternal(false /* forceNewFocus */, true /* startInput */, viewRootImpl); if (!checkFocusInternal(false /* forceNewFocus */, viewRootImpl)) { return; } startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } /** * Check the next served view if needs to start input. */ private boolean checkFocusInternal(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { private boolean checkFocusInternal(boolean forceNewFocus, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; Loading @@ -2694,12 +2702,6 @@ public final class InputMethodManager { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; } Loading core/java/com/android/internal/inputmethod/InputMethodDebug.java +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public final class InputMethodDebug { return "WINDOW_FOCUS_GAIN"; case StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY: return "WINDOW_FOCUS_GAIN_REPORT_ONLY"; case StartInputReason.SCHEDULED_CHECK_FOCUS: return "SCHEDULED_CHECK_FOCUS"; case StartInputReason.APP_CALLED_RESTART_INPUT_API: return "APP_CALLED_RESTART_INPUT_API"; case StartInputReason.CHECK_FOCUS: Loading core/java/com/android/internal/inputmethod/StartInputReason.java +6 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.lang.annotation.Retention; StartInputReason.UNSPECIFIED, StartInputReason.WINDOW_FOCUS_GAIN, StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, StartInputReason.SCHEDULED_CHECK_FOCUS, StartInputReason.APP_CALLED_RESTART_INPUT_API, StartInputReason.CHECK_FOCUS, StartInputReason.BOUND_TO_IMMS, Loading @@ -57,6 +58,11 @@ public @interface StartInputReason { * this window focus change event to sync IME input target for system. */ int WINDOW_FOCUS_GAIN_REPORT_ONLY = 2; /** * Similar to {@link #CHECK_FOCUS}, but the one scheduled with * {@link android.view.ViewRootImpl#dispatchCheckFocus()}. */ int SCHEDULED_CHECK_FOCUS = 3; /** * {@link android.view.inputmethod.InputMethodManager#restartInput(android.view.View)} is * either explicitly called by the application or indirectly called by some Framework class Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +16 −14 Original line number Diff line number Diff line Loading @@ -789,7 +789,7 @@ public final class InputMethodManager { } } if (checkFocusInternal(forceNewFocus, false, viewRootImpl)) { if (checkFocusInternal(forceNewFocus, viewRootImpl)) { // We need to restart input on the current focus view. This // should be done in conjunction with telling the system service // about the window gaining focus, to help make the transition Loading Loading @@ -826,7 +826,12 @@ public final class InputMethodManager { @Override public void onScheduledCheckFocus(@NonNull ViewRootImpl viewRootImpl) { checkFocusInternal(false, true, viewRootImpl); if (!checkFocusInternal(false, viewRootImpl)) { return; } startInputOnWindowFocusGainInternal(StartInputReason.SCHEDULED_CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } @Override Loading Loading @@ -1118,7 +1123,7 @@ public final class InputMethodManager { if (mCurRootView == null) { return; } if (!checkFocusInternal(mRestartOnNextWindowFocus, false, mCurRootView)) { if (!checkFocusInternal(mRestartOnNextWindowFocus, mCurRootView)) { return; } final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS Loading Loading @@ -2338,8 +2343,7 @@ public final class InputMethodManager { } /** * Called from {@link #checkFocusInternal(boolean, boolean, ViewRootImpl)}, * {@link #restartInput(View)}, {@link #MSG_BIND} or {@link #MSG_UNBIND}. * Starts an input connection from the served view that gains the window focus. * Note that this method should *NOT* be called inside of {@code mH} lock to prevent start input * background thread may blocked by other methods which already inside {@code mH} lock. */ Loading Loading @@ -2660,14 +2664,18 @@ public final class InputMethodManager { } viewRootImpl = mCurRootView; } checkFocusInternal(false /* forceNewFocus */, true /* startInput */, viewRootImpl); if (!checkFocusInternal(false /* forceNewFocus */, viewRootImpl)) { return; } startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } /** * Check the next served view if needs to start input. */ private boolean checkFocusInternal(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { private boolean checkFocusInternal(boolean forceNewFocus, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; Loading @@ -2694,12 +2702,6 @@ public final class InputMethodManager { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; } Loading
core/java/com/android/internal/inputmethod/InputMethodDebug.java +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public final class InputMethodDebug { return "WINDOW_FOCUS_GAIN"; case StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY: return "WINDOW_FOCUS_GAIN_REPORT_ONLY"; case StartInputReason.SCHEDULED_CHECK_FOCUS: return "SCHEDULED_CHECK_FOCUS"; case StartInputReason.APP_CALLED_RESTART_INPUT_API: return "APP_CALLED_RESTART_INPUT_API"; case StartInputReason.CHECK_FOCUS: Loading
core/java/com/android/internal/inputmethod/StartInputReason.java +6 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.lang.annotation.Retention; StartInputReason.UNSPECIFIED, StartInputReason.WINDOW_FOCUS_GAIN, StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, StartInputReason.SCHEDULED_CHECK_FOCUS, StartInputReason.APP_CALLED_RESTART_INPUT_API, StartInputReason.CHECK_FOCUS, StartInputReason.BOUND_TO_IMMS, Loading @@ -57,6 +58,11 @@ public @interface StartInputReason { * this window focus change event to sync IME input target for system. */ int WINDOW_FOCUS_GAIN_REPORT_ONLY = 2; /** * Similar to {@link #CHECK_FOCUS}, but the one scheduled with * {@link android.view.ViewRootImpl#dispatchCheckFocus()}. */ int SCHEDULED_CHECK_FOCUS = 3; /** * {@link android.view.inputmethod.InputMethodManager#restartInput(android.view.View)} is * either explicitly called by the application or indirectly called by some Framework class Loading