Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +4 −3 Original line number Diff line number Diff line Loading @@ -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.Utilities.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; Loading Loading @@ -91,6 +91,7 @@ public class StatusBarTouchController implements TouchController { if (!mCanIntercept) { return false; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { // Check!! should only set it only when threshold is not entered. Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -369,7 +369,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mIsTaskbarAllAppsOpen = controller != null && controller.isTaskbarAllAppsOpen(); mTaskbarAppWindowThreshold = res.getDimensionPixelSize(R.dimen.taskbar_app_window_threshold); boolean swipeWillNotShowTaskbar = mTaskbarAlreadyOpen; boolean swipeWillNotShowTaskbar = mTaskbarAlreadyOpen || mGestureState.isTrackpadGesture(); mTaskbarHomeOverviewThreshold = swipeWillNotShowTaskbar ? 0 : res.getDimensionPixelSize(R.dimen.taskbar_home_overview_threshold); Loading Loading @@ -2317,7 +2317,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return displacement; } if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) { if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen || mGestureState.isTrackpadGesture()) { return displacement; } Loading quickstep/src/com/android/quickstep/MotionEventsUtils.java 0 → 100644 +48 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static android.view.MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE; import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE; import android.annotation.TargetApi; import android.os.Build; import android.view.MotionEvent; /** Handles motion events from trackpad. */ public class MotionEventsUtils { /** {@link MotionEvent#CLASSIFICATION_MULTI_FINGER_SWIPE} is hidden. */ public static final int CLASSIFICATION_MULTI_FINGER_SWIPE = 4; @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static boolean isTrackpadScroll(MotionEvent event) { return ENABLE_TRACKPAD_GESTURE.get() && event.getClassification() == CLASSIFICATION_TWO_FINGER_SWIPE; } @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static boolean isTrackpadMultiFingerSwipe(MotionEvent event) { return ENABLE_TRACKPAD_GESTURE.get() && event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE; } public static boolean isTrackpadMotionEvent(MotionEvent event) { return isTrackpadScroll(event) || isTrackpadMultiFingerSwipe(event); } } quickstep/src/com/android/quickstep/RotationTouchHelper.java +4 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.quickstep; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Surface.ROTATION_0; import static com.android.launcher3.Utilities.isTrackpadMotionEvent; 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; Loading @@ -26,6 +25,8 @@ 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; Loading Loading @@ -233,10 +234,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { * @return whether the coordinates of the {@param event} is in the swipe up gesture region. */ public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) { if (isTrackpadMotionEvent(event)) { return !activity.isResumed(); } return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(), event.getY()); return isInSwipeUpTouchRegion(event, 0, activity); } /** Loading @@ -246,7 +244,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex, BaseActivityInterface activity) { if (isTrackpadMotionEvent(event)) { return !activity.isResumed(); return isTrackpadMultiFingerSwipe(event) && !activity.isResumed(); } return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(pointerIndex), event.getY(pointerIndex)); Loading quickstep/src/com/android/quickstep/TouchInteractionService.java +13 −5 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ package com.android.quickstep; import static android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; 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.Utilities.isTrackpadMotionEvent; 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; Loading Loading @@ -628,7 +630,7 @@ public class TouchInteractionService extends Service Object traceToken = TraceHelper.INSTANCE.beginFlagsOverride( TraceHelper.FLAG_ALLOW_BINDER_TRACKING); final int action = event.getAction(); final int action = event.getActionMasked(); if (action == ACTION_DOWN) { mRotationTouchHelper.setOrientationTransformIfNeeded(event); Loading @@ -639,7 +641,7 @@ public class TouchInteractionService extends Service // onConsumerInactive and wipe the previous gesture state GestureState prevGestureState = new GestureState(mGestureState); GestureState newGestureState = createGestureState(mGestureState, isTrackpadMotionEvent(event)); isTrackpadMultiFingerSwipe(event)); newGestureState.setSwipeUpStartTimeMs(SystemClock.uptimeMillis()); mConsumer.onConsumerAboutToBeSwitched(); mGestureState = newGestureState; Loading @@ -647,7 +649,8 @@ public class TouchInteractionService extends Service mUncheckedConsumer = mConsumer; } else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode() && mDeviceState.canTriggerAssistantAction(event)) { mGestureState = createGestureState(mGestureState, isTrackpadMotionEvent(event)); mGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); // Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we // should not interrupt it. QuickSwitch assumes that interruption can only // happen if the next gesture is also quick switch. Loading Loading @@ -694,7 +697,12 @@ public class TouchInteractionService extends Service if (cancelGesture) { event.setAction(ACTION_CANCEL); } // Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad. if (!mGestureState.isTrackpadGesture() || (action != ACTION_POINTER_DOWN && action != ACTION_POINTER_UP)) { mUncheckedConsumer.onMotionEvent(event); } if (cleanUpConsumer) { reset(); Loading Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +4 −3 Original line number Diff line number Diff line Loading @@ -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.Utilities.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; Loading Loading @@ -91,6 +91,7 @@ public class StatusBarTouchController implements TouchController { if (!mCanIntercept) { return false; } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { // Check!! should only set it only when threshold is not entered. Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -369,7 +369,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mIsTaskbarAllAppsOpen = controller != null && controller.isTaskbarAllAppsOpen(); mTaskbarAppWindowThreshold = res.getDimensionPixelSize(R.dimen.taskbar_app_window_threshold); boolean swipeWillNotShowTaskbar = mTaskbarAlreadyOpen; boolean swipeWillNotShowTaskbar = mTaskbarAlreadyOpen || mGestureState.isTrackpadGesture(); mTaskbarHomeOverviewThreshold = swipeWillNotShowTaskbar ? 0 : res.getDimensionPixelSize(R.dimen.taskbar_home_overview_threshold); Loading Loading @@ -2317,7 +2317,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return displacement; } if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) { if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen || mGestureState.isTrackpadGesture()) { return displacement; } Loading
quickstep/src/com/android/quickstep/MotionEventsUtils.java 0 → 100644 +48 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static android.view.MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE; import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE; import android.annotation.TargetApi; import android.os.Build; import android.view.MotionEvent; /** Handles motion events from trackpad. */ public class MotionEventsUtils { /** {@link MotionEvent#CLASSIFICATION_MULTI_FINGER_SWIPE} is hidden. */ public static final int CLASSIFICATION_MULTI_FINGER_SWIPE = 4; @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static boolean isTrackpadScroll(MotionEvent event) { return ENABLE_TRACKPAD_GESTURE.get() && event.getClassification() == CLASSIFICATION_TWO_FINGER_SWIPE; } @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static boolean isTrackpadMultiFingerSwipe(MotionEvent event) { return ENABLE_TRACKPAD_GESTURE.get() && event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE; } public static boolean isTrackpadMotionEvent(MotionEvent event) { return isTrackpadScroll(event) || isTrackpadMultiFingerSwipe(event); } }
quickstep/src/com/android/quickstep/RotationTouchHelper.java +4 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.quickstep; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Surface.ROTATION_0; import static com.android.launcher3.Utilities.isTrackpadMotionEvent; 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; Loading @@ -26,6 +25,8 @@ 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; Loading Loading @@ -233,10 +234,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { * @return whether the coordinates of the {@param event} is in the swipe up gesture region. */ public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) { if (isTrackpadMotionEvent(event)) { return !activity.isResumed(); } return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(), event.getY()); return isInSwipeUpTouchRegion(event, 0, activity); } /** Loading @@ -246,7 +244,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex, BaseActivityInterface activity) { if (isTrackpadMotionEvent(event)) { return !activity.isResumed(); return isTrackpadMultiFingerSwipe(event) && !activity.isResumed(); } return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(pointerIndex), event.getY(pointerIndex)); Loading
quickstep/src/com/android/quickstep/TouchInteractionService.java +13 −5 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ package com.android.quickstep; import static android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; 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.Utilities.isTrackpadMotionEvent; 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; Loading Loading @@ -628,7 +630,7 @@ public class TouchInteractionService extends Service Object traceToken = TraceHelper.INSTANCE.beginFlagsOverride( TraceHelper.FLAG_ALLOW_BINDER_TRACKING); final int action = event.getAction(); final int action = event.getActionMasked(); if (action == ACTION_DOWN) { mRotationTouchHelper.setOrientationTransformIfNeeded(event); Loading @@ -639,7 +641,7 @@ public class TouchInteractionService extends Service // onConsumerInactive and wipe the previous gesture state GestureState prevGestureState = new GestureState(mGestureState); GestureState newGestureState = createGestureState(mGestureState, isTrackpadMotionEvent(event)); isTrackpadMultiFingerSwipe(event)); newGestureState.setSwipeUpStartTimeMs(SystemClock.uptimeMillis()); mConsumer.onConsumerAboutToBeSwitched(); mGestureState = newGestureState; Loading @@ -647,7 +649,8 @@ public class TouchInteractionService extends Service mUncheckedConsumer = mConsumer; } else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode() && mDeviceState.canTriggerAssistantAction(event)) { mGestureState = createGestureState(mGestureState, isTrackpadMotionEvent(event)); mGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); // Do not change mConsumer as if there is an ongoing QuickSwitch gesture, we // should not interrupt it. QuickSwitch assumes that interruption can only // happen if the next gesture is also quick switch. Loading Loading @@ -694,7 +697,12 @@ public class TouchInteractionService extends Service if (cancelGesture) { event.setAction(ACTION_CANCEL); } // Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad. if (!mGestureState.isTrackpadGesture() || (action != ACTION_POINTER_DOWN && action != ACTION_POINTER_UP)) { mUncheckedConsumer.onMotionEvent(event); } if (cleanUpConsumer) { reset(); Loading