Loading tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt +10 −7 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen import androidx.test.filters.RequiresDevice import org.junit.ClassRule import org.junit.FixMethodOrder Loading @@ -49,21 +50,23 @@ import org.junit.runners.Parameterized open class OpenAppFromLockscreenNotificationColdTest(flicker: LegacyFlickerTest) : OpenAppFromNotificationColdTest(flicker) { override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit get() = { // Needs to run at start of transition, // so before the transition defined in super.transition transitions { device.wakeUp() } super.transition(this) transitions { device.wakeUp() openAppFromLockNotification() } // Needs to run at the end of the setup, so after the setup defined in super.transition setup { device.wakeUpAndGoToHomeScreen() launchAppAndPostNotification() clearOverview() device.sleep() wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { testApp.exit(wmHelper) } } /** {@inheritDoc} */ Loading tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt +8 −7 Original line number Diff line number Diff line Loading @@ -49,21 +49,22 @@ import org.junit.runners.Parameterized class OpenAppFromLockscreenNotificationWarmTest(flicker: LegacyFlickerTest) : OpenAppFromNotificationWarmTest(flicker) { override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit get() = { // Needs to run at start of transition, // so before the transition defined in super.transition transitions { device.wakeUp() } super.transition(this) transitions { device.wakeUp() openAppFromLockNotification() } // Needs to run at the end of the setup, so after the setup defined in super.transition setup { launchAppAndPostNotification() goHome() device.sleep() wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { testApp.exit(wmHelper) } } /** Loading tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt +11 −8 Original line number Diff line number Diff line Loading @@ -51,21 +51,21 @@ class OpenAppFromLockscreenNotificationWithOverlayAppTest(flicker: LegacyFlicker OpenAppFromLockscreenNotificationColdTest(flicker) { private val showWhenLockedApp = ShowWhenLockedAppHelper(instrumentation) // Although we are technically still locked here, the overlay app means we should open the // notification shade as if we were unlocked. override val openingNotificationsFromLockScreen = false override val transition: FlickerBuilder.() -> Unit get() = { super.transition(this) transitions { device.wakeUp() // Although we are technically still locked here, the overlay app means we should // open the // notification shade as if we were unlocked. openAppFromNotification() wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() } setup { device.wakeUpAndGoToHomeScreen() launchAppAndPostNotification() clearOverview() // Launch an activity that is shown when the device is locked showWhenLockedApp.launchViaIntent(wmHelper) wmHelper.StateSyncBuilder().withFullScreenApp(showWhenLockedApp).waitForAndVerify() Loading @@ -74,7 +74,10 @@ class OpenAppFromLockscreenNotificationWithOverlayAppTest(flicker: LegacyFlicker wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { showWhenLockedApp.exit(wmHelper) } teardown { testApp.exit(wmHelper) showWhenLockedApp.exit(wmHelper) } } @Test Loading tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt +10 −8 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.statusBarLayerPositionAtEnd import org.junit.FixMethodOrder import org.junit.Ignore Loading @@ -45,16 +47,16 @@ open class OpenAppFromNotificationColdTest(flicker: LegacyFlickerTest) : /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { super.transition(this) setup { // Close the app that posted the notification to trigger a cold start next time // it is open - can't just kill it because that would remove the notification. tapl.setExpectedRotationCheckEnabled(false) tapl.goHome() tapl.workspace.switchToOverview() tapl.overview.dismissAllTasks() device.wakeUpAndGoToHomeScreen() this.setRotation(flicker.scenario.startRotation) launchAppAndPostNotification() clearOverview() } transitions { openAppFromNotification() } teardown { testApp.exit(wmHelper) } } @Presubmit @Test override fun appWindowBecomesVisible() = appWindowBecomesVisible_coldStart() Loading tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt +51 −45 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.platform.test.annotations.Presubmit import android.tools.common.traces.component.ComponentNameMatcher import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.FlickerTestData import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen Loading Loading @@ -55,17 +56,28 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : OpenAppTransition(flicker) { override val testApp: NotificationAppHelper = NotificationAppHelper(instrumentation) open val openingNotificationsFromLockScreen = false /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { setup { device.wakeUpAndGoToHomeScreen() this.setRotation(flicker.scenario.startRotation) launchAppAndPostNotification() goHome() } transitions { openAppFromNotification() } teardown { testApp.exit(wmHelper) } } protected fun FlickerTestData.launchAppAndPostNotification() { testApp.launchViaIntent(wmHelper) wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() testApp.postNotification(wmHelper) } protected fun FlickerTestData.goHome() { device.pressHome() wmHelper .StateSyncBuilder() Loading @@ -73,12 +85,11 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : .withWindowSurfaceDisappeared(ComponentNameMatcher.NOTIFICATION_SHADE) .waitForAndVerify() } protected fun FlickerTestData.openAppFromNotification() { doOpenAppAndWait(startY = 10, endY = 3 * device.displayHeight / 4, steps = 25) } transitions { var startY = 10 var endY = 3 * device.displayHeight / 4 var steps = 25 if (openingNotificationsFromLockScreen) { protected fun FlickerTestData.openAppFromLockNotification() { val wm: WindowManager = instrumentation.context.getSystemService(WindowManager::class.java) ?: error("Unable to connect to WindowManager service") Loading @@ -88,11 +99,10 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : WindowInsets.Type.statusBars() or WindowInsets.Type.displayCutout() ) startY = insets.top + 100 endY = device.displayHeight / 2 steps = 4 doOpenAppAndWait(startY = insets.top + 100, endY = device.displayHeight / 2, steps = 4) } protected fun FlickerTestData.doOpenAppAndWait(startY: Int, endY: Int, steps: Int) { // Swipe down to show the notification shade val x = device.displayWidth / 2 device.swipe(x, startY, x, endY, steps) Loading @@ -108,10 +118,6 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : // Wait for the app to launch wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() } teardown { testApp.exit(wmHelper) } } @Presubmit @Test override fun appWindowBecomesVisible() = appWindowBecomesVisible_warmStart() @Presubmit @Test override fun appLayerBecomesVisible() = appLayerBecomesVisible_warmStart() Loading Loading
tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationColdTest.kt +10 −7 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen import androidx.test.filters.RequiresDevice import org.junit.ClassRule import org.junit.FixMethodOrder Loading @@ -49,21 +50,23 @@ import org.junit.runners.Parameterized open class OpenAppFromLockscreenNotificationColdTest(flicker: LegacyFlickerTest) : OpenAppFromNotificationColdTest(flicker) { override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit get() = { // Needs to run at start of transition, // so before the transition defined in super.transition transitions { device.wakeUp() } super.transition(this) transitions { device.wakeUp() openAppFromLockNotification() } // Needs to run at the end of the setup, so after the setup defined in super.transition setup { device.wakeUpAndGoToHomeScreen() launchAppAndPostNotification() clearOverview() device.sleep() wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { testApp.exit(wmHelper) } } /** {@inheritDoc} */ Loading
tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWarmTest.kt +8 −7 Original line number Diff line number Diff line Loading @@ -49,21 +49,22 @@ import org.junit.runners.Parameterized class OpenAppFromLockscreenNotificationWarmTest(flicker: LegacyFlickerTest) : OpenAppFromNotificationWarmTest(flicker) { override val openingNotificationsFromLockScreen = true override val transition: FlickerBuilder.() -> Unit get() = { // Needs to run at start of transition, // so before the transition defined in super.transition transitions { device.wakeUp() } super.transition(this) transitions { device.wakeUp() openAppFromLockNotification() } // Needs to run at the end of the setup, so after the setup defined in super.transition setup { launchAppAndPostNotification() goHome() device.sleep() wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { testApp.exit(wmHelper) } } /** Loading
tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromLockscreenNotificationWithOverlayAppTest.kt +11 −8 Original line number Diff line number Diff line Loading @@ -51,21 +51,21 @@ class OpenAppFromLockscreenNotificationWithOverlayAppTest(flicker: LegacyFlicker OpenAppFromLockscreenNotificationColdTest(flicker) { private val showWhenLockedApp = ShowWhenLockedAppHelper(instrumentation) // Although we are technically still locked here, the overlay app means we should open the // notification shade as if we were unlocked. override val openingNotificationsFromLockScreen = false override val transition: FlickerBuilder.() -> Unit get() = { super.transition(this) transitions { device.wakeUp() // Although we are technically still locked here, the overlay app means we should // open the // notification shade as if we were unlocked. openAppFromNotification() wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() } setup { device.wakeUpAndGoToHomeScreen() launchAppAndPostNotification() clearOverview() // Launch an activity that is shown when the device is locked showWhenLockedApp.launchViaIntent(wmHelper) wmHelper.StateSyncBuilder().withFullScreenApp(showWhenLockedApp).waitForAndVerify() Loading @@ -74,7 +74,10 @@ class OpenAppFromLockscreenNotificationWithOverlayAppTest(flicker: LegacyFlicker wmHelper.StateSyncBuilder().withoutTopVisibleAppWindows().waitForAndVerify() } teardown { showWhenLockedApp.exit(wmHelper) } teardown { testApp.exit(wmHelper) showWhenLockedApp.exit(wmHelper) } } @Test Loading
tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationColdTest.kt +10 −8 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.setRotation import com.android.server.wm.flicker.statusBarLayerPositionAtEnd import org.junit.FixMethodOrder import org.junit.Ignore Loading @@ -45,16 +47,16 @@ open class OpenAppFromNotificationColdTest(flicker: LegacyFlickerTest) : /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { super.transition(this) setup { // Close the app that posted the notification to trigger a cold start next time // it is open - can't just kill it because that would remove the notification. tapl.setExpectedRotationCheckEnabled(false) tapl.goHome() tapl.workspace.switchToOverview() tapl.overview.dismissAllTasks() device.wakeUpAndGoToHomeScreen() this.setRotation(flicker.scenario.startRotation) launchAppAndPostNotification() clearOverview() } transitions { openAppFromNotification() } teardown { testApp.exit(wmHelper) } } @Presubmit @Test override fun appWindowBecomesVisible() = appWindowBecomesVisible_coldStart() Loading
tests/FlickerTests/Notification/src/com/android/server/wm/flicker/notification/OpenAppFromNotificationWarmTest.kt +51 −45 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.platform.test.annotations.Presubmit import android.tools.common.traces.component.ComponentNameMatcher import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.FlickerTestData import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory import android.tools.device.helpers.wakeUpAndGoToHomeScreen Loading Loading @@ -55,17 +56,28 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : OpenAppTransition(flicker) { override val testApp: NotificationAppHelper = NotificationAppHelper(instrumentation) open val openingNotificationsFromLockScreen = false /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { setup { device.wakeUpAndGoToHomeScreen() this.setRotation(flicker.scenario.startRotation) launchAppAndPostNotification() goHome() } transitions { openAppFromNotification() } teardown { testApp.exit(wmHelper) } } protected fun FlickerTestData.launchAppAndPostNotification() { testApp.launchViaIntent(wmHelper) wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() testApp.postNotification(wmHelper) } protected fun FlickerTestData.goHome() { device.pressHome() wmHelper .StateSyncBuilder() Loading @@ -73,12 +85,11 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : .withWindowSurfaceDisappeared(ComponentNameMatcher.NOTIFICATION_SHADE) .waitForAndVerify() } protected fun FlickerTestData.openAppFromNotification() { doOpenAppAndWait(startY = 10, endY = 3 * device.displayHeight / 4, steps = 25) } transitions { var startY = 10 var endY = 3 * device.displayHeight / 4 var steps = 25 if (openingNotificationsFromLockScreen) { protected fun FlickerTestData.openAppFromLockNotification() { val wm: WindowManager = instrumentation.context.getSystemService(WindowManager::class.java) ?: error("Unable to connect to WindowManager service") Loading @@ -88,11 +99,10 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : WindowInsets.Type.statusBars() or WindowInsets.Type.displayCutout() ) startY = insets.top + 100 endY = device.displayHeight / 2 steps = 4 doOpenAppAndWait(startY = insets.top + 100, endY = device.displayHeight / 2, steps = 4) } protected fun FlickerTestData.doOpenAppAndWait(startY: Int, endY: Int, steps: Int) { // Swipe down to show the notification shade val x = device.displayWidth / 2 device.swipe(x, startY, x, endY, steps) Loading @@ -108,10 +118,6 @@ open class OpenAppFromNotificationWarmTest(flicker: LegacyFlickerTest) : // Wait for the app to launch wmHelper.StateSyncBuilder().withFullScreenApp(testApp).waitForAndVerify() } teardown { testApp.exit(wmHelper) } } @Presubmit @Test override fun appWindowBecomesVisible() = appWindowBecomesVisible_warmStart() @Presubmit @Test override fun appLayerBecomesVisible() = appLayerBecomesVisible_warmStart() Loading