am a14ebc73: am 92847c96: Merge "Revert "Update IME focus when the active view is losing the focus."" into mnc-dev
* commit 'a14ebc73cf26f893a8e72671a7562937ecbe6f2e': Revert "Update IME focus when the active view is losing the focus."
This commit is contained in:
@@ -2015,6 +2015,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mLastWasImTarget = imTarget;
|
mLastWasImTarget = imTarget;
|
||||||
InputMethodManager imm = InputMethodManager.peekInstance();
|
InputMethodManager imm = InputMethodManager.peekInstance();
|
||||||
if (imm != null && imTarget) {
|
if (imm != null && imTarget) {
|
||||||
|
imm.startGettingWindowFocus(mView);
|
||||||
imm.onWindowFocus(mView, mView.findFocus(),
|
imm.onWindowFocus(mView, mView.findFocus(),
|
||||||
mWindowAttributes.softInputMode,
|
mWindowAttributes.softInputMode,
|
||||||
!mHasHadWindowFocus, mWindowAttributes.flags);
|
!mHasHadWindowFocus, mWindowAttributes.flags);
|
||||||
@@ -3321,6 +3322,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
InputMethodManager imm = InputMethodManager.peekInstance();
|
InputMethodManager imm = InputMethodManager.peekInstance();
|
||||||
if (mView != null) {
|
if (mView != null) {
|
||||||
|
if (hasWindowFocus && imm != null && mLastWasImTarget &&
|
||||||
|
!isInLocalFocusMode()) {
|
||||||
|
imm.startGettingWindowFocus(mView);
|
||||||
|
}
|
||||||
mAttachInfo.mKeyDispatchState.reset();
|
mAttachInfo.mKeyDispatchState.reset();
|
||||||
mView.dispatchWindowFocusChanged(hasWindowFocus);
|
mView.dispatchWindowFocusChanged(hasWindowFocus);
|
||||||
mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
|
mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
|
||||||
|
|||||||
@@ -281,7 +281,12 @@ public final class InputMethodManager {
|
|||||||
boolean mFullscreenMode;
|
boolean mFullscreenMode;
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the root view of the overall window that currently has input
|
||||||
|
* method focus.
|
||||||
|
*/
|
||||||
|
View mCurRootView;
|
||||||
/**
|
/**
|
||||||
* This is the view that should currently be served by an input method,
|
* This is the view that should currently be served by an input method,
|
||||||
* regardless of the state of setting that up.
|
* regardless of the state of setting that up.
|
||||||
@@ -801,6 +806,7 @@ public final class InputMethodManager {
|
|||||||
* Disconnect any existing input connection, clearing the served view.
|
* Disconnect any existing input connection, clearing the served view.
|
||||||
*/
|
*/
|
||||||
void finishInputLocked() {
|
void finishInputLocked() {
|
||||||
|
mCurRootView = null;
|
||||||
mNextServedView = null;
|
mNextServedView = null;
|
||||||
if (mServedView != null) {
|
if (mServedView != null) {
|
||||||
if (DEBUG) Log.v(TAG, "FINISH INPUT: " + mServedView);
|
if (DEBUG) Log.v(TAG, "FINISH INPUT: " + mServedView);
|
||||||
@@ -1284,9 +1290,10 @@ public final class InputMethodManager {
|
|||||||
void focusInLocked(View view) {
|
void focusInLocked(View view) {
|
||||||
if (DEBUG) Log.v(TAG, "focusIn: " + view);
|
if (DEBUG) Log.v(TAG, "focusIn: " + view);
|
||||||
|
|
||||||
if (!view.hasWindowFocus()) {
|
if (mCurRootView != view.getRootView()) {
|
||||||
// This is a request from a window that doesn't have window focus, so ignore it.
|
// This is a request from a window that isn't in the window with
|
||||||
if (DEBUG) Log.v(TAG, "Not focused window, ignoring");
|
// IME focus, so ignore it.
|
||||||
|
if (DEBUG) Log.v(TAG, "Not IME target window, ignoring");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1303,9 +1310,16 @@ public final class InputMethodManager {
|
|||||||
if (DEBUG) Log.v(TAG, "focusOut: " + view
|
if (DEBUG) Log.v(TAG, "focusOut: " + view
|
||||||
+ " mServedView=" + mServedView
|
+ " mServedView=" + mServedView
|
||||||
+ " winFocus=" + view.hasWindowFocus());
|
+ " winFocus=" + view.hasWindowFocus());
|
||||||
if (mServedView == view && view.hasWindowFocus()) {
|
if (mServedView != view) {
|
||||||
mNextServedView = null;
|
// The following code would auto-hide the IME if we end up
|
||||||
scheduleCheckFocusLocked(view);
|
// with no more views with focus. This can happen, however,
|
||||||
|
// whenever we go into touch mode, so it ends up hiding
|
||||||
|
// at times when we don't really want it to. For now it
|
||||||
|
// seems better to just turn it all off.
|
||||||
|
if (false && view.hasWindowFocus()) {
|
||||||
|
mNextServedView = null;
|
||||||
|
scheduleCheckFocusLocked(view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1428,6 +1442,13 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void startGettingWindowFocus(View rootView) {
|
||||||
|
synchronized (mH) {
|
||||||
|
mCurRootView = rootView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report the current selection range.
|
* Report the current selection range.
|
||||||
*
|
*
|
||||||
@@ -2135,6 +2156,7 @@ public final class InputMethodManager {
|
|||||||
+ " mBindSequence=" + mBindSequence
|
+ " mBindSequence=" + mBindSequence
|
||||||
+ " mCurId=" + mCurId);
|
+ " mCurId=" + mCurId);
|
||||||
p.println(" mCurMethod=" + mCurMethod);
|
p.println(" mCurMethod=" + mCurMethod);
|
||||||
|
p.println(" mCurRootView=" + mCurRootView);
|
||||||
p.println(" mServedView=" + mServedView);
|
p.println(" mServedView=" + mServedView);
|
||||||
p.println(" mNextServedView=" + mNextServedView);
|
p.println(" mNextServedView=" + mNextServedView);
|
||||||
p.println(" mServedConnecting=" + mServedConnecting);
|
p.println(" mServedConnecting=" + mServedConnecting);
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ public class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showSoftInput() {
|
public void showSoftInput() {
|
||||||
|
mInput.startGettingWindowFocus(mEditText.getRootView());
|
||||||
mInput.focusIn(mEditText);
|
mInput.focusIn(mEditText);
|
||||||
mInput.showSoftInput(mEditText, 0);
|
mInput.showSoftInput(mEditText, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user