Loading core/java/android/view/ViewRootImpl.java +6 −7 Original line number Diff line number Diff line Loading @@ -2021,8 +2021,8 @@ public final class ViewRootImpl implements ViewParent, mLastWasImTarget = imTarget; InputMethodManager imm = InputMethodManager.peekInstance(); if (imm != null && imTarget) { imm.startGettingWindowFocus(mView); imm.onWindowFocus(mView, mView.findFocus(), imm.onPreWindowFocus(mView, true /* hasWindowFocus */); imm.onPostWindowFocus(mView, mView.findFocus(), mWindowAttributes.softInputMode, !mHasHadWindowFocus, mWindowAttributes.flags); } Loading Loading @@ -3327,11 +3327,10 @@ public final class ViewRootImpl implements ViewParent, .mayUseInputMethod(mWindowAttributes.flags); InputMethodManager imm = InputMethodManager.peekInstance(); if (mView != null) { if (hasWindowFocus && imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.startGettingWindowFocus(mView); if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onPreWindowFocus(mView, hasWindowFocus); } if (mView != null) { mAttachInfo.mKeyDispatchState.reset(); mView.dispatchWindowFocusChanged(hasWindowFocus); mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus); Loading @@ -3341,7 +3340,7 @@ public final class ViewRootImpl implements ViewParent, // so all of the view state is set up correctly. if (hasWindowFocus) { if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onWindowFocus(mView, mView.findFocus(), imm.onPostWindowFocus(mView, mView.findFocus(), mWindowAttributes.softInputMode, !mHasHadWindowFocus, mWindowAttributes.flags); } Loading core/java/android/view/inputmethod/InputMethodManager.java +20 −7 Original line number Diff line number Diff line Loading @@ -1392,7 +1392,7 @@ public final class InputMethodManager { * Called by ViewAncestor when its window gets input focus. * @hide */ public void onWindowFocus(View rootView, View focusedView, int softInputMode, public void onPostWindowFocus(View rootView, View focusedView, int softInputMode, boolean first, int windowFlags) { boolean forceNewFocus = false; synchronized (mH) { Loading Loading @@ -1443,9 +1443,22 @@ public final class InputMethodManager { } /** @hide */ public void startGettingWindowFocus(View rootView) { public void onPreWindowFocus(View rootView, boolean hasWindowFocus) { synchronized (mH) { if (rootView == null) { mCurRootView = null; } if (hasWindowFocus) { mCurRootView = rootView; } else if (rootView == mCurRootView) { // If the mCurRootView is losing window focus, release the strong reference to it // so as not to prevent it from being garbage-collected. mCurRootView = null; } else { if (DEBUG) { Log.v(TAG, "Ignoring onPreWindowFocus()." + " mCurRootView=" + mCurRootView + " rootView=" + rootView); } } } } Loading core/java/android/webkit/FindActionModeCallback.java +3 −3 Original line number Diff line number Diff line Loading @@ -154,10 +154,10 @@ public class FindActionModeCallback implements ActionMode.Callback, TextWatcher, } public void showSoftInput() { mInput.startGettingWindowFocus(mEditText.getRootView()); mInput.focusIn(mEditText); if (mEditText.requestFocus()) { mInput.showSoftInput(mEditText, 0); } } public void updateMatchCount(int matchIndex, int matchCount, boolean isEmptyFind) { if (!isEmptyFind) { Loading Loading
core/java/android/view/ViewRootImpl.java +6 −7 Original line number Diff line number Diff line Loading @@ -2021,8 +2021,8 @@ public final class ViewRootImpl implements ViewParent, mLastWasImTarget = imTarget; InputMethodManager imm = InputMethodManager.peekInstance(); if (imm != null && imTarget) { imm.startGettingWindowFocus(mView); imm.onWindowFocus(mView, mView.findFocus(), imm.onPreWindowFocus(mView, true /* hasWindowFocus */); imm.onPostWindowFocus(mView, mView.findFocus(), mWindowAttributes.softInputMode, !mHasHadWindowFocus, mWindowAttributes.flags); } Loading Loading @@ -3327,11 +3327,10 @@ public final class ViewRootImpl implements ViewParent, .mayUseInputMethod(mWindowAttributes.flags); InputMethodManager imm = InputMethodManager.peekInstance(); if (mView != null) { if (hasWindowFocus && imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.startGettingWindowFocus(mView); if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onPreWindowFocus(mView, hasWindowFocus); } if (mView != null) { mAttachInfo.mKeyDispatchState.reset(); mView.dispatchWindowFocusChanged(hasWindowFocus); mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus); Loading @@ -3341,7 +3340,7 @@ public final class ViewRootImpl implements ViewParent, // so all of the view state is set up correctly. if (hasWindowFocus) { if (imm != null && mLastWasImTarget && !isInLocalFocusMode()) { imm.onWindowFocus(mView, mView.findFocus(), imm.onPostWindowFocus(mView, mView.findFocus(), mWindowAttributes.softInputMode, !mHasHadWindowFocus, mWindowAttributes.flags); } Loading
core/java/android/view/inputmethod/InputMethodManager.java +20 −7 Original line number Diff line number Diff line Loading @@ -1392,7 +1392,7 @@ public final class InputMethodManager { * Called by ViewAncestor when its window gets input focus. * @hide */ public void onWindowFocus(View rootView, View focusedView, int softInputMode, public void onPostWindowFocus(View rootView, View focusedView, int softInputMode, boolean first, int windowFlags) { boolean forceNewFocus = false; synchronized (mH) { Loading Loading @@ -1443,9 +1443,22 @@ public final class InputMethodManager { } /** @hide */ public void startGettingWindowFocus(View rootView) { public void onPreWindowFocus(View rootView, boolean hasWindowFocus) { synchronized (mH) { if (rootView == null) { mCurRootView = null; } if (hasWindowFocus) { mCurRootView = rootView; } else if (rootView == mCurRootView) { // If the mCurRootView is losing window focus, release the strong reference to it // so as not to prevent it from being garbage-collected. mCurRootView = null; } else { if (DEBUG) { Log.v(TAG, "Ignoring onPreWindowFocus()." + " mCurRootView=" + mCurRootView + " rootView=" + rootView); } } } } Loading
core/java/android/webkit/FindActionModeCallback.java +3 −3 Original line number Diff line number Diff line Loading @@ -154,10 +154,10 @@ public class FindActionModeCallback implements ActionMode.Callback, TextWatcher, } public void showSoftInput() { mInput.startGettingWindowFocus(mEditText.getRootView()); mInput.focusIn(mEditText); if (mEditText.requestFocus()) { mInput.showSoftInput(mEditText, 0); } } public void updateMatchCount(int matchIndex, int matchCount, boolean isEmptyFind) { if (!isEmptyFind) { Loading