diff options
Diffstat (limited to 'quickstep/src/com/android/quickstep/util/TaskViewSimulator.java')
-rw-r--r-- | quickstep/src/com/android/quickstep/util/TaskViewSimulator.java | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 9b2a449337..baaa062e97 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; @@ -26,6 +27,7 @@ import static com.android.launcher3.util.SplitConfigurationOptions.StagePosition import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation; import static com.android.quickstep.util.RecentsOrientedState.preDisplayRotation; +import static com.android.quickstep.util.SplitScreenUtils.convertLauncherSplitBoundsToShell; import android.animation.TimeInterpolator; import android.content.Context; @@ -107,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; @@ -146,12 +149,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { return 1; } - if (mIsDesktopTask) { - mTaskRect.set(mThumbnailPosition); - mPivot.set(mTaskRect.centerX(), mTaskRect.centerY()); - return 1; - } - if (mIsGridTask) { mSizeStrategy.calculateGridTaskSize(mContext, mDp, mTaskRect, mOrientationState.getOrientationHandler()); @@ -169,10 +166,25 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mOrientationState.getOrientationHandler() .setSplitTaskSwipeRect(mDp, mTaskRect, mSplitBounds, mStagePosition); mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); + } else if (mIsDesktopTask) { + // For desktop, tasks can take up only part of the screen size. + // Full task size represents the whole screen size, but scaled down to fit in recents. + // Task rect will represent the scaled down thumbnail position and is placed inside + // full task size as it is on the home screen. + fullTaskSize = new Rect(mTaskRect); + PointF fullscreenTaskDimension = new PointF(); + BaseActivityInterface.getTaskDimension(mContext, mDp, fullscreenTaskDimension); + // Calculate the scale down factor used in recents + float scale = fullTaskSize.width() / fullscreenTaskDimension.x; + mTaskRect.set(mThumbnailPosition); + mTaskRect.scale(scale); + // 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); } @@ -202,7 +214,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mStagePosition = mThumbnailPosition.equals(splitInfo.leftTopBounds) ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT; - mPositionHelper.setSplitBounds(convertSplitBounds(mSplitBounds), mStagePosition); + mPositionHelper.setSplitBounds(convertLauncherSplitBoundsToShell(mSplitBounds), + mStagePosition); } /** @@ -255,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); } @@ -335,8 +353,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { boolean isRtlEnabled = !mIsRecentsRtl; mPositionHelper.updateThumbnailMatrix( mThumbnailPosition, mThumbnailData, mTaskRect.width(), mTaskRect.height(), - mDp.widthPx, mDp.heightPx, mDp.taskbarHeight, mDp.isTablet, - mOrientationState.getRecentsActivityRotation(), isRtlEnabled); + mDp.isTablet, mOrientationState.getRecentsActivityRotation(), isRtlEnabled); mPositionHelper.getMatrix().invert(mInversePositionMatrix); if (DEBUG) { Log.d(TAG, " taskRect: " + mTaskRect); @@ -345,7 +362,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { float fullScreenProgress = Utilities.boundToRange(this.fullScreenProgress.value, 0, 1); mCurrentFullscreenParams.setProgress(fullScreenProgress, recentsViewScale.value, - /* taskViewScale= */1f, mTaskRect.width(), mDp, mPositionHelper); + /* taskViewScale= */1f); // Apply thumbnail matrix float taskWidth = mTaskRect.width(); @@ -410,9 +427,16 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { // conflict with layers that WM core positions (ie. the input consumers). For shell // transitions, the animation leashes are reparented to an animation container so we // can bump layers as needed. - builder.setLayer(mDrawsBelowRecents - ? Integer.MIN_VALUE + app.prefixOrderIndex - : ENABLE_SHELL_TRANSITIONS ? Integer.MAX_VALUE : 0); + if (ENABLE_SHELL_TRANSITIONS) { + builder.setLayer(mDrawsBelowRecents + ? Integer.MIN_VALUE + app.prefixOrderIndex + // 1000 is an arbitrary number to give room for multiple layers. + : Integer.MAX_VALUE - 1000 + app.prefixOrderIndex); + } else { + builder.setLayer(mDrawsBelowRecents + ? Integer.MIN_VALUE + app.prefixOrderIndex + : 0); + } } } @@ -429,16 +453,4 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { // Ideally we should use square-root. This is an optimization as one of the dimension is 0. return Math.max(Math.abs(mTempPoint[0]), Math.abs(mTempPoint[1])); } - - /** - * TODO(b/254378592): Remove this after consolidation of classes - */ - public static com.android.wm.shell.util.SplitBounds convertSplitBounds(SplitBounds bounds) { - return new com.android.wm.shell.util.SplitBounds( - bounds.leftTopBounds, - bounds.rightBottomBounds, - bounds.leftTopTaskId, - bounds.rightBottomTaskId - ); - } } |