Merge "Enable logs on swipe detection in tests" into sc-v2-dev am: 0eaf4e86a2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15302098

Change-Id: I4883b5be8c49ef0215a50a8a94a025492f239424
diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
index 30c3417..92bc19a 100644
--- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
+++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
@@ -87,6 +87,7 @@
         if (accessibilityManager == null) return;
 
         sendEventToTest(accessibilityManager, context, TestProtocol.PAUSE_DETECTED_MESSAGE, null);
+        Log.d(TestProtocol.HOME_TO_OVERVIEW_FLAKY, "sendPauseDetectedEventToTest");
     }
 
     private static void sendEventToTest(
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 2f1f82d..2dc644b 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -110,4 +110,5 @@
     public static final String PERMANENT_DIAG_TAG = "TaplTarget";
     public static final String WORK_PROFILE_REMOVED = "b/159671700";
     public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015";
+    public static final String HOME_TO_OVERVIEW_FLAKY = "b/193440212";
 }
diff --git a/src/com/android/launcher3/touch/BaseSwipeDetector.java b/src/com/android/launcher3/touch/BaseSwipeDetector.java
index 1276ece..cfd3153 100644
--- a/src/com/android/launcher3/touch/BaseSwipeDetector.java
+++ b/src/com/android/launcher3/touch/BaseSwipeDetector.java
@@ -17,6 +17,8 @@
 
 import static android.view.MotionEvent.INVALID_POINTER_ID;
 
+import static com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS;
+
 import android.graphics.PointF;
 import android.util.Log;
 import android.view.MotionEvent;
@@ -41,7 +43,8 @@
  */
 public abstract class BaseSwipeDetector {
 
-    private static final boolean DBG = false;
+    // b/193440212: Debug swipe gesture in tests.
+    private static final boolean DBG = IS_RUNNING_IN_TEST_HARNESS;
     private static final String TAG = "BaseSwipeDetector";
     private static final float ANIMATION_DURATION = 1200;
     /** The minimum release velocity in pixels per millisecond that triggers fling.*/