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

Commit 4fa582be authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Applies last scroll position in recents after rotation"

parents a98d3891 89a52f1a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -156,7 +156,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                    // Launched from app is always the worst case (in terms of how many
                    // thumbnails/tasks visible)
                    launchState.launchedFromApp = true;
                    mBackgroundLayoutAlgorithm.update(plan.getTaskStack(), EMPTY_SET, launchState);
                    mBackgroundLayoutAlgorithm.update(plan.getTaskStack(), EMPTY_SET, launchState,
                            -1 /* lastScrollPPresent */);
                    VisibilityReport visibilityReport =
                            mBackgroundLayoutAlgorithm.computeStackVisibilityReport(
                                    stack.getTasks());
+3 −1
Original line number Diff line number Diff line
@@ -431,7 +431,7 @@ public class TaskStackLayoutAlgorithm {
     * in the stack.
     */
    public void update(TaskStack stack, ArraySet<Task.TaskKey> ignoreTasksSet,
            RecentsActivityLaunchState launchState) {
            RecentsActivityLaunchState launchState, float lastScrollPPercent) {
        SystemServicesProxy ssp = Recents.getSystemServices();

        // Clear the progress map
@@ -506,6 +506,8 @@ public class TaskStackLayoutAlgorithm {

            if (launchState.launchedWithAltTab) {
                mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
            } else if (0 <= lastScrollPPercent && lastScrollPPercent <= 1) {
                mInitialScrollP = Utilities.mapRange(lastScrollPPercent, mMinScrollP, mMaxScrollP);
            } else if (Recents.getConfiguration().isLowRamDevice) {
                mInitialScrollP = mTaskStackLowRamLayoutAlgorithm.getInitialScrollP(mNumStackTasks,
                        scrollToFront);
+7 −1
Original line number Diff line number Diff line
@@ -209,6 +209,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    private int mLastHeight;
    private boolean mStackActionButtonVisible;

    // Percentage of last ScrollP from the min to max scrollP that lives after configuration changes
    private float mLastScrollPPercent;

    // We keep track of the task view focused by user interaction and draw a frame around it in the
    // grid layout.
    private TaskViewFocusFrame mTaskViewFocusFrame;
@@ -327,6 +330,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
            mStackScroller.reset();
            mStableLayoutAlgorithm.reset();
            mLayoutAlgorithm.reset();
            mLastScrollPPercent = -1;
        }

        // Since we always animate to the same place in (the initial state), always reset the stack
@@ -822,7 +826,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
   public void updateLayoutAlgorithm(boolean boundScrollToNewMinMax,
           RecentsActivityLaunchState launchState) {
        // Compute the min and max scroll values
        mLayoutAlgorithm.update(mStack, mIgnoreTasks, launchState);
        mLayoutAlgorithm.update(mStack, mIgnoreTasks, launchState, mLastScrollPPercent);

        if (boundScrollToNewMinMax) {
            mStackScroller.boundScroll();
@@ -1150,6 +1154,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        if (mTaskViewsClipDirty) {
            clipTaskViews();
        }
        mLastScrollPPercent = Utilities.clamp(Utilities.unmapRange(mStackScroller.getStackScroll(),
            mLayoutAlgorithm.mMinScrollP, mLayoutAlgorithm.mMaxScrollP), 0, 1);
    }

    /**