Disable quickswitch for trackpad gestures

Bug: 261815244
Test: make sure (1) if user starts by swiping up, disable quickswitch (they will land either in overview, home, or the current app) (2) if user starts by quick switching, cancel the gesture

Change-Id: I6b59cec0089d5e6f22eee3241c6336345dd15dce
This commit is contained in:
Tracy Zhou
2022-12-07 23:58:35 -08:00
parent 4bfef12fdd
commit 6692653328
5 changed files with 43 additions and 10 deletions

View File

@@ -628,7 +628,8 @@ public class TouchInteractionService extends Service
// Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
// onConsumerInactive and wipe the previous gesture state
GestureState prevGestureState = new GestureState(mGestureState);
GestureState newGestureState = createGestureState(mGestureState);
GestureState newGestureState = createGestureState(mGestureState,
isTrackpadMotionEvent(event));
newGestureState.setSwipeUpStartTimeMs(SystemClock.uptimeMillis());
mConsumer.onConsumerAboutToBeSwitched();
mGestureState = newGestureState;
@@ -637,7 +638,7 @@ public class TouchInteractionService extends Service
} else if (LockedUserState.get(this).isUserUnlocked()
&& mDeviceState.isFullyGesturalNavMode()
&& mDeviceState.canTriggerAssistantAction(event)) {
mGestureState = createGestureState(mGestureState);
mGestureState = createGestureState(mGestureState, isTrackpadMotionEvent(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.
@@ -715,7 +716,8 @@ public class TouchInteractionService extends Service
}
}
public GestureState createGestureState(GestureState previousGestureState) {
public GestureState createGestureState(GestureState previousGestureState,
boolean isTrackpadGesture) {
final GestureState gestureState;
TopTaskTracker.CachedTaskInfo taskInfo;
if (mTaskAnimationManager.isRecentsAnimationRunning()) {
@@ -732,6 +734,8 @@ public class TouchInteractionService extends Service
taskInfo = TopTaskTracker.INSTANCE.get(this).getCachedTopTask(false);
gestureState.updateRunningTask(taskInfo);
}
gestureState.setIsTrackpadGesture(isTrackpadGesture);
// Log initial state for the gesture.
ActiveGestureLog.INSTANCE.addLog(new CompoundString("Current running task package name=")
.append(taskInfo == null ? "no running task" : taskInfo.getPackageName()));