Fix bug where back swipe to icon in All Apps search result.

Issue is that All Apps is scaling during the animation, so when
FloatingIconView looks for it in the view hierarchy,
it's not in its final position.

This would be the cleanest approach for a scv2 fix

Bug: 213306709
Test: manual
Change-Id: Iaec77d15c9533edccd9c82164143af8fa522158f
Merged-In: Iaec77d15c9533edccd9c82164143af8fa522158f
(cherry picked from commit db767aa5757878ff37b82951b1bda71be1c9be4f)
Merged-In:Iaec77d15c9533edccd9c82164143af8fa522158f
This commit is contained in:
Jon Miranda 2022-01-20 13:48:40 -08:00 committed by Android Build Coastguard Worker
parent 354b6d6f96
commit ba6d0ba2d6
1 changed files with 18 additions and 8 deletions

View File

@ -367,7 +367,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
if (launcherClosing) { if (launcherClosing) {
// Delay animation by a frame to avoid jank. // Delay animation by a frame to avoid jank.
Pair<AnimatorSet, Runnable> launcherContentAnimator = Pair<AnimatorSet, Runnable> launcherContentAnimator =
getLauncherContentAnimator(true /* isAppOpening */, startDelay); getLauncherContentAnimator(true /* isAppOpening */, startDelay, false);
anim.play(launcherContentAnimator.first); anim.play(launcherContentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() { anim.addListener(new AnimatorListenerAdapter() {
@Override @Override
@ -464,9 +464,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
* @param isAppOpening True when this is called when an app is opening. * @param isAppOpening True when this is called when an app is opening.
* False when this is called when an app is closing. * False when this is called when an app is closing.
* @param startDelay Start delay duration. * @param startDelay Start delay duration.
* @param skipAllAppsScale True if we want to avoid scaling All Apps
*/ */
private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening, private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening,
int startDelay) { int startDelay, boolean skipAllAppsScale) {
AnimatorSet launcherAnimator = new AnimatorSet(); AnimatorSet launcherAnimator = new AnimatorSet();
Runnable endListener; Runnable endListener;
@ -484,7 +485,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
final float startAlpha = appsView.getAlpha(); final float startAlpha = appsView.getAlpha();
final float startScale = SCALE_PROPERTY.get(appsView); final float startScale = SCALE_PROPERTY.get(appsView);
appsView.setAlpha(alphas[0]); appsView.setAlpha(alphas[0]);
SCALE_PROPERTY.set(appsView, scales[0]);
ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas); ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION); alpha.setDuration(CONTENT_ALPHA_DURATION);
@ -496,12 +496,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
appsView.setLayerType(View.LAYER_TYPE_NONE, null); appsView.setLayerType(View.LAYER_TYPE_NONE, null);
} }
}); });
if (!skipAllAppsScale) {
SCALE_PROPERTY.set(appsView, scales[0]);
ObjectAnimator scale = ObjectAnimator.ofFloat(appsView, SCALE_PROPERTY, scales); ObjectAnimator scale = ObjectAnimator.ofFloat(appsView, SCALE_PROPERTY, scales);
scale.setInterpolator(AGGRESSIVE_EASE); scale.setInterpolator(AGGRESSIVE_EASE);
scale.setDuration(CONTENT_SCALE_DURATION); scale.setDuration(CONTENT_SCALE_DURATION);
launcherAnimator.play(scale);
}
launcherAnimator.play(alpha); launcherAnimator.play(alpha);
launcherAnimator.play(scale);
endListener = () -> { endListener = () -> {
appsView.setAlpha(startAlpha); appsView.setAlpha(startAlpha);
@ -1565,6 +1569,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|| mLauncher.getWorkspace().isOverlayShown(); || mLauncher.getWorkspace().isOverlayShown();
boolean playWorkspaceReveal = true; boolean playWorkspaceReveal = true;
boolean skipAllAppsScale = false;
if (mFromUnlock) { if (mFromUnlock) {
anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets)); anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
} else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get() } else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get()
@ -1579,6 +1584,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
true /* animateOverviewScrim */, launcherView).getAnimators()); true /* animateOverviewScrim */, launcherView).getAnimators());
// We play StaggeredWorkspaceAnim as a part of the closing window animation. // We play StaggeredWorkspaceAnim as a part of the closing window animation.
playWorkspaceReveal = false; playWorkspaceReveal = false;
} else {
// Skip scaling all apps, otherwise FloatingIconView will get wrong
// layout bounds.
skipAllAppsScale = true;
} }
} else { } else {
anim.play(getFallbackClosingWindowAnimators(appTargets)); anim.play(getFallbackClosingWindowAnimators(appTargets));
@ -1600,7 +1609,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
if (mLauncher.isInState(LauncherState.ALL_APPS)) { if (mLauncher.isInState(LauncherState.ALL_APPS)) {
Pair<AnimatorSet, Runnable> contentAnimator = Pair<AnimatorSet, Runnable> contentAnimator =
getLauncherContentAnimator(false, LAUNCHER_RESUME_START_DELAY); getLauncherContentAnimator(false, LAUNCHER_RESUME_START_DELAY,
skipAllAppsScale);
anim.play(contentAnimator.first); anim.play(contentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() { anim.addListener(new AnimatorListenerAdapter() {
@Override @Override