mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Don't reset GestureState when touching outside of swipe region
We were setting mGestureState = DEFAULT_STATE when touching outside of the swipe region. Instead, we should only set mGestureState when starting a new gesture, and only set it to DEFAULT_STATE on reset. This also makes it clearer that mGestureState always refers to the current gesture state, rather than sometimes being the current gesture and sometimes being the previous gesture depending on where it was used. Now previousGestureState is passed when needed. Bug: 159494933 Change-Id: Ib62278b7c591ca4c6b99b26e058a34772e6cec2a
This commit is contained in:
@@ -471,7 +471,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
Log.d(TestProtocol.NO_SWIPE_TO_HOME, "TouchInteractionService.onInputEvent:DOWN");
|
||||
}
|
||||
mDeviceState.setOrientationTransformIfNeeded(event);
|
||||
GestureState newGestureState;
|
||||
|
||||
if (mDeviceState.isInSwipeUpTouchRegion(event)) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
@@ -481,35 +480,30 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
// Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
|
||||
// onConsumerInactive and wipe the previous gesture state
|
||||
GestureState prevGestureState = new GestureState(mGestureState);
|
||||
newGestureState = createGestureState();
|
||||
mGestureState = createGestureState(mGestureState);
|
||||
mConsumer.onConsumerAboutToBeSwitched();
|
||||
mConsumer = newConsumer(prevGestureState, newGestureState, event);
|
||||
mConsumer = newConsumer(prevGestureState, mGestureState, event);
|
||||
|
||||
ActiveGestureLog.INSTANCE.addLog("setInputConsumer: " + mConsumer.getName());
|
||||
mUncheckedConsumer = mConsumer;
|
||||
} else if (mDeviceState.isUserUnlocked() && mDeviceState.isFullyGesturalNavMode()) {
|
||||
newGestureState = createGestureState();
|
||||
ActivityManager.RunningTaskInfo runningTask = newGestureState.getRunningTask();
|
||||
mGestureState = createGestureState(mGestureState);
|
||||
ActivityManager.RunningTaskInfo runningTask = mGestureState.getRunningTask();
|
||||
if (mDeviceState.canTriggerAssistantAction(event, runningTask)) {
|
||||
// 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.
|
||||
mUncheckedConsumer = new AssistantInputConsumer(
|
||||
this,
|
||||
newGestureState,
|
||||
mGestureState,
|
||||
InputConsumer.NO_OP, mInputMonitorCompat,
|
||||
mOverviewComponentObserver.assistantGestureIsConstrained());
|
||||
} else {
|
||||
newGestureState = DEFAULT_STATE;
|
||||
mUncheckedConsumer = InputConsumer.NO_OP;
|
||||
}
|
||||
} else {
|
||||
newGestureState = DEFAULT_STATE;
|
||||
mUncheckedConsumer = InputConsumer.NO_OP;
|
||||
}
|
||||
|
||||
// Save the current gesture state
|
||||
mGestureState = newGestureState;
|
||||
} else {
|
||||
// Other events
|
||||
if (mUncheckedConsumer != InputConsumer.NO_OP) {
|
||||
@@ -533,14 +527,14 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
TraceHelper.INSTANCE.endFlagsOverride(traceToken);
|
||||
}
|
||||
|
||||
private GestureState createGestureState() {
|
||||
private GestureState createGestureState(GestureState previousGestureState) {
|
||||
GestureState gestureState = new GestureState(mOverviewComponentObserver,
|
||||
ActiveGestureLog.INSTANCE.generateAndSetLogId());
|
||||
if (mTaskAnimationManager.isRecentsAnimationRunning()) {
|
||||
gestureState.updateRunningTask(mGestureState.getRunningTask());
|
||||
gestureState.updateLastStartedTaskId(mGestureState.getLastStartedTaskId());
|
||||
gestureState.updateRunningTask(previousGestureState.getRunningTask());
|
||||
gestureState.updateLastStartedTaskId(previousGestureState.getLastStartedTaskId());
|
||||
gestureState.updatePreviouslyAppearedTaskIds(
|
||||
mGestureState.getPreviouslyAppearedTaskIds());
|
||||
previousGestureState.getPreviouslyAppearedTaskIds());
|
||||
} else {
|
||||
gestureState.updateRunningTask(TraceHelper.whitelistIpcs("getRunningTask.0",
|
||||
() -> mAM.getRunningTask(false /* filterOnlyVisibleRecents */)));
|
||||
@@ -743,7 +737,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
|
||||
private void reset() {
|
||||
mConsumer = mUncheckedConsumer = mResetGestureInputConsumer;
|
||||
mGestureState = new GestureState();
|
||||
mGestureState = DEFAULT_STATE;
|
||||
}
|
||||
|
||||
private void preloadOverview(boolean fromInit) {
|
||||
|
||||
Reference in New Issue
Block a user