Merge "Fix screen rounded corner flicker." into tm-dev am: 8073fc8daf am: 276a31bbf8

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17948370

Change-Id: I6331e568fc55b51257e48a59d1159dfacc775ac3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shan Huang
2022-04-29 18:28:03 +00:00
committed by Automerger Merge Worker
2 changed files with 26 additions and 18 deletions
@@ -1354,7 +1354,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
*/ */
private RectFSpringAnim getClosingWindowAnimators(AnimatorSet animation, private RectFSpringAnim getClosingWindowAnimators(AnimatorSet animation,
RemoteAnimationTargetCompat[] targets, View launcherView, PointF velocityPxPerS, RemoteAnimationTargetCompat[] targets, View launcherView, PointF velocityPxPerS,
RectF closingWindowStartRect) { RectF closingWindowStartRect, float startWindowCornerRadius) {
FloatingIconView floatingIconView = null; FloatingIconView floatingIconView = null;
FloatingWidgetView floatingWidget = null; FloatingWidgetView floatingWidget = null;
RectF targetRect = new RectF(); RectF targetRect = new RectF();
@@ -1403,7 +1403,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION; final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect, RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
windowTargetBounds) { windowTargetBounds, startWindowCornerRadius) {
@Override @Override
public void onUpdate(RectF currentRectF, float progress) { public void onUpdate(RectF currentRectF, float progress) {
finalFloatingIconView.update(1f, 255 /* fgAlpha */, currentRectF, progress, finalFloatingIconView.update(1f, 255 /* fgAlpha */, currentRectF, progress,
@@ -1421,7 +1421,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final float floatingWidgetAlpha = isTransluscent ? 0 : 1; final float floatingWidgetAlpha = isTransluscent ? 0 : 1;
FloatingWidgetView finalFloatingWidget = floatingWidget; FloatingWidgetView finalFloatingWidget = floatingWidget;
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect, RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
windowTargetBounds) { windowTargetBounds, startWindowCornerRadius) {
@Override @Override
public void onUpdate(RectF currentRectF, float progress) { public void onUpdate(RectF currentRectF, float progress) {
final float fallbackBackgroundAlpha = final float fallbackBackgroundAlpha =
@@ -1438,7 +1438,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
} else { } else {
// If no floating icon or widget is present, animate the to the default window // If no floating icon or widget is present, animate the to the default window
// target rect. // target rect.
anim.addOnUpdateListener(new SpringAnimRunner(targets, targetRect, windowTargetBounds)); anim.addOnUpdateListener(new SpringAnimRunner(
targets, targetRect, windowTargetBounds, startWindowCornerRadius));
} }
// Use a fixed velocity to start the animation. // Use a fixed velocity to start the animation.
@@ -1580,7 +1581,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] appTargets,
RemoteAnimationTargetCompat[] wallpaperTargets, RemoteAnimationTargetCompat[] wallpaperTargets,
boolean fromUnlock, boolean fromUnlock,
RectF startRect) { RectF startRect,
float startWindowCornerRadius) {
AnimatorSet anim = null; AnimatorSet anim = null;
RectFSpringAnim rectFSpringAnim = null; RectFSpringAnim rectFSpringAnim = null;
@@ -1612,7 +1614,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
.getDimension(R.dimen.unlock_staggered_velocity_dp_per_s); .getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
PointF velocity = new PointF(0, -velocityPxPerS); PointF velocity = new PointF(0, -velocityPxPerS);
rectFSpringAnim = getClosingWindowAnimators( rectFSpringAnim = getClosingWindowAnimators(
anim, appTargets, launcherView, velocity, startRect); anim, appTargets, launcherView, velocity, startRect,
startWindowCornerRadius);
if (!mLauncher.isInState(LauncherState.ALL_APPS)) { if (!mLauncher.isInState(LauncherState.ALL_APPS)) {
anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y, anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
true /* animateOverviewScrim */, launcherView).getAnimators()); true /* animateOverviewScrim */, launcherView).getAnimators());
@@ -1711,7 +1714,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
Pair<RectFSpringAnim, AnimatorSet> pair = createWallpaperOpenAnimations( Pair<RectFSpringAnim, AnimatorSet> pair = createWallpaperOpenAnimations(
appTargets, wallpaperTargets, mFromUnlock, appTargets, wallpaperTargets, mFromUnlock,
new RectF(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx)); new RectF(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx),
QuickStepContract.getWindowCornerRadius(mLauncher));
mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL); mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL);
result.setAnimation(pair.second, mLauncher); result.setAnimation(pair.second, mLauncher);
@@ -1874,9 +1878,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
private final Rect mTmpRect = new Rect(); private final Rect mTmpRect = new Rect();
SpringAnimRunner(RemoteAnimationTargetCompat[] appTargets, RectF targetRect, SpringAnimRunner(RemoteAnimationTargetCompat[] appTargets, RectF targetRect,
Rect windowTargetBounds) { Rect windowTargetBounds, float startWindowCornerRadius) {
mAppTargets = appTargets; mAppTargets = appTargets;
mStartRadius = QuickStepContract.getWindowCornerRadius(mLauncher); mStartRadius = startWindowCornerRadius;
mEndRadius = Math.max(1, targetRect.width()) / 2f; mEndRadius = Math.max(1, targetRect.width()) / 2f;
mSurfaceApplier = new SurfaceTransactionApplier(mDragLayer); mSurfaceApplier = new SurfaceTransactionApplier(mDragLayer);
mWindowTargetBounds.set(windowTargetBounds); mWindowTargetBounds.set(windowTargetBounds);
@@ -29,7 +29,6 @@ import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.os.Handler; import android.os.Handler;
import android.util.MathUtils;
import android.util.Pair; import android.util.Pair;
import android.view.RemoteAnimationTarget; import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl; import android.view.SurfaceControl;
@@ -195,10 +194,10 @@ public class LauncherBackAnimationController {
float followWidth = screenWidth - dX; float followWidth = screenWidth - dX;
// The 'progress width' is the width of the window if it strictly linearly interpolates // The 'progress width' is the width of the window if it strictly linearly interpolates
// to minimum scale base on progress. // to minimum scale base on progress.
float progressWidth = MathUtils.lerp(1, MIN_WINDOW_SCALE, progress) * screenWidth; float progressWidth = Utilities.mapRange(progress, 1, MIN_WINDOW_SCALE) * screenWidth;
// The final width is derived from interpolating between the follow with and progress width // The final width is derived from interpolating between the follow with and progress width
// using gesture progress. // using gesture progress.
float width = MathUtils.lerp(followWidth, progressWidth, progress); float width = Utilities.mapRange(progress, followWidth, progressWidth);
float height = screenHeight / screenWidth * width; float height = screenHeight / screenWidth * width;
float deltaYRatio = (event.getTouchY() - mInitialTouchPos.y) / screenHeight; float deltaYRatio = (event.getTouchY() - mInitialTouchPos.y) / screenHeight;
// Base the window movement in the Y axis on the touch movement in the Y axis. // Base the window movement in the Y axis on the touch movement in the Y axis.
@@ -221,13 +220,15 @@ public class LauncherBackAnimationController {
return; return;
} }
mCurrentRect.set( mCurrentRect.set(
MathUtils.lerp(mCancelRect.left, mStartRect.left, progress), Utilities.mapRange(progress, mCancelRect.left, mStartRect.left),
MathUtils.lerp(mCancelRect.top, mStartRect.top, progress), Utilities.mapRange(progress, mCancelRect.top, mStartRect.top),
MathUtils.lerp(mCancelRect.right, mStartRect.right, progress), Utilities.mapRange(progress, mCancelRect.right, mStartRect.right),
MathUtils.lerp(mCancelRect.bottom, mStartRect.bottom, progress)); Utilities.mapRange(progress, mCancelRect.bottom, mStartRect.bottom));
float endCornerRadius = Utilities.mapRange(
mBackProgress, mWindowScaleStartCornerRadius, mWindowScaleEndCornerRadius);
float cornerRadius = Utilities.mapRange( float cornerRadius = Utilities.mapRange(
progress, mWindowScaleEndCornerRadius, mWindowScaleStartCornerRadius); progress, endCornerRadius, mWindowScaleStartCornerRadius);
applyTransform(mCurrentRect, cornerRadius); applyTransform(mCurrentRect, cornerRadius);
} }
@@ -267,12 +268,15 @@ public class LauncherBackAnimationController {
mLauncher.getStateManager().moveToRestState(); mLauncher.getStateManager().moveToRestState();
} }
float cornerRadius = Utilities.mapRange(
mBackProgress, mWindowScaleStartCornerRadius, mWindowScaleEndCornerRadius);
Pair<RectFSpringAnim, AnimatorSet> pair = Pair<RectFSpringAnim, AnimatorSet> pair =
mQuickstepTransitionManager.createWallpaperOpenAnimations( mQuickstepTransitionManager.createWallpaperOpenAnimations(
new RemoteAnimationTargetCompat[]{mBackTarget}, new RemoteAnimationTargetCompat[]{mBackTarget},
new RemoteAnimationTargetCompat[]{}, new RemoteAnimationTargetCompat[]{},
false /* fromUnlock */, false /* fromUnlock */,
mCurrentRect); mCurrentRect,
cornerRadius);
startTransitionAnimations(pair.first, pair.second); startTransitionAnimations(pair.first, pair.second);
mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL); mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL);
} }