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
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index e186838..e0313eb 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -3011,9 +3011,22 @@
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 @@
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(