Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +15 −4 Original line number Diff line number Diff line Loading @@ -15,11 +15,15 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS; import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.MotionEventsUtils.isTrackpadFourFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; Loading Loading @@ -106,6 +110,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, newCancelListener(this::clearState); private boolean mNoIntercept; private Boolean mIsTrackpadFourFingerSwipe; private LauncherState mStartState; private boolean mIsHomeScreenVisible = true; Loading @@ -131,7 +136,9 @@ public class NoButtonQuickSwitchTouchController implements TouchController, @Override public boolean onControllerInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { int action = ev.getActionMasked(); if (action == ACTION_DOWN) { mIsTrackpadFourFingerSwipe = null; mNoIntercept = !canInterceptTouch(ev); if (mNoIntercept) { return false; Loading @@ -140,6 +147,13 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // Only detect horizontal swipe for intercept, then we will allow swipe up as well. mSwipeDetector.setDetectableScrollConditions(DIRECTION_RIGHT, false /* ignoreSlopWhenSettling */); } else if (isTrackpadMultiFingerSwipe(ev) && mIsTrackpadFourFingerSwipe == null && action == ACTION_MOVE) { mIsTrackpadFourFingerSwipe = isTrackpadFourFingerSwipe(ev); mNoIntercept = !mIsTrackpadFourFingerSwipe; if (mNoIntercept) { return false; } } if (mNoIntercept) { Loading @@ -162,9 +176,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, if ((ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0) { return false; } if (isTrackpadMultiFingerSwipe(ev)) { return false; } int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0) { return false; Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -2064,8 +2064,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsView.setRecentsAnimationTargets(mRecentsAnimationController, mRecentsAnimationTargets)); // Disable scrolling in RecentsView for trackpad gestures. if (!mGestureState.isTrackpadGesture()) { // Disable scrolling in RecentsView for trackpad 3-finger swipe up gesture. if (!mGestureState.isThreeFingerTrackpadGesture()) { mRecentsViewScrollLinked = true; } } Loading quickstep/src/com/android/quickstep/GestureState.java +39 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.quickstep; import static com.android.launcher3.MotionEventsUtils.isTrackpadFourFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadThreeFingerSwipe; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; Loading @@ -27,6 +30,7 @@ import android.annotation.Nullable; import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.view.MotionEvent; import android.view.RemoteAnimationTarget; import com.android.launcher3.statemanager.BaseState; Loading Loading @@ -139,8 +143,30 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL private final BaseActivityInterface mActivityInterface; private final MultiStateCallback mStateCallback; private final int mGestureId; private boolean mIsTrackpadGesture; public enum TrackpadGestureType { NONE, // Assigned before we know whether it's a 3-finger or 4-finger gesture. MULTI_FINGER, THREE_FINGER, FOUR_FINGER; public static TrackpadGestureType getTrackpadGestureType(MotionEvent event) { if (!isTrackpadMultiFingerSwipe(event)) { return TrackpadGestureType.NONE; } if (isTrackpadThreeFingerSwipe(event)) { return TrackpadGestureType.THREE_FINGER; } if (isTrackpadFourFingerSwipe(event)) { return TrackpadGestureType.FOUR_FINGER; } return TrackpadGestureType.MULTI_FINGER; } } private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE; private CachedTaskInfo mRunningTask; private GestureEndTarget mEndTarget; private RemoteAnimationTarget mLastAppearedTaskTarget; Loading Loading @@ -249,17 +275,22 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL } /** * Sets if the gesture is is from the trackpad. * Sets if the gesture is is from the trackpad, if so, whether 3-finger, or 4-finger */ public void setIsTrackpadGesture(boolean isTrackpadGesture) { mIsTrackpadGesture = isTrackpadGesture; public void setTrackpadGestureType(TrackpadGestureType trackpadGestureType) { mTrackpadGestureType = trackpadGestureType; } /** * @return if the gesture is from the trackpad. */ public boolean isTrackpadGesture() { return mIsTrackpadGesture; return mTrackpadGestureType != TrackpadGestureType.NONE; } public boolean isThreeFingerTrackpadGesture() { return mTrackpadGestureType == TrackpadGestureType.THREE_FINGER; } public boolean isFourFingerTrackpadGesture() { return mTrackpadGestureType == TrackpadGestureType.FOUR_FINGER; } /** Loading quickstep/src/com/android/quickstep/OverviewCommandHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,7 @@ public class OverviewCommandHelper { } GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE, false /* isTrackpadGesture */); GestureState.TrackpadGestureType.NONE); gestureState.setHandlingAtomicEvent(true); AbsSwipeUpHandler interactionHandler = mService.getSwipeUpHandlerFactory() .newHandler(gestureState, cmd.createTime); Loading quickstep/src/com/android/quickstep/TouchInteractionService.java +12 −8 Original line number Diff line number Diff line Loading @@ -24,11 +24,11 @@ import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.Launcher.INTENT_ACTION_ALL_APPS_TOGGLE; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.quickstep.GestureState.TrackpadGestureType.getTrackpadGestureType; 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_MOVE; Loading Loading @@ -647,7 +647,7 @@ public class TouchInteractionService extends Service // onConsumerInactive and wipe the previous gesture state GestureState prevGestureState = new GestureState(mGestureState); GestureState newGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); getTrackpadGestureType(event)); newGestureState.setSwipeUpStartTimeMs(SystemClock.uptimeMillis()); mConsumer.onConsumerAboutToBeSwitched(); mGestureState = newGestureState; Loading @@ -656,7 +656,7 @@ public class TouchInteractionService extends Service } else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode() && mDeviceState.canTriggerAssistantAction(event)) { mGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); getTrackpadGestureType(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 @@ -713,9 +713,13 @@ public class TouchInteractionService extends Service event.setAction(ACTION_CANCEL); } if (mGestureState.isTrackpadGesture() && (action == ACTION_POINTER_DOWN || action == ACTION_POINTER_UP)) { // Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad. if (!mGestureState.isTrackpadGesture() || (action != ACTION_POINTER_DOWN && action != ACTION_POINTER_UP)) { if (action == ACTION_POINTER_DOWN) { mGestureState.setTrackpadGestureType(getTrackpadGestureType(event)); } } else { mUncheckedConsumer.onMotionEvent(event); } Loading Loading @@ -749,7 +753,7 @@ public class TouchInteractionService extends Service } public GestureState createGestureState(GestureState previousGestureState, boolean isTrackpadGesture) { GestureState.TrackpadGestureType trackpadGestureType) { final GestureState gestureState; TopTaskTracker.CachedTaskInfo taskInfo; if (mTaskAnimationManager.isRecentsAnimationRunning()) { Loading @@ -766,7 +770,7 @@ public class TouchInteractionService extends Service taskInfo = TopTaskTracker.INSTANCE.get(this).getCachedTopTask(false); gestureState.updateRunningTask(taskInfo); } gestureState.setIsTrackpadGesture(isTrackpadGesture); gestureState.setTrackpadGestureType(trackpadGestureType); // Log initial state for the gesture. ActiveGestureLog.INSTANCE.addLog(new CompoundString("Current running task package name=") Loading Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +15 −4 Original line number Diff line number Diff line Loading @@ -15,11 +15,15 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS; import static com.android.launcher3.LauncherState.QUICK_SWITCH_FROM_HOME; import static com.android.launcher3.MotionEventsUtils.isTrackpadFourFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; Loading Loading @@ -106,6 +110,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, newCancelListener(this::clearState); private boolean mNoIntercept; private Boolean mIsTrackpadFourFingerSwipe; private LauncherState mStartState; private boolean mIsHomeScreenVisible = true; Loading @@ -131,7 +136,9 @@ public class NoButtonQuickSwitchTouchController implements TouchController, @Override public boolean onControllerInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { int action = ev.getActionMasked(); if (action == ACTION_DOWN) { mIsTrackpadFourFingerSwipe = null; mNoIntercept = !canInterceptTouch(ev); if (mNoIntercept) { return false; Loading @@ -140,6 +147,13 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // Only detect horizontal swipe for intercept, then we will allow swipe up as well. mSwipeDetector.setDetectableScrollConditions(DIRECTION_RIGHT, false /* ignoreSlopWhenSettling */); } else if (isTrackpadMultiFingerSwipe(ev) && mIsTrackpadFourFingerSwipe == null && action == ACTION_MOVE) { mIsTrackpadFourFingerSwipe = isTrackpadFourFingerSwipe(ev); mNoIntercept = !mIsTrackpadFourFingerSwipe; if (mNoIntercept) { return false; } } if (mNoIntercept) { Loading @@ -162,9 +176,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, if ((ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0) { return false; } if (isTrackpadMultiFingerSwipe(ev)) { return false; } int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0) { return false; Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -2064,8 +2064,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsView.setRecentsAnimationTargets(mRecentsAnimationController, mRecentsAnimationTargets)); // Disable scrolling in RecentsView for trackpad gestures. if (!mGestureState.isTrackpadGesture()) { // Disable scrolling in RecentsView for trackpad 3-finger swipe up gesture. if (!mGestureState.isThreeFingerTrackpadGesture()) { mRecentsViewScrollLinked = true; } } Loading
quickstep/src/com/android/quickstep/GestureState.java +39 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.quickstep; import static com.android.launcher3.MotionEventsUtils.isTrackpadFourFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadThreeFingerSwipe; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; Loading @@ -27,6 +30,7 @@ import android.annotation.Nullable; import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.view.MotionEvent; import android.view.RemoteAnimationTarget; import com.android.launcher3.statemanager.BaseState; Loading Loading @@ -139,8 +143,30 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL private final BaseActivityInterface mActivityInterface; private final MultiStateCallback mStateCallback; private final int mGestureId; private boolean mIsTrackpadGesture; public enum TrackpadGestureType { NONE, // Assigned before we know whether it's a 3-finger or 4-finger gesture. MULTI_FINGER, THREE_FINGER, FOUR_FINGER; public static TrackpadGestureType getTrackpadGestureType(MotionEvent event) { if (!isTrackpadMultiFingerSwipe(event)) { return TrackpadGestureType.NONE; } if (isTrackpadThreeFingerSwipe(event)) { return TrackpadGestureType.THREE_FINGER; } if (isTrackpadFourFingerSwipe(event)) { return TrackpadGestureType.FOUR_FINGER; } return TrackpadGestureType.MULTI_FINGER; } } private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE; private CachedTaskInfo mRunningTask; private GestureEndTarget mEndTarget; private RemoteAnimationTarget mLastAppearedTaskTarget; Loading Loading @@ -249,17 +275,22 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL } /** * Sets if the gesture is is from the trackpad. * Sets if the gesture is is from the trackpad, if so, whether 3-finger, or 4-finger */ public void setIsTrackpadGesture(boolean isTrackpadGesture) { mIsTrackpadGesture = isTrackpadGesture; public void setTrackpadGestureType(TrackpadGestureType trackpadGestureType) { mTrackpadGestureType = trackpadGestureType; } /** * @return if the gesture is from the trackpad. */ public boolean isTrackpadGesture() { return mIsTrackpadGesture; return mTrackpadGestureType != TrackpadGestureType.NONE; } public boolean isThreeFingerTrackpadGesture() { return mTrackpadGestureType == TrackpadGestureType.THREE_FINGER; } public boolean isFourFingerTrackpadGesture() { return mTrackpadGestureType == TrackpadGestureType.FOUR_FINGER; } /** Loading
quickstep/src/com/android/quickstep/OverviewCommandHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,7 @@ public class OverviewCommandHelper { } GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE, false /* isTrackpadGesture */); GestureState.TrackpadGestureType.NONE); gestureState.setHandlingAtomicEvent(true); AbsSwipeUpHandler interactionHandler = mService.getSwipeUpHandlerFactory() .newHandler(gestureState, cmd.createTime); Loading
quickstep/src/com/android/quickstep/TouchInteractionService.java +12 −8 Original line number Diff line number Diff line Loading @@ -24,11 +24,11 @@ import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.Launcher.INTENT_ACTION_ALL_APPS_TOGGLE; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.quickstep.GestureState.TrackpadGestureType.getTrackpadGestureType; 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_MOVE; Loading Loading @@ -647,7 +647,7 @@ public class TouchInteractionService extends Service // onConsumerInactive and wipe the previous gesture state GestureState prevGestureState = new GestureState(mGestureState); GestureState newGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); getTrackpadGestureType(event)); newGestureState.setSwipeUpStartTimeMs(SystemClock.uptimeMillis()); mConsumer.onConsumerAboutToBeSwitched(); mGestureState = newGestureState; Loading @@ -656,7 +656,7 @@ public class TouchInteractionService extends Service } else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode() && mDeviceState.canTriggerAssistantAction(event)) { mGestureState = createGestureState(mGestureState, isTrackpadMultiFingerSwipe(event)); getTrackpadGestureType(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 @@ -713,9 +713,13 @@ public class TouchInteractionService extends Service event.setAction(ACTION_CANCEL); } if (mGestureState.isTrackpadGesture() && (action == ACTION_POINTER_DOWN || action == ACTION_POINTER_UP)) { // Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad. if (!mGestureState.isTrackpadGesture() || (action != ACTION_POINTER_DOWN && action != ACTION_POINTER_UP)) { if (action == ACTION_POINTER_DOWN) { mGestureState.setTrackpadGestureType(getTrackpadGestureType(event)); } } else { mUncheckedConsumer.onMotionEvent(event); } Loading Loading @@ -749,7 +753,7 @@ public class TouchInteractionService extends Service } public GestureState createGestureState(GestureState previousGestureState, boolean isTrackpadGesture) { GestureState.TrackpadGestureType trackpadGestureType) { final GestureState gestureState; TopTaskTracker.CachedTaskInfo taskInfo; if (mTaskAnimationManager.isRecentsAnimationRunning()) { Loading @@ -766,7 +770,7 @@ public class TouchInteractionService extends Service taskInfo = TopTaskTracker.INSTANCE.get(this).getCachedTopTask(false); gestureState.updateRunningTask(taskInfo); } gestureState.setIsTrackpadGesture(isTrackpadGesture); gestureState.setTrackpadGestureType(trackpadGestureType); // Log initial state for the gesture. ActiveGestureLog.INSTANCE.addLog(new CompoundString("Current running task package name=") Loading