mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Support 4-finger gesture to quick switch
Fixes: 270610237 Test: 4-finger horizontal swipe -> quick switch Change-Id: I981a7e93ecd07357c7a9cda075f476b397c448cc
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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.
|
||||
@@ -713,9 +713,13 @@ public class TouchInteractionService extends Service
|
||||
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)) {
|
||||
if (mGestureState.isTrackpadGesture() && (action == ACTION_POINTER_DOWN
|
||||
|| action == ACTION_POINTER_UP)) {
|
||||
// Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad.
|
||||
if (action == ACTION_POINTER_DOWN) {
|
||||
mGestureState.setTrackpadGestureType(getTrackpadGestureType(event));
|
||||
}
|
||||
} else {
|
||||
mUncheckedConsumer.onMotionEvent(event);
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
@@ -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=")
|
||||
|
||||
Reference in New Issue
Block a user