From 18e6c2e5db615e536da73bb344805403972853f0 Mon Sep 17 00:00:00 2001 From: chaviw Date: Tue, 31 Mar 2020 15:35:44 -0700 Subject: [PATCH] Added test for isAnimating bug Fixes: 152657145 Test: WindowContainerTests#testIsAnimating_typesToCheck Change-Id: Id2b99e6d50ae1ee6cc8df870077cb542b2127601 --- .../com/android/server/wm/WindowContainerTests.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java index 3059b17204bc9..21f69c2239e8a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java @@ -21,6 +21,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; +import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.TRANSIT_TASK_OPEN; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; @@ -438,6 +439,18 @@ public class WindowContainerTests extends WindowTestsBase { assertTrue(child.isAnimating(PARENTS)); assertTrue(child.isAnimating(PARENTS, ANIMATION_TYPE_APP_TRANSITION)); assertFalse(child.isAnimating(PARENTS, ANIMATION_TYPE_SCREEN_ROTATION)); + + final WindowState windowState = createWindow(null /* parent */, TYPE_BASE_APPLICATION, + mDisplayContent, "TestWindowState"); + WindowContainer parent = windowState.getParent(); + spyOn(windowState.mSurfaceAnimator); + doReturn(true).when(windowState.mSurfaceAnimator).isAnimating(); + doReturn(ANIMATION_TYPE_APP_TRANSITION).when( + windowState.mSurfaceAnimator).getAnimationType(); + assertTrue(parent.isAnimating(CHILDREN)); + + windowState.setControllableInsetProvider(mock(InsetsSourceProvider.class)); + assertFalse(parent.isAnimating(CHILDREN)); } @Test