diff options
4 files changed, 21 insertions, 9 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 411a8088c..c80dede53 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -922,7 +922,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> windowAnim.addListener(new AnimationSuccessListener() { @Override public void onAnimationSuccess(Animator animator) { - setStateOnUiThread(target.endState); + if (target == NEW_TASK && mRecentsView != null + && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) { + // We are about to launch the current running task, so use LAST_TASK state + // instead of NEW_TASK. This could happen, for example, if our scroll is + // aborted after we determined the target to be NEW_TASK. + setStateOnUiThread(LAST_TASK.endState); + } else { + setStateOnUiThread(target.endState); + } } }); windowAnim.start(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 554f4372c..02c43e4ad 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -17,7 +17,6 @@ package com.android.quickstep.views; import static androidx.dynamicanimation.animation.DynamicAnimation.MIN_VISIBLE_CHANGE_PIXELS; - import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; @@ -573,11 +572,14 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl taskView.bind(task); } - TaskView runningTaskView = getRunningTaskView(); - if (runningTaskView != null) { - setCurrentPage(indexOfChild(runningTaskView)); - } else if (getTaskViewCount() > 0) { - setCurrentPage(indexOfChild(getTaskViewAt(0))); + if (mNextPage == INVALID_PAGE) { + // Set the current page to the running task, but not if settling on new task. + TaskView runningTaskView = getRunningTaskView(); + if (runningTaskView != null) { + setCurrentPage(indexOfChild(runningTaskView)); + } else if (getTaskViewCount() > 0) { + setCurrentPage(indexOfChild(getTaskViewAt(0))); + } } if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreResetTaskView) { diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index e29552713..c2197ab70 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -181,7 +181,7 @@ public class NavigationModeSwitchRule implements TestRule { SysUINavigationMode.INSTANCE.get(targetContext); targetContext.getMainExecutor().execute(() -> sysUINavigationMode.addModeChangeListener(listener)); - latch.await(10, TimeUnit.SECONDS); + latch.await(60, TimeUnit.SECONDS); targetContext.getMainExecutor().execute(() -> sysUINavigationMode.removeModeChangeListener(listener)); assertTrue("Navigation mode didn't change to " + expectedMode, diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 5c790f379..ff2b40038 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1088,7 +1088,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou if (mFreeScroll) { setCurrentPage(getNextPage()); } else if (wasFreeScroll) { - snapToPage(getNextPage()); + if (getScrollForPage(getNextPage()) != getScrollX()) { + snapToPage(getNextPage()); + } } } |