summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ming-Shin Lu <lumark@google.com> 2022-03-30 20:51:35 +0800
committer Ming-Shin Lu <lumark@google.com> 2022-03-30 22:43:44 +0800
commit2ebbf7937435b2915304ca77d814b70ee39e40e3 (patch)
tree860fcee51699e31136eca44b51499a1a6143d729
parentd8ea5df38154bfed206cebe288eba385b76e89a4 (diff)
Fix seeing a weird window animation above TaskFragment transition
As DC#assignRelativeLayerForImeTargetChild will set relative layer for non-IME focusable window to relatively above IME layer. This layering setting could have a UI issue that during a side-by-side TaskFragment changing transition, will see a weird animation that non-IME focusable window is animating with being shifted position on top of the TaskFragment. In case seeing the window is animating above the app transition layer because its relative layer is above the IME container on the display area but actually not necessary, Add a check to not set the window to be relatively above IME if the IME is not visible. Fix: 225363555 Test: atest WindowStateTests ZOrderingTests Test: manual as issue steps by using Google chat app with enabling window extensions and side car library configuration on the device, and verify if any weird window animation during launching in-call activity fragment. Change-Id: I641f54e18a18997f86779a355a23b17421fb35ec
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java7
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java2
3 files changed, 12 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 7bf7295fd2cb..832a823c03e7 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -5677,6 +5677,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return false;
}
+ // We don't need to set the window to be relatively above IME if the IME is not visible.
+ // In case seeing the window is animating above the app transition layer because its
+ // relative layer is above the IME container on the display area but actually not necessary.
+ if (!getDisplayContent().getImeContainer().isVisible()) {
+ return false;
+ }
+
if (isChildWindow()) {
// If we are a child of the input method target we need this promotion.
if (getParentWindow().isImeLayeringTarget()) {
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
index bb0c7f7000ab..fcaaec59be76 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -855,12 +855,13 @@ public class WindowStateTests extends WindowTestsBase {
assertTrue(mAtm.mActiveUids.hasNonAppVisibleWindow(uid));
}
- @UseTestDisplay(addWindows = W_ACTIVITY)
+ @UseTestDisplay(addWindows = {W_ACTIVITY, W_INPUT_METHOD})
@Test
public void testNeedsRelativeLayeringToIme_notAttached() {
WindowState sameTokenWindow = createWindow(null, TYPE_BASE_APPLICATION, mAppWindow.mToken,
"SameTokenWindow");
mDisplayContent.setImeLayeringTarget(mAppWindow);
+ makeWindowVisible(mImeWindow);
sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
assertTrue(sameTokenWindow.needsRelativeLayeringToIme());
sameTokenWindow.removeImmediately();
@@ -873,6 +874,7 @@ public class WindowStateTests extends WindowTestsBase {
WindowState sameTokenWindow = createWindow(null, TYPE_APPLICATION_STARTING,
mAppWindow.mToken, "SameTokenWindow");
mDisplayContent.setImeLayeringTarget(mAppWindow);
+ makeWindowVisible(mImeWindow);
sameTokenWindow.mActivityRecord.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
assertFalse(sameTokenWindow.needsRelativeLayeringToIme());
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
index 0f223ca037ee..2df1d23c0497 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java
@@ -274,6 +274,7 @@ public class ZOrderingTests extends WindowTestsBase {
"imeAppTargetChildBelowWindow");
mDisplayContent.setImeLayeringTarget(imeAppTarget);
+ makeWindowVisible(mImeWindow);
mDisplayContent.assignChildLayers(mTransaction);
// Ime should be above all app windows except for child windows that are z-ordered above it
@@ -599,6 +600,7 @@ public class ZOrderingTests extends WindowTestsBase {
WINDOWING_MODE_MULTI_WINDOW);
mDisplayContent.setImeLayeringTarget(mAppWindow);
mDisplayContent.setImeInputTarget(mAppWindow);
+ makeWindowVisible(mImeWindow);
// Create a popupWindow
assertWindowHigher(mImeWindow, mAppWindow);