Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3664426d authored by Winson's avatar Winson
Browse files

Fixing animation spec animation problem.

- We were always using the stack layout to get the task transforms, but
  when we are animating to a given task position (ie. hitting recents 
  while the home->recents transition is happening), we would start the
  animation with the final task rect, instead of the current task rect.
  Instead, use the current transform of the task view, and transform
  that to screen coordinates and use it.

Bug: 27154882
Change-Id: I25af8fad97ee78669c952dd81708e6cee5dfab05
parent bde852db
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -286,10 +286,9 @@ public class RecentsTransitionHelper {
        // Calculate the offscreen task rect (for tasks that are not backed by views)
        float stackScroll = stackView.getScroller().getStackScroll();
        TaskView taskView = stackView.getChildViewForTask(task);
        TaskStackLayoutAlgorithm layoutAlgorithm = stackView.getStackAlgorithm();
        Rect offscreenTaskRect = new Rect(layoutAlgorithm.mTaskRect);
        offscreenTaskRect.offsetTo(offscreenTaskRect.left,
                layoutAlgorithm.mStackRect.bottom);
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        Rect offscreenTaskRect = new Rect();
        stackLayout.getFrontOfStackTransform().rect.round(offscreenTaskRect);

        // If this is a full screen stack, the transition will be towards the single, full screen
        // task. We only need the transition spec for this task.
@@ -302,8 +301,8 @@ public class RecentsTransitionHelper {
            if (taskView == null) {
                specs.add(composeOffscreenAnimationSpec(task, offscreenTaskRect));
            } else {
                layoutAlgorithm.getStackTransformScreenCoordinates(task, stackScroll, mTmpTransform,
                        null);
                mTmpTransform.fillIn(taskView);
                stackLayout.transformToScreenCoordinates(mTmpTransform);
                specs.add(composeAnimationSpec(stackView, taskView, mTmpTransform,
                        true /* addHeaderBitmap */));
            }
@@ -324,8 +323,8 @@ public class RecentsTransitionHelper {
                    //       never happen)
                    specs.add(composeOffscreenAnimationSpec(t, offscreenTaskRect));
                } else {
                    layoutAlgorithm.getStackTransformScreenCoordinates(t, stackScroll,
                            mTmpTransform, null);
                    mTmpTransform.fillIn(taskView);
                    stackLayout.transformToScreenCoordinates(mTmpTransform);
                    specs.add(composeAnimationSpec(stackView, tv, mTmpTransform,
                            true /* addHeaderBitmap */));
                }
+10 −3
Original line number Diff line number Diff line
@@ -831,12 +831,19 @@ public class TaskStackLayoutAlgorithm {
     */
    public TaskViewTransform getStackTransformScreenCoordinates(Task task, float stackScroll,
            TaskViewTransform transformOut, TaskViewTransform frontTransform) {
        Rect windowRect = Recents.getSystemServices().getWindowRect();
        TaskViewTransform transform = getStackTransform(task, stackScroll, mFocusState,
                transformOut, frontTransform, true /* forceUpdate */,
                false /* ignoreTaskOverrides */);
        transform.rect.offset(windowRect.left, windowRect.top);
        return transform;
        return transformToScreenCoordinates(transform);
    }

    /**
     * Transforms the given {@param transformOut} to the screen coordinates.
     */
    public TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut) {
        Rect windowRect = Recents.getSystemServices().getWindowRect();
        transformOut.rect.offset(windowRect.left, windowRect.top);
        return transformOut;
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -1618,7 +1618,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }
        if (launchTaskIndex != -1) {
            // Stop all animations
            mUIDozeTrigger.stopDozing();
            cancelAllTaskViewAnimations();

            final Task launchTask = mStack.getStackTasks().get(launchTaskIndex);