Merge "Adding tracing for a lab-only flake" into ub-launcher3-qt-dev

This commit is contained in:
TreeHugger Robot
2019-05-22 03:12:56 +00:00
committed by Android (Google) Code Review
7 changed files with 50 additions and 0 deletions
@@ -111,6 +111,14 @@ public class TestInformationProvider extends ContentProvider {
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;
}
@@ -447,6 +447,10 @@ public class LauncherStateManager {
}
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 @@ public class LauncherStateManager {
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;
}
@@ -64,4 +64,8 @@ public final class TestProtocol {
"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";
}
+8
View File
@@ -371,6 +371,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
@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 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
// 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);
}
@@ -472,6 +472,10 @@ public class DragController implements DragDriver.EventListener, TouchController
}
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 @@ public class DragController implements DragDriver.EventListener, TouchController
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 @@ public class DragController implements DragDriver.EventListener, TouchController
* 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;
}
@@ -213,6 +213,10 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
@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 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
}
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
@@ -148,6 +148,7 @@ public final class Workspace extends Home {
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 @@ public final class Workspace extends Home {
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
launcher.getTestInfo(TestProtocol.REQUEST_DISABLE_DRAG_LOGGING);
}
/**