From 1eedfc33c52cea1d37ae4948737f9d773f87779b Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Mon, 18 May 2020 10:36:35 +0800 Subject: [PATCH] Fix weird split-screen secondary task animation As CL[1] corrects the screenBounds of remote animation target, and we are now using RemoteAnimationTarget#localBounds to offect the position. Remove the offset logics in AppWindowAnimationHelper#updateSourceStack, and TaskViewSimulator#setPreview, then refine computeSurfaceParams with offseting the position of HOME task by localBounds. [1]: I793f01fb290fe65af1bbf8e29e429fbca63ac255 Fix: 153581126 Test: manual as below steps: 1) Launch a app, swipe up to overview screen. 2) Tap app icon and pressing "Split screen" item. 3) After entered split-screen mode, taps the task view. 4) Make sure the secondary task animation the movement is correct and smoothly. Change-Id: I0e4ed1465e80f48336908813ac694fb3aaa3c347 --- .../quickstep/util/AppWindowAnimationHelper.java | 13 +++++-------- .../android/quickstep/util/TaskViewSimulator.java | 4 ---- .../android/quickstep/views/TaskThumbnailView.java | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/AppWindowAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/AppWindowAnimationHelper.java index a7979cce96..110370a722 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/AppWindowAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/AppWindowAnimationHelper.java @@ -107,9 +107,6 @@ public class AppWindowAnimationHelper implements TransformParams.BuilderProxy { private void updateSourceStack(RemoteAnimationTargetCompat target) { mSourceInsets.set(target.contentInsets); mSourceStackBounds.set(target.screenSpaceBounds); - - // TODO: Should sourceContainerBounds already have this offset? - mSourceStackBounds.offsetTo(target.position.x, target.position.y); } public void updateSource(Rect homeStackBounds, RemoteAnimationTargetCompat target) { @@ -186,14 +183,14 @@ public class AppWindowAnimationHelper implements TransformParams.BuilderProxy { crop.offsetTo(0, 0); float cornerRadius = 0f; float scale = Math.max(mCurrentRect.width(), mTargetRect.width()) / crop.width(); + mTmpMatrix.setTranslate(0, 0); + if (app.activityType == RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) { + mTmpMatrix.setTranslate(app.localBounds.left, app.localBounds.top); + } if (app.mode == targetMode && app.activityType != RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) { mTmpMatrix.setRectToRect(mSourceRect, mCurrentRect, ScaleToFit.FILL); - if (app.localBounds != null) { - mTmpMatrix.postTranslate(app.localBounds.left, app.localBounds.top); - } else { - mTmpMatrix.postTranslate(app.position.x, app.position.y); - } + mTmpMatrix.postTranslate(app.localBounds.left, app.localBounds.top); mCurrentClipRectF.roundOut(crop); if (mSupportsRoundedCornersOnWindows) { if (params.getCornerRadius() > -1) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java index b8f0f4ddf7..a204aaeb66 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java @@ -15,8 +15,6 @@ */ package com.android.quickstep.util; -import static android.view.Surface.ROTATION_0; - import static com.android.launcher3.states.RotationHelper.deltaRotation; import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE; import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation; @@ -130,8 +128,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mThumbnailData.windowingMode = WINDOWING_MODE_FULLSCREEN; mThumbnailPosition.set(runningTarget.screenSpaceBounds); - // TODO: Should sourceContainerBounds already have this offset? - mThumbnailPosition.offset(-mRunningTarget.position.x, -mRunningTarget.position.y); mLayoutValid = false; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java index a3e360fa22..e3c1b42b71 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java @@ -472,7 +472,6 @@ public class TaskThumbnailView extends View implements PluginListener