Loading core/java/android/view/ImeFocusController.java +4 −11 Original line number Diff line number Diff line Loading @@ -132,22 +132,16 @@ public final class ImeFocusController { } /** * To handle the lifecycle of the input connection when the device interactivity state changed. * (i.e. Calling IMS#onFinishInput when the device screen-off and Calling IMS#onStartInput * when the device screen-on again). * Calling IMS#onStartInput when the device screen-on again). */ @UiThread public void onInteractiveChanged(boolean interactive) { public void onInteractive() { final InputMethodManagerDelegate immDelegate = getImmDelegate(); if (!immDelegate.isCurrentRootView(mViewRootImpl)) { return; } if (interactive) { final View focusedView = mViewRootImpl.mView.findFocus(); onViewFocusChanged(focusedView, focusedView != null); } else { mDelegate.finishInputAndReportToIme(); } } /** Loading Loading @@ -186,7 +180,6 @@ public final class ImeFocusController { void onViewDetachedFromWindow(View view, ViewRootImpl viewRootImpl); void onWindowDismissed(ViewRootImpl viewRootImpl); void finishInputAndReportToIme(); boolean isCurrentRootView(ViewRootImpl rootView); } Loading core/java/android/view/inputmethod/InputMethodManager.java +17 −27 Original line number Diff line number Diff line Loading @@ -741,26 +741,6 @@ public final class InputMethodManager { private final class DelegateImpl implements ImeFocusController.InputMethodManagerDelegate { /** * Used by {@link ImeFocusController} to finish input connection and callback * {@link InputMethodService#onFinishInput()}. * * This method is especially for when ImeFocusController received device screen-off event to * ensure the entire finish input connection and the connection lifecycle callback to * IME can be done for security concern. */ @Override public void finishInputAndReportToIme() { synchronized (mH) { finishInputLocked(); if (isImeSessionAvailableLocked()) { mCurBindState.mImeSession.finishInput(); } forAccessibilitySessionsLocked( IAccessibilityInputMethodSessionInvoker::finishInput); } } @Override public void onPreWindowGainedFocus(ViewRootImpl viewRootImpl) { synchronized (mH) { Loading Loading @@ -1203,14 +1183,24 @@ public final class InputMethodManager { mActive = interactive; mFullscreenMode = fullscreen; if (interactive) { // Report active state to ImeFocusController to handle IME input // connection lifecycle callback when it allowed. final ImeFocusController controller = getFocusController(); final View rootView = mCurRootView != null ? mCurRootView.getView() : null; final View rootView = mCurRootView != null ? mCurRootView.getView() : null; if (controller == null || rootView == null) { return; } rootView.post(() -> controller.onInteractiveChanged(interactive)); rootView.post(controller::onInteractive); } else { finishInputLocked(); if (isImeSessionAvailableLocked()) { mCurBindState.mImeSession.finishInput(); } forAccessibilitySessionsLocked( IAccessibilityInputMethodSessionInvoker::finishInput); } } return; } Loading Loading
core/java/android/view/ImeFocusController.java +4 −11 Original line number Diff line number Diff line Loading @@ -132,22 +132,16 @@ public final class ImeFocusController { } /** * To handle the lifecycle of the input connection when the device interactivity state changed. * (i.e. Calling IMS#onFinishInput when the device screen-off and Calling IMS#onStartInput * when the device screen-on again). * Calling IMS#onStartInput when the device screen-on again). */ @UiThread public void onInteractiveChanged(boolean interactive) { public void onInteractive() { final InputMethodManagerDelegate immDelegate = getImmDelegate(); if (!immDelegate.isCurrentRootView(mViewRootImpl)) { return; } if (interactive) { final View focusedView = mViewRootImpl.mView.findFocus(); onViewFocusChanged(focusedView, focusedView != null); } else { mDelegate.finishInputAndReportToIme(); } } /** Loading Loading @@ -186,7 +180,6 @@ public final class ImeFocusController { void onViewDetachedFromWindow(View view, ViewRootImpl viewRootImpl); void onWindowDismissed(ViewRootImpl viewRootImpl); void finishInputAndReportToIme(); boolean isCurrentRootView(ViewRootImpl rootView); } Loading
core/java/android/view/inputmethod/InputMethodManager.java +17 −27 Original line number Diff line number Diff line Loading @@ -741,26 +741,6 @@ public final class InputMethodManager { private final class DelegateImpl implements ImeFocusController.InputMethodManagerDelegate { /** * Used by {@link ImeFocusController} to finish input connection and callback * {@link InputMethodService#onFinishInput()}. * * This method is especially for when ImeFocusController received device screen-off event to * ensure the entire finish input connection and the connection lifecycle callback to * IME can be done for security concern. */ @Override public void finishInputAndReportToIme() { synchronized (mH) { finishInputLocked(); if (isImeSessionAvailableLocked()) { mCurBindState.mImeSession.finishInput(); } forAccessibilitySessionsLocked( IAccessibilityInputMethodSessionInvoker::finishInput); } } @Override public void onPreWindowGainedFocus(ViewRootImpl viewRootImpl) { synchronized (mH) { Loading Loading @@ -1203,14 +1183,24 @@ public final class InputMethodManager { mActive = interactive; mFullscreenMode = fullscreen; if (interactive) { // Report active state to ImeFocusController to handle IME input // connection lifecycle callback when it allowed. final ImeFocusController controller = getFocusController(); final View rootView = mCurRootView != null ? mCurRootView.getView() : null; final View rootView = mCurRootView != null ? mCurRootView.getView() : null; if (controller == null || rootView == null) { return; } rootView.post(() -> controller.onInteractiveChanged(interactive)); rootView.post(controller::onInteractive); } else { finishInputLocked(); if (isImeSessionAvailableLocked()) { mCurBindState.mImeSession.finishInput(); } forAccessibilitySessionsLocked( IAccessibilityInputMethodSessionInvoker::finishInput); } } return; } Loading