From 59e8c59ec6451c79abc86642845c8a038930b8e0 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 28 Feb 2025 16:20:52 +0000 Subject: [PATCH] Update gridTranslation of live tile when gestures ends - Instead of updating in updateGridProperties, which will be re-run after dismiss and potentially apply wrong translations to live tile. - Also set gridTranslationX of live tile to 0, as recentsScroll already takes care of horizontally task offest - Guaded assigning RemoteTargetHandle to DesktopTaskView with enableDrawingLiveTile, so going to Home won't continue to mananages the TaskViewSimulator Fix: 398231631 Fix: 394316748 Test: App to Overview with live tile on different location in the grid Flag: com.android.launcher3.enable_grid_only_overview Change-Id: I2e0f83a55421279581f3632c16c1e4c41d1fdae6 --- .../android/quickstep/views/RecentsView.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index e1868384ef..e0313eb718 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3011,9 +3011,22 @@ public abstract class RecentsView< startIconFadeInOnGestureComplete(); animateActionsViewIn(); - for (TaskView taskView : getTaskViews()) { - if (taskView instanceof DesktopTaskView desktopTaskView) { - desktopTaskView.setRemoteTargetHandles(mRemoteTargetHandles); + if (mEnableDrawingLiveTile) { + for (TaskView taskView : getTaskViews()) { + if (taskView instanceof DesktopTaskView desktopTaskView) { + desktopTaskView.setRemoteTargetHandles(mRemoteTargetHandles); + } + } + TaskView runningTaskView = getRunningTaskView(); + if (showAsGrid() && enableGridOnlyOverview() && runningTaskView != null) { + runActionOnRemoteHandles(remoteTargetHandle -> { + TaskViewSimulator taskViewSimulator = remoteTargetHandle.getTaskViewSimulator(); + // After settling in Overview, recentsScroll will be used to adjust horizontally + // location and taskGridTranslationX doesn't needs to be applied. + taskViewSimulator.taskGridTranslationX.value = 0; + taskViewSimulator.taskGridTranslationY.value = + runningTaskView.getGridTranslationY(); + }); } } @@ -3528,19 +3541,6 @@ public abstract class RecentsView< mAddDesktopButton.setGridTranslationX(translationX); } - final TaskView runningTask = getRunningTaskView(); - if (showAsGrid() && enableGridOnlyOverview() && runningTask != null) { - runActionOnRemoteHandles( - remoteTargetHandle -> { - remoteTargetHandle.getTaskViewSimulator().taskGridTranslationX.value = - runningTask.getGridTranslationX() - - runningTask.getNonGridTranslationX(); - remoteTargetHandle.getTaskViewSimulator().taskGridTranslationY.value = - runningTask.getGridTranslationY(); - } - ); - } - mClearAllButton.setGridTranslationPrimary( clearAllTotalTranslationX - snappedTaskGridTranslationX); mClearAllButton.setGridScrollOffset(