Slowing down some gestures for testing on virtual devices
Change-Id: Ie8b9a4eff3e9b4c133719a6292d2d251b87b90e8
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 122151e..7ab91bc 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -29,7 +29,7 @@
public class AllApps extends LauncherInstrumentation.VisibleContainer {
private static final int MAX_SCROLL_ATTEMPTS = 40;
private static final int MIN_INTERACT_SIZE = 100;
- private static final int FLING_SPEED = 3000;
+ private static final int FLING_SPEED = LauncherInstrumentation.needSlowGestures() ? 1000 : 3000;
private final int mHeight;
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index f44022b..f7de2f9 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -26,6 +26,7 @@
import android.content.Context;
import android.graphics.Point;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
@@ -161,6 +162,10 @@
return isSwipeUpEnabled() ? NavigationModel.TWO_BUTTON : NavigationModel.THREE_BUTTON;
}
+ static boolean needSlowGestures() {
+ return Build.MODEL.contains("Cuttlefish");
+ }
+
private boolean isSwipeUpEnabled() {
final boolean swipeUpEnabledDefaultValue = SwipeUpSetting.isSwipeUpEnabledDefaultValue();
return SwipeUpSetting.isSwipeUpSettingAvailable() ?
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 7d97acd..6868e1e 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -36,7 +36,7 @@
public final class Workspace extends Home {
private static final float FLING_SPEED = 3500.0F;
private final UiObject2 mHotseat;
- private final int ICON_DRAG_SPEED = 2000;
+ private final int ICON_DRAG_SPEED = LauncherInstrumentation.needSlowGestures() ? 100 : 570;
Workspace(LauncherInstrumentation launcher) {
super(launcher);
@@ -107,7 +107,7 @@
getHotseatAppIcon("Messages"),
new Point(mLauncher.getDevice().getDisplayWidth(),
workspace.getVisibleBounds().centerY()),
- ICON_DRAG_SPEED);
+ (int) (ICON_DRAG_SPEED * mLauncher.getDisplayDensity()));
verifyActiveContainer();
}
assertTrue("Home screen workspace didn't become scrollable",