diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java index 53dcc74808..fdb13b1d16 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java @@ -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 }; + } } diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index 206c8be4b4..2331a4e302 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -286,7 +286,7 @@ public interface ActivityControlHelper { } if (interactionType == INTERACTION_NORMAL) { - playScaleDownAnim(anim, activity); + playScaleDownAnim(anim, activity, endState); } anim.setDuration(transitionLength * 2); @@ -304,14 +304,24 @@ public interface ActivityControlHelper { /** * 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(); diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java index 711ef586ed..8c84f29b7d 100644 --- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -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 mTaskAlphaCallback = (t, a1) -> a1;