Adding tracing for a lab-only flake
We had a resolved case in the past where an app's context menu didn't
open on a long click (thanks to app updates), now the menu opens, but
the drag gesture doesn't drag the icon.
Bug: 133009122
Change-Id: I45d104a92fab6556ecd937aef76f0a8147e67f56
diff --git a/quickstep/src/com/android/quickstep/TestInformationProvider.java b/quickstep/src/com/android/quickstep/TestInformationProvider.java
index b37ddda..a948570 100644
--- a/quickstep/src/com/android/quickstep/TestInformationProvider.java
+++ b/quickstep/src/com/android/quickstep/TestInformationProvider.java
@@ -111,6 +111,14 @@
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance);
break;
}
+
+ case TestProtocol.REQUEST_ENABLE_DRAG_LOGGING:
+ TestProtocol.sDebugTracing = true;
+ break;
+
+ case TestProtocol.REQUEST_DISABLE_DRAG_LOGGING:
+ TestProtocol.sDebugTracing = false;
+ break;
}
return response;
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index b1a3fc9..49ae338 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -447,6 +447,10 @@
}
private void onStateTransitionStart(LauncherState state) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onStateTransitionStart");
+ }
if (mState != state) {
mState.onStateDisabled(mLauncher);
}
@@ -572,6 +576,10 @@
private final AnimatorSet mAnim;
public StartAnimRunnable(AnimatorSet anim) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "StartAnimRunnable");
+ }
mAnim = anim;
}
diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/TestProtocol.java
index eefecda..081150d 100644
--- a/src/com/android/launcher3/TestProtocol.java
+++ b/src/com/android/launcher3/TestProtocol.java
@@ -64,4 +64,8 @@
"all-apps-to-overview-swipe-height";
public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
"home-to-all-apps-swipe-height";
+ public static boolean sDebugTracing = false;
+ public static final String REQUEST_ENABLE_DRAG_LOGGING = "enable-drag-logging";
+ public static final String REQUEST_DISABLE_DRAG_LOGGING = "disable-drag-logging";
+ public static final String NO_DRAG_TAG = "b/133009122";
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index a508ce5..d19f9cd 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -371,6 +371,10 @@
@Override
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onDragStart 1");
+ }
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
@@ -421,6 +425,10 @@
}
// Always enter the spring loaded mode
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onDragStart 2");
+ }
mLauncher.getStateManager().goToState(SPRING_LOADED);
}
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index f92e00a..bf692fe 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -472,6 +472,10 @@
}
private void handleMoveEvent(int x, int y) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "handleMoveEvent 1");
+ }
mDragObject.dragView.move(x, y);
// Drop on someone?
@@ -488,6 +492,10 @@
if (mIsInPreDrag && mOptions.preDragCondition != null
&& mOptions.preDragCondition.shouldStartDrag(mDistanceSinceScroll)) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "handleMoveEvent 2");
+ }
callOnDragStart();
}
}
@@ -525,6 +533,10 @@
* Call this from a drag source view.
*/
public boolean onControllerTouchEvent(MotionEvent ev) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onControllerTouchEvent");
+ }
if (mDragDriver == null || mOptions == null || mOptions.isAccessibleDrag) {
return false;
}
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 3c81bcf..4964182 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -213,6 +213,10 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onTouchEvent " + ev);
+ }
int action = ev.getAction();
if (action == ACTION_UP || action == ACTION_CANCEL) {
if (mTouchCompleteListener != null) {
@@ -222,6 +226,10 @@
}
if (mActiveController != null) {
+ if (com.android.launcher3.TestProtocol.sDebugTracing) {
+ android.util.Log.d(com.android.launcher3.TestProtocol.NO_DRAG_TAG,
+ "onTouchEvent 1");
+ }
return mActiveController.onControllerTouchEvent(ev);
} else {
// In case no child view handled the touch event, we may not get onIntercept anymore
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 11c0794..f1dd013 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -148,6 +148,7 @@
static void dragIconToWorkspace(
LauncherInstrumentation launcher, Launchable launchable, Point dest,
String longPressIndicator) {
+ launcher.getTestInfo(TestProtocol.REQUEST_ENABLE_DRAG_LOGGING);
LauncherInstrumentation.log("dragIconToWorkspace: begin");
final Point launchableCenter = launchable.getObject().getVisibleCenter();
final long downTime = SystemClock.uptimeMillis();
@@ -162,6 +163,7 @@
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
+ launcher.getTestInfo(TestProtocol.REQUEST_DISABLE_DRAG_LOGGING);
}
/**