Fix flicker issue in IME.
When IME is being moved as part of a window going away, it could flicker
as it immediately moves behind the window. Fix this.
Also make the default soft input mode for PopupWindow to be to not change
the IME visibility, since it is a rare pop-up window that should cause your
IME to close.
Change-Id: I0b43e080ad012739e9a3e5842794c778c859ac1a
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 94ed813..c33d19d 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -435,7 +435,6 @@
// This just indicates the window the input method is on top of, not
// necessarily the window its input is going to.
WindowState mInputMethodTarget = null;
- WindowState mUpcomingInputMethodTarget = null;
boolean mInputMethodTargetWaitingAnim;
int mInputMethodAnimLayerAdjustment;
@@ -1337,7 +1336,20 @@
}
}
- mUpcomingInputMethodTarget = w;
+ // Now, a special case -- if the last target's window is in the
+ // process of exiting, and is above the new target, keep on the
+ // last target to avoid flicker. Consider for example a Dialog with
+ // the IME shown: when the Dialog is dismissed, we want to keep
+ // the IME above it until it is completely gone so it doesn't drop
+ // behind the dialog or its full-screen scrim.
+ if (mInputMethodTarget != null && w != null
+ && mInputMethodTarget.isDisplayedLw()
+ && mInputMethodTarget.mExiting) {
+ if (mInputMethodTarget.mAnimLayer > w.mAnimLayer) {
+ w = mInputMethodTarget;
+ i = localmWindows.indexOf(w);
+ }
+ }
if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Desired input method target="
+ w + " willMove=" + willMove);
@@ -1626,7 +1638,7 @@
}
imPos = tmpRemoveWindowLocked(imPos, imWin);
if (DEBUG_INPUT_METHOD) {
- Slog.v(TAG, "List after moving with new pos " + imPos + ":");
+ Slog.v(TAG, "List after removing with new pos " + imPos + ":");
logWindowList(" ");
}
imWin.mTargetAppToken = mInputMethodTarget.mAppToken;