diff options
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 2 | ||||
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/OverviewTask.java | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 22b04fb04..ffb42fbf5 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -692,7 +692,7 @@ public final class LauncherInstrumentation { // Inject a swipe gesture. Inject exactly 'steps' motion points, incrementing event time by a // fixed interval each time. - private void linearGesture(int startX, int startY, int endX, int endY, int steps) { + void linearGesture(int startX, int startY, int endX, int endY, int steps) { final long downTime = SystemClock.uptimeMillis(); final Point start = new Point(startX, startY); final Point end = new Point(endX, endY); diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java index 8b124641f..641c41353 100644 --- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java +++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java @@ -16,7 +16,8 @@ package com.android.launcher3.tapl; -import androidx.test.uiautomator.Direction; +import android.graphics.Rect; + import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; @@ -26,7 +27,6 @@ import com.android.launcher3.testing.TestProtocol; * A recent task in the overview panel carousel. */ public final class OverviewTask { - static final int FLING_SPEED = 3000; private static final long WAIT_TIME_MS = 60000; private final LauncherInstrumentation mLauncher; private final UiObject2 mTask; @@ -51,7 +51,10 @@ public final class OverviewTask { "want to dismiss a task")) { verifyActiveContainer(); // Dismiss the task via flinging it up. - mTask.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity())); + final Rect taskBounds = mTask.getVisibleBounds(); + final int centerX = taskBounds.centerX(); + final int centerY = taskBounds.centerY(); + mLauncher.linearGesture(centerX, centerY, centerX, 0, 10); mLauncher.waitForIdle(); } } |