Enable quickscrub when notification shade is showing

Change-Id: I6ba3dfd6a84ac489ee361e3becde63b30963ce61
Fixes: 78681298
Test: manual - show notifications and do quick scrub
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
index 6cc88bb..1341301 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStepController.java
@@ -45,9 +45,6 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.WindowManagerGlobal;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import androidx.annotation.DimenRes;
 import com.android.systemui.Dependency;
 import com.android.systemui.OverviewProxyService;
 import com.android.systemui.R;
@@ -72,6 +69,7 @@
     private boolean mQuickScrubActive;
     private boolean mAllowGestureDetection;
     private boolean mQuickStepStarted;
+    private boolean mNotificationsVisibleOnDown;
     private int mTouchDownX;
     private int mTouchDownY;
     private boolean mDragPositive;
@@ -221,6 +219,7 @@
                 mNavigationBarView.transformMatrixToLocal(mTransformLocalMatrix);
                 mQuickStepStarted = false;
                 mAllowGestureDetection = true;
+                mNotificationsVisibleOnDown = !mNavigationBarView.isNotificationsFullyCollapsed();
                 break;
             }
             case MotionEvent.ACTION_MOVE: {
@@ -257,7 +256,8 @@
                 // Decide to start quickstep if dragging away from the navigation bar, otherwise in
                 // the parallel direction, decide to start quickscrub. Only one may run.
                 if (!mQuickScrubActive && exceededSwipeUpTouchSlop) {
-                    if (mNavigationBarView.isQuickStepSwipeUpEnabled()) {
+                    if (mNavigationBarView.isQuickStepSwipeUpEnabled()
+                            && !mNotificationsVisibleOnDown) {
                         startQuickStep(event);
                     }
                     break;
@@ -303,15 +303,28 @@
                 break;
         }
 
-        // Proxy motion events to launcher if not handled by quick scrub
-        // Proxy motion events up/cancel that would be sent after long press on any nav button
-        if (!mQuickScrubActive && !mIsInScreenPinning && (mAllowGestureDetection
-                || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP)) {
+        if (shouldProxyEvents(action)) {
             proxyMotionEvents(event);
         }
         return mQuickScrubActive || mQuickStepStarted || deadZoneConsumed;
     }
 
+    private boolean shouldProxyEvents(int action) {
+        if (!mQuickScrubActive && !mIsInScreenPinning) {
+            // Allow down, cancel and up events, move and other events are passed if notifications
+            // are not showing and disabled gestures (such as long press) are not executed
+            switch (action) {
+                case MotionEvent.ACTION_DOWN:
+                case MotionEvent.ACTION_CANCEL:
+                case MotionEvent.ACTION_UP:
+                    return true;
+                default:
+                    return !mNotificationsVisibleOnDown && mAllowGestureDetection;
+            }
+        }
+        return false;
+    }
+
     @Override
     public void onDraw(Canvas canvas) {
         if (!mNavigationBarView.isQuickScrubEnabled()) {