From db82b37998f13f481f4c0ef18e8666c46023bd75 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Fri, 11 Nov 2022 14:54:07 +0000 Subject: [PATCH] Revert "Extand the long press duration" This reverts commit 8dc06e533523855764a16f84f5daa35b1c3ab800. Reason for revert: b/258787797 Bug: 258787797 Change-Id: I417939d7d9f0344e4f260703cac9929d1e0633d1 --- .../flicker/splitscreen/SplitScreenUtils.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenUtils.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenUtils.kt index 4a3284e1953bf..ead451f076538 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenUtils.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SplitScreenUtils.kt @@ -41,7 +41,6 @@ import com.android.server.wm.traces.parser.toFlickerComponent import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper import com.android.wm.shell.flicker.LAUNCHER_UI_PACKAGE_NAME import com.android.wm.shell.flicker.SYSTEM_UI_PACKAGE_NAME -import org.junit.Assert.assertNotNull import java.util.Collections internal object SplitScreenUtils { @@ -51,7 +50,7 @@ internal object SplitScreenUtils { private const val DIVIDER_BAR = "docked_divider_handle" private const val OVERVIEW_SNAPSHOT = "snapshot" private const val GESTURE_STEP_MS = 16L - private val LONG_PRESS_TIME_MS = ViewConfiguration.getLongPressTimeout() * 2L + private const val LONG_PRESS_TIME_MS = 100L private val SPLIT_DECOR_MANAGER = ComponentNameMatcher("", "SplitDecorManager#") private val notificationScrollerSelector: BySelector @@ -276,6 +275,13 @@ internal object SplitScreenUtils { } } + fun longPress(instrumentation: Instrumentation, point: Point) { + val downTime = SystemClock.uptimeMillis() + touch(instrumentation, MotionEvent.ACTION_DOWN, downTime, downTime, TIMEOUT_MS, point) + SystemClock.sleep(LONG_PRESS_TIME_MS) + touch(instrumentation, MotionEvent.ACTION_UP, downTime, downTime, TIMEOUT_MS, point) + } + fun createShortcutOnHotseatIfNotExist(tapl: LauncherInstrumentation, appName: String) { tapl.workspace.deleteAppIcon(tapl.workspace.getHotseatAppIcon(0)) val allApps = tapl.workspace.switchToAllApps() @@ -347,11 +353,9 @@ internal object SplitScreenUtils { Until.findObject(By.res(sourceApp.packageName, "SplitScreenTest")), TIMEOUT_MS ) - assertNotNull("Unable to find the TextView", textView) - textView.click(LONG_PRESS_TIME_MS) + longPress(instrumentation, textView.visibleCenter) val copyBtn = device.wait(Until.findObject(By.text("Copy")), TIMEOUT_MS) - assertNotNull("Unable to find the copy button", copyBtn) copyBtn.click() // Paste text to destinationApp @@ -360,11 +364,9 @@ internal object SplitScreenUtils { Until.findObject(By.res(destinationApp.packageName, "plain_text_input")), TIMEOUT_MS ) - assertNotNull("Unable to find the EditText", editText) - editText.click(LONG_PRESS_TIME_MS) + longPress(instrumentation, editText.visibleCenter) val pasteBtn = device.wait(Until.findObject(By.text("Paste")), TIMEOUT_MS) - assertNotNull("Unable to find the paste button", pasteBtn) pasteBtn.click() // Verify text