From 05fdc49ef796a33816fef7169330934ad7119553 Mon Sep 17 00:00:00 2001 From: Daniel Andersson Date: Fri, 25 Apr 2025 16:32:04 -0700 Subject: [PATCH] desktop-exploded-view: Fix broken live tile when activating desk - Apply scrollOffset directly to tvs.recentsViewCroll, which already take orientationHandler into account - Apply gridTranslationY directly to taskSecondaryTranslation, which already take orientationHandler into account - This make sure both translations are applied after mTaskRectTransform - Also re-calculate tvs task size after updating orientationState rotations, as the orientationHandler might be changed and affect task position - Remove setTaskRectTranslation that is no longer used Flag: EXEMPT bugfix Test: manual with central/side task launching with portrait, fake landscape and 3p launcher Bug: 410628946 Change-Id: I8ef38d193328e8a449594515403c00f517e213b3 --- .../com/android/quickstep/TaskViewUtils.java | 10 +++---- .../quickstep/util/TaskViewSimulator.java | 27 +++++-------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 47edb05928..3c10effa00 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -229,8 +229,8 @@ public final class TaskViewUtils { boolean showAsGrid = dp.isTablet; boolean parallaxCenterAndAdjacentTask = !showAsGrid && taskIndex != recentsView.getCurrentPage(); - int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex); - int taskRectTranslationSecondary = showAsGrid ? (int) taskView.getGridTranslationY() : 0; + int scrollOffset = recentsView.getScrollOffset(taskIndex); + int gridTranslationY = showAsGrid ? (int) taskView.getGridTranslationY() : 0; RemoteTargetHandle[] topMostSimulators = null; @@ -244,15 +244,15 @@ public final class TaskViewUtils { // be stale. Use the display value instead. int displayRotation = DisplayController.INSTANCE.get(context).getInfo().rotation; tvsLocal.getOrientationState().update(displayRotation, displayRotation); + tvsLocal.calculateTaskSize(); tvsLocal.fullScreenProgress.value = 0; tvsLocal.recentsViewScale.value = 1; if (!enableGridOnlyOverview()) { tvsLocal.setIsGridTask(taskView.isGridTask()); } - tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal, - TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary, - taskRectTranslationSecondary); + tvsLocal.recentsViewScroll.value = scrollOffset; + tvsLocal.taskSecondaryTranslation.value = gridTranslationY; if (taskView instanceof DesktopTaskView) { targetHandle.getTransformParams().setTargetAlpha(1f); diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index f80d209444..7fbc7bd4e0 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -120,9 +120,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { private boolean mIsGridTask; private final boolean mIsDesktopTask; private boolean mIsAnimatingToCarousel = false; - private int mTaskRectTranslationX; - private int mTaskRectTranslationY; - private int mDesktopTaskIndex = 0; + private final int mDesktopTaskIndex; @Nullable private Matrix mTaskRectTransform = null; @@ -159,7 +157,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { calculateTaskSize(); } - private void calculateTaskSize() { + /** + * Updates the task size. + */ + public void calculateTaskSize() { if (mDp == null) { return; } @@ -211,7 +212,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { } else { mTaskRect.set(mFullTaskSize); } - mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } /** @@ -229,11 +229,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { if (mDp == null) { return 1; } - // Copy mFullTaskSize instead of updating it directly so it could be reused next time - // without recalculating - Rect scaleRect = new Rect(mIsAnimatingToCarousel ? mCarouselTaskSize : mFullTaskSize); - scaleRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); - float scale = mOrientationState.getFullScreenScaleAndPivot(scaleRect, mDp, mPivot); + float scale = mOrientationState.getFullScreenScaleAndPivot( + mIsAnimatingToCarousel ? mCarouselTaskSize : mFullTaskSize, mDp, mPivot); if (mPivotOverride != null) { mPivot.set(mPivotOverride); } @@ -314,16 +311,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mDrawAboveOtherApps = drawsAboveOtherApps; } - /** - * Apply translations on TaskRect's starting location. - */ - public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) { - mTaskRectTranslationX = taskRectTranslationX; - mTaskRectTranslationY = taskRectTranslationY; - // Re-calculate task size after changing translation - calculateTaskSize(); - } - /** * Override the pivot used to apply scale changes. */