Merge "Don't give IME focus to temporarily detached View." into nyc-dev

This commit is contained in:
Yohei Yukawa
2016-04-05 21:21:07 +00:00
committed by Android (Google) Code Review

View File

@@ -1307,6 +1307,12 @@ public final class InputMethodManager {
void focusInLocked(View view) { void focusInLocked(View view) {
if (DEBUG) Log.v(TAG, "focusIn: " + dumpViewInfo(view)); if (DEBUG) Log.v(TAG, "focusIn: " + dumpViewInfo(view));
if (view != null && view.isTemporarilyDetached()) {
// This is a request from a view that is temporarily detached from a window.
if (DEBUG) Log.v(TAG, "Temporarily detached view, ignoring");
return;
}
if (mCurRootView != view.getRootView()) { if (mCurRootView != view.getRootView()) {
// This is a request from a window that isn't in the window with // This is a request from a window that isn't in the window with
// IME focus, so ignore it. // IME focus, so ignore it.
@@ -1332,6 +1338,7 @@ public final class InputMethodManager {
// whenever we go into touch mode, so it ends up hiding // whenever we go into touch mode, so it ends up hiding
// at times when we don't really want it to. For now it // at times when we don't really want it to. For now it
// seems better to just turn it all off. // seems better to just turn it all off.
// TODO: Check view.isTemporarilyDetached() when re-enable the following code.
if (false && view.hasWindowFocus()) { if (false && view.hasWindowFocus()) {
mNextServedView = null; mNextServedView = null;
scheduleCheckFocusLocked(view); scheduleCheckFocusLocked(view);
@@ -2315,6 +2322,7 @@ public final class InputMethodManager {
sb.append(",focus=" + view.hasFocus()); sb.append(",focus=" + view.hasFocus());
sb.append(",windowFocus=" + view.hasWindowFocus()); sb.append(",windowFocus=" + view.hasWindowFocus());
sb.append(",window=" + view.getWindowToken()); sb.append(",window=" + view.getWindowToken());
sb.append(",temporaryDetach=" + view.isTemporarilyDetached());
return sb.toString(); return sb.toString();
} }
} }