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

Commit 55940ecf authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Render and track live tile position when launching another app from Overview

Fixes: 165394366
Fixes: 170338328
Test: Manual
Change-Id: Idfcd423cbe062af33564eaa9e83ec21fbac0cdf9
parent ceb8618f
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -41,10 +41,8 @@ import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINI
import static com.android.quickstep.GestureState.STATE_END_TARGET_SET;
import static com.android.quickstep.GestureState.STATE_END_TARGET_SET;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;


import android.animation.Animator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
@@ -1485,13 +1483,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
                mRecentsAnimationTargets.apps,
                mRecentsAnimationTargets.apps,
                mRecentsAnimationTargets.apps.length + 1);
                mRecentsAnimationTargets.apps.length + 1);
        apps[apps.length - 1] = appearedTaskTarget;
        apps[apps.length - 1] = appearedTaskTarget;
        boolean launcherClosing =
                taskIsATargetWithMode(apps, mActivity.getTaskId(), MODE_CLOSING);


        AnimatorSet anim = new AnimatorSet();
        AnimatorSet anim = new AnimatorSet();
        TaskViewUtils.composeRecentsLaunchAnimator(
        TaskViewUtils.composeRecentsLaunchAnimator(
                anim, taskView, apps,
                anim, taskView, apps,
                mRecentsAnimationTargets.wallpapers, launcherClosing,
                mRecentsAnimationTargets.wallpapers, true /* launcherClosing */,
                mActivity.getStateManager(), mRecentsView,
                mActivity.getStateManager(), mRecentsView,
                mActivityInterface.getDepthController());
                mActivityInterface.getDepthController());
        anim.addListener(new AnimatorListenerAdapter(){
        anim.addListener(new AnimatorListenerAdapter(){
+5 −2
Original line number Original line Diff line number Diff line
@@ -297,7 +297,6 @@ public final class TaskViewUtils {
        PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
        PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
        createRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets, wallpaperTargets,
        createRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets, wallpaperTargets,
                depthController, pa);
                depthController, pa);
        anim.play(pa.buildAnim());


        Animator childStateAnimation = null;
        Animator childStateAnimation = null;
        // Found a visible recents task that matches the opening app, lets launch the app from there
        // Found a visible recents task that matches the opening app, lets launch the app from there
@@ -330,7 +329,11 @@ public final class TaskViewUtils {
                }
                }
            };
            };
        }
        }
        anim.play(launcherAnim);
        pa.add(launcherAnim);
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskIndex() != -1) {
            pa.addOnFrameCallback(recentsView::redrawLiveTile);
        }
        anim.play(pa.buildAnim());


        // Set the current animation first, before adding windowAnimEndListener. Setting current
        // Set the current animation first, before adding windowAnimEndListener. Setting current
        // animation adds some listeners which need to be called before windowAnimEndListener
        // animation adds some listeners which need to be called before windowAnimEndListener
+16 −15
Original line number Original line Diff line number Diff line
@@ -53,8 +53,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    public static final IntProperty<TaskViewSimulator> SCROLL =
    public static final IntProperty<TaskViewSimulator> SCROLL =
            new IntProperty<TaskViewSimulator>("scroll") {
            new IntProperty<TaskViewSimulator>("scroll") {
                @Override
                @Override
        public void setValue(TaskViewSimulator simulator, int i) {
                public void setValue(TaskViewSimulator simulator, int scroll) {
            simulator.setScroll(i);
                    simulator.setScroll(scroll);
                }
                }


                @Override
                @Override
@@ -72,7 +72,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    private final BaseActivityInterface mSizeStrategy;
    private final BaseActivityInterface mSizeStrategy;


    private final Rect mTaskRect = new Rect();
    private final Rect mTaskRect = new Rect();
    private float mOffsetY;
    private boolean mDrawsBelowRecents;
    private boolean mDrawsBelowRecents;
    private final PointF mPivot = new PointF();
    private final PointF mPivot = new PointF();
    private DeviceProfile mDp;
    private DeviceProfile mDp;
@@ -89,6 +88,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    // TaskView properties
    // TaskView properties
    private final FullscreenDrawParams mCurrentFullscreenParams;
    private final FullscreenDrawParams mCurrentFullscreenParams;
    private float mCurveScale = 1;
    private float mCurveScale = 1;
    public final AnimatedFloat taskPrimaryTranslation = new AnimatedFloat();
    public final AnimatedFloat taskSecondaryTranslation = new AnimatedFloat();


    // RecentsView properties
    // RecentsView properties
    public final AnimatedFloat recentsViewScale = new AnimatedFloat();
    public final AnimatedFloat recentsViewScale = new AnimatedFloat();
@@ -178,10 +179,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        }
        }
    }
    }


    public void setOffsetY(float offsetY) {
        mOffsetY = offsetY;
    }

    public void setDrawsBelowRecents(boolean drawsBelowRecents) {
    public void setDrawsBelowRecents(boolean drawsBelowRecents) {
        mDrawsBelowRecents = drawsBelowRecents;
        mDrawsBelowRecents = drawsBelowRecents;
    }
    }
@@ -298,7 +295,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {


        // Apply TaskView matrix: scale, translate, scroll
        // Apply TaskView matrix: scale, translate, scroll
        mMatrix.postScale(mCurveScale, mCurveScale, taskWidth / 2, taskHeight / 2);
        mMatrix.postScale(mCurveScale, mCurveScale, taskWidth / 2, taskHeight / 2);
        mMatrix.postTranslate(mTaskRect.left, mTaskRect.top + mOffsetY);
        mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
        mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
                taskPrimaryTranslation.value);
        mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
                taskSecondaryTranslation.value);
        mOrientationState.getOrientationHandler().set(
        mOrientationState.getOrientationHandler().set(
                mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);
                mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);


+28 −10
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ import android.animation.AnimatorSet;
import android.animation.LayoutTransition;
import android.animation.LayoutTransition;
import android.animation.LayoutTransition.TransitionListener;
import android.animation.LayoutTransition.TransitionListener;
import android.animation.ObjectAnimator;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.annotation.TargetApi;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityManager.RunningTaskInfo;
@@ -99,7 +100,6 @@ import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PendingAnimation.EndState;
import com.android.launcher3.anim.PendingAnimation.EndState;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.anim.SpringProperty;
import com.android.launcher3.anim.SpringProperty;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.FeatureFlags;
@@ -114,6 +114,7 @@ import com.android.launcher3.util.OverScroller;
import com.android.launcher3.util.ResourceBasedOverride.Overrides;
import com.android.launcher3.util.ResourceBasedOverride.Overrides;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool;
import com.android.launcher3.util.ViewPool;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.GestureState;
import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.RecentsAnimationController;
@@ -874,9 +875,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
            // Since we reuse the same mLiveTileTaskViewSimulator in the RecentsView, we need
            // Since we reuse the same mLiveTileTaskViewSimulator in the RecentsView, we need
            // to reset the params after it settles in Overview from swipe up so that we don't
            // to reset the params after it settles in Overview from swipe up so that we don't
            // render with obsolete param values.
            // render with obsolete param values.
            mLiveTileTaskViewSimulator.taskPrimaryTranslation.value = 0;
            mLiveTileTaskViewSimulator.taskSecondaryTranslation.value = 0;
            mLiveTileTaskViewSimulator.fullScreenProgress.value = 0;
            mLiveTileTaskViewSimulator.fullScreenProgress.value = 0;
            mLiveTileTaskViewSimulator.recentsViewScale.value = 1;
            mLiveTileTaskViewSimulator.recentsViewScale.value = 1;
            mLiveTileTaskViewSimulator.setOffsetY(0);


            // Reset the live tile rect
            // Reset the live tile rect
            DeviceProfile deviceProfile = mActivity.getDeviceProfile();
            DeviceProfile deviceProfile = mActivity.getDeviceProfile();
@@ -1545,7 +1547,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView


        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && getRunningTaskView() == taskView) {
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && getRunningTaskView() == taskView) {
            anim.addOnFrameCallback(() -> {
            anim.addOnFrameCallback(() -> {
                mLiveTileTaskViewSimulator.setOffsetY(taskView.getTranslationY());
                mLiveTileTaskViewSimulator.taskSecondaryTranslation.value =
                        mOrientationHandler.getSecondaryValue(
                                taskView.getTranslationX(),
                                taskView.getTranslationY());
                redrawLiveTile();
                redrawLiveTile();
            });
            });
        }
        }
@@ -2090,22 +2095,35 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        boolean launchingCenterTask = taskIndex == centerTaskIndex;
        boolean launchingCenterTask = taskIndex == centerTaskIndex;


        float toScale = getMaxScaleForFullScreen();
        float toScale = getMaxScaleForFullScreen();
        if (launchingCenterTask) {
        RecentsView recentsView = tv.getRecentsView();
        RecentsView recentsView = tv.getRecentsView();
        if (launchingCenterTask) {
            anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale));
            anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale));
            anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
            anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
        } else {
        } else {
            // We are launching an adjacent task, so parallax the center and other adjacent task.
            // We are launching an adjacent task, so parallax the center and other adjacent task.
            float displacementX = tv.getWidth() * (toScale - tv.getCurveScale());
            float displacementX = tv.getWidth() * (toScale - tv.getCurveScale());
            anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex), TRANSLATION_X,
            float primaryTranslation = mIsRtl ? -displacementX : displacementX;
                    mIsRtl ? -displacementX : displacementX));
            anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex),
                    mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation));
            int runningTaskIndex = recentsView.getRunningTaskIndex();
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && runningTaskIndex != -1
                    && runningTaskIndex != taskIndex) {
                anim.play(ObjectAnimator.ofFloat(
                        recentsView.getLiveTileTaskViewSimulator().taskPrimaryTranslation,
                        AnimatedFloat.VALUE,
                        primaryTranslation));
            }


            int otherAdjacentTaskIndex = centerTaskIndex + (centerTaskIndex - taskIndex);
            int otherAdjacentTaskIndex = centerTaskIndex + (centerTaskIndex - taskIndex);
            if (otherAdjacentTaskIndex >= 0 && otherAdjacentTaskIndex < getPageCount()) {
            if (otherAdjacentTaskIndex >= 0 && otherAdjacentTaskIndex < getPageCount()) {
                anim.play(new PropertyListBuilder()
                PropertyValuesHolder[] properties = new PropertyValuesHolder[3];
                        .translationX(mIsRtl ? -displacementX : displacementX)
                properties[0] = PropertyValuesHolder.ofFloat(
                        .scale(1)
                        mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation);
                        .build(getPageAt(otherAdjacentTaskIndex)));
                properties[1] = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
                properties[2] = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);

                anim.play(ObjectAnimator.ofPropertyValuesHolder(getPageAt(otherAdjacentTaskIndex),
                        properties));
            }
            }
        }
        }
        return anim;
        return anim;
+4 −4
Original line number Original line Diff line number Diff line
@@ -42,13 +42,13 @@ import com.android.launcher3.util.OverScroller;
public class LandscapePagedViewHandler implements PagedOrientationHandler {
public class LandscapePagedViewHandler implements PagedOrientationHandler {


    @Override
    @Override
    public int getPrimaryValue(int x, int y) {
    public <T> T getPrimaryValue(T x, T y) {
        return y;
        return x;
    }
    }


    @Override
    @Override
    public int getSecondaryValue(int x, int y) {
    public <T> T getSecondaryValue(T x, T y) {
        return x;
        return y;
    }
    }


    @Override
    @Override
Loading