diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java index 929b11ad66..ed33532e6d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java @@ -488,6 +488,16 @@ public abstract class BaseSwipeUpHandlerV2, Q exte recentsAttachedToAppWindow = mIsShelfPeeking || mIsLikelyToStartNewTask; } mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate); + + // Reapply window transform throughout the attach animation, as the animation affects how + // much the window is bound by overscroll (vs moving freely). + if (animate) { + ValueAnimator reapplyWindowTransformAnim = ValueAnimator.ofFloat(0, 1); + reapplyWindowTransformAnim.addUpdateListener(anim -> applyWindowTransform()); + reapplyWindowTransformAnim.setDuration(RECENTS_ATTACH_DURATION).start(); + } else { + applyWindowTransform(); + } } @Override 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 857a020698..26e6055174 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 @@ -2290,7 +2290,14 @@ public abstract class RecentsView extends PagedView if (pageIndex == -1) { return 0; } - return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this); + // Unbound the scroll (due to overscroll) if the adjacent tasks are offset away from it. + // This allows the page to move freely, given there's no visual indication why it shouldn't. + int boundedScroll = mOrientationHandler.getPrimaryScroll(this); + int unboundedScroll = getUnboundedScroll(); + float unboundedProgress = mAdjacentPageOffset; + int scroll = Math.round(unboundedScroll * unboundedProgress + + boundedScroll * (1 - unboundedProgress)); + return getScrollForPage(pageIndex) - scroll; } public Consumer getEventDispatcher(float navbarRotation) {