Merge changes Iae65d604,I3024443c into sc-v2-dev
* changes: Fix IME flicker when switching recents tasks Consolidate DisplayContent#assignRelativeLayerForIme
This commit is contained in:
committed by
Android (Google) Code Review
commit
881f90dede
@@ -121,6 +121,7 @@ import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY;
|
|||||||
import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA;
|
import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA;
|
||||||
import static com.android.server.wm.DisplayContentProto.SCREEN_ROTATION_ANIMATION;
|
import static com.android.server.wm.DisplayContentProto.SCREEN_ROTATION_ANIMATION;
|
||||||
import static com.android.server.wm.DisplayContentProto.SLEEP_TOKENS;
|
import static com.android.server.wm.DisplayContentProto.SLEEP_TOKENS;
|
||||||
|
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
|
||||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
||||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
|
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
|
||||||
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
|
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
|
||||||
@@ -5025,15 +5026,21 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// Keep IME window in surface parent as long as app's starting window
|
// Keep IME window in surface parent as long as app's starting window
|
||||||
// exists so it get's layered above the starting window.
|
// exists so it get's layered above the starting window.
|
||||||
if (imeTarget != null && !(imeTarget.mActivityRecord != null
|
if (imeTarget != null && !(imeTarget.mActivityRecord != null
|
||||||
&& imeTarget.mActivityRecord.hasStartingWindow()) && (
|
&& imeTarget.mActivityRecord.hasStartingWindow())) {
|
||||||
!(imeTarget.inMultiWindowMode()
|
final boolean canImeTargetSetRelativeLayer = imeTarget.getSurfaceControl() != null
|
||||||
|| imeTarget.mToken.isAppTransitioning()) && (
|
&& imeTarget == mImeControlTarget
|
||||||
imeTarget.getSurfaceControl() != null))) {
|
&& !imeTarget.inMultiWindowMode()
|
||||||
|
&& imeTarget.mToken.getActivity(app -> app.isAnimating(TRANSITION | PARENTS,
|
||||||
|
ANIMATION_TYPE_ALL & ~ANIMATION_TYPE_RECENTS)) == null;
|
||||||
|
if (canImeTargetSetRelativeLayer) {
|
||||||
mImeWindowsContainer.assignRelativeLayer(t, imeTarget.getSurfaceControl(),
|
mImeWindowsContainer.assignRelativeLayer(t, imeTarget.getSurfaceControl(),
|
||||||
// TODO: We need to use an extra level on the app surface to ensure
|
// TODO: We need to use an extra level on the app surface to ensure
|
||||||
// this is always above SurfaceView but always below attached window.
|
// this is always above SurfaceView but always below attached window.
|
||||||
1, forceUpdate);
|
1, forceUpdate);
|
||||||
} else if (mInputMethodSurfaceParent != null) {
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mInputMethodSurfaceParent != null) {
|
||||||
// The IME surface parent may not be its window parent's surface
|
// The IME surface parent may not be its window parent's surface
|
||||||
// (@see #computeImeParent), so set relative layer here instead of letting the window
|
// (@see #computeImeParent), so set relative layer here instead of letting the window
|
||||||
// parent to assign layer.
|
// parent to assign layer.
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
|||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
|
||||||
|
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
|
||||||
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
|
||||||
@@ -38,10 +40,12 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
|
|||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
|
||||||
|
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
|
||||||
import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER;
|
import static com.android.server.wm.WindowStateAnimator.PRESERVED_SURFACE_LAYER;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -294,6 +298,7 @@ public class ZOrderingTests extends WindowTestsBase {
|
|||||||
final WindowState appAboveImeTarget = createWindow("appAboveImeTarget");
|
final WindowState appAboveImeTarget = createWindow("appAboveImeTarget");
|
||||||
|
|
||||||
mDisplayContent.setImeLayeringTarget(imeAppTarget);
|
mDisplayContent.setImeLayeringTarget(imeAppTarget);
|
||||||
|
mDisplayContent.setImeControlTarget(imeAppTarget);
|
||||||
mDisplayContent.assignChildLayers(mTransaction);
|
mDisplayContent.assignChildLayers(mTransaction);
|
||||||
|
|
||||||
// Ime should be above all app windows except for non-fullscreen app window above it and
|
// Ime should be above all app windows except for non-fullscreen app window above it and
|
||||||
@@ -340,6 +345,7 @@ public class ZOrderingTests extends WindowTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void testAssignWindowLayers_ForStatusBarImeTarget() {
|
public void testAssignWindowLayers_ForStatusBarImeTarget() {
|
||||||
mDisplayContent.setImeLayeringTarget(mStatusBarWindow);
|
mDisplayContent.setImeLayeringTarget(mStatusBarWindow);
|
||||||
|
mDisplayContent.setImeControlTarget(mStatusBarWindow);
|
||||||
mDisplayContent.assignChildLayers(mTransaction);
|
mDisplayContent.assignChildLayers(mTransaction);
|
||||||
|
|
||||||
assertWindowHigher(mImeWindow, mChildAppWindowAbove);
|
assertWindowHigher(mImeWindow, mChildAppWindowAbove);
|
||||||
@@ -399,6 +405,31 @@ public class ZOrderingTests extends WindowTestsBase {
|
|||||||
assertWindowHigher(statusBarSubPanel, statusBarPanel);
|
assertWindowHigher(statusBarSubPanel, statusBarPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssignWindowLayers_ForImeOnAppWithRecentsAnimating() {
|
||||||
|
final WindowState imeAppTarget = createWindow(null, TYPE_APPLICATION,
|
||||||
|
mAppWindow.mActivityRecord, "imeAppTarget");
|
||||||
|
mDisplayContent.setImeInputTarget(imeAppTarget);
|
||||||
|
mDisplayContent.setImeLayeringTarget(imeAppTarget);
|
||||||
|
mDisplayContent.setImeControlTarget(imeAppTarget);
|
||||||
|
mDisplayContent.updateImeParent();
|
||||||
|
|
||||||
|
// Simulate the ime layering target task is animating with recents animation.
|
||||||
|
final Task imeAppTargetTask = imeAppTarget.getTask();
|
||||||
|
final SurfaceAnimator imeTargetTaskAnimator = imeAppTargetTask.mSurfaceAnimator;
|
||||||
|
spyOn(imeTargetTaskAnimator);
|
||||||
|
doReturn(ANIMATION_TYPE_RECENTS).when(imeTargetTaskAnimator).getAnimationType();
|
||||||
|
doReturn(true).when(imeTargetTaskAnimator).isAnimating();
|
||||||
|
|
||||||
|
mDisplayContent.assignChildLayers(mTransaction);
|
||||||
|
|
||||||
|
// Ime should on top of the application window when in recents animation and keep
|
||||||
|
// attached on app.
|
||||||
|
assertTrue(mDisplayContent.shouldImeAttachedToApp());
|
||||||
|
assertWindowHigher(mImeWindow, imeAppTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAssignWindowLayers_ForNegativelyZOrderedSubtype() {
|
public void testAssignWindowLayers_ForNegativelyZOrderedSubtype() {
|
||||||
// TODO(b/70040778): We should aim to eliminate the last user of TYPE_APPLICATION_MEDIA
|
// TODO(b/70040778): We should aim to eliminate the last user of TYPE_APPLICATION_MEDIA
|
||||||
|
|||||||
Reference in New Issue
Block a user