From 8c21721c18ba4d49c934dcd7f341e64363d4fe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Thu, 9 Jun 2022 22:02:16 +0000 Subject: [PATCH] Use tapl instrumentation to go home. This fixes an issue in gesture nav, when the swipe would not be properly recognized. Test: atest WMShellFlickerTests:EnterPipOnUserLeaveHintTest Bug: 234848637 Change-Id: I011cd3a83531f48939d4ac4d7686e0f142b2766b --- .../wm/shell/flicker/helpers/PipAppHelper.kt | 27 ------------------- .../pip/EnterPipOnUserLeaveHintTest.kt | 8 +++--- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt index 5a364ddf3a8f6..f73d191b19171 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt @@ -107,33 +107,6 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( uiDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "dismiss")), FIND_TIMEOUT) } - @JvmOverloads - fun enterPipViaHomeButton(wmHelper: WindowManagerStateHelper) { - uiDevice.pressHome() - - // Wait on WMHelper or simply wait for 3 seconds - wmHelper.waitPipShown() ?: SystemClock.sleep(3_000) - // when entering pip, the dismiss button is visible at the start. to ensure the pip - // animation is complete, wait until the pip dismiss button is no longer visible. - // b/176822698: dismiss-only state will be removed in the future - uiDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "dismiss")), FIND_TIMEOUT) - } - - @JvmOverloads - fun enterPipViaSwipeToHome(wmHelper: WindowManagerStateHelper) { - uiDevice.swipe( - uiDevice.displayWidth / 2, uiDevice.displayHeight - 10, - uiDevice.displayWidth / 2, uiDevice.displayHeight - 300, 3 - ) - - // Wait on WMHelper or simply wait for 3 seconds - wmHelper.waitPipShown() ?: SystemClock.sleep(3_000) - // when entering pip, the dismiss button is visible at the start. to ensure the pip - // animation is complete, wait until the pip dismiss button is no longer visible. - // b/176822698: dismiss-only state will be removed in the future - uiDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "dismiss")), FIND_TIMEOUT) - } - fun enableEnterPipOnUserLeaveHint() { clickObject(ENTER_PIP_ON_USER_LEAVE_HINT) } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipOnUserLeaveHintTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipOnUserLeaveHintTest.kt index 04bf856fd9f8d..e7d641e9c66e6 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipOnUserLeaveHintTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipOnUserLeaveHintTest.kt @@ -17,6 +17,7 @@ package com.android.wm.shell.flicker.pip import androidx.test.filters.RequiresDevice +import com.android.launcher3.tapl.LauncherInstrumentation import com.android.server.wm.flicker.FlickerParametersRunnerFactory import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.annotation.Group3 @@ -50,7 +51,7 @@ import org.junit.runners.Parameterized @FixMethodOrder(MethodSorters.NAME_ASCENDING) @Group3 class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest(testSpec) { - + protected val taplInstrumentation = LauncherInstrumentation() /** * Defines the transition used to run the test */ @@ -69,10 +70,7 @@ class EnterPipOnUserLeaveHintTest(testSpec: FlickerTestParameter) : EnterPipTest } } transitions { - when (testSpec.isGesturalNavigation) { - true -> pipApp.enterPipViaSwipeToHome(wmHelper) - false -> pipApp.enterPipViaHomeButton(wmHelper) - } + taplInstrumentation.goHome() } }