From 4227fe30cb701a42903b801e5696af5f79aa8270 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Tue, 16 Aug 2022 14:08:22 +0000 Subject: [PATCH] Fix nav bar window visibility check on quick switch The nav bar becomes invisible during animation. check only start and end now Fixes: 241917511 Test: atest FlickerTests Change-Id: I453d7703aec5dcbdec1da71ffb7e7fb4763eb334 --- .../server/wm/flicker/CommonAssertions.kt | 13 ++++++++++++ ...eWindowsFromGestureNavTest_ShellTransit.kt | 20 +++++++++++++++++++ ...itchBetweenTwoAppsBackTest_ShellTransit.kt | 20 +++++++++++++++++++ ...hBetweenTwoAppsForwardTest_ShellTransit.kt | 20 +++++++++++++++++++ .../QuickSwitchFromLauncherTest.kt | 19 ++++++++++++++++++ 5 files changed, 92 insertions(+) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt index 5e21252f3ebd2..472a0fa376bfa 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -42,6 +42,19 @@ fun FlickerTestParameter.navBarWindowIsAlwaysVisible() { } } +/** + * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start + * and end of the WM trace + */ +fun FlickerTestParameter.navBarWindowIsVisibleAtStartAndEnd() { + assertWmStart { + this.isAboveAppWindowVisible(ComponentMatcher.NAV_BAR) + } + assertWmEnd { + this.isAboveAppWindowVisible(ComponentMatcher.NAV_BAR) + } +} + /** * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in * all WM trace entries diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest_ShellTransit.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest_ShellTransit.kt index 457e973392f71..a8c0a0b550096 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest_ShellTransit.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/SwitchImeWindowsFromGestureNavTest_ShellTransit.kt @@ -17,14 +17,18 @@ package com.android.server.wm.flicker.ime import android.platform.test.annotations.FlakyTest +import android.platform.test.annotations.Presubmit import androidx.test.filters.RequiresDevice import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.annotation.Group4 import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled +import com.android.server.wm.flicker.navBarWindowIsVisibleAtStartAndEnd +import com.android.server.wm.traces.common.ComponentMatcher import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -65,4 +69,20 @@ class SwitchImeWindowsFromGestureNavTest_ShellTransit( @Test override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() + + /** {@inheritDoc} */ + @Ignore("Nav bar window becomes invisible during quick switch") + @Test + override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible() + + /** + * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start + * and end of the WM trace + */ + @Presubmit + @Test + fun navBarWindowIsVisibleAtStartAndEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.navBarWindowIsVisibleAtStartAndEnd() + } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest_ShellTransit.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest_ShellTransit.kt index e007fe3549947..2607ee5bb0efc 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest_ShellTransit.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsBackTest_ShellTransit.kt @@ -17,14 +17,18 @@ package com.android.server.wm.flicker.quickswitch import android.platform.test.annotations.FlakyTest +import android.platform.test.annotations.Presubmit import android.platform.test.annotations.RequiresDevice import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled +import com.android.server.wm.flicker.navBarWindowIsVisibleAtStartAndEnd +import com.android.server.wm.traces.common.ComponentMatcher import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -76,4 +80,20 @@ open class QuickSwitchBetweenTwoAppsBackTest_ShellTransit( @Test override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() + + /** {@inheritDoc} */ + @Ignore("Nav bar window becomes invisible during quick switch") + @Test + override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible() + + /** + * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start + * and end of the WM trace + */ + @Presubmit + @Test + fun navBarWindowIsVisibleAtStartAndEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.navBarWindowIsVisibleAtStartAndEnd() + } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest_ShellTransit.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest_ShellTransit.kt index 6f78ba8dc0f65..27ae12566e94c 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest_ShellTransit.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchBetweenTwoAppsForwardTest_ShellTransit.kt @@ -17,14 +17,18 @@ package com.android.server.wm.flicker.quickswitch import android.platform.test.annotations.FlakyTest +import android.platform.test.annotations.Presubmit import android.platform.test.annotations.RequiresDevice import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled +import com.android.server.wm.flicker.navBarWindowIsVisibleAtStartAndEnd +import com.android.server.wm.traces.common.ComponentMatcher import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -66,4 +70,20 @@ open class QuickSwitchBetweenTwoAppsForwardTest_ShellTransit( @FlakyTest(bugId = 228009808) @Test override fun endsWithApp2BeingOnTop() = super.endsWithApp2BeingOnTop() + + /** {@inheritDoc} */ + @Ignore("Nav bar window becomes invisible during quick switch") + @Test + override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible() + + /** + * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start + * and end of the WM trace + */ + @Presubmit + @Test + fun navBarWindowIsVisibleAtStartAndEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.navBarWindowIsVisibleAtStartAndEnd() + } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt index 510043b680e51..c79b55251c74f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt @@ -29,9 +29,12 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.SimpleAppHelper +import com.android.server.wm.flicker.navBarWindowIsVisibleAtStartAndEnd import com.android.server.wm.traces.common.ComponentMatcher import com.android.server.wm.traces.common.Rect +import org.junit.Assume import org.junit.FixMethodOrder +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters @@ -296,6 +299,22 @@ class QuickSwitchFromLauncherTest(testSpec: FlickerTestParameter) : BaseTest(tes override fun visibleWindowsShownMoreThanOneConsecutiveEntry() = super.visibleWindowsShownMoreThanOneConsecutiveEntry() + /** {@inheritDoc} */ + @Ignore("Nav bar window becomes invisible during quick switch") + @Test + override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible() + + /** + * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start + * and end of the WM trace + */ + @Presubmit + @Test + fun navBarWindowIsVisibleAtStartAndEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.navBarWindowIsVisibleAtStartAndEnd() + } + companion object { /** {@inheritDoc} */ private var startDisplayBounds = Rect.EMPTY