Merge "Revert^2 "Cancel gestures on launcher destroy"" into tm-qpr-dev

This commit is contained in:
Schneider Victor-tulias
2023-01-24 17:55:54 +00:00
committed by Android (Google) Code Review
6 changed files with 66 additions and 5 deletions
@@ -51,6 +51,7 @@ import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHE
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.LAUNCHER_DESTROYED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.ON_SETTLED_ON_END_TARGET;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -182,6 +183,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
if (mActivity != activity) {
return;
}
handleActivityDestroyed();
mRecentsView = null;
mActivity = null;
}
@@ -462,6 +464,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
return false;
}
mStateCallback.resumeCallbacks();
T createdActivity = mActivityInterface.getCreatedActivity();
if (createdActivity != null) {
@@ -531,6 +534,15 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
return true;
}
private void handleActivityDestroyed() {
ActiveGestureLog.INSTANCE.addLog("Launcher activity destroyed", LAUNCHER_DESTROYED);
if (mActivityInterface.shouldCancelGestureOnDestroy()) {
onGestureCancelled();
} else {
mStateCallback.pauseCallbacks();
}
}
/**
* Return true if the window should be translated horizontally if the recents view scrolls
*/