From d801f5d214e08b21e7319639f5974c7559520c09 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 14 Apr 2021 10:29:17 -0400 Subject: [PATCH] Have one app open animation properties for both cold/start app launch. If cold start, shell draws icon. If warm start, launcher draws the icon. In both cases, the app window scale/crop/position is the same. This helps the case where shell does not notify launcher whether the preview window is drawn before launcher starts the animation. Bug: 177264697 Test: manual, cold/warm app launches Change-Id: I88bff607f68042ebc8230bd9fbaf983fe1f0afac --- .../launcher3/QuickstepTransitionManager.java | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 009ca27603..7da6f60e6e 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -566,7 +566,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener // Set the crop here so we can calculate the corner radius below. crop.set(left, top, right, bottom); - RectF targetBounds = new RectF(windowTargetBounds); RectF floatingIconBounds = new RectF(); RectF tmpRectF = new RectF(); Point tmpPos = new Point(); @@ -655,12 +654,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener tmpRectF.offset(dragLayerBounds[0], dragLayerBounds[1]); tmpRectF.offset(mDx.value, mDy.value); Utilities.scaleRectFAboutCenter(tmpRectF, mIconScaleToFitScreen.value); - float windowTransX0 = tmpRectF.left - offsetX; - float windowTransY0 = tmpRectF.top - offsetY; - if (hasSplashScreen) { - windowTransX0 -= crop.left * scale; - windowTransY0 -= crop.top * scale; - } + float windowTransX0 = tmpRectF.left - offsetX - crop.left * scale; + float windowTransY0 = tmpRectF.top - offsetY - crop.top * scale; // Calculate the icon position. floatingIconBounds.set(launcherIconBounds); @@ -1213,25 +1208,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener alphaDuration = useUpwardAnimation ? APP_LAUNCH_ALPHA_DURATION : APP_LAUNCH_ALPHA_DOWN_DURATION; - if (hasSplashScreen) { - iconAlphaStart = 0; + iconAlphaStart = hasSplashScreen ? 0 : 1f; - // TOOD: Share value from shell when available. - final float windowIconSize = Utilities.pxFromSp(108, r.getDisplayMetrics()); + // TOOD: Share value from shell when available. + final float windowIconSize = Utilities.pxFromSp(108, r.getDisplayMetrics()); - cropCenterXStart = windowTargetBounds.centerX(); - cropCenterYStart = windowTargetBounds.centerY(); + cropCenterXStart = windowTargetBounds.centerX(); + cropCenterYStart = windowTargetBounds.centerY(); - cropWidthStart = (int) windowIconSize; - cropHeightStart = (int) windowIconSize; - } else { - iconAlphaStart = 1; - - cropWidthStart = cropHeightStart = - Math.min(windowTargetBounds.width(), windowTargetBounds.height()); - cropCenterXStart = cropCenterYStart = - Math.min(windowTargetBounds.centerX(), windowTargetBounds.centerY()); - } + cropWidthStart = (int) windowIconSize; + cropHeightStart = (int) windowIconSize; cropWidthEnd = windowTargetBounds.width(); cropHeightEnd = windowTargetBounds.height();