From 75b534e9c931d23f456b8d20e5c61cc929ed614e Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 17 Apr 2023 12:56:52 -0700 Subject: [PATCH] Support 3-finger swipe to pull down notifications from app Fixes: 270211015 Test: 3-finger swipe down to bring down notifications. 3-finger swipe up to go home / to Overview Change-Id: Id0f8ad95d9a4a1f8ecf1632ea28efb0c790c291b --- .../touchcontrollers/StatusBarTouchController.java | 7 ++----- .../com/android/quickstep/TouchInteractionService.java | 1 - .../inputconsumers/OtherActivityInputConsumer.java | 10 ++++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index 683f4ea896..395833ffea 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -21,7 +21,6 @@ import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_UP; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; -import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN; import android.graphics.PointF; @@ -106,8 +105,7 @@ public class StatusBarTouchController implements TouchController { // Currently input dispatcher will not do touch transfer if there are more than // one touch pointer. Hence, even if slope passed, only set the slippery flag // when there is single touch event. (context: InputDispatcher.cpp line 1445) - if (dy > mTouchSlop && dy > Math.abs(dx) && (isTrackpadMotionEvent(ev) - || ev.getPointerCount() == 1)) { + if (dy > mTouchSlop && dy > Math.abs(dx) && ev.getPointerCount() == 1) { ev.setAction(ACTION_DOWN); dispatchTouchEvent(ev); setWindowSlippery(true); @@ -161,8 +159,7 @@ public class StatusBarTouchController implements TouchController { } else { // For NORMAL state, only listen if the event originated above the navbar height DeviceProfile dp = mLauncher.getDeviceProfile(); - if (!isTrackpadMotionEvent(ev) && ev.getY() > (mLauncher.getDragLayer().getHeight() - - dp.getInsets().bottom)) { + if (ev.getY() > (mLauncher.getDragLayer().getHeight() - dp.getInsets().bottom)) { return false; } } diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 89920f0b03..d5f9dba666 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -864,7 +864,6 @@ public class TouchInteractionService extends Service } if (ENABLE_TRACKPAD_GESTURE.get() && mGestureState.isTrackpadGesture() - && mGestureState.getActivityInterface().isResumed() && !previousGestureState.isRecentsAnimationRunning()) { reasonString = newCompoundString(reasonPrefix) .append(SUBSTRING_PREFIX) diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 601533d7e6..a8963f602d 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -294,8 +294,14 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC boolean haveNotPassedSlopOnContinuedGesture = !mPassedSlopOnThisGesture && mPassedPilferInputSlop; double degrees = Math.toDegrees(Math.atan(upDist / horizontalDist)); - boolean isLikelyToStartNewTask = haveNotPassedSlopOnContinuedGesture - || degrees <= OVERVIEW_MIN_DEGREES; + + // Regarding degrees >= -OVERVIEW_MIN_DEGREES - Trackpad gestures can start anywhere + // on the screen, allowing downward swipes. We want to impose the same angle in that + // scenario. + boolean swipeWithinQuickSwitchRange = degrees <= OVERVIEW_MIN_DEGREES + && (!mGestureState.isTrackpadGesture() || degrees >= -OVERVIEW_MIN_DEGREES); + boolean isLikelyToStartNewTask = + haveNotPassedSlopOnContinuedGesture || swipeWithinQuickSwitchRange; if (!mPassedPilferInputSlop) { if (passedSlop) {