Loading core/java/android/view/inputmethod/InputMethodManager.java +40 −35 Original line number Diff line number Diff line Loading @@ -835,39 +835,7 @@ public final class InputMethodManager { @Override public boolean checkFocus(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; } if (mServedView == mNextServedView && !forceNewFocus) { return false; } if (DEBUG) { Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView + " force=" + forceNewFocus + " package=" + (mServedView != null ? mServedView.getContext().getPackageName() : "<none>")); } // Close the connection when no next served view coming. if (mNextServedView == null) { finishInputLocked(); closeCurrentInput(); return false; } mServedView = mNextServedView; if (mServedInputConnection != null) { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; return checkFocusInternal(forceNewFocus, startInput, viewRootImpl); } @Override Loading Loading @@ -2371,8 +2339,8 @@ public final class InputMethodManager { } /** * Called when {@link DelegateImpl#checkFocus}, {@link #restartInput(View)}, * {@link #MSG_BIND} or {@link #MSG_UNBIND}. * Called from {@link #checkFocusInternal(boolean, boolean, ViewRootImpl)}, * {@link #restartInput(View)}, {@link #MSG_BIND} or {@link #MSG_UNBIND}. * 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 @@ -2693,6 +2661,43 @@ public final class InputMethodManager { } } private boolean checkFocusInternal(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; } if (mServedView == mNextServedView && !forceNewFocus) { return false; } if (DEBUG) { Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView + " force=" + forceNewFocus + " package=" + (mServedView != null ? mServedView.getContext().getPackageName() : "<none>")); } // Close the connection when no next served view coming. if (mNextServedView == null) { finishInputLocked(); closeCurrentInput(); return false; } mServedView = mNextServedView; if (mServedInputConnection != null) { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; } @UiThread private void onViewFocusChangedInternal(@Nullable View view, boolean hasFocus) { if (view == null || view.isTemporarilyDetached()) { Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +40 −35 Original line number Diff line number Diff line Loading @@ -835,39 +835,7 @@ public final class InputMethodManager { @Override public boolean checkFocus(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; } if (mServedView == mNextServedView && !forceNewFocus) { return false; } if (DEBUG) { Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView + " force=" + forceNewFocus + " package=" + (mServedView != null ? mServedView.getContext().getPackageName() : "<none>")); } // Close the connection when no next served view coming. if (mNextServedView == null) { finishInputLocked(); closeCurrentInput(); return false; } mServedView = mNextServedView; if (mServedInputConnection != null) { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; return checkFocusInternal(forceNewFocus, startInput, viewRootImpl); } @Override Loading Loading @@ -2371,8 +2339,8 @@ public final class InputMethodManager { } /** * Called when {@link DelegateImpl#checkFocus}, {@link #restartInput(View)}, * {@link #MSG_BIND} or {@link #MSG_UNBIND}. * Called from {@link #checkFocusInternal(boolean, boolean, ViewRootImpl)}, * {@link #restartInput(View)}, {@link #MSG_BIND} or {@link #MSG_UNBIND}. * 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 @@ -2693,6 +2661,43 @@ public final class InputMethodManager { } } private boolean checkFocusInternal(boolean forceNewFocus, boolean startInput, ViewRootImpl viewRootImpl) { synchronized (mH) { if (mCurRootView != viewRootImpl) { return false; } if (mServedView == mNextServedView && !forceNewFocus) { return false; } if (DEBUG) { Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView + " force=" + forceNewFocus + " package=" + (mServedView != null ? mServedView.getContext().getPackageName() : "<none>")); } // Close the connection when no next served view coming. if (mNextServedView == null) { finishInputLocked(); closeCurrentInput(); return false; } mServedView = mNextServedView; if (mServedInputConnection != null) { mServedInputConnection.finishComposingTextFromImm(); } } if (startInput) { startInputOnWindowFocusGainInternal(StartInputReason.CHECK_FOCUS, null /* focusedView */, 0 /* startInputFlags */, 0 /* softInputMode */, 0 /* windowFlags */); } return true; } @UiThread private void onViewFocusChangedInternal(@Nullable View view, boolean hasFocus) { if (view == null || view.isTemporarilyDetached()) { Loading