Capture Launcher icon positions by reusing UiObject2
Reuse the same UiObject2/HomeAppIcon objects
when capturing Launcher icon positions.
When invoking 'launcher.workspace.allWorkspaceIcons'
we wait for the animation to finish which makes
the test fail as we expect to capture icon positions
midway through the animation.
Test: atest LauncherFoldAnimationTest
Bug: 315163608
Bug: 296991492
Flag: EXEMPT bugfix
Change-Id: I668d15165e4c777b3be24d66ad3f7888eaca2fea
diff --git a/tests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
index 7c6d684..02a862d 100644
--- a/tests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE;
+import android.graphics.Point;
import android.util.Log;
import android.widget.TextView;
@@ -129,6 +130,14 @@
}
/**
+ * @return the center coordinates of the icon
+ */
+ @NonNull
+ public Point getVisibleCenter() {
+ return getObject().getVisibleCenter();
+ }
+
+ /**
* Create a regular expression pattern that matches strings containing all of the non-whitespace
* characters of the app name, with any amount of whitespace added between characters (e.g.
* newline for multiline app labels).