OSDN Git Service

Fixing animation spec animation problem.
authorWinson <winsonc@google.com>
Mon, 18 Apr 2016 19:57:56 +0000 (12:57 -0700)
committerWinson <winsonc@google.com>
Tue, 19 Apr 2016 01:20:38 +0000 (18:20 -0700)
- 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

packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java

index db5413f..04f10ef 100644 (file)
@@ -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 */));
                 }
index ee3a9b9..bdc4c1a 100644 (file)
@@ -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;
     }
 
     /**
index 068596b..6176d99 100644 (file)
@@ -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);