Loading tests/src/com/android/launcher3/ui/TestViewHelpers.java +14 −8 Original line number Diff line number Diff line Loading @@ -114,7 +114,8 @@ public class TestViewHelpers { Point center = icon.getVisibleCenter(); // Action Down sendPointer(MotionEvent.ACTION_DOWN, center); final long downTime = SystemClock.uptimeMillis(); sendPointer(downTime, MotionEvent.ACTION_DOWN, center); UiObject2 dragLayer = findViewById(R.id.drag_layer); Loading @@ -131,7 +132,7 @@ public class TestViewHelpers { } else { moveLocation.y += distanceToMove; } movePointer(center, moveLocation); movePointer(downTime, center, moveLocation); assertNull(findViewById(R.id.deep_shortcuts_container)); } Loading @@ -142,19 +143,24 @@ public class TestViewHelpers { Point moveLocation = dragLayer.getVisibleCenter(); // Move to center movePointer(center, moveLocation); sendPointer(MotionEvent.ACTION_UP, center); movePointer(downTime, center, moveLocation); sendPointer(downTime, MotionEvent.ACTION_UP, moveLocation); // Wait until remove target is gone. getDevice().wait(Until.gone(getSelectorForId(R.id.delete_target_text)), AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT); } private static void movePointer(Point from, Point to) { private static void movePointer(long downTime, Point from, Point to) { while (!from.equals(to)) { try { Thread.sleep(20); } catch (InterruptedException e) { e.printStackTrace(); } from.x = getNextMoveValue(to.x, from.x); from.y = getNextMoveValue(to.y, from.y); sendPointer(MotionEvent.ACTION_MOVE, from); sendPointer(downTime, MotionEvent.ACTION_MOVE, from); } } Loading @@ -168,8 +174,8 @@ public class TestViewHelpers { } } public static void sendPointer(int action, Point point) { MotionEvent event = MotionEvent.obtain(SystemClock.uptimeMillis(), public static void sendPointer(long downTime, int action, Point point) { MotionEvent event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), action, point.x, point.y, 0); getInstrumentation().sendPointerSync(event); event.recycle(); Loading tests/tapl/com/android/launcher3/tapl/AllApps.java +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame"); allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1); } else { allAppsContainer.setGestureMargins(0, 0, 0, 100); allAppsContainer.setGestureMargins(0, 0, 0, 200); } final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher); if (!hasClickableIcon(allAppsContainer, appIconSelector)) { Loading tests/tapl/com/android/launcher3/tapl/Widgets.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { "want to fling forward in widgets")) { LauncherInstrumentation.log("Widgets.flingForward enter"); final UiObject2 widgetsContainer = verifyActiveContainer(); widgetsContainer.setGestureMargin(100); widgetsContainer.setGestureMargins(0, 0, 0, 200); widgetsContainer.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity())); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung forward")) { Loading Loading
tests/src/com/android/launcher3/ui/TestViewHelpers.java +14 −8 Original line number Diff line number Diff line Loading @@ -114,7 +114,8 @@ public class TestViewHelpers { Point center = icon.getVisibleCenter(); // Action Down sendPointer(MotionEvent.ACTION_DOWN, center); final long downTime = SystemClock.uptimeMillis(); sendPointer(downTime, MotionEvent.ACTION_DOWN, center); UiObject2 dragLayer = findViewById(R.id.drag_layer); Loading @@ -131,7 +132,7 @@ public class TestViewHelpers { } else { moveLocation.y += distanceToMove; } movePointer(center, moveLocation); movePointer(downTime, center, moveLocation); assertNull(findViewById(R.id.deep_shortcuts_container)); } Loading @@ -142,19 +143,24 @@ public class TestViewHelpers { Point moveLocation = dragLayer.getVisibleCenter(); // Move to center movePointer(center, moveLocation); sendPointer(MotionEvent.ACTION_UP, center); movePointer(downTime, center, moveLocation); sendPointer(downTime, MotionEvent.ACTION_UP, moveLocation); // Wait until remove target is gone. getDevice().wait(Until.gone(getSelectorForId(R.id.delete_target_text)), AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT); } private static void movePointer(Point from, Point to) { private static void movePointer(long downTime, Point from, Point to) { while (!from.equals(to)) { try { Thread.sleep(20); } catch (InterruptedException e) { e.printStackTrace(); } from.x = getNextMoveValue(to.x, from.x); from.y = getNextMoveValue(to.y, from.y); sendPointer(MotionEvent.ACTION_MOVE, from); sendPointer(downTime, MotionEvent.ACTION_MOVE, from); } } Loading @@ -168,8 +174,8 @@ public class TestViewHelpers { } } public static void sendPointer(int action, Point point) { MotionEvent event = MotionEvent.obtain(SystemClock.uptimeMillis(), public static void sendPointer(long downTime, int action, Point point) { MotionEvent event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), action, point.x, point.y, 0); getInstrumentation().sendPointerSync(event); event.recycle(); Loading
tests/tapl/com/android/launcher3/tapl/AllApps.java +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer { final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame"); allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1); } else { allAppsContainer.setGestureMargins(0, 0, 0, 100); allAppsContainer.setGestureMargins(0, 0, 0, 200); } final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher); if (!hasClickableIcon(allAppsContainer, appIconSelector)) { Loading
tests/tapl/com/android/launcher3/tapl/Widgets.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { "want to fling forward in widgets")) { LauncherInstrumentation.log("Widgets.flingForward enter"); final UiObject2 widgetsContainer = verifyActiveContainer(); widgetsContainer.setGestureMargin(100); widgetsContainer.setGestureMargins(0, 0, 0, 200); widgetsContainer.fling(Direction.DOWN, (int) (FLING_SPEED * mLauncher.getDisplayDensity())); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung forward")) { Loading