diff --git a/libs/WindowManager/Shell/tests/flicker/Android.bp b/libs/WindowManager/Shell/tests/flicker/Android.bp index 3ca5b9c38aff7..3bbe7ea056b42 100644 --- a/libs/WindowManager/Shell/tests/flicker/Android.bp +++ b/libs/WindowManager/Shell/tests/flicker/Android.bp @@ -45,6 +45,8 @@ android_test { "app-helpers-core", "launcher-helper-lib", "launcher-aosp-tapl", + "systemui-tapl", + "systemui-helper", "wm-flicker-common-assertions", "wm-flicker-common-app-helpers", "platform-test-annotations", diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt index 293eb7cd55810..3f2027a8c09e3 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/bubble/LaunchBubbleFromLockScreen.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.bubble +import android.platform.systemui_tapl.controller.LockscreenController import android.platform.test.annotations.FlakyTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit @@ -46,18 +47,23 @@ import org.junit.runners.Parameterized @Group4 class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen(testSpec) { + private val lockScreen = LockscreenController.get() + /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = buildTransition { setup { + test { + lockScreen.setUnlockSwipe() + } eachRun { val addBubbleBtn = waitAndGetAddBubbleBtn() addBubbleBtn?.click() ?: error("Bubble widget not found") - device.sleep() + lockScreen.lockScreen() wmHelper.StateSyncBuilder() - .withoutTopVisibleAppWindows() + .withKeyguardShowing() .waitForAndVerify() - device.wakeUp() + lockScreen.turnScreenOn() } } transitions { @@ -70,8 +76,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr or WindowInsets.Type.displayCutout() ) device.swipe(100, insets.top + 100, 100, device.displayHeight / 2, 4) - device.waitForIdle(2000) - instrumentation.uiAutomation.syncInputTransactions() + wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() val notification = device.wait( Until.findObject( @@ -79,14 +84,14 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr ), FIND_OBJECT_TIMEOUT ) notification?.click() ?: error("Notification not found") - instrumentation.uiAutomation.syncInputTransactions() + wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() val showBubble = device.wait( Until.findObject( By.res("com.android.systemui", "bubble_view") ), FIND_OBJECT_TIMEOUT ) showBubble?.click() ?: error("Bubble notify not found") - instrumentation.uiAutomation.syncInputTransactions() + wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify() val cancelAllBtn = waitAndGetCancelAllBtn() cancelAllBtn?.click() ?: error("Cancel widget not found") } diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index 855d3c1f4ea7d..714f22e73c903 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -45,6 +45,8 @@ android_test { "truth-prebuilt", "launcher-helper-lib", "launcher-aosp-tapl", + "systemui-tapl", + "systemui-helper", "platform-test-annotations", "wm-flicker-window-extensions", ], 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 bfc7b39f9d9fc..5715cfcd1daf5 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 @@ -16,6 +16,7 @@ package com.android.server.wm.flicker.launch +import android.platform.systemui_tapl.controller.LockscreenController import android.platform.test.annotations.FlakyTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.RequiresDevice @@ -50,6 +51,8 @@ import org.junit.runners.Parameterized open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) : OpenAppFromNotificationCold(testSpec) { + private val lockScreen = LockscreenController.get() + override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit @@ -57,7 +60,7 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) : // Needs to run at start of transition, // so before the transition defined in super.transition transitions { - device.wakeUp() + lockScreen.turnScreenOn() } super.transition(this) @@ -65,9 +68,9 @@ open class OpenAppFromLockNotificationCold(testSpec: FlickerTestParameter) : // Needs to run at the end of the setup, so after the setup defined in super.transition setup { eachRun { - device.sleep() + lockScreen.lockScreen() wmHelper.StateSyncBuilder() - .withoutTopVisibleAppWindows() + .withKeyguardShowing() .waitForAndVerify() } } 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 e517c2ad2c49e..e65cecb124700 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 @@ -16,9 +16,9 @@ package com.android.server.wm.flicker.launch +import android.platform.systemui_tapl.controller.LockscreenController import android.platform.test.annotations.FlakyTest import android.platform.test.annotations.Postsubmit -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 @@ -52,6 +52,8 @@ import org.junit.runners.Parameterized open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) : OpenAppFromNotificationWarm(testSpec) { + private val lockScreen = LockscreenController.get() + override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit @@ -59,7 +61,7 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) : // Needs to run at start of transition, // so before the transition defined in super.transition transitions { - device.wakeUp() + lockScreen.turnScreenOn() } super.transition(this) @@ -67,9 +69,9 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) : // Needs to run at the end of the setup, so after the setup defined in super.transition setup { eachRun { - device.sleep() + lockScreen.lockScreen() wmHelper.StateSyncBuilder() - .withoutTopVisibleAppWindows() + .withKeyguardShowing() .waitForAndVerify() } } @@ -193,7 +195,7 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) : super.appWindowIsTopWindowAtEnd() /** {@inheritDoc} */ - @Presubmit + @Postsubmit @Test override fun appWindowBecomesTopWindow_ShellTransit() = super.appWindowBecomesTopWindow_ShellTransit() diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt index 75311eaf5c66a..2eedc280b637b 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt @@ -16,6 +16,7 @@ package com.android.server.wm.flicker.launch +import android.platform.systemui_tapl.controller.LockscreenController import android.platform.test.annotations.FlakyTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.RequiresDevice @@ -25,7 +26,6 @@ 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.ShowWhenLockedAppHelper -import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.traces.common.ComponentNameMatcher import org.junit.FixMethodOrder import org.junit.Test @@ -49,6 +49,7 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet OpenAppFromLockNotificationCold(testSpec) { private val showWhenLockedApp: ShowWhenLockedAppHelper = ShowWhenLockedAppHelper(instrumentation) + private val lockScreen = LockscreenController.get() // Although we are technically still locked here, the overlay app means we should open the // notification shade as if we were unlocked. @@ -60,7 +61,7 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet setup { eachRun { - device.wakeUpAndGoToHomeScreen() + lockScreen.turnScreenOn() // Launch an activity that is shown when the device is locked showWhenLockedApp.launchViaIntent(wmHelper) @@ -68,9 +69,9 @@ class OpenAppFromLockNotificationWithLockOverlayApp(testSpec: FlickerTestParamet .withFullScreenApp(showWhenLockedApp) .waitForAndVerify() - device.sleep() + lockScreen.lockScreen() wmHelper.StateSyncBuilder() - .withoutTopVisibleAppWindows() + .withKeyguardShowing() .waitForAndVerify() } } 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 ecc60b8d45c02..1f7fbfb927cb6 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 @@ -16,6 +16,7 @@ package com.android.server.wm.flicker.launch +import android.platform.systemui_tapl.controller.LockscreenController import android.platform.test.annotations.FlakyTest import android.platform.test.annotations.Presubmit import com.android.server.wm.flicker.FlickerTestParameter @@ -33,16 +34,20 @@ import org.junit.Test abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) : OpenAppTransition(testSpec) { + protected val lockScreen = LockscreenController.get() /** * Defines the transition used to run the test */ override val transition: FlickerBuilder.() -> Unit = { super.transition(this) setup { + test { + lockScreen.setUnlockSwipe() + } eachRun { - device.sleep() + lockScreen.lockScreen() wmHelper.StateSyncBuilder() - .withoutTopVisibleAppWindows() + .withKeyguardShowing() .waitForAndVerify() } } @@ -91,8 +96,8 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter) : @Presubmit @Test fun screenLockedStart() { - testSpec.assertLayersStart { - isEmpty() + testSpec.assertWmStart { + isKeyguardShowing() } } 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 53be7d43cce82..1de1f9a3b422d 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 @@ -27,6 +27,7 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.FlickerServiceCompatible import com.android.server.wm.flicker.annotation.Group1 +import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.NonResizeableAppHelper import com.android.server.wm.flicker.statusBarLayerPositionAtEnd import com.android.server.wm.traces.common.ComponentNameMatcher @@ -67,6 +68,17 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppFromLockTransition(testSpec) { override val testApp = NonResizeableAppHelper(instrumentation) + override val transition: FlickerBuilder.() -> Unit = { + super.transition(this) + setup { + eachRun { + lockScreen.turnScreenOff() + wmHelper.StateSyncBuilder() + .withoutTopVisibleAppWindows() + .waitForAndVerify() + } + } + } /** * Checks that the [ComponentMatcher.NAV_BAR] layer starts invisible, becomes visible during * unlocking animation and remains visible at the end