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

Commit 9bbd2861 authored by Winson's avatar Winson
Browse files

Fixing issue with task animating from 0,0.

- When we get all the initial task transforms when swiping to dismiss, 
  the tasks that are not visible at the original scroll position but are
  in the final position are not initialized correctly.  Instead when
  getting the current transforms for all tasks, always calculate their 
  transforms regardless of whether they are currently visible or not.
- This revealed another issue where on snap-back, a task that was 
  visible at the new scroll and not at the old scroll was not getting 
  removed until the next update (which would cause a task view to linger
  if you press home for example).

Bug: 26964326
Change-Id: I4db9cd1b072d3841351c2e84b219ca224a3045f9
parent 40a22733
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ public class TaskStackLayoutAlgorithm {
            boolean isFrontMostTaskInGroup = task.group == null || task.group.isFrontMostTask(task);
            if (isFrontMostTaskInGroup) {
                getStackTransform(taskProgress, mInitialScrollP, tmpTransform, null,
                        false /* ignoreSingleTaskCase */);
                        false /* ignoreSingleTaskCase */, false /* forceUpdate */);
                float screenY = tmpTransform.rect.top;
                boolean hasVisibleThumbnail = (prevScreenY - screenY) > taskBarHeight;
                if (hasVisibleThumbnail) {
@@ -601,6 +601,12 @@ public class TaskStackLayoutAlgorithm {
     */
    public TaskViewTransform getStackTransform(Task task, float stackScroll,
            TaskViewTransform transformOut, TaskViewTransform frontTransform) {
        return getStackTransform(task, stackScroll, transformOut, frontTransform,
                false /* forceUpdate */);
    }

    public TaskViewTransform getStackTransform(Task task, float stackScroll,
        TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean forceUpdate) {
        if (mFreeformLayoutAlgorithm.isTransformAvailable(task, this)) {
            mFreeformLayoutAlgorithm.getTransform(task, transformOut, this);
            return transformOut;
@@ -610,8 +616,9 @@ public class TaskStackLayoutAlgorithm {
                transformOut.reset();
                return transformOut;
            }
            return getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
                    frontTransform, false /* ignoreSingleTaskCase */);
            getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
                    frontTransform, false /* ignoreSingleTaskCase */, forceUpdate);
            return transformOut;
        }
    }

@@ -635,9 +642,9 @@ public class TaskStackLayoutAlgorithm {
     *                             internally to ensure that we can calculate the transform for any
     *                             position in the stack.
     */
    public TaskViewTransform getStackTransform(float taskProgress, float stackScroll,
    public void getStackTransform(float taskProgress, float stackScroll,
            TaskViewTransform transformOut, TaskViewTransform frontTransform,
            boolean ignoreSingleTaskCase) {
            boolean ignoreSingleTaskCase, boolean forceUpdate) {
        SystemServicesProxy ssp = Recents.getSystemServices();

        // Compute the focused and unfocused offset
@@ -658,9 +665,9 @@ public class TaskStackLayoutAlgorithm {
        }

        // Skip if the task is not visible
        if (!unfocusedVisible && !focusedVisible) {
        if (!forceUpdate && !unfocusedVisible && !focusedVisible) {
            transformOut.reset();
            return transformOut;
            return;
        }

        int x = (mStackRect.width() - mTaskRect.width()) / 2;
@@ -700,7 +707,6 @@ public class TaskStackLayoutAlgorithm {
        transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
                (frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
        transformOut.p = relP;
        return transformOut;
    }

    /**
@@ -797,8 +803,10 @@ public class TaskStackLayoutAlgorithm {
                mFocusState * (mFocusedRange.relativeMin - mUnfocusedRange.relativeMin);
        float max = mUnfocusedRange.relativeMax +
                mFocusState * (mFocusedRange.relativeMax - mUnfocusedRange.relativeMax);
        getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */);
        getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */);
        getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */,
                true /* forceUpdate */);
        getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */,
                true /* forceUpdate */);
        mBackOfStackTransform.visible = true;
        mFrontOfStackTransform.visible = true;
    }
+1 −1
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                transform.fillIn(tv);
            } else {
                mLayoutAlgorithm.getStackTransform(task, mStackScroller.getStackScroll(),
                        transform, null);
                        transform, null, true /* forceUpdate */);
            }
            transform.visible = true;
        }
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import android.view.animation.Animation;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;

@@ -497,6 +498,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
        // onBeginDrag().
        mSv.removeIgnoreTask(tv.getTask());
        mSv.updateLayoutAlgorithm(false /* boundScroll */);
        mSv.relayoutTaskViews(AnimationProps.IMMEDIATE);
        mSwipeHelperAnimations.remove(v);
    }