From d60eff365b21e759ffd04bae1f899363096547cf Mon Sep 17 00:00:00 2001 From: helencheuk Date: Wed, 4 Oct 2023 18:35:34 +0100 Subject: [PATCH] Move task to middle when dragging up in grid only overview When dragging up, TaskView should be in the middle of the screen if grid only overview is enabled. The pivot and translation of current task and other tasks are changed to move it to the middle. Bug: 291880228 Test: TaplTestsQuickstep#testBackground Test: Manual Test, swipe up to go from app to overview, app launch for live/non-live, split screen as live/non-live task. Test the same scenario in 3P Launcher Flag: enableGridOnlyOverview Change-Id: I297119283771ef70c916c63f799552656d767661 --- .../quickstep/util/TaskViewSimulator.java | 12 ++++++++++-- .../android/quickstep/views/RecentsView.java | 17 +++++++++++++---- .../com/android/quickstep/views/TaskView.java | 16 +++++++++++++--- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 767aa15ff3..5d8e53efe7 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -17,6 +17,7 @@ package com.android.quickstep.util; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static com.android.launcher3.Flags.enableGridOnlyOverview; import static com.android.launcher3.states.RotationHelper.deltaRotation; import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; @@ -108,6 +109,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { private boolean mIsDesktopTask; private int mTaskRectTranslationX; private int mTaskRectTranslationY; + private int mPivotOffsetX; public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) { mContext = context; @@ -179,9 +181,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { // Ensure the task rect is inside the full task rect mTaskRect.offset(fullTaskSize.left, fullTaskSize.top); } else { - fullTaskSize = mTaskRect; + fullTaskSize = new Rect(mTaskRect); + mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } - fullTaskSize.offset(mTaskRectTranslationX, mTaskRectTranslationY); + fullTaskSize.offset(mTaskRectTranslationX + mPivotOffsetX, mTaskRectTranslationY); return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot); } @@ -265,6 +268,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { */ public void addAppToOverviewAnim(PendingAnimation pa, TimeInterpolator interpolator) { pa.addFloat(fullScreenProgress, AnimatedFloat.VALUE, 1, 0, interpolator); + if (enableGridOnlyOverview() && mDp.isTablet) { + int translationXToMiddle = mDp.widthPx / 2 - mTaskRect.centerX(); + taskPrimaryTranslation.value = translationXToMiddle; + mPivotOffsetX = translationXToMiddle; + } pa.addFloat(recentsViewScale, AnimatedFloat.VALUE, getFullScreenScale(), 1, interpolator); } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index e6f015e1cf..76e92defa3 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2101,11 +2101,15 @@ public abstract class RecentsView