From 94d1b4be17f607b17b20915b3adba6a1ef18a5ae Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 19 Jun 2020 17:42:18 -0500 Subject: [PATCH] Fix RecentsView scroll linking - Reverts change from ag/11900651 that deferred setting mRecentsViewScrollLinked = true - Instead, setCurrentPage(mCurrentPage) after updating layout rotation to ensure we recompute page scrolls before using them Test: - Auto rotate on, home rotation off, open Calculator in landscape, swipe up slowly and ensure it never turns invisible - Quick switch from Calculator to Clock, start swiping directly up immediately after settling on Clock, ensure Calculator window remains at its scroll position to the side (b/159461591) Fixes: 159461591 Change-Id: Iab92963cc6c33df42b77f5ccfa3932382e8f869a --- .../src/com/android/quickstep/BaseSwipeUpHandler.java | 5 +---- .../src/com/android/quickstep/views/RecentsView.java | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 9db6576765..02bae64274 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -121,10 +121,6 @@ public abstract class BaseSwipeUpHandler, Q extend }); mRecentsView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> { - // Wait until the first scroll event before applying scroll to taskViewSimulator. - // Since, by default the current/running task already centered, this ensures that we - // do not move the running task, in case RecentsView has not yet laid out completely. - mRecentsViewScrollLinked = true; if (moveWindowWithRecentsScroll()) { updateFinalShift(); } @@ -132,6 +128,7 @@ public abstract class BaseSwipeUpHandler, Q extend runOnRecentsAnimationStart(() -> mRecentsView.setRecentsAnimationTargets(mRecentsAnimationController, mRecentsAnimationTargets)); + mRecentsViewScrollLinked = true; } protected void startNewTask(Consumer resultCallback) { 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 6380bbefa0..dd9eb19591 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 @@ -1656,6 +1656,8 @@ public abstract class RecentsView extends PagedView impl !mOrientationState.canLauncherRotate() && isInLandscape); resetPaddingFromTaskSize(); requestLayout(); + // Reapply the current page to update page scrolls. + setCurrentPage(mCurrentPage); } }