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
This commit is contained in:
Alex Chau
2025-02-28 16:20:52 +00:00
parent 7699ddc59d
commit 59e8c59ec6
@@ -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(