OSDN Git Service

Keep IME target till window is closing and not removed
authorTarandeep Singh <tarandeep@google.com>
Thu, 28 Mar 2019 21:08:58 +0000 (14:08 -0700)
committerTarandeep Singh <tarandeep@google.com>
Thu, 28 Mar 2019 22:50:57 +0000 (15:50 -0700)
Issue:
When current IME target window has IME open and user navigates
to next window, IME target is set to next window
(unless it's isActivityTypeHome).
This causes IME to be reparented to the next window. This next window may
not have an editor and IME will be dismissed.
This causes flicker: IME animating out as next window is animating-in.

The fix:
If we hold on to IME target till last IME target is closing and
not removed, the flicker can be prevented.

The restriction for isActivityTypeHome() was originally added for bug 78214125
which made sense prior to reparenting.

Fix: 129270541
Test: 1. Manually tested steps in bug and flickering was not observed.
      2. Verified with next window having IME up (stateAlwaysVisible).
         No noticeable change.
      3. also ran go/wm-smoke-auto

Change-Id: I016c1e4549cf03c09cf1a30a91bd55fdb2587075

services/core/java/com/android/server/wm/DisplayContent.java

index 0c34e25..85dd8b3 100644 (file)
@@ -3219,13 +3219,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                 "Proposed new IME target: " + target + " for display: " + getDisplayId());
 
         // Now, a special case -- if the last target's window is in the process of exiting, but
-        // not removed, and the new target is home, keep on the last target to avoid flicker.
-        // Home is a special case since its above other stacks in the ordering list, but layed
-        // out below the others.
+        // not removed, keep on the last target to avoid IME flicker.
         if (curTarget != null && !curTarget.mRemoved && curTarget.isDisplayedLw()
-                && curTarget.isClosing() && (target == null || target.isActivityTypeHome())) {
-            if (DEBUG_INPUT_METHOD) Slog.v(TAG_WM, "New target is home while current target is "
-                    + "closing, not changing");
+                && curTarget.isClosing()) {
+            if (DEBUG_INPUT_METHOD) Slog.v(TAG_WM, "Not changing target till current window is"
+                    + " closing and not removed");
             return curTarget;
         }