Merge "Add logs to help debug TwoButtonNavBarTouchController" into sc-dev
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarTouchController.java
index 3f7190f..c426329 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarTouchController.java
@@ -24,11 +24,13 @@
 
 import android.animation.ValueAnimator;
 import android.os.SystemClock;
+import android.util.Log;
 import android.view.MotionEvent;
 
 import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherState;
+import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.touch.AbstractStateChangeTouchController;
 import com.android.launcher3.touch.SingleAxisSwipeDetector;
 import com.android.quickstep.SystemUiProxy;
@@ -76,9 +78,18 @@
             return true;
         }
         if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
+            if (TestProtocol.sDebugTracing) {
+                Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW,
+                        "Didn't intercept touch due to top view: "
+                                + AbstractFloatingView.getTopOpenView(mLauncher));
+            }
             return false;
         }
         if ((ev.getEdgeFlags() & EDGE_NAV_BAR) == 0) {
+            if (TestProtocol.sDebugTracing) {
+                Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW,
+                        "Didn't intercept touch because event wasn't from nav bar");
+            }
             return false;
         }
         if (!mIsTransposed && mLauncher.isInState(OVERVIEW)) {
@@ -89,14 +100,21 @@
 
     @Override
     protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
+        final LauncherState targetState;
         if (mIsTransposed) {
             boolean draggingFromNav =
                     mLauncher.getDeviceProfile().isSeascape() == isDragTowardPositive;
-            return draggingFromNav ? HINT_STATE_TWO_BUTTON : NORMAL;
+            targetState = draggingFromNav ? HINT_STATE_TWO_BUTTON : NORMAL;
         } else {
             LauncherState startState = mStartState != null ? mStartState : fromState;
-            return isDragTowardPositive ^ (startState == OVERVIEW) ? HINT_STATE_TWO_BUTTON : NORMAL;
+            targetState = isDragTowardPositive ^ (startState == OVERVIEW)
+                    ? HINT_STATE_TWO_BUTTON : NORMAL;
         }
+
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW, "Target state: " + targetState);
+        }
+        return targetState;
     }
 
     @Override
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 943d129..9a02b66 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -113,4 +113,5 @@
     public static final String WORK_PROFILE_REMOVED = "b/159671700";
     public static final String TIS_NO_EVENTS = "b/180915942";
     public static final String GET_RECENTS_FAILED = "b/177472267";
+    public static final String TWO_BUTTON_NORMAL_NOT_OVERVIEW = "b/13714484";
 }