Merge "Fix issue with side pages being visible momentarily when swiping up" into ub-launcher3-master
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java
index 53dcc74..fdb13b1 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 @@
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 206c8be..2331a4e 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -286,7 +286,7 @@
}
if (interactionType == INTERACTION_NORMAL) {
- playScaleDownAnim(anim, activity);
+ playScaleDownAnim(anim, activity, endState);
}
anim.setDuration(transitionLength * 2);
@@ -304,14 +304,24 @@
/**
* 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 711ef58..8c84f29 100644
--- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -90,8 +90,6 @@
// 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;