From cb2a1474a787c868451a9d5d12291fcbf4e5e71c Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 12 Jun 2024 13:46:35 -0400 Subject: [PATCH] Fix icon flash on app launch Flag: com.android.launcher3.enable_additional_home_animations Fixes: 343051344 Test: temp logs, launched apps from home, quickly swiped home while quick switching (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9fb1f8043573d5bc3376f0786354fc8f7a9cf2cd) Merged-In: I91071d53f753eb7bc99305c46241de203bcfdc98 Change-Id: I91071d53f753eb7bc99305c46241de203bcfdc98 --- .../quickstep/SwipeUpAnimationLogic.java | 20 ++++++++++++------- .../android/quickstep/views/RecentsView.java | 4 ++++ .../android/launcher3/views/ClipIconView.java | 4 ++++ .../launcher3/views/FloatingIconView.java | 8 +++++++- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java index fb54241592..ba33c62d9d 100644 --- a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +++ b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static com.android.app.animation.Interpolators.ACCELERATE_1_5; import static com.android.app.animation.Interpolators.LINEAR; +import static com.android.launcher3.Flags.enableAdditionalHomeAnimations; import static com.android.launcher3.PagedView.INVALID_PAGE; import android.animation.Animator; @@ -449,7 +450,7 @@ public abstract class SwipeUpAnimationLogic implements float alpha = mAnimationFactory.getWindowAlpha(progress); mHomeAnim.setPlayFraction(progress); - if (mTargetTaskView == null) { + if (!enableAdditionalHomeAnimations() || mTargetTaskView == null) { mHomeToWindowPositionMap.mapRect(mWindowCurrentRect, currentRect); mMatrix.setRectToRect(mCropRectF, mWindowCurrentRect, ScaleToFit.FILL); mLocalTransformParams @@ -464,10 +465,15 @@ public abstract class SwipeUpAnimationLogic implements mLocalTransformParams.applySurfaceParams( mLocalTransformParams.createSurfaceParams(this)); - mAnimationFactory.update( - currentRect, progress, mMatrix.mapRadius(cornerRadius), (int) (alpha * 255)); - if (mTargetTaskView == null) { + mAnimationFactory.update( + currentRect, + progress, + mMatrix.mapRadius(cornerRadius), + !enableAdditionalHomeAnimations() || mTargetTaskView == null + ? 0 : (int) (alpha * 255)); + + if (!enableAdditionalHomeAnimations() || mTargetTaskView == null) { return; } if (mAnimationFactory.isAnimatingIntoIcon() && mAnimationFactory.isAnimationReady()) { @@ -506,7 +512,7 @@ public abstract class SwipeUpAnimationLogic implements public void onAnimationStart(Animator animation) { setUp(); mHomeAnim.dispatchOnStart(); - if (mTargetTaskView == null) { + if (!enableAdditionalHomeAnimations() || mTargetTaskView == null) { return; } Rect thumbnailBounds = new Rect(); @@ -521,7 +527,7 @@ public abstract class SwipeUpAnimationLogic implements } private void setUp() { - if (mTargetTaskView == null) { + if (!enableAdditionalHomeAnimations() || mTargetTaskView == null) { return; } RecentsView recentsView = mTargetTaskView.getRecentsView(); @@ -542,7 +548,7 @@ public abstract class SwipeUpAnimationLogic implements } private void cleanUp() { - if (mTargetTaskView == null) { + if (!enableAdditionalHomeAnimations() || mTargetTaskView == null) { return; } RecentsView recentsView = mTargetTaskView.getRecentsView(); diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 6798676174..43a3eda6fb 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -35,6 +35,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU; import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; +import static com.android.launcher3.Flags.enableAdditionalHomeAnimations; import static com.android.launcher3.Flags.enableGridOnlyOverview; import static com.android.launcher3.Flags.enableRefactorTaskThumbnail; import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; @@ -4523,6 +4524,9 @@ public abstract class RecentsView