From bc5d7e68e8a70a8ca350342fa9037ad9ac0dc7fd Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 9 Dec 2019 13:53:05 -0800 Subject: [PATCH] Diagnosing the reason for opening context menu Adding it permanently. System tests using TAPL sometimes run into mysterious hard-to-diagnose problems (like, a menu opens for no apparent reason), so we'll need to keep diags like this forever. Change-Id: I25fcab94931fa4f6e1bda34d5705de5dd411188a --- src/com/android/launcher3/Launcher.java | 4 ++++ src/com/android/launcher3/testing/TestProtocol.java | 2 ++ src/com/android/launcher3/touch/WorkspaceTouchListener.java | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index cb8fe05c0e..faf49f72af 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -122,6 +122,7 @@ import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.qsb.QsbContainerView; import com.android.launcher3.states.RotationHelper; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.AllAppsSwipeController; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; @@ -2636,6 +2637,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, // Setting the touch point to (-1, -1) will show the options popup in the center of // the screen. + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Opening options popup on key up"); + } OptionsPopupView.showDefaultOptions(this, -1, -1); } return true; diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 832f7f0990..5aae841e22 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -83,6 +83,8 @@ public final class TestProtocol { public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing"; public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing"; + public static final String PERMANENT_DIAG_TAG = "TaplTarget"; + public static final String NO_BACKGROUND_TO_OVERVIEW_TAG = "b/138251824"; public static final String NO_DRAG_TO_WORKSPACE = "b/138729456"; public static final String APP_NOT_DISABLED = "b/139891609"; diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java index 310d598b25..66fdc9467f 100644 --- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java +++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java @@ -25,6 +25,7 @@ import static com.android.launcher3.LauncherState.NORMAL; import android.graphics.PointF; import android.graphics.Rect; +import android.util.Log; import android.view.GestureDetector; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -36,8 +37,10 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; +import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.dragndrop.DragLayer; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.views.OptionsPopupView; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; @@ -175,6 +178,9 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS, Action.Direction.NONE, ContainerType.WORKSPACE, mWorkspace.getCurrentPage()); + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Opening options popup on long press"); + } OptionsPopupView.showDefaultOptions(mLauncher, mTouchDownPoint.x, mTouchDownPoint.y); } else { cancelLongPress();