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 75f1337b9388a..7f309e1974e14 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -102,28 +102,59 @@ fun FlickerTestParameter.statusBarLayerIsVisible() { } } -fun FlickerTestParameter.navBarLayerRotatesAndScales() { +/** + * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start + * of the SF trace + */ +fun FlickerTestParameter.navBarLayerPositionStart() { assertLayersStart { val display = this.entry.displays.minByOrNull { it.id } - ?: throw RuntimeException("There is no display!") - this.visibleRegion(FlickerComponentName.NAV_BAR) - .coversExactly(WindowUtils.getNavigationBarPosition(display)) - } - assertLayersEnd { - val display = this.entry.displays.minByOrNull { it.id } - ?: throw RuntimeException("There is no display!") + ?: throw RuntimeException("There is no display!") this.visibleRegion(FlickerComponentName.NAV_BAR) .coversExactly(WindowUtils.getNavigationBarPosition(display)) } } -fun FlickerTestParameter.statusBarLayerRotatesScales() { +/** + * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the end + * of the SF trace + */ +fun FlickerTestParameter.navBarLayerPositionEnd() { + assertLayersEnd { + val display = this.entry.displays.minByOrNull { it.id } + ?: throw RuntimeException("There is no display!") + this.visibleRegion(FlickerComponentName.NAV_BAR) + .coversExactly(WindowUtils.getNavigationBarPosition(display)) + } +} + +/** + * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start + * and end of the SF trace + */ +fun FlickerTestParameter.navBarLayerRotatesAndScales() { + navBarLayerPositionStart() + navBarLayerPositionEnd() +} + +/** + * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start + * of the SF trace + */ +fun FlickerTestParameter.statusBarLayerPositionStart() { assertLayersStart { val display = this.entry.displays.minByOrNull { it.id } ?: throw RuntimeException("There is no display!") this.visibleRegion(FlickerComponentName.STATUS_BAR) .coversExactly(WindowUtils.getStatusBarPosition(display)) } +} + +/** + * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the end + * of the SF trace + */ +fun FlickerTestParameter.statusBarLayerPositionEnd() { assertLayersEnd { val display = this.entry.displays.minByOrNull { it.id } ?: throw RuntimeException("There is no display!") @@ -132,6 +163,15 @@ fun FlickerTestParameter.statusBarLayerRotatesScales() { } } +/** + * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start + * and end of the SF trace + */ +fun FlickerTestParameter.statusBarLayerRotatesScales() { + statusBarLayerPositionStart() + statusBarLayerPositionEnd() +} + /** * Asserts that: * [originalLayer] is visible at the start of the trace diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt index 8daf4ca696bf3..44188e8e5808e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt @@ -31,6 +31,8 @@ import org.junit.runners.Parameterized /** * Test cold launching an app from a notification from the lock screen. * + * This test assumes the device doesn't have AOD enabled + * * To run this test: `atest FlickerTests:OpenAppFromLockNotificationCold` */ @RequiresDevice diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt index 8eb182a9fa319..87e2c3fad3ea5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt @@ -33,6 +33,8 @@ import org.junit.runners.Parameterized /** * Test warm launching an app from a notification from the lock screen. * + * This test assumes the device doesn't have AOD enabled + * * To run this test: `atest FlickerTests:OpenAppFromLockNotificationWarm` */ @RequiresDevice diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockTransition.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockTransition.kt index f47e2726e6ad9..fe80162b5b819 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockTransition.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockTransition.kt @@ -20,6 +20,7 @@ import android.platform.test.annotations.Presubmit import androidx.test.filters.FlakyTest import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.dsl.FlickerBuilder +import com.android.server.wm.flicker.navBarLayerPositionEnd import com.android.server.wm.traces.common.FlickerComponentName import org.junit.Test @@ -99,4 +100,27 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) @FlakyTest(bugId = 203538234) @Test override fun appWindowBecomesVisible() = super.appWindowBecomesVisible() + + /** + * Checks the position of the navigation bar at the start and end of the transition + * + * Differently from the normal usage of this assertion, check only the final state of the + * transition because the display is off at the start and the NavBar is never visible + */ + @Presubmit + @Test + override fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd() + + /** + * Checks that the status bar layer is visible at the end of the trace + * + * It is not possible to check at the start because the screen is off + */ + @Presubmit + @Test + override fun statusBarLayerIsVisible() { + testSpec.assertLayersEnd { + this.isVisible(FlickerComponentName.STATUS_BAR) + } + } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationCold.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationCold.kt index ee018ecfd25a6..5022dd8f9bffd 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationCold.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationCold.kt @@ -32,6 +32,8 @@ import org.junit.runners.Parameterized /** * Test cold launching an app from a notification. * + * This test assumes the device doesn't have AOD enabled + * * To run this test: `atest FlickerTests:OpenAppFromNotificationCold` */ @RequiresDevice 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 74f1fd781a51c..af9eaa56dd524 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 @@ -40,6 +40,8 @@ import org.junit.runners.Parameterized /** * Test cold launching an app from a notification. * + * This test assumes the device doesn't have AOD enabled + * * To run this test: `atest FlickerTests:OpenAppFromNotificationWarm` */ @RequiresDevice diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt index f357177aade2d..55eb3c3d1a0af 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppNonResizeableTest.kt @@ -16,6 +16,7 @@ package com.android.server.wm.flicker.launch +import android.platform.test.annotations.Postsubmit import androidx.test.filters.FlakyTest import android.platform.test.annotations.Presubmit import android.platform.test.annotations.RequiresDevice @@ -27,6 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.helpers.NonResizeableAppHelper import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.flicker.navBarLayerPositionEnd import com.android.server.wm.traces.common.FlickerComponentName import org.junit.FixMethodOrder import org.junit.Test @@ -37,6 +39,8 @@ import org.junit.runners.Parameterized /** * Test launching an app while the device is locked * + * This test assumes the device doesn't have AOD enabled + * * To run this test: `atest FlickerTests:OpenAppNonResizeableTest` * * Actions: @@ -103,8 +107,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) /** * Checks that the status bar layer is visible at the end of the trace * - * It is not possible to check at the start because the animation is working differently - * in devices with and without blur (b/202936526) + * It is not possible to check at the start because the screen is off */ @Presubmit @Test @@ -115,7 +118,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) } /** {@inheritDoc} */ - @FlakyTest(bugId = 202936526) + @FlakyTest(bugId = 206753786) @Test override fun statusBarLayerRotatesScales() = super.statusBarLayerRotatesScales() @@ -131,10 +134,15 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) } } - /** {@inheritDoc} */ - @FlakyTest + /** + * Checks the position of the navigation bar at the start and end of the transition + * + * Differently from the normal usage of this assertion, check only the final state of the + * transition because the display is off at the start and the NavBar is never visible + */ + @Postsubmit @Test - override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales() + override fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd() /** {@inheritDoc} */ @FlakyTest