From 36714cfbe964597493dd0a7127838be50b58622d Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Fri, 29 Jul 2022 09:38:18 +0000 Subject: [PATCH] Fix task bar assertions on tablets when screen is locked Fixes: 240662437 Test: atest FlickerTests Change-Id: If80aaccea7b65d9e6eb941e914ca6a7bef2afd5f --- .../com/android/server/wm/flicker/BaseTest.kt | 6 ++- .../server/wm/flicker/CommonAssertions.kt | 26 ++++++++++++ .../launch/OpenAppFromNotificationWarm.kt | 40 +++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/BaseTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/BaseTest.kt index e0ae19383b414..e138d332bb171 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/BaseTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/BaseTest.kt @@ -108,7 +108,8 @@ abstract class BaseTest @JvmOverloads constructor( } /** - * Checks that the [ComponentMatcher.TASK_BAR] layer is visible during the whole transition + * Checks that the [ComponentMatcher.TASK_BAR] window is visible at the start and end of the + * transition * * Note: Large screen only */ @@ -132,7 +133,8 @@ abstract class BaseTest @JvmOverloads constructor( } /** - * Checks that the [ComponentMatcher.STATUS_BAR] layer is visible during the whole transition + * Checks that the [ComponentMatcher.STATUS_BAR] layer is visible at the start and end + * of the transition */ @Presubmit @Test 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 d173b7250548c..5e21252f3ebd2 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -52,6 +52,16 @@ fun FlickerTestParameter.taskBarWindowIsAlwaysVisible() { } } +/** + * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in + * all WM trace entries + */ +fun FlickerTestParameter.taskBarWindowIsVisibleAtEnd() { + assertWmEnd { + this.isAboveAppWindowVisible(ComponentMatcher.TASK_BAR) + } +} + /** * If [allStates] is true, checks if the stack space of all displays is fully covered * by any visible layer, during the whole transitions @@ -103,9 +113,25 @@ fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() { * trace */ fun FlickerTestParameter.taskBarLayerIsVisibleAtStartAndEnd() { + this.taskBarLayerIsVisibleAtStart() + this.taskBarLayerIsVisibleAtEnd() +} + +/** + * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the start of the SF + * trace + */ +fun FlickerTestParameter.taskBarLayerIsVisibleAtStart() { assertLayersStart { this.isVisible(ComponentMatcher.TASK_BAR) } +} + +/** + * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the end of the SF + * trace + */ +fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() { assertLayersEnd { this.isVisible(ComponentMatcher.TASK_BAR) } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt index 6e3e74df01936..866e819bf5fc6 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt @@ -32,8 +32,12 @@ import com.android.server.wm.flicker.helpers.NotificationAppHelper import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.taskBarLayerIsVisibleAtEnd +import com.android.server.wm.flicker.taskBarWindowIsVisibleAtEnd +import com.android.server.wm.traces.common.ComponentMatcher 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 @@ -231,6 +235,42 @@ open class OpenAppFromNotificationWarm( super.appWindowBecomesTopWindow() } + /** + * Checks that the [ComponentMatcher.TASK_BAR] window is visible at the end of the transition + * + * Note: Large screen only + */ + @Postsubmit + @Test + open fun taskBarWindowIsVisibleAtEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.taskBarWindowIsVisibleAtEnd() + } + + /** + * Checks that the [ComponentMatcher.TASK_BAR] layer is visible at the end of the transition + * + * Note: Large screen only + */ + @Postsubmit + @Test + open fun taskBarLayerIsVisibleAtEnd() { + Assume.assumeFalse(testSpec.isTablet) + testSpec.taskBarLayerIsVisibleAtEnd() + } + + /** {@inheritDoc} */ + @Test + @Ignore("Display is locked at the start") + override fun taskBarWindowIsAlwaysVisible() = + super.taskBarWindowIsAlwaysVisible() + + /** {@inheritDoc} */ + @Test + @Ignore("Display is locked at the start") + override fun taskBarLayerIsVisibleAtStartAndEnd() = + super.taskBarLayerIsVisibleAtStartAndEnd() + companion object { /** * Creates the test configurations.