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

Commit 7f96440e authored by Winson Chung's avatar Winson Chung
Browse files

Fix issue with side pages being visible momentarily when swiping up

- Apply the initial scale to overview while it is in the backround app
  state to ensure the side pages are positioned accordingly.  Since this
  affects the computation of the target rects for the overview
  animation, also ensure that we calculate those with the final target
  overview scale applied.

Bug: 117439562
Change-Id: I5e00cf1683e31b22cf937b966d52f8cbe745aaba
parent 9ccff14b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -15,10 +15,14 @@
 */
package com.android.launcher3.uioverrides;

import android.os.RemoteException;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.quickstep.QuickScrubController;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.ISystemUiProxy;

/**
 * State indicating that the Launcher is behind an app
@@ -43,4 +47,27 @@ public class BackgroundAppState extends OverviewState {
        float progressDelta = (transitionLength / scrollRange);
        return super.getVerticalProgress(launcher) + progressDelta;
    }

    @Override
    public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) {
        // Initialize the recents view scale to what it would be when starting swipe up/quickscrub
        RecentsView recentsView = launcher.getOverviewPanel();
        recentsView.getTaskSize(sTempRect);
        int appWidth = launcher.getDragLayer().getWidth();
        if (recentsView.shouldUseMultiWindowTaskSizeStrategy()) {
            ISystemUiProxy sysUiProxy = RecentsModel.INSTANCE.get(launcher).getSystemUiProxy();
            if (sysUiProxy != null) {
                try {
                    // Try to use the actual non-minimized app width (launcher will be resized to
                    // the non-minimized bounds, which differs from the app width in landscape
                    // multi-window mode
                    appWidth = sysUiProxy.getNonMinimizedSplitScreenSecondaryBounds().width();
                } catch (RemoteException e) {
                    // Ignore, fall back to just using the drag layer width
                }
            }
        }
        float scale = (float) appWidth / sTempRect.width();
        return new float[] { scale, 0f };
    }
}
+12 −2
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
            }

            if (interactionType == INTERACTION_NORMAL) {
                playScaleDownAnim(anim, activity);
                playScaleDownAnim(anim, activity, endState);
            }

            anim.setDuration(transitionLength * 2);
@@ -304,14 +304,24 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        /**
         * Scale down recents from the center task being full screen to being in overview.
         */
        private void playScaleDownAnim(AnimatorSet anim, Launcher launcher) {
        private void playScaleDownAnim(AnimatorSet anim, Launcher launcher,
                LauncherState endState) {
            RecentsView recentsView = launcher.getOverviewPanel();
            TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
            if (v == null) {
                return;
            }

            // Setup the clip animation helper source/target rects in the final transformed state
            // of the recents view (a scale may be applied prior to this animation starting to
            // line up the side pages during swipe up)
            float prevRvScale = recentsView.getScaleX();
            float targetRvScale = endState.getOverviewScaleAndTranslationYFactor(launcher)[0];
            SCALE_PROPERTY.set(recentsView, targetRvScale);
            ClipAnimationHelper clipHelper = new ClipAnimationHelper();
            clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
            SCALE_PROPERTY.set(recentsView, prevRvScale);

            if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
                float fromScale = clipHelper.getSourceRect().width()
                        / clipHelper.getTargetRect().width();
+0 −2
Original line number Diff line number Diff line
@@ -90,8 +90,6 @@ public class ClipAnimationHelper {

    // Whether to boost the opening animation target layers, or the closing
    private int mBoostModeTargetLayers = -1;
    // Wether or not applyTransform has been called yet since prepareAnimation()
    private boolean mIsFirstFrame = true;

    private BiFunction<RemoteAnimationTargetCompat, Float, Float> mTaskAlphaCallback =
            (t, a1) -> a1;