Merge "Debugging Logs for TaplDragTest#testDragAppIconToMultipleWorkspaceCells" into main
diff --git a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index 623f9f2..afda3a3 100644
--- a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -175,6 +175,7 @@
public static final String ACTIVITY_NOT_RESUMED_AFTER_BACK = "b/322823209";
public static final String GET_FROM_RECENTS_FAILURE = "b/321775748";
public static final String SUCCESSFUL_GESTURE_MISMATCH_EVENTS = "b/324940434";
+ public static final String TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE = "b/326908466";
public static final String TEST_TAPL_OVERVIEW_ACTIONS_MENU_FAILURE = "b/326073471";
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java
index 156568b..7c6d684 100644
--- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java
+++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java
@@ -16,6 +16,9 @@
package com.android.launcher3.tapl;
+import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE;
+
+import android.util.Log;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -49,7 +52,7 @@
/**
* Find an app icon with the given name.
*
- * @param appName app icon to look for
+ * @param appName app icon to look for
* @param launcher (optional) - only match ui elements from Launcher's package
*/
static BySelector getAppIconSelector(String appName, LauncherInstrumentation launcher) {
@@ -95,6 +98,8 @@
@Override
protected void waitForLongPressConfirmation() {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "AppIcon.waitForLongPressConfirmation, resName: popupContainer");
mLauncher.waitForLauncherObject("popup_container");
}
diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java
index ed47334..9d3bc6e 100644
--- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -17,8 +17,10 @@
package com.android.launcher3.tapl;
import static com.android.launcher3.testing.shared.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
+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.view.MotionEvent;
import androidx.test.uiautomator.UiObject2;
@@ -113,11 +115,15 @@
iconCenter.y - getStartDragThreshold());
if (runToSpringLoadedState) {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "Launchable.startDrag: actionName: long-pressing and triggering drag start"
+ + " iconCenter: " + iconCenter + " dragStartCenter: "
+ + dragStartCenter);
mLauncher.runToState(() -> movePointerForStartDrag(
- downTime,
- iconCenter,
- dragStartCenter,
- expectLongClickEvents),
+ downTime,
+ iconCenter,
+ dragStartCenter,
+ expectLongClickEvents),
SPRING_LOADED_STATE_ORDINAL, "long-pressing and triggering drag start");
} else {
movePointerForStartDrag(
diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index b15ed91..053b360 100644
--- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -31,6 +31,7 @@
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_GET_SPLIT_SELECTION_ACTIVE;
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_NUM_ALL_APPS_COLUMNS;
import static com.android.launcher3.testing.shared.TestProtocol.SUCCESSFUL_GESTURE_MISMATCH_EVENTS;
+import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE;
import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD;
import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
@@ -1165,7 +1166,11 @@
log("Hierarchy before clicking home:");
dumpViewHierarchy();
action = "clicking home button";
-
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.goHome: isThreeFingerTrackpadGesture: "
+ + isThreeFingerTrackpadGesture
+ + "getNavigationModel() == NavigationModel.ZERO_BUTTON: " + (
+ getNavigationModel() == NavigationModel.ZERO_BUTTON));
runToState(
getHomeButton()::click,
NORMAL_STATE_ORDINAL,
@@ -1512,6 +1517,8 @@
@NonNull
UiObject2 waitForLauncherObject(String resName) {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.waitForLauncherObject");
return waitForObjectBySelector(getLauncherObjectSelector(resName));
}
@@ -1541,12 +1548,16 @@
@NonNull
List<UiObject2> waitForObjectsBySelector(BySelector selector) {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.waitForObjectsBySelector");
final List<UiObject2> objects = mDevice.wait(Until.findObjects(selector), WAIT_TIME_MS);
assertNotNull("Can't find any view in Launcher, selector: " + selector, objects);
return objects;
}
private UiObject2 waitForObjectBySelector(BySelector selector) {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.waitForObjectBySelector");
final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
assertNotNull("Can't find a view in Launcher, selector: " + selector, object);
return object;
@@ -1589,6 +1600,9 @@
void runToState(Runnable command, int expectedState, boolean requireEvent, String actionName) {
if (requireEvent) {
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.runToState: command: " + command + " expectedState: "
+ + expectedState + " actionName: " + actionName + "requireEvent: true");
runToState(command, expectedState, actionName);
} else {
command.run();
@@ -1966,11 +1980,15 @@
mPointerCount = 1;
pointerCount = mPointerCount;
}
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.sendPointer: ACTION_DOWN");
break;
case MotionEvent.ACTION_UP:
if (hasTIS && gestureScope == GestureScope.EXPECT_PILFER) {
expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS);
}
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "LauncherInstrumentation.sendPointer: ACTION_UP");
break;
case MotionEvent.ACTION_POINTER_DOWN:
mPointerCount++;
diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java
index 506e563..4e92634 100644
--- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -25,6 +25,7 @@
import static com.android.launcher3.testing.shared.TestProtocol.ALL_APPS_STATE_ORDINAL;
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL;
+import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE;
import static com.android.launcher3.testing.shared.TestProtocol.UIOBJECT_STALE_ELEMENT;
import static junit.framework.TestCase.assertNotNull;
@@ -626,6 +627,8 @@
try (LauncherInstrumentation.Closable ignored = launcher.addContextLayer(
"want to drag icon to workspace")) {
final long downTime = SystemClock.uptimeMillis();
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "Workspace.dragIconToWorkspace: starting drag | downtime: " + downTime);
Point dragStart = launchable.startDrag(
downTime,
expectLongClickEvents,
diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java
index e5a2a2e..b42d43b 100644
--- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java
+++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java
@@ -15,7 +15,10 @@
*/
package com.android.launcher3.tapl;
+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 java.util.function.Supplier;
@@ -76,6 +79,9 @@
LauncherInstrumentation.Closable c = launcher.addContextLayer(
String.format("want to drag the icon to cell(%d, %d)", cellX, cellY))) {
final Supplier<Point> dest = () -> Workspace.getCellCenter(launcher, cellX, cellY);
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "WorkspaceDragSource.dragToWorkspace: dragging icon to workspace | dest: "
+ + dest.get());
Workspace.dragIconToWorkspace(
launcher,
launchable,
diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
index 615f679..d1227d8 100644
--- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java
+++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.dragging;
+import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE;
import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
import static com.android.launcher3.util.TestConstants.AppNames.PHOTOS_APP_NAME;
@@ -233,6 +234,11 @@
final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(TEST_APP_NAME);
for (Point target : targets) {
startTime = SystemClock.uptimeMillis();
+ Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE,
+ "TaplDragTest.java.testDragAppIconToMultipleWorkspaceCells: shortcut name: "
+ + launcherTestAppIcon.getIconName()
+ + " | target cell coordinates: (" + target.x + ", " + target.y
+ + ") | start time: " + startTime);
launcherTestAppIcon.dragToWorkspace(target.x, target.y);
endTime = SystemClock.uptimeMillis();
elapsedTime = endTime - startTime;