From a33fb696039be39fb3d712be945b04c14a5cc76d Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 20 Mar 2023 10:57:02 -0700 Subject: [PATCH] Disable 3-finger workspace scroll Fixes: 274474023 Test: 3-finger horizontal scroll on the workspace doesn't do anything Change-Id: I32ade8a5c26eae43f5ce9c8c71d47ed0d1abd5a2 --- .../StatusBarTouchController.java | 2 +- .../quickstep/RotationTouchHelper.java | 4 ++-- .../quickstep/TouchInteractionService.java | 2 +- .../TaskbarStashInputConsumer.java | 2 +- .../android/launcher3}/MotionEventsUtils.java | 2 +- src/com/android/launcher3/Workspace.java | 24 +++++++++++++++++++ 6 files changed, 30 insertions(+), 6 deletions(-) rename {quickstep/src/com/android/quickstep => src/com/android/launcher3}/MotionEventsUtils.java (98%) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index 7de6b189a9..683f4ea896 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -21,8 +21,8 @@ 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 static com.android.quickstep.MotionEventsUtils.isTrackpadMotionEvent; import android.graphics.PointF; import android.util.SparseArray; diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index 7500e79118..81b818e926 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -18,6 +18,8 @@ package com.android.quickstep; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Surface.ROTATION_0; +import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; +import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN; import static com.android.launcher3.util.DisplayController.CHANGE_ALL; import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE; @@ -25,8 +27,6 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION; import static com.android.launcher3.util.DisplayController.CHANGE_SUPPORTED_BOUNDS; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS; -import static com.android.quickstep.MotionEventsUtils.isTrackpadMotionEvent; -import static com.android.quickstep.MotionEventsUtils.isTrackpadMultiFingerSwipe; import android.content.Context; import android.content.res.Resources; diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 0a7d9bee5e..5e14d19fd0 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -22,10 +22,10 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; +import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.GestureState.DEFAULT_STATE; -import static com.android.quickstep.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_DOWN; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_UP; diff --git a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java index b8e573a0e8..30cc49d9aa 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java @@ -17,9 +17,9 @@ package com.android.quickstep.inputconsumers; import static android.view.MotionEvent.INVALID_POINTER_ID; +import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_TOUCHING; -import static com.android.quickstep.MotionEventsUtils.isTrackpadMotionEvent; import android.content.Context; import android.content.res.Resources; diff --git a/quickstep/src/com/android/quickstep/MotionEventsUtils.java b/src/com/android/launcher3/MotionEventsUtils.java similarity index 98% rename from quickstep/src/com/android/quickstep/MotionEventsUtils.java rename to src/com/android/launcher3/MotionEventsUtils.java index 142febf829..7f8794dfe8 100644 --- a/quickstep/src/com/android/quickstep/MotionEventsUtils.java +++ b/src/com/android/launcher3/MotionEventsUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.quickstep; +package com.android.launcher3; import static android.view.MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index ba492d57e2..fd787397a8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -25,6 +25,7 @@ import static com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.SPRING_LOADED; +import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback; import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; @@ -1064,6 +1065,29 @@ public class Workspace extends PagedView } } + /** + * Needed here because launcher has a fullscreen exclusion rect and doesn't pilfer the pointers. + */ + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (isTrackpadMultiFingerSwipe(ev)) { + return false; + } + return super.onInterceptTouchEvent(ev); + } + + /** + * Needed here because launcher has a fullscreen exclusion rect and doesn't pilfer the pointers. + */ + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (isTrackpadMultiFingerSwipe(ev)) { + return false; + } + return super.onTouchEvent(ev); + } + /** * Called directly from a CellLayout (not by the framework), after we've been added as a * listener via setOnInterceptTouchEventListener(). This allows us to tell the CellLayout