diff options
author | Tony Wickham <twickham@google.com> | 2019-10-04 12:55:22 -0700 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-10-11 18:51:35 +0000 |
commit | 7409190c86352c24e6ac6a023f0e610e02bc93ce (patch) | |
tree | 22c56c00bb0175f63d1dafee59dcd19389fe42f2 | |
parent | b8b9cfaf0d7565db83df94b1b026e2e746c628d8 (diff) | |
download | packages_apps_Trebuchet-7409190c86352c24e6ac6a023f0e610e02bc93ce.tar.gz packages_apps_Trebuchet-7409190c86352c24e6ac6a023f0e610e02bc93ce.tar.bz2 packages_apps_Trebuchet-7409190c86352c24e6ac6a023f0e610e02bc93ce.zip |
Fix quickswitch flickers/ignored swipes
- Don't set current page to running task when applying load plan,
if we are already settling on a new task to launch.
- When starting a new task, finish to the running app if that's
the task being started (should not happen with above change)
- When disabling free scroll mode, don't snap to a page if we're
already on it. This was setting mNextPage so the first check
was falsing.
Bug: 142068081
Change-Id: I5b392d9726a81c51718d2f94eee6cd4f78b61f69
Merged-In: I5b392d9726a81c51718d2f94eee6cd4f78b61f69
(cherry picked from commit af33f2c9d4063c2ad95a92777cbd5e66d81d3fab)
(cherry picked from commit 4d86c804baf6afb9fad0592ab062a4dba6998a03)
3 files changed, 19 insertions, 6 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 a3bd348e2..e1085e608 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -923,7 +923,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 d98ef425e..ef54d3f89 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; @@ -572,9 +571,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl final TaskView taskView = (TaskView) getChildAt(pageIndex); taskView.bind(task); } - TaskView runningTaskView = getRunningTaskView(); - if (runningTaskView != null) { - setCurrentPage(indexOfChild(runningTaskView)); + + 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)); + } } if (mIgnoreResetTaskId != -1 && getTaskView(mIgnoreResetTaskId) != ignoreRestTaskView) { diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 70b55a44d..79d6ca793 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()); + } } } |